Skip to content
Snippets Groups Projects
Commit cce7c000 authored by Tim Steiner's avatar Tim Steiner
Browse files

[gh-74] Merging from testing into staging

git-svn-id: file:///tmp/wdn_thm_drupal/branches/drupal-7.x/staging@431 20a16fea-79d4-4915-8869-1ea9d5ebf173
parent 27298945
Branches
Tags
No related merge requests found
......@@ -164,15 +164,9 @@ function unl_site_updates($form, &$form_state) {
'#description' => 'Using drush, do database updates and clear the caches of all sites.',
);
if ($form_state['rebuild']) {
$button_text = 'Continue Drush';
}
else {
$button_text = 'Run Drush';
}
$form['root']['submit'] = array(
'#type' => 'submit',
'#value' => $button_text,
'#value' => 'Run Drush',
);
return $form;
......@@ -184,33 +178,24 @@ function unl_site_updates_submit($form, &$form_state) {
->execute()
->fetchAll();
$start_time = time();
if (isset($form_state['storage'])) {
$completed_sites = $form_state['storage'];
}
else {
$completed_sites = array();
}
$operations = array();
foreach ($sites as $site) {
if (in_array($site->uri, $completed_sites)) {
continue;
}
if (time() - $start_time > 30) {
$form_state['rebuild'] = TRUE;
$form_state['storage'] = $completed_sites;
drupal_set_message('Drush ran out of time to process every site. Click "Continue Drush" below.', 'warning');
return;
}
$uri = escapeshellarg($site->uri);
$root = escapeshellarg(DRUPAL_ROOT);
$command = "sites/all/modules/drush/drush.php -y --token=secret --root={$root} --uri={$uri} updatedb";
drupal_set_message('Messages from ' . $site->uri . ':<br />' . PHP_EOL . '<pre>' . shell_exec($command) . '</pre>', 'status');
$completed_sites[] = $site->uri;
$operations[] = array('unl_site_updates_step', array($site->uri));
}
$batch = array(
'operations' => $operations,
'file' => substr(__FILE__, strlen(DRUPAL_ROOT) + 1),
);
batch_set($batch);
}
function unl_site_updates_step($site_uri, &$context) {
$uri = escapeshellarg($site_uri);
$root = escapeshellarg(DRUPAL_ROOT);
$command = "sites/all/modules/drush/drush.php -y --token=secret --root={$root} --uri={$uri} updatedb";
drupal_set_message('Messages from ' . $site_uri . ':<br />' . PHP_EOL . '<pre>' . shell_exec($command) . '</pre>', 'status');
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment