Commit 02209961 authored by Dries's avatar Dries

- Patch #605344 by dww: documentation and code style fixes for update manager....

- Patch #605344 by dww: documentation and code style fixes for update manager. This was ready before freeze.
parent cc421475
......@@ -38,7 +38,7 @@ function authorize_access_denied_page() {
drupal_add_http_header('403 Forbidden');
watchdog('access denied', 'authorize.php', NULL, WATCHDOG_WARNING);
drupal_set_title('Access denied');
return t("You are not allowed to access this page.");
return t('You are not allowed to access this page.');
}
/**
......@@ -141,7 +141,7 @@ function authorize_access_allowed() {
}
else {
if (empty($_SESSION['authorize_operation']) || empty($_SESSION['authorize_filetransfer_backends'])) {
$output = t("It appears you have reached this page in error.");
$output = t('It appears you have reached this page in error.');
}
elseif (!$batch = batch_get()) {
// We have a batch to process, show the filetransfer form.
......
......@@ -37,7 +37,7 @@ function authorize_filetransfer_form($form_state) {
$form['information']['main_header'] = array(
'#prefix' => '<h3>',
'#markup' => t('To continue please provide your server connection details'),
'#markup' => t('To continue, please provide your server connection details'),
'#suffix' => '</h3>',
);
......@@ -52,15 +52,15 @@ function authorize_filetransfer_form($form_state) {
/*
* Here we create two submit buttons. For a JS enabled client, they will
* only ever see submit_process. However, if a client doesn't have JS
* enabled, they will see submit_connection on the first form (whden picking
* enabled, they will see submit_connection on the first form (when picking
* what filetranfer type to use, and submit_process on the second one (which
* leads to the actual operation)
* leads to the actual operation).
*/
$form['submit_connection'] = array(
'#prefix' => "<br style='clear:both'/>",
'#name' => 'enter_connection_settings', // This is later changed in JS.
'#name' => 'enter_connection_settings',
'#type' => 'submit',
'#value' => t('Enter connetion settings'), // As is this. @see authorize.js.
'#value' => t('Enter connection settings'),
'#weight' => 100,
);
......@@ -81,7 +81,7 @@ function authorize_filetransfer_form($form_state) {
'#title' => t('@backend connection settings', array('@backend' => $backend['title'])),
);
$current_settings = variable_get("authorize_filetransfer_connection_settings_" . $name, array());
$current_settings = variable_get('authorize_filetransfer_connection_settings_' . $name, array());
$form['connection_settings'][$name] += system_get_filetransfer_settings_form($name, $current_settings);
// Start non-JS code.
......@@ -126,7 +126,7 @@ function authorize_filetransfer_form_validate($form, &$form_state) {
$filetransfer = authorize_get_filetransfer($backend, $form_state['values']['connection_settings'][$backend]);
try {
if (!$filetransfer) {
throw new Exception(t("Error, this type of connection protocol (%backend) doesn't exist.", array('%backend' => $backend)));
throw new Exception(t('Error, this type of connection protocol (%backend) does not exist.', array('%backend' => $backend)));
}
$filetransfer->connect();
}
......@@ -173,7 +173,7 @@ function authorize_filetransfer_form_submit($form, &$form_state) {
// Set this one as the default authorize method.
variable_set('authorize_filetransfer_default', $filetransfer_backend);
// Save the connection settings minus the password.
variable_set("authorize_filetransfer_connection_settings_" . $filetransfer_backend, $connection_settings);
variable_set('authorize_filetransfer_connection_settings_' . $filetransfer_backend, $connection_settings);
$filetransfer = authorize_get_filetransfer($filetransfer_backend, $form_state['values']['connection_settings'][$filetransfer_backend]);
......
......@@ -81,7 +81,7 @@ public function isFile($path) {
/**
* This is impossible with the stream wrapper, so an exception is thrown.
*
* If the ftp extenstion is available, we will cheat and use it.
* If the ftp extenstion is available, we will cheat and use that instead.
*
* @param string $path
* @param long $mode
......
......@@ -15,12 +15,12 @@ Drupal.behaviors.authorizeFileTransferForm = {
});
$('.filetransfer').hide().filter('.filetransfer-' + $('#edit-connection-settings-authorize-filetransfer-default').val()).show();
// Removes the float on the select box (used for non-JS interface)
if($('.connection-settings-update-filetransfer-default-wrapper').length > 0) {
// Removes the float on the select box (used for non-JS interface).
if ($('.connection-settings-update-filetransfer-default-wrapper').length > 0) {
console.log($('.connection-settings-update-filetransfer-default-wrapper'));
$('.connection-settings-update-filetransfer-default-wrapper').css('float', 'none');
}
// Hides the submit button for non-js users
// Hides the submit button for non-js users.
$('#edit-submit-connection').hide();
$('#edit-submit-process').show();
}
......
......@@ -19,7 +19,7 @@
* @param $projects
* A nested array of projects to install into the live webroot, keyed by
* project name. Each subarray contains the following keys:
* - 'project': The cannonical project short name.
* - 'project': The canonical project short name.
* - 'updater_name': The name of the Updater class to use for this project.
* - 'local_url': The locally installed location of new code to update with.
*/
......@@ -99,7 +99,7 @@ function update_authorize_run_install($filetransfer, $project, $updater_name, $l
* Copy a project to its proper place when authorized with elevated privileges.
*
* @param string $project
* The cannonical short name of the project being installed.
* The canonical short name of the project being installed.
* @param string $updater_name
* The name of the Updater class to use for installing this project.
* @param string $local_url
......@@ -151,8 +151,8 @@ function update_authorize_batch_copy_project($project, $updater_name, $local_url
$tasks = $updater->install($filetransfer);
}
}
catch (UpdaterError $e) {
_update_batch_create_message($context['results']['log'][$project], t("Error installing / updating"), FALSE);
catch (UpdaterException $e) {
_update_batch_create_message($context['results']['log'][$project], t('Error installing / updating'), FALSE);
_update_batch_create_message($context['results']['log'][$project], $e->getMessage(), FALSE);
$context['results']['log'][$project]['#abort'] = TRUE;
return;
......
......@@ -89,7 +89,7 @@ function update_manager_update_form($form, $form_state = array(), $context) {
module_load_include('inc', 'update', 'update.compare');
$project_data = update_calculate_project_data($available);
foreach ($project_data as $name => $project) {
// Filter out projects which are up2date already.
// Filter out projects which are up to date already.
if ($project['status'] == UPDATE_CURRENT) {
continue;
}
......@@ -164,9 +164,9 @@ function update_manager_update_form($form, $form_state = array(), $context) {
$needs_manual = $project['project_type'] == 'core' || ($project['install_type'] == 'dev' && $recommended_release['version_extra'] == 'dev');
if ($needs_manual) {
// Since it won't be tableselect, #weight will confuse the table if it's
// defined, so just unset it (since the order doesn't really matter that
// much in the manual updates table, anyway).
// Since it won't be tableselect, #weight will add an extra column to the
// table if it's defined, so just unset it. The order doesn't matter that
// much in the manual updates table, anyway.
unset($entry['#weight']);
}
else {
......@@ -361,6 +361,17 @@ function update_manager_download_batch_finished($success, $results) {
}
}
/**
* Build the form to confirm that an update should proceed (after downloading).
*
* This form is an intermediary step in the automated update workflow. It is
* presented to the site administrator after all the required updates have
* been downloaded and verified. The point of this page is to encourage the
* user to backup their site, gives them the opportunity to put the site
* offline, and then asks them to confirm that the update should continue.
* After this step, the user is redirected to authorize.php to enter their
* file transfer credentials and attempt to complete the update.
*/
function update_manager_confirm_update_form($form, &$form_state) {
$form['information']['#weight'] = -100;
$form['information']['backup_header'] = array(
......@@ -402,6 +413,17 @@ function update_manager_confirm_update_form($form, &$form_state) {
return $form;
}
/**
* Submit handler for the form to confirm that an update should continue.
*
* If the site administrator requested that the site is put offline during the
* update, do so now. Otherwise, pull information about all the required
* updates out of the SESSION, figure out what Updater class is needed for
* each one, generate an array of update operations to perform, and hand it
* all off to system_run_authorized() where we redirect to authorize.php.
*
* @see system_run_authorized()
*/
function update_manager_confirm_update_form_submit($form, &$form_state) {
if ($form_state['values']['site_offline'] == TRUE) {
variable_set('site_offline', TRUE);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment