Commit 3f487652 authored by catch's avatar catch

Issue #1798732: Revert convert install_task() variable to use state system - breaks the installer.

parent 60aaaaea
......@@ -436,7 +436,7 @@ function install_run_tasks(&$install_state) {
$install_state['tasks_performed'][] = $task_name;
$install_state['installation_finished'] = empty($tasks_to_perform);
if ($install_state['database_tables_exist'] && ($task['run'] == INSTALL_TASK_RUN_IF_NOT_COMPLETED || $install_state['installation_finished'])) {
state()->set('system.install_task', $install_state['installation_finished'] ? 'done' : $task_name);
variable_set('install_task', $install_state['installation_finished'] ? 'done' : $task_name);
}
}
// Stop when there are no tasks left. In the case of an interactive
......@@ -509,7 +509,7 @@ function install_run_task($task, &$install_state) {
elseif ($task['type'] == 'batch') {
// Start a new batch based on the task function, if one is not running
// already.
$current_batch = state()->get('system.install_current_batch');
$current_batch = variable_get('install_current_batch');
if (!$install_state['interactive'] || !$current_batch) {
$batch = $function($install_state);
if (empty($batch)) {
......@@ -522,7 +522,7 @@ function install_run_task($task, &$install_state) {
// task is currently running. Otherwise, we need to make sure the batch
// will complete in one page request.
if ($install_state['interactive']) {
state()->set('system.install_current_batch', $function);
variable_set('install_current_batch', $function);
}
else {
$batch =& batch_get();
......@@ -551,7 +551,7 @@ function install_run_task($task, &$install_state) {
// longer requesting a batch ID.
if ($output === FALSE) {
// Return nothing so the next task will run in the same request.
state()->delete('system.install_current_batch');
variable_del('install_current_batch');
return;
}
else {
......@@ -918,8 +918,16 @@ function install_base_system(&$install_state) {
* is already installed.
*/
function install_verify_completed_task() {
$task = state()->get('system.install_task');
if ($task) {
try {
if ($result = db_query("SELECT value FROM {variable} WHERE name = :name", array('name' => 'install_task'))) {
$task = unserialize($result->fetchField());
}
}
// Do not trigger an error if the database query fails, since the database
// might not be set up yet.
catch (Exception $e) {
}
if (isset($task)) {
if ($task == 'done') {
throw new Exception(install_already_done_error());
}
......@@ -2027,5 +2035,5 @@ function install_configure_form_submit($form, &$form_state) {
user_login_finalize();
// Record when this install ran.
state()->set('system.install_time', $_SERVER['REQUEST_TIME']);
variable_set('install_time', $_SERVER['REQUEST_TIME']);
}
......@@ -274,7 +274,7 @@ function system_requirements($phase) {
// Determine when cron last ran.
$cron_last = variable_get('cron_last');
if (!is_numeric($cron_last)) {
$cron_last = state()->get('system.install_time') ?: 0;
$cron_last = variable_get('install_time', 0);
}
// Determine severity based on time since cron last ran.
......@@ -2119,20 +2119,6 @@ function system_update_8025() {
db_drop_table('system');
}
/**
* Convert install_task and install_time variables to state api values.
*/
function system_update_8026() {
$variables = array('system.install_task', 'system.install_time');
foreach ($variables as $variable) {
if ($value = update_variable_get($variable, FALSE)) {
state()->set($variable, $value);
}
update_variable_del($variable);
}
}
/**
* Cleans up javascript_parsed variable.
*
......
......@@ -3700,7 +3700,7 @@ function system_run_automated_cron() {
// If the site is not fully installed, suppress the automated cron run.
// Otherwise it could be triggered prematurely by Ajax requests during
// installation.
if (($threshold = config('system.cron')->get('threshold.autorun')) > 0 && state()->get('system.install_task') == 'done') {
if (($threshold = config('system.cron')->get('threshold.autorun')) > 0 && variable_get('install_task') == 'done') {
$cron_last = variable_get('cron_last', NULL);
if (!isset($cron_last) || (REQUEST_TIME - $cron_last > $threshold)) {
drupal_cron_run();
......
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