function update_script_selection_form in Drupal 6
Same name and namespace in other branches
- 5 update.php \update_script_selection_form()
- 7 update.php \update_script_selection_form()
1 string reference to 'update_script_selection_form'
- update_selection_page in ./
update.php - Renders a form with a list of available database updates.
File
- ./
update.php, line 201 - 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();
$modules = drupal_get_installed_schema_version(NULL, FALSE, TRUE);
foreach ($modules as $module => $schema_version) {
$updates = drupal_get_schema_versions($module);
// Skip incompatible module updates completely, otherwise test schema versions.
if (!update_check_incompatibility($module) && $updates !== FALSE && $schema_version >= 0) {
// module_invoke returns NULL for nonexisting hooks, so if no updates
// are removed, it will == 0.
$last_removed = module_invoke($module, 'update_last_removed');
if ($schema_version < $last_removed) {
$form['start'][$module] = array(
'#value' => '<em>' . $module . '</em> module can not be updated. Its schema version is ' . $schema_version . '. Updates up to and including ' . $last_removed . ' have been removed in this release. In order to update <em>' . $module . '</em> module, you will first <a href="http://drupal.org/upgrade">need to upgrade</a> to the last version in which these updates were available.',
'#prefix' => '<div class="warning">',
'#suffix' => '</div>',
);
$form['start']['#collapsed'] = FALSE;
continue;
}
$updates = drupal_map_assoc($updates);
$updates[] = 'No updates available';
$default = $schema_version;
foreach (array_keys($updates) as $update) {
if ($update > $schema_version) {
$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,
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => 'Update',
);
return $form;
}