summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeil Drumm <drumm@3064.no-reply.drupal.org>2006-07-19 07:45:35 +0000
committerNeil Drumm <drumm@3064.no-reply.drupal.org>2006-07-19 07:45:35 +0000
commit479bd2fe280965404a46ef34e69119990d3c1bb6 (patch)
tree4c720b26b075a32e7dd9961b545c2acc6876cfd7
parent7645a1f46831df6cd14db70b6f5dd74d2a4aa1d8 (diff)
downloadbrdo-479bd2fe280965404a46ef34e69119990d3c1bb6.tar.gz
brdo-479bd2fe280965404a46ef34e69119990d3c1bb6.tar.bz2
#73615 by chx, Eaton, and Steven, Provide the full range of Drupal functions to .install files
-rw-r--r--includes/common.inc7
-rw-r--r--includes/install.inc61
2 files changed, 54 insertions, 14 deletions
diff --git a/includes/common.inc b/includes/common.inc
index ad795d393..82368d8dd 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -491,11 +491,16 @@ function drupal_http_request($url, $headers = array(), $method = 'GET', $data =
* 1 = Log errors to database and to screen.
*/
function error_handler($errno, $message, $filename, $line) {
+ // If the @ error suppression operator was used, error_reporting is temporarily set to 0
+ if (error_reporting() == 0) {
+ return;
+ }
+
if ($errno & (E_ALL ^ E_NOTICE)) {
$types = array(1 => 'error', 2 => 'warning', 4 => 'parse error', 8 => 'notice', 16 => 'core error', 32 => 'core warning', 64 => 'compile error', 128 => 'compile warning', 256 => 'user error', 512 => 'user warning', 1024 => 'user notice', 2048 => 'strict warning');
$entry = $types[$errno] .': '. $message .' in '. $filename .' on line '. $line .'.';
- // Note: force display of error messages in update.php
+ // Force display of error messages in update.php
if (variable_get('error_level', 1) == 1 || strstr($_SERVER['PHP_SELF'], 'update.php')) {
drupal_set_message($entry, 'error');
}
diff --git a/includes/install.inc b/includes/install.inc
index bef15c617..08aa55154 100644
--- a/includes/install.inc
+++ b/includes/install.inc
@@ -270,11 +270,50 @@ function drupal_install_profile($profile) {
require_once($profile_file);
+ // Get a list of modules absolutely required by Drupal.
+ $bootstrap_list = array('system');
+
// Get a list of modules required by this profile.
$function = $profile .'_profile_modules';
$module_list = $function();
+
+ // If anyone has added modules that we automatically install, filter them out.
+ $module_list = array_diff($module_list, $bootstrap_list);
// Verify that all required modules exist.
+ $bootstrap_modules = drupal_find_modules($bootstrap_list);
+ $profile_modules = drupal_find_modules($module_list);
+
+ // Install the essential system modules and bootstrap Drupal.
+ drupal_install_modules($bootstrap_list);
+ drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
+
+ // Install schemas for profile and all its modules.
+ $function = $profile .'_install';
+ if (function_exists($function)) {
+ $function();
+ }
+
+ drupal_install_modules($module_list);
+
+ // Enable the modules required by the profile.
+ db_query("DELETE FROM {system} WHERE type = 'module'");
+ $modules = array_merge($bootstrap_modules, $profile_modules);
+ foreach ($modules as $module) {
+ db_query("INSERT INTO {system} (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES('%s', '%s', 'module', '', 1, 0, 0, 0)", $module->filename, $module->name);
+ }
+}
+
+
+/**
+ * Finds the file paths for a set of modules.
+ *
+ * @param module_list
+ * The modules to locate.
+ * @return
+ * An array containing file information for the modules.
+ */
+function drupal_find_modules($module_list = array()) {
$modules = array();
foreach ($module_list as $current) {
$module = file_scan_directory('./modules', "^$current.module$", array('.', '..', 'CVS'), 0, TRUE, 'name', 0);
@@ -285,26 +324,22 @@ function drupal_install_profile($profile) {
$modules = array_merge($modules, $module);
}
}
+ return $modules;
+}
+/**
+ * Execute the install scripts for a set of modules.
+ *
+ * @param module_list
+ * The modules to install.
+ */
+function drupal_install_modules($module_list = array()) {
// Get a list of all .install files.
$installs = drupal_get_install_files($module_list);
-
- // Install schemas for profile and all its modules.
- $function = $profile .'_install';
- if (function_exists($function)) {
- $function();
- }
-
foreach ($installs as $install) {
require_once $install->filename;
module_invoke($install->name, 'install');
}
-
- // Enable the modules required by the profile.
- db_query("DELETE FROM {system} WHERE type = 'module'");
- foreach ($modules as $module) {
- db_query("INSERT INTO {system} (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES('%s', '%s', 'module', '', 1, 0, 0, 0)", $module->filename, $module->name);
- }
}
/**