diff options
author | Dries Buytaert <dries@buytaert.net> | 2010-03-01 07:39:12 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2010-03-01 07:39:12 +0000 |
commit | 1c26e2cee1dfde11eb505db66ec2b97baa7244d9 (patch) | |
tree | 8b6371f500ec89099e871200cfafe8c70cda1e83 | |
parent | 1cfde5913d09de7ffaa52f98ef3c303cb363e524 (diff) | |
download | brdo-1c26e2cee1dfde11eb505db66ec2b97baa7244d9.tar.gz brdo-1c26e2cee1dfde11eb505db66ec2b97baa7244d9.tar.bz2 |
- Patch #728820 by David_Rothstein: clean up installation of required modules.
-rw-r--r-- | includes/install.core.inc | 8 | ||||
-rw-r--r-- | includes/install.inc | 2 | ||||
-rw-r--r-- | modules/node/node.install | 17 | ||||
-rw-r--r-- | modules/system/system.install | 72 | ||||
-rw-r--r-- | modules/user/user.install | 52 |
5 files changed, 81 insertions, 70 deletions
diff --git a/includes/install.core.inc b/includes/install.core.inc index 7c4bc1057..f67d790ca 100644 --- a/includes/install.core.inc +++ b/includes/install.core.inc @@ -741,9 +741,13 @@ function install_verify_requirements(&$install_state) { function install_system_module(&$install_state) { // Install system.module. drupal_install_system(); + + // Enable the user module so that sessions can be recorded during the + // upcoming bootstrap step. + module_enable(array('user'), FALSE); + // Save the list of other modules to install for the upcoming tasks. - // variable_set() can be used now that system.module is installed and - // Drupal is bootstrapped. + // variable_set() can be used now that system.module is installed. $modules = $install_state['profile_info']['dependencies']; // The install profile is also a module, which needs to be installed diff --git a/includes/install.inc b/includes/install.inc index 17225f562..577724c0a 100644 --- a/includes/install.inc +++ b/includes/install.inc @@ -589,8 +589,6 @@ function drupal_install_system() { 'bootstrap' => 0, )) ->execute(); - // Now that we've installed things properly, bootstrap the full Drupal environment - drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); system_rebuild_module_data(); } diff --git a/modules/node/node.install b/modules/node/node.install index b4eeaeab6..473bc4efd 100644 --- a/modules/node/node.install +++ b/modules/node/node.install @@ -357,6 +357,23 @@ function node_schema() { } /** + * Implements hook_install(). + */ +function node_install() { + // Populate the node access table. + db_insert('node_access') + ->fields(array( + 'nid' => 0, + 'gid' => 0, + 'realm' => 'all', + 'grant_view' => 1, + 'grant_update' => 0, + 'grant_delete' => 0, + )) + ->execute(); +} + +/** * Implements hook_update_dependencies(). */ function node_update_dependencies() { diff --git a/modules/system/system.install b/modules/system/system.install index ccdcad65c..047605b13 100644 --- a/modules/system/system.install +++ b/modules/system/system.install @@ -392,13 +392,10 @@ function system_requirements($phase) { */ function system_install() { // Create tables. - $modules = array('system', 'filter', 'user', 'node'); - foreach ($modules as $module) { - drupal_install_schema($module); - $versions = drupal_get_schema_versions($module); - $version = $versions ? max($versions) : SCHEMA_INSTALLED; - drupal_set_installed_schema_version($module, $version); - } + drupal_install_schema('system'); + $versions = drupal_get_schema_versions('system'); + $version = $versions ? max($versions) : SCHEMA_INSTALLED; + drupal_set_installed_schema_version('system', $version); // Clear out module list and hook implementation statics before calling // system_rebuild_theme_data(). @@ -408,73 +405,16 @@ function system_install() { // Load system theme data appropriately. system_rebuild_theme_data(); - db_insert('users') - ->fields(array( - 'uid' => 0, - 'name' => '', - 'mail' => '', - )) - ->execute(); - // We need some placeholders here as name and mail are uniques and data is - // presumed to be a serialized array. This will be changed by the settings - // form. - db_insert('users') - ->fields(array( - 'uid' => 1, - 'name' => 'placeholder-for-uid-1', - 'mail' => 'placeholder-for-uid-1', - 'created' => REQUEST_TIME, - 'status' => 1, - 'data' => serialize(array()), - )) - ->execute(); - // Built-in roles. - $rid_anonymous = db_insert('role') - ->fields(array('name' => 'anonymous user')) - ->execute(); - - $rid_authenticated = db_insert('role') - ->fields(array('name' => 'authenticated user')) - ->execute(); - - // Sanity check to ensure the anonymous and authenticated role IDs are the - // same as the drupal defined constants. In certain situations, this will - // not be true. - if ($rid_anonymous != DRUPAL_ANONYMOUS_RID) { - db_update('role') - ->fields(array('rid' => DRUPAL_ANONYMOUS_RID)) - ->condition('rid', $rid_anonymous) - ->execute(); - } - - if ($rid_authenticated != DRUPAL_AUTHENTICATED_RID) { - db_update('role') - ->fields(array('rid' => DRUPAL_AUTHENTICATED_RID)) - ->condition('rid', $rid_authenticated) - ->execute(); - } - + // Enable the default theme. variable_set('theme_default', 'garland'); - db_update('system') ->fields(array('status' => 1)) ->condition('type', 'theme') ->condition('name', 'garland') ->execute(); - db_insert('node_access') - ->fields(array( - 'nid' => 0, - 'gid' => 0, - 'realm' => 'all', - 'grant_view' => 1, - 'grant_update' => 0, - 'grant_delete' => 0, - )) - ->execute(); - + // Populate the cron key variable. $cron_key = md5(mt_rand()); - variable_set('cron_key', $cron_key); } diff --git a/modules/user/user.install b/modules/user/user.install index 9c7de82c3..d9d017661 100644 --- a/modules/user/user.install +++ b/modules/user/user.install @@ -252,6 +252,58 @@ function user_schema() { } /** + * Implements hook_install(). + */ +function user_install() { + // Insert a row for the anonymous user. + db_insert('users') + ->fields(array( + 'uid' => 0, + 'name' => '', + 'mail' => '', + )) + ->execute(); + + // We need some placeholders here as name and mail are uniques and data is + // presumed to be a serialized array. This will be changed by the settings + // form in the installer. + db_insert('users') + ->fields(array( + 'uid' => 1, + 'name' => 'placeholder-for-uid-1', + 'mail' => 'placeholder-for-uid-1', + 'created' => REQUEST_TIME, + 'status' => 1, + 'data' => serialize(array()), + )) + ->execute(); + + // Built-in roles. + $rid_anonymous = db_insert('role') + ->fields(array('name' => 'anonymous user')) + ->execute(); + $rid_authenticated = db_insert('role') + ->fields(array('name' => 'authenticated user')) + ->execute(); + + // Sanity check to ensure the anonymous and authenticated role IDs are the + // same as the drupal defined constants. In certain situations, this will + // not be true. + if ($rid_anonymous != DRUPAL_ANONYMOUS_RID) { + db_update('role') + ->fields(array('rid' => DRUPAL_ANONYMOUS_RID)) + ->condition('rid', $rid_anonymous) + ->execute(); + } + if ($rid_authenticated != DRUPAL_AUTHENTICATED_RID) { + db_update('role') + ->fields(array('rid' => DRUPAL_AUTHENTICATED_RID)) + ->condition('rid', $rid_authenticated) + ->execute(); + } +} + +/** * @defgroup user-updates-6.x-to-7.x User updates from 6.x to 7.x * @{ */ |