summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorGábor Hojtsy <gabor@hojtsy.hu>2007-12-08 15:15:25 +0000
committerGábor Hojtsy <gabor@hojtsy.hu>2007-12-08 15:15:25 +0000
commita33b43386dee4b19be0f3bd2b5d4eabd54d47b21 (patch)
tree0efa37a2b6e8890e181840cc500d8583dfba2e49 /includes
parent5622bce2d52904922a7fd450088bcaed417af7fd (diff)
downloadbrdo-a33b43386dee4b19be0f3bd2b5d4eabd54d47b21.tar.gz
brdo-a33b43386dee4b19be0f3bd2b5d4eabd54d47b21.tar.bz2
#176003 by yched, KarenS, dvessel: put module installs into a batch, solving the following issues:
- possible timeouts with installing/enabling lots of modules at once in core - enable install profiles to have more modules without fear of timeouts on install - bootstrap Drupal before each module load, so previously enabled modules are bootstrapped - let modules run their hook_requirements() (although actually calling them will be possibly fixed in another patch)
Diffstat (limited to 'includes')
-rw-r--r--includes/install.inc65
-rw-r--r--includes/module.inc5
-rw-r--r--includes/theme.inc2
-rw-r--r--includes/theme.maintenance.inc2
4 files changed, 37 insertions, 37 deletions
diff --git a/includes/install.inc b/includes/install.inc
index 04f7939b0..d68185e91 100644
--- a/includes/install.inc
+++ b/includes/install.inc
@@ -294,19 +294,41 @@ function drupal_verify_profile($profile, $locale) {
}
/**
- * Install a profile (i.e. a set of modules) from scratch.
- * The profile must be verified first using drupal_verify_profile().
+ * Calls the install function and updates the system table for a given list of
+ * modules.
*
- * @param profile
- * The name of the profile to install.
* @param module_list
- * An array of modules to install.
+ * The modules to install.
+ */
+function drupal_install_modules($module_list = array()) {
+ array_filter($module_list, '_drupal_install_module');
+ module_enable($module_list);
+}
+
+/**
+ * Callback to install an individual profile module.
+ *
+ * Used during installation to install modules one at a time and then
+ * enable them, or to install a number of modules at one time
+ * from admin/build/modules.
*/
-function drupal_install_profile($profile, $module_list) {
- // The system module is a special case; we can't bootstrap until it's
- // installed, so we can't use the normal installation function.
- $module_list = array_diff($module_list, array('system'));
+function _drupal_install_module($module) {
+ if (drupal_get_installed_schema_version($module, TRUE) == SCHEMA_UNINSTALLED) {
+ module_load_install($module);
+ module_invoke($module, 'install');
+ $versions = drupal_get_schema_versions($module);
+ drupal_set_installed_schema_version($module, $versions ? max($versions) : SCHEMA_INSTALLED);
+ return TRUE;
+ }
+}
+/**
+ * Callback to install the system module.
+ *
+ * Separated from the installation of other modules so core system
+ * functions can be made available while other modules are installed.
+ */
+function drupal_install_system() {
$system_path = dirname(drupal_get_filename('module', 'system', NULL));
require_once './'. $system_path .'/system.install';
module_invoke('system', 'install');
@@ -315,34 +337,9 @@ function drupal_install_profile($profile, $module_list) {
db_query("INSERT INTO {system} (filename, name, type, owner, status, throttle, bootstrap, schema_version) VALUES('%s', '%s', '%s', '%s', %d, %d, %d, %d)", $system_path .'/system.module', 'system', 'module', '', 1, 0, 0, $system_version);
// Now that we've installed things properly, bootstrap the full Drupal environment
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
-
- // Install schemas for profile and all its modules.
module_rebuild_cache();
- drupal_install_modules($module_list);
}
-/**
- * Calls the install function and updates the system table for a given list of
- * modules.
- *
- * @param module_list
- * The modules to install.
- */
-function drupal_install_modules($module_list = array()) {
- $enable_modules = array();
-
- foreach ($module_list as $module) {
- if (drupal_get_installed_schema_version($module, TRUE) == SCHEMA_UNINSTALLED) {
- module_load_install($module);
- module_invoke($module, 'install');
- $versions = drupal_get_schema_versions($module);
- drupal_set_installed_schema_version($module, $versions ? max($versions) : SCHEMA_INSTALLED);
- $enable_modules[] = $module;
- }
- }
-
- module_enable($enable_modules);
-}
/**
* Calls the uninstall function and updates the system table for a given module.
diff --git a/includes/module.inc b/includes/module.inc
index 64087717a..c249a4175 100644
--- a/includes/module.inc
+++ b/includes/module.inc
@@ -261,7 +261,10 @@ function module_enable($module_list) {
foreach ($invoke_modules as $module) {
module_invoke($module, 'enable');
// Check if node_access table needs rebuilding.
- if (!node_access_needs_rebuild() && module_hook($module, 'node_grants')) {
+ // We check for the existence of node_access_needs_rebuild() since
+ // at install time, module_enable() could be called while node.module
+ // is not enabled yet.
+ if (function_exists('node_access_needs_rebuild') && !node_access_needs_rebuild() && module_hook($module, 'node_grants')) {
node_access_needs_rebuild(TRUE);
}
}
diff --git a/includes/theme.inc b/includes/theme.inc
index 026973585..45655c58a 100644
--- a/includes/theme.inc
+++ b/includes/theme.inc
@@ -1632,7 +1632,7 @@ function template_preprocess(&$variables, $hook) {
$variables['is_admin'] = FALSE;
$variables['is_front'] = FALSE;
$variables['logged_in'] = FALSE;
- if ($variables['db_is_active'] = db_is_active()) {
+ if ($variables['db_is_active'] = db_is_active() && !defined('MAINTENANCE_MODE')) {
// Check for administrators.
if (user_access('access administration pages')) {
$variables['is_admin'] = TRUE;
diff --git a/includes/theme.maintenance.inc b/includes/theme.maintenance.inc
index d56a7c89d..94d30cf88 100644
--- a/includes/theme.maintenance.inc
+++ b/includes/theme.maintenance.inc
@@ -127,7 +127,7 @@ function theme_install_page($content) {
// Special handling of status messages
if (isset($messages['status'])) {
- $warnings = count($messages['status']) > 1 ? st('The following installation warnings should be carefully reviewed, but in most cases may be safely ignored') : st('The following installation warning should be carefully reviewed, but in most cases may be safely ignored');
+ $title = count($messages['status']) > 1 ? st('The following installation warnings should be carefully reviewed, but in most cases may be safely ignored') : st('The following installation warning should be carefully reviewed, but in most cases may be safely ignored');
$variables['messages'] .= '<h4>'. $title .':</h4>';
$variables['messages'] .= theme('status_messages', 'status');
}