summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdrian Rossouw2008-11-06 18:58:44 (GMT)
committeradrian2008-11-06 18:58:44 (GMT)
commit215a4e744b6068eb3c216793b762c1bf958726ca (patch)
tree9f764a52fcb054c3d723c5086774a0216b1be4a5
parent497eec9e0e54796d41dae0c48fb14b6935b727b5 (diff)
Load modules on demand using --load-module-name in provision args
-rw-r--r--platform/provision_drupal.module2
-rw-r--r--provision.module39
2 files changed, 39 insertions, 2 deletions
diff --git a/platform/provision_drupal.module b/platform/provision_drupal.module
index b6a7642..af803c0 100644
--- a/platform/provision_drupal.module
+++ b/platform/provision_drupal.module
@@ -510,7 +510,7 @@ function _provision_drupal_import_site($url) {
* do any caching whatsoever.
*/
function _provision_drupal_variable_get($name, $default) {
- $value = db_result(db_query("SELECT value FROM {variable} WHERE name='%s'", $name));
+ $value = db_result(@db_query("SELECT value FROM {variable} WHERE name='%s'", $name));
return ($value) ? unserialize($value) : $default;
}
diff --git a/provision.module b/provision.module
index 3bb7d22..09236c8 100644
--- a/provision.module
+++ b/provision.module
@@ -40,6 +40,40 @@
include_once('provision.help.inc');
+/**
+ * Load additional modules just for this process
+ *
+ * Load additional modules specified by --load_module_name
+ */
+function provision_load_from_args() {
+ if (!function_exists('drush_verify_cli')) {
+ return null;
+ }
+ global $args;
+ $reset = FALSE;
+ foreach ($args['options'] as $arg => $value) {
+ if (preg_match("/^load-([a-z\-]*)$/", $arg, $matches)) {
+ $module = str_replace("-", "_", $matches[1]);
+ provision_log("notice", t("Loaded @module on request", array("@module" => $module)));
+ drupal_load('module', $module);
+ $loaded[$module]['name'] = $module;
+ $loaded[$module]['filename'] = drupal_get_filename('module', $module);
+ $reset = TRUE;
+ }
+ }
+ if ($reset) {
+ $list = module_list(TRUE, FALSE);
+ foreach ($list as $module) {
+ $loaded[$module]['name'] = $module;
+ $loaded[$module]['filename'] = drupal_get_filename('module', $module);
+ }
+ module_list(TRUE, FALSE, FALSE, $loaded);
+ // Force to regenerate the stored list of hook implementations.
+ module_implements('', FALSE, TRUE);
+ }
+}
+
+
/**
* Implementation of hook_init
*
@@ -48,6 +82,9 @@
* program, but are configurable.
*/
function provision_init() {
+ // Load requested additional modules
+ provision_load_from_args();
+
// Set up defines for platform
if (function_exists('drush_get_option')) {
$docroot = drush_get_option(array("r", "root"), $_SERVER['PWD']);
@@ -55,7 +92,7 @@ function provision_init() {
else {
$docroot = $_SERVER['pwd'];
}
-
+
define('PROVISION_DOMAIN', $_SERVER['HTTP_HOST']);
$path = ($docroot) ? $docroot : $_SERVER['DOCUMENT_ROOT'];