Skip to content
Snippets Groups Projects
Commit 64c950f5 authored by Lucas Hedding's avatar Lucas Hedding Committed by Lucas Hedding
Browse files

Issue #3093861 by heddn, ressa: Manual update (experimental) to 8.8.0-beta1 requires db_update

parent 0791dd8b
No related branches found
Tags 7.x-1.0-beta1
No related merge requests found
......@@ -49,27 +49,38 @@ function automatic_updates_admin_form() {
update_refresh();
$available = update_get_available(TRUE);
$data = update_calculate_project_data($available);
$not_recommended = $data['drupal']['existing_version'] !== $data['drupal']['recommended'];
$security_update = isset($data['drupal']['security updates']);
$no_dev_core = strpos(VERSION, '-dev') === FALSE;
$projects = update_calculate_project_data($available);
$not_recommended_version = $projects['drupal']['status'] !== UPDATE_CURRENT;
$not_dev_core = strpos(VERSION, '-dev') === FALSE;
$security_update = in_array($projects['drupal']['status'], [UPDATE_NOT_SECURE, UPDATE_REVOKED], TRUE);
$recommended_release = $projects['drupal']['releases'][$projects['drupal']['recommended']];
$major_upgrade = $recommended_release['version_major'] !== $projects['drupal']['existing_major'];
$form['experimental'] = [
'#type' => 'fieldset',
'#title' => t('Experimental'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
];
if ($not_recommended && $security_update && $no_dev_core) {
$form['experimental']['security'] = [
'#type' => 'html_tag',
'#tag' => 'p',
'#value' => t('A security update is available for your version of Drupal.'),
];
if ($not_recommended_version && $not_dev_core) {
if ($security_update) {
$form['experimental']['security'] = [
'#type' => 'html_tag',
'#tag' => 'p',
'#value' => t('A security update is available for your version of Drupal.'),
];
}
if ($major_upgrade) {
$form['experimental']['major_version'] = [
'#type' => 'html_tag',
'#tag' => 'p',
'#value' => t('This update is a major version update which means that it may not be backwards compatible with your currently running version. It is recommended that you read the release notes and proceed at your own risk.'),
];
}
}
$update_text = t('Your site is running %version of Drupal core. No recommended update is available at this time.', ['%version' => VERSION]);
if ($not_recommended && $no_dev_core) {
if ($not_recommended_version && $not_dev_core) {
$from_version = VERSION;
$to_version = $data['drupal']['latest_version'];
$to_version = $recommended_release['version'];
$query['token'] = drupal_get_token('in-place-automatic-updates-link');
$update_text = t('Even with all that caution, if you want to try it out, <a href="@link">manually update now</a>.', [
'@link' => url("/automatic_updates/in-place-update/drupal/core/$from_version/$to_version", ['query' => $query]),
......
......@@ -102,17 +102,24 @@ function automatic_updates_cron() {
return;
}
if (variable_get('automatic_updates_enable_cron_updates', FALSE)) {
update_refresh();
$available = update_get_available(TRUE);
$data = update_calculate_project_data($available);
$not_recommended = $data['drupal']['existing_version'] !== $data['drupal']['recommended'];
$projects = update_calculate_project_data($available);
$not_recommended_version = $projects['drupal']['status'] !== UPDATE_CURRENT;
$dev_core = strpos(VERSION, '-dev') !== FALSE;
$security_update = in_array($projects['drupal']['status'], [UPDATE_NOT_SECURE, UPDATE_REVOKED], TRUE);
$recommended_release = $projects['drupal']['releases'][$projects['drupal']['recommended']];
$major_upgrade = $recommended_release['version_major'] !== $projects['drupal']['existing_major'];
// Don't automatically update major version bumps or a dev version of core.
if ($major_upgrade || $dev_core) {
return;
}
if (variable_get('automatic_updates_enable_cron_security_updates', FALSE)) {
if ($not_recommended && isset($data['drupal']['security updates'])) {
InPlaceUpdate::update('drupal', 'core', VERSION, $data['drupal']['latest_version']);
if ($not_recommended_version && $security_update) {
InPlaceUpdate::update('drupal', 'core', VERSION, $recommended_release['version']);
}
}
elseif ($not_recommended) {
InPlaceUpdate::update('drupal', 'core', VERSION, $data['drupal']['latest_version']);
elseif ($not_recommended_version) {
InPlaceUpdate::update('drupal', 'core', VERSION, $recommended_release['version']);
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment