summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorSteven Wittens <steven@10.no-reply.drupal.org>2006-08-03 01:02:51 +0000
committerSteven Wittens <steven@10.no-reply.drupal.org>2006-08-03 01:02:51 +0000
commit38e4c1ae91545d0c45885966cad694660010068d (patch)
tree8edc167d1723e2f9ec3033779007fbc13a8adbe2 /modules
parent8b820834e5c7ee12668c8f3a172dabc3af0455ba (diff)
downloadbrdo-38e4c1ae91545d0c45885966cad694660010068d.tar.gz
brdo-38e4c1ae91545d0c45885966cad694660010068d.tar.bz2
#76209: (Eaton et al)
- Make installer code integrate better with module.inc / system.module - Fix schema version bug when installing core
Diffstat (limited to 'modules')
-rw-r--r--modules/system/system.module56
-rw-r--r--modules/user/user.module4
2 files changed, 15 insertions, 45 deletions
diff --git a/modules/system/system.module b/modules/system/system.module
index 56950f5eb..e19ed56e5 100644
--- a/modules/system/system.module
+++ b/modules/system/system.module
@@ -1154,12 +1154,7 @@ function system_themes_submit($form_id, $values) {
*/
function system_modules() {
// Get current list of modules
- $files = system_listing('\.module$', 'modules', 'name', 0);
-
- // Extract current files from database.
- system_get_files_database($files, 'module');
-
- ksort($files);
+ $files = module_rebuild_cache();
foreach ($files as $filename => $file) {
drupal_get_filename('module', $file->name, $file->filename);
@@ -1176,27 +1171,8 @@ function system_modules() {
if ($file->throttle) {
$throttle[] = $file->name;
}
-
- // log the critical hooks implemented by this module
- $bootstrap = 0;
- foreach (bootstrap_hooks() as $hook) {
- if (module_hook($file->name, $hook)) {
- $bootstrap = 1;
- break;
- }
- }
-
- // Update the contents of the system table:
- if (isset($file->status) || (isset($file->old_filename) && $file->old_filename != $file->filename)) {
- db_query("UPDATE {system} SET description = '%s', name = '%s', bootstrap = %d, filename = '%s' WHERE filename = '%s'", $file->description, $file->name, $bootstrap, $file->filename, $file->old_filename);
- }
- else {
- // This is a new module.
- db_query("INSERT INTO {system} (name, description, type, filename, status, throttle, bootstrap) VALUES ('%s', '%s', '%s', '%s', %d, %d, %d)", $file->name, $file->description, 'module', $file->filename, $file->status, $file->throttle, $bootstrap);
- }
}
-
// Handle status checkboxes, including overriding the generated
// checkboxes for required modules.
$form['status'] = array('#type' => 'checkboxes', '#default_value' => $status, '#options' => $options);
@@ -1246,16 +1222,26 @@ function theme_system_modules($form) {
function system_modules_submit($form_id, $edit) {
- db_query("UPDATE {system} SET status = 0, throttle = 0 WHERE type = 'module'");
-
+ include_once './includes/install.inc';
$new_modules = array();
foreach ($edit['status'] as $key => $choice) {
if ($choice) {
- db_query("UPDATE {system} SET status = 1 WHERE type = 'module' AND name = '%s'", $key);
- if (!module_exist($key)) {
+ if (drupal_get_installed_schema_version($key) == SCHEMA_UNINSTALLED) {
$new_modules[] = $key;
}
+ else {
+ module_enable($key);
+ }
}
+ else {
+ module_disable($key);
+ }
+ }
+
+ module_list(TRUE, FALSE);
+
+ foreach ($new_modules as $module) {
+ drupal_install_module($module);
}
if (is_array($edit['throttle'])) {
@@ -1266,18 +1252,6 @@ function system_modules_submit($form_id, $edit) {
}
}
- module_list(TRUE, FALSE);
-
- include './includes/install.inc';
- foreach ($new_modules as $module) {
- // Set the installed schema version for newly-enabled modules
- $versions = drupal_get_schema_versions($module);
- if (drupal_get_installed_schema_version($module) == SCHEMA_UNINSTALLED) {
- drupal_set_installed_schema_version($module, $versions ? max($versions) : SCHEMA_INSTALLED);
- module_invoke($module, 'install');
- }
- }
-
menu_rebuild();
drupal_set_message(t('The configuration options have been saved.'));
diff --git a/modules/user/user.module b/modules/user/user.module
index a4d120e72..e95a8921a 100644
--- a/modules/user/user.module
+++ b/modules/user/user.module
@@ -1207,10 +1207,6 @@ function user_register_submit($form_id, $form_values) {
drupal_set_message(t('<p>Welcome to Drupal. You are user #1, which gives you full and immediate access. All future registrants will receive their passwords via e-mail, so please make sure your website e-mail address is set properly under the general settings on the <a href="%settings">site information settings page</a>.</p><p> Your password is <strong>%pass</strong>. You may change your password below.</p>', array('%pass' => $pass, '%settings' => url('admin/settings/site-information'))));
user_authenticate($account->name, trim($pass));
- // Set the installed schema version of the system module to the most recent version.
- include_once './includes/install.inc';
- drupal_set_installed_schema_version('system', max(drupal_get_schema_versions('system')));
-
return 'user/1/edit';
}
else {