You are here

function update_script_selection_form in Drupal 5

Same name and namespace in other branches
  1. 6 update.php \update_script_selection_form()
  2. 7 update.php \update_script_selection_form()
1 string reference to 'update_script_selection_form'
update_selection_page in ./update.php

File

./update.php, line 330
Administrative page for handling updates from one Drupal version to another.

Code

function update_script_selection_form() {
  $form = array();
  $form['start'] = array(
    '#tree' => TRUE,
    '#type' => 'fieldset',
    '#title' => 'Select versions',
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );

  // Ensure system.module's updates appear first
  $form['start']['system'] = array();
  foreach (module_list() as $module) {
    $updates = drupal_get_schema_versions($module);
    if ($updates !== FALSE) {
      $updates = drupal_map_assoc($updates);
      $updates[] = 'No updates available';
      $default = drupal_get_installed_schema_version($module);
      foreach (array_keys($updates) as $update) {
        if ($update > $default) {
          $default = $update;
          break;
        }
      }
      $form['start'][$module] = array(
        '#type' => 'select',
        '#title' => $module . ' module',
        '#default_value' => $default,
        '#options' => $updates,
      );
    }
  }
  $form['has_js'] = array(
    '#type' => 'hidden',
    '#default_value' => FALSE,
    '#attributes' => array(
      'id' => 'edit-has_js',
    ),
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => 'Update',
  );
  return $form;
}