diff --git a/core/includes/common.inc b/core/includes/common.inc index 4f78db1..baf4dc9 100644 --- a/core/includes/common.inc +++ b/core/includes/common.inc @@ -7373,7 +7373,11 @@ function drupal_flush_all_caches() { system_rebuild_theme_data(); drupal_theme_rebuild(); - node_types_rebuild(); + // @todo D8: Split cache flushing from rebuilding. + // @see http://drupal.org/node/996236 + if (module_exists('node')) { + node_types_rebuild(); + } // node_menu() defines menu items based on node types so it needs to come // after node types are rebuilt. menu_rebuild(); diff --git a/core/includes/module.inc b/core/includes/module.inc index 221ad60..748e792 100644 --- a/core/includes/module.inc +++ b/core/includes/module.inc @@ -520,11 +520,6 @@ function module_disable($module_list, $disable_dependents = TRUE) { foreach ($module_list as $module) { if (module_exists($module)) { - // Check if node_access table needs rebuilding. - if (!node_access_needs_rebuild() && module_hook($module, 'node_grants')) { - node_access_needs_rebuild(TRUE); - } - module_load_install($module); module_invoke($module, 'disable'); db_update('system') @@ -549,12 +544,6 @@ function module_disable($module_list, $disable_dependents = TRUE) { registry_update(); _system_update_bootstrap_status(); } - - // If there remains no more node_access module, rebuilding will be - // straightforward, we can do it right now. - if (node_access_needs_rebuild() && count(module_implements('node_grants')) == 0) { - node_access_rebuild(); - } } /** diff --git a/core/includes/path.inc b/core/includes/path.inc index 1fac235..9ae1875 100644 --- a/core/includes/path.inc +++ b/core/includes/path.inc @@ -16,7 +16,7 @@ function drupal_path_initialize() { // Ensure $_GET['q'] is set before calling drupal_normal_path(), to support // path caching with hook_url_inbound_alter(). if (empty($_GET['q'])) { - $_GET['q'] = variable_get('site_frontpage', 'node'); + $_GET['q'] = variable_get('site_frontpage', 'user'); } $_GET['q'] = drupal_get_normal_path($_GET['q']); } @@ -292,7 +292,7 @@ function drupal_is_front_page() { if (!isset($is_front_page)) { // As drupal_path_initialize updates $_GET['q'] with the 'site_frontpage' path, // we can check it against the 'site_frontpage' variable. - $is_front_page = ($_GET['q'] == variable_get('site_frontpage', 'node')); + $is_front_page = ($_GET['q'] == variable_get('site_frontpage', 'user')); } return $is_front_page; @@ -323,7 +323,7 @@ function drupal_match_path($path, $patterns) { $replacements = array( '|', '.*', - '\1' . preg_quote(variable_get('site_frontpage', 'node'), '/') . '\2' + '\1' . preg_quote(variable_get('site_frontpage', 'user'), '/') . '\2' ); $patterns_quoted = preg_quote($patterns, '/'); $regexps[$patterns] = '/^(' . preg_replace($to_replace, $replacements, $patterns_quoted) . ')$/'; diff --git a/core/modules/book/book.info b/core/modules/book/book.info index 15984ad..f370800 100644 --- a/core/modules/book/book.info +++ b/core/modules/book/book.info @@ -3,6 +3,7 @@ description = Allows users to create and organize related content in an outline. package = Core version = VERSION core = 8.x +dependencies[] = node files[] = book.test configure = admin/content/book/settings stylesheets[all][] = book.theme.css diff --git a/core/modules/comment/comment.info b/core/modules/comment/comment.info index 606f46d..db6dc2c 100644 --- a/core/modules/comment/comment.info +++ b/core/modules/comment/comment.info @@ -3,6 +3,7 @@ description = Allows users to comment on and discuss published content. package = Core version = VERSION core = 8.x +dependencies[] = node dependencies[] = text dependencies[] = entity files[] = comment.entity.inc diff --git a/core/modules/forum/forum.info b/core/modules/forum/forum.info index cb6e3e7..f202f9e 100644 --- a/core/modules/forum/forum.info +++ b/core/modules/forum/forum.info @@ -1,5 +1,6 @@ name = Forum description = Provides discussion forums. +dependencies[] = node dependencies[] = taxonomy dependencies[] = comment package = Core diff --git a/core/modules/help/help.module b/core/modules/help/help.module index 773a52d..6f7322e 100644 --- a/core/modules/help/help.module +++ b/core/modules/help/help.module @@ -43,7 +43,10 @@ function help_help($path, $arg) { $output .= '
  • ' . t('Configure your website Once logged in, visit the administration section, where you can customize and configure all aspects of your website.', array('@admin' => url('admin'), '@config' => url('admin/config'))) . '
  • '; $output .= '
  • ' . t('Enable additional functionality Next, visit the module list and enable features which suit your specific needs. You can find additional modules in the Drupal modules download section.', array('@modules' => url('admin/modules'), '@download_modules' => 'http://drupal.org/project/modules')) . '
  • '; $output .= '
  • ' . t('Customize your website design To change the "look and feel" of your website, visit the themes section. You may choose from one of the included themes or download additional themes from the Drupal themes download section.', array('@themes' => url('admin/appearance'), '@download_themes' => 'http://drupal.org/project/themes')) . '
  • '; - $output .= '
  • ' . t('Start posting content Finally, you can add new content for your website.', array('@content' => url('node/add'))) . '
  • '; + // Display a link to the create content page if Node module is enabled. + if (module_exists('node')) { + $output .= '
  • ' . t('Start posting content Finally, you can add new content for your website.', array('@content' => url('node/add'))) . '
  • '; + } $output .= ''; $output .= '

    ' . t('For more information, refer to the specific topics listed in the next section or to the online Drupal handbooks. You may also post at the Drupal forum or view the wide range of other support options available.', array('@help' => url('admin/help'), '@handbook' => 'http://drupal.org/handbooks', '@forum' => 'http://drupal.org/forum', '@support' => 'http://drupal.org/support')) . '

    '; return $output; diff --git a/core/modules/locale/locale.install b/core/modules/locale/locale.install index 4ae03fc..ab5e66e 100644 --- a/core/modules/locale/locale.install +++ b/core/modules/locale/locale.install @@ -57,9 +57,11 @@ function locale_uninstall() { variable_del("locale_language_providers_weight_$type"); } - foreach (node_type_get_types() as $type => $content_type) { - $setting = variable_del("language_content_type_$type"); - } + // Remove all node type language variables. Node module might have been + // enabled, but may be disabled, so use a wildcard delete. + db_delete('variable') + ->condition('name', 'language_content_type_%', 'LIKE') + ->execute(); // Switch back to English: with a $language->language value different from 'en' // successive calls of t() might result in calling locale(), which in turn might diff --git a/core/modules/node/node.module b/core/modules/node/node.module index 7c25666..65d47ab 100644 --- a/core/modules/node/node.module +++ b/core/modules/node/node.module @@ -4067,6 +4067,28 @@ function node_modules_enabled($modules) { } /** + * Implements hook_modules_disabled(). + */ +function node_modules_disabled($modules) { + // Check whether any of the disabled modules implemented hook_node_grants(), + // in which case the node access table needs to be rebuilt. + foreach ($modules as $module) { + // At this point, the module is already disabled, but its code is still + // loaded in memory. Module functions must no longer be called. We only + // check whether a hook implementation function exists and do not invoke it. + if (!node_access_needs_rebuild() && module_hook($module, 'node_grants')) { + node_access_needs_rebuild(TRUE); + } + } + + // If there remains no more node_access module, rebuilding will be + // straightforward, we can do it right now. + if (node_access_needs_rebuild() && count(module_implements('node_grants')) == 0) { + node_access_rebuild(); + } +} + +/** * Controller class for nodes. * * This extends the DrupalDefaultEntityController class, adding required diff --git a/core/modules/overlay/overlay.module b/core/modules/overlay/overlay.module index 5433d3e..8f62c01 100644 --- a/core/modules/overlay/overlay.module +++ b/core/modules/overlay/overlay.module @@ -635,7 +635,7 @@ function overlay_overlay_parent_initialize() { // Let the client side know which paths are administrative. $paths = path_get_admin_paths(); foreach ($paths as &$type) { - $type = str_replace('', variable_get('site_frontpage', 'node'), $type); + $type = str_replace('', variable_get('site_frontpage', 'user'), $type); } drupal_add_js(array('overlay' => array('paths' => $paths)), 'setting'); // Pass along the Ajax callback for rerendering sections of the parent window. diff --git a/core/modules/poll/poll.info b/core/modules/poll/poll.info index de6ac25..dbdd621 100644 --- a/core/modules/poll/poll.info +++ b/core/modules/poll/poll.info @@ -3,5 +3,6 @@ description = Allows your site to capture votes on different topics in the form package = Core version = VERSION core = 8.x +dependencies[] = node files[] = poll.test stylesheets[all][] = poll.css diff --git a/core/modules/rdf/tests/rdf_test.info b/core/modules/rdf/tests/rdf_test.info index b168815..a65cc59 100644 --- a/core/modules/rdf/tests/rdf_test.info +++ b/core/modules/rdf/tests/rdf_test.info @@ -4,3 +4,8 @@ package = Testing version = VERSION core = 8.x hidden = TRUE +; module_enable() sorts modules with dependencies _always_ after modules without +; dependencies. Blog module depends on Node module, so it is sorted last. +; rdf_test module attempts to override Blog module's RDF mapping, so a +; dependency is needed to sort it into "groups of modules having dependencies". +dependencies[] = rdf diff --git a/core/modules/shortcut/shortcut.install b/core/modules/shortcut/shortcut.install index 60ee6be..7aee9c9 100644 --- a/core/modules/shortcut/shortcut.install +++ b/core/modules/shortcut/shortcut.install @@ -13,18 +13,19 @@ function shortcut_install() { // Create an initial default shortcut set. $shortcut_set = new stdClass(); $shortcut_set->title = $t('Default'); - $shortcut_set->links = array( - array( + $shortcut_set->links = array(); + if (module_exists('node')) { + $shortcut_set->links[] = array( 'link_path' => 'node/add', 'link_title' => $t('Add content'), 'weight' => -20, - ), - array( + ); + $shortcut_set->links[] = array( 'link_path' => 'admin/content', 'link_title' => $t('Find content'), 'weight' => -19, - ), - ); + ); + } // If Drupal is being installed, rebuild the menu before saving the shortcut // set, to make sure the links defined above can be correctly saved. (During // installation, the menu might not have been built at all yet, or it might diff --git a/core/modules/simpletest/drupal_web_test_case.php b/core/modules/simpletest/drupal_web_test_case.php index 5c711fb..8ebdea6 100644 --- a/core/modules/simpletest/drupal_web_test_case.php +++ b/core/modules/simpletest/drupal_web_test_case.php @@ -1093,26 +1093,33 @@ class DrupalWebTestCase extends DrupalTestCase { } /** - * Create a user with a given set of permissions. The permissions correspond to the - * names given on the privileges page. + * Create a user with a given set of permissions. * * @param $permissions - * Array of permission names to assign to user. + * Array of permission names to assign to user. Note that the user always + * has the default permissions derived from the "authenticated users" role. + * * @return * A fully loaded user object with pass_raw property, or FALSE if account * creation fails. */ - protected function drupalCreateUser($permissions = array('access comments', 'access content', 'post comments', 'skip comment approval')) { - // Create a role with the given permission set. - if (!($rid = $this->drupalCreateRole($permissions))) { - return FALSE; + protected function drupalCreateUser(array $permissions = array()) { + // Create a role with the given permissions, if any. + $rid = FALSE; + if ($permissions) { + $rid = $this->drupalCreateRole($permissions); + if (!$rid) { + return FALSE; + } } // Create a user assigned to that role. $edit = array(); $edit['name'] = $this->randomName(); $edit['mail'] = $edit['name'] . '@example.com'; - $edit['roles'] = array($rid => $rid); + if ($rid) { + $edit['roles'] = array($rid => $rid); + } $edit['pass'] = user_password(); $edit['status'] = 1; diff --git a/core/modules/simpletest/tests/database_test.test b/core/modules/simpletest/tests/database_test.test index 6e55fbd..934847f 100644 --- a/core/modules/simpletest/tests/database_test.test +++ b/core/modules/simpletest/tests/database_test.test @@ -19,7 +19,12 @@ class DatabaseTestCase extends DrupalWebTestCase { protected $profile = 'testing'; function setUp() { - parent::setUp('database_test'); + $modules = func_get_args(); + if (isset($modules[0]) && is_array($modules[0])) { + $modules = $modules[0]; + } + $modules[] = 'database_test'; + parent::setUp($modules); $schema['test'] = drupal_get_schema('test'); $schema['test_people'] = drupal_get_schema('test_people'); @@ -377,10 +382,6 @@ class DatabaseFetch2TestCase extends DatabaseTestCase { ); } - function setUp() { - parent::setUp(); - } - // Confirm that we can fetch a record into an indexed array explicitly. function testQueryFetchNum() { $records = array(); @@ -2218,24 +2219,14 @@ class DatabaseSelectComplexTestCase2 extends DatabaseTestCase { } function setUp() { - DrupalWebTestCase::setUp('database_test', 'node_access_test'); - - $schema['test'] = drupal_get_schema('test'); - $schema['test_people'] = drupal_get_schema('test_people'); - $schema['test_one_blob'] = drupal_get_schema('test_one_blob'); - $schema['test_two_blobs'] = drupal_get_schema('test_two_blobs'); - $schema['test_task'] = drupal_get_schema('test_task'); - - $this->installTables($schema); - - $this->addSampleData(); + parent::setUp(array('node_access_test')); } /** * Test that we can join on a query. */ function testJoinSubquery() { - $acct = $this->drupalCreateUser(array('access content')); + $acct = $this->drupalCreateUser(); $this->drupalLogin($acct); $query = db_select('test_task', 'tt', array('target' => 'slave')); @@ -2754,6 +2745,10 @@ class DatabaseRegressionTestCase extends DatabaseTestCase { ); } + function setUp() { + parent::setUp(array('node')); + } + /** * Regression test for #310447. * @@ -3045,10 +3040,6 @@ class DatabaseBasicSyntaxTestCase extends DatabaseTestCase { ); } - function setUp() { - parent::setUp('database_test'); - } - /** * Test for string concatenation. */ @@ -3146,10 +3137,6 @@ class DatabaseInvalidDataTestCase extends DatabaseTestCase { ); } - function setUp() { - parent::setUp('database_test'); - } - /** * Traditional SQL database systems abort inserts when invalid data is encountered. */ @@ -3219,10 +3206,6 @@ class DatabaseQueryTestCase extends DatabaseTestCase { ); } - function setUp() { - parent::setUp('database_test'); - } - /** * Test that we can specify an array of values in the query by simply passing in an array. */ diff --git a/core/modules/system/system.admin.inc b/core/modules/system/system.admin.inc index 97a4673..c68f3d1 100644 --- a/core/modules/system/system.admin.inc +++ b/core/modules/system/system.admin.inc @@ -1487,7 +1487,7 @@ function system_site_information_settings() { $form['front_page']['site_frontpage'] = array( '#type' => 'textfield', '#title' => t('Default front page'), - '#default_value' => (variable_get('site_frontpage')!='node'?drupal_get_path_alias(variable_get('site_frontpage', 'node')):''), + '#default_value' => (variable_get('site_frontpage') != 'user' ? drupal_get_path_alias(variable_get('site_frontpage', 'user')) : ''), '#size' => 40, '#description' => t('Optionally, specify a relative URL to display as the front page. Leave blank to display the default content feed.'), '#field_prefix' => url(NULL, array('absolute' => TRUE)) . (variable_get('clean_url', 0) ? '' : '?q='), @@ -1497,8 +1497,8 @@ function system_site_information_settings() { '#default_value' => variable_get('default_nodes_main', 10), '#options' => drupal_map_assoc(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30)), '#description' => t('The maximum number of posts displayed on overview pages such as the front page.'), - '#access' => (variable_get('site_frontpage')=='node'), - ); + '#access' => (variable_get('site_frontpage') == 'node'), + ); $form['error_page'] = array( '#type' => 'fieldset', '#title' => t('Error pages'), @@ -1535,8 +1535,8 @@ function system_site_information_settings_validate($form, &$form_state) { } // Check for empty front page path. if (empty($form_state['values']['site_frontpage'])) { - // Set to default "node". - form_set_value($form['front_page']['site_frontpage'], 'node', $form_state); + // Set to default "user". + form_set_value($form['front_page']['site_frontpage'], 'user', $form_state); } else { // Get the normal path of the front page. diff --git a/profiles/minimal/minimal.info b/profiles/minimal/minimal.info index c384680..f221948 100644 --- a/profiles/minimal/minimal.info +++ b/profiles/minimal/minimal.info @@ -2,6 +2,7 @@ name = Minimal description = Start with only a few modules enabled. version = VERSION core = 8.x +dependencies[] = node dependencies[] = block dependencies[] = dblog files[] = minimal.profile diff --git a/profiles/minimal/minimal.install b/profiles/minimal/minimal.install index 059f038..d29b9ad 100644 --- a/profiles/minimal/minimal.install +++ b/profiles/minimal/minimal.install @@ -66,6 +66,9 @@ function minimal_install() { } $query->execute(); + // Set front page to "node". + variable_set('site_frontpage', 'node'); + // Allow visitor account creation, but with administrative approval. variable_set('user_register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL); diff --git a/profiles/standard/standard.info b/profiles/standard/standard.info index 56e4308..e21c18c 100644 --- a/profiles/standard/standard.info +++ b/profiles/standard/standard.info @@ -2,6 +2,7 @@ name = Standard description = Install with commonly used features pre-configured. version = VERSION core = 8.x +dependencies[] = node dependencies[] = block dependencies[] = color dependencies[] = comment diff --git a/profiles/standard/standard.install b/profiles/standard/standard.install index 5d44717..fa5383c 100644 --- a/profiles/standard/standard.install +++ b/profiles/standard/standard.install @@ -193,6 +193,9 @@ function standard_install() { } $query->execute(); + // Set front page to "node". + variable_set('site_frontpage', 'node'); + // Insert default pre-defined node types into the database. For a complete // list of available node type attributes, refer to the node type API // documentation at: http://api.drupal.org/api/HEAD/function/hook_node_info. diff --git a/profiles/testing/testing.install b/profiles/testing/testing.install index 192704d..19092d4 100644 --- a/profiles/testing/testing.install +++ b/profiles/testing/testing.install @@ -8,8 +8,4 @@ function testing_install() { // Allow visitor account creation, but with administrative approval. variable_set('user_register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL); - - // Enable default permissions for system roles. - user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array('access content')); - user_role_grant_permissions(DRUPAL_AUTHENTICATED_RID, array('access content')); }