Commit 7602c3bd authored by Adrian Rossouw's avatar Adrian Rossouw Committed by adrian

Refactor to use the new drush conditional include api (#415108)

parent 57b6fd56
......@@ -95,6 +95,6 @@ function provision_drupal_provision_deploy_rollback($url) {
function provision_drupal_post_provision_deploy($url) {
drush_invoke('provision update', $url);
provision_platform_include(dirname(__FILE__), 'deploy');
drush_include_engine('drupal', 'deploy');
drush_set_option('packages', _scrub_object(provision_drupal_system_map()), 'site');
}
......@@ -19,6 +19,6 @@ function provision_drupal_provision_import_validate() {
*/
function provision_drupal_provision_import($url = NULL) {
drush_bootstrap(DRUSH_BOOTSTRAP_DRUPAL_FULL);
provision_platform_include(dirname(__FILE__), 'import');
drush_include_engine('drupal', 'import');
}
......@@ -38,7 +38,7 @@ function provision_drupal_provision_install($url) {
// Requires at least the database settings to complete.
_provision_drupal_create_settings_file($url);
drush_bootstrap(DRUSH_BOOTSTRAP_DRUPAL_SITE);
provision_platform_include(dirname(__FILE__), 'install');
drush_include_engine('drupal', 'install');
drush_set_option('installed', TRUE, 'site');
}
......
......@@ -30,6 +30,18 @@ function provision_drupal_drush_help($section) {
}
function provision_drupal_drush_engine_drupal() {
$engines = array();
$engines['install'] = array();
$engines['update'] = array();
$engines['import'] = array();
$engines['deploy'] = array();
$engines['clear'] = array();
$engines['packages'] = array();
$engines['verify'] = array();
return $engines;
}
/**
* Initialize the platform / site
*
......@@ -243,8 +255,7 @@ function _provision_drupal_create_directories($url, $profile = NULL) {
function _provision_drupal_rebuild_caches($url = NULL) {
if (PROVISION_CONTEXT_SITE) {
#drush_bootstrap(DRUSH_BOOTSTRAP_DRUPAL_FULL);
provision_platform_include(dirname(__FILE__), 'clear');
drush_include_engine('drupal', 'clear');
}
}
......@@ -382,7 +393,7 @@ require_once('cvs_deploy.inc');
function provision_find_packages() {
// Load the version specific include files.
provision_platform_include(dirname(__FILE__), 'packages');
drush_include_engine('drupal', 'packages');
$packages['base'] = _provision_find_packages('base');
......@@ -440,7 +451,7 @@ function _provision_find_packages($scope, $key = '') {
*/
function provision_drupal_system_map() {
// Load the version specific include files.
provision_platform_include(dirname(__FILE__), 'packages');
drush_include_engine('drupal', 'packages');
$profiles = _provision_find_profiles();
foreach ($profiles as $profile => $info) {
......
......@@ -7,6 +7,6 @@ function provision_drupal_provision_update_validate() {
function provision_drupal_provision_update($url) {
_provision_drupal_create_settings_file($url);
drush_bootstrap(DRUSH_BOOTSTRAP_DRUPAL_SITE);
provision_platform_include(dirname(__FILE__), 'update');
provision_platform_include(dirname(__FILE__), 'clear');
drush_include_engine('drupal', 'update');
drush_include_engine('drupal', 'clear');
}
......@@ -282,27 +282,6 @@ function provision_password($length = 10) {
return $pass;
}
function provision_platform_include($path, $command, $version = null, $platform = 'drupal') {
$version = ($version) ? $version : drush_drupal_major_version();
$options[] = sprintf("%s_%s_%s", $platform, $version, $command);
$options[] = sprintf("%s_%s", $platform, $command);
$options[] = sprintf("%s", $command);
$match = false;
foreach ($options as $option) {
$file = sprintf("%s/%s.inc", $path, $option);
if (file_exists($file)) {
$match = $file;
break;
}
}
if ($match) {
drush_log(dt('Including platform specific file : @file', array('@file' => $match)));
include_once($file);
}
}
function _provision_errors_on() {
$errors =& drush_get_context('DRUPAL_ERROR_REPORTING', E_ALL ^ E_NOTICE);
$errors = error_reporting($errors);
......
<?php
function provision_apache_provision_verify($url) {
function provision_apache_provision_verify($url = null) {
if (PROVISION_CONTEXT_PLATFORM) {
_provision_create_dir(drush_get_option('vhost_path'), dt("Virtual host configuration"), 0700);
$data = drush_get_merged_options();
$options = drush_get_context('options');
$options = drush_get_merged_options();
$data['extra_config'] = "# Extra configuration from modules:\n";
$data['extra_config'] .= join("\n", drush_command_invoke_all('provision_apache_dir_config', $data));
_provision_apache_create_config('platform_' . $options['platform'] . '.conf', $data, _provision_apache_platform_template());
......@@ -15,7 +15,7 @@ function provision_apache_provision_verify($url) {
_provision_apache_restart_apache(TRUE);
}
function provision_apache_post_provision_verify($url) {
function provision_apache_post_provision_verify($url = null) {
if (PROVISION_CONTEXT_PLATFORM) {
drush_set_option('master_url', drush_get_option('master_url'), 'drupal');
drush_set_option('publish_path', drush_get_option('publish_path'), 'drupal');
......
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