Commit ecdc93bf authored by Steven Jones's avatar Steven Jones

Get the cron key from the Drupal site and set in a drush context.

parent 71ce951b
...@@ -35,6 +35,8 @@ function drush_provision_drupal_post_provision_import() { ...@@ -35,6 +35,8 @@ function drush_provision_drupal_post_provision_import() {
drush_set_option('provision_save_config', false); drush_set_option('provision_save_config', false);
provision_backend_invoke(d()->name, 'provision-verify'); provision_backend_invoke(d()->name, 'provision-verify');
drush_set_option('cron_key', provision_drupal_fetch_cron_key());
provision_reload_config('site'); provision_reload_config('site');
} }
......
...@@ -73,5 +73,6 @@ function drush_provision_drupal_post_provision_install() { ...@@ -73,5 +73,6 @@ function drush_provision_drupal_post_provision_install() {
_provision_drupal_rebuild_caches(); _provision_drupal_rebuild_caches();
drush_set_option('packages', _scrub_object(provision_drupal_system_map()), 'site'); drush_set_option('packages', _scrub_object(provision_drupal_system_map()), 'site');
_provision_client_create_symlink(); _provision_client_create_symlink();
drush_set_option('cron_key', provision_drupal_fetch_cron_key());
} }
...@@ -134,7 +134,6 @@ class provisionConfig_drupal_settings extends provisionConfig { ...@@ -134,7 +134,6 @@ class provisionConfig_drupal_settings extends provisionConfig {
function process() { function process() {
if (drush_drupal_major_version() >= 7) { if (drush_drupal_major_version() >= 7) {
$this->data['db_type'] = ($this->data['db_type'] == 'mysqli') ? 'mysql' : $this->data['db_type']; $this->data['db_type'] = ($this->data['db_type'] == 'mysqli') ? 'mysql' : $this->data['db_type'];
$this->data['cron_key'] = $this->cron_key;
} }
$this->version = provision_version(); $this->version = provision_version();
$this->api_version = provision_api_version(); $this->api_version = provision_api_version();
...@@ -742,3 +741,20 @@ function _provision_client_delete_symlink() { ...@@ -742,3 +741,20 @@ function _provision_client_delete_symlink() {
->fail('Failed to delete symlink @path: @reason'); ->fail('Failed to delete symlink @path: @reason');
} }
} }
/**
* Fetch the cron key for the currently bootstrapped Drupal site.
*
* @return
* The cron key for the site, may be an empty string on older versions of
* Drupal.
*/
function provision_drupal_fetch_cron_key() {
$key = '';
if (drush_drupal_major_version() >= 7) {
$key = variable_get('cron_key', 'drupal');
}
return $key;
}
...@@ -123,9 +123,6 @@ ...@@ -123,9 +123,6 @@
$conf['file_directory_temp'] = 'sites/<?php print $this->uri ?>/files/tmp'; $conf['file_directory_temp'] = 'sites/<?php print $this->uri ?>/files/tmp';
$conf['clean_url'] = 1; $conf['clean_url'] = 1;
$conf['aegir_api'] = <?php print !$this->backup_in_progress ? $this->api_version : 0 ?>; $conf['aegir_api'] = <?php print !$this->backup_in_progress ? $this->api_version : 0 ?>;
<?php if (!empty($cron_key)) : ?>
$conf['cron_key'] = '<?php print $cron_key; ?>';
<?php endif ?>
<?php if (!$this->site_enabled) : ?> <?php if (!$this->site_enabled) : ?>
$conf['site_offline'] = 1; $conf['site_offline'] = 1;
......
...@@ -99,6 +99,7 @@ function drush_provision_drupal_post_provision_verify() { ...@@ -99,6 +99,7 @@ function drush_provision_drupal_post_provision_verify() {
drush_set_option('installed', TRUE, 'site'); drush_set_option('installed', TRUE, 'site');
_provision_client_create_symlink(); _provision_client_create_symlink();
drush_set_option('cron_key', provision_drupal_fetch_cron_key());
} }
} }
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