1 installer.manager.inc installer_manager_update_ready_form_submit($form, &$form_state)

Form submission handler for installer_manager_update_ready_form().

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_authorized_init(), then redirect to authorize.php.

See also




Related topics


core/modules/installer/installer.manager.inc, line 442
Administrative screens and processing functions of the Installer module.


function installer_manager_update_ready_form_submit($form, &$form_state) {
  // Store maintenance_mode setting so we can restore it when done.
  $_SESSION['maintenance_mode'] = state_get('maintenance_mode', FALSE);
  if ($form_state['values']['maintenance_mode'] == TRUE) {
    state_set('maintenance_mode', TRUE);

  if (!empty($_SESSION['installer_manager_update_projects'])) {
    // Make sure the Updater registry is loaded.

    $updates = array();
    $directory = _installer_manager_extract_directory();

    $projects = $_SESSION['installer_manager_update_projects'];

    $project_realpath = NULL;
    foreach ($projects as $project => $url) {
      $project_location = $directory . '/' . $project;
      $updater = Updater::factory($project_location);
      $project_realpath = backdrop_realpath($project_location);
      $updates[] = array(
        'project' => $project,
        'updater_name' => get_class($updater),
        'local_url' => $project_realpath,

    // If the owner of the last directory we extracted is the same as the
    // owner of our configuration directory where we're trying to install the
    // code, there's no need to prompt for FTP/SSH credentials. Instead, we
    // instantiate a FileTransferLocal and invoke installer_authorize_run_update()
    // directly.
    if (fileowner($project_realpath) == fileowner(conf_path())) {
      module_load_include('inc', 'installer', 'installer.authorize');
      $filetransfer = new FileTransferLocal(BACKDROP_ROOT);
      installer_authorize_run_update($filetransfer, $updates);
    // Otherwise, go through the regular workflow to prompt for FTP/SSH
    // credentials and invoke installer_authorize_run_update() indirectly with
    // whatever FileTransfer object authorize.php creates for us.
    else {
      system_authorized_init('installer_authorize_run_update', backdrop_get_path('module', 'installer') . '/installer.authorize.inc', array($updates), t('Update manager'));
      $form_state['redirect'] = system_authorized_get_url();