From 65654b29e8987f8c2a58fcb5e6dc090d80827887 Mon Sep 17 00:00:00 2001 From: Angie Byron <webchick@24967.no-reply.drupal.org> Date: Thu, 17 Sep 2009 03:12:41 +0000 Subject: [PATCH] #574796 by sun: Fixed 'Article' content-type permissions not granted to admin role after installation. --- modules/node/node.admin.inc | 3 +- modules/node/node.install | 4 +-- modules/node/node.module | 34 ++++++++++----------- modules/simpletest/drupal_web_test_case.php | 2 +- 4 files changed, 21 insertions(+), 22 deletions(-) diff --git a/modules/node/node.admin.inc b/modules/node/node.admin.inc index fc00a9f76da2..054ee1a239f1 100644 --- a/modules/node/node.admin.inc +++ b/modules/node/node.admin.inc @@ -586,7 +586,6 @@ function node_multiple_delete_confirm_submit($form, &$form_state) { drupal_set_message(t('Deleted @count posts.', array('@count' => $count))); } $form_state['redirect'] = 'admin/content'; - return; } /** @@ -594,5 +593,5 @@ function node_multiple_delete_confirm_submit($form, &$form_state) { */ function node_modules_installed($modules) { // Clear node type cache for node permissions. - node_type_clear(); + drupal_static_reset('_node_types_build'); } diff --git a/modules/node/node.install b/modules/node/node.install index 22bd5515269a..c53bdf8c91c0 100644 --- a/modules/node/node.install +++ b/modules/node/node.install @@ -408,7 +408,7 @@ function node_update_7004() { // Map old preview setting to new values order. $original_preview ? $original_preview = 2 : $original_preview = 1; - node_type_clear(); + drupal_static_reset('_node_types_build'); $type_list = node_type_get_types(); // Apply original settings to all types. @@ -444,7 +444,7 @@ function node_update_7006(&$context) { $ret = array('#finished' => 0); // Get node type info for every invocation. - node_type_clear(); + drupal_static_reset('_node_types_build'); $node_types = node_type_get_types(); if (!isset($context['total'])) { diff --git a/modules/node/node.module b/modules/node/node.module index 586d2e037f35..28246c84fdae 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -360,13 +360,6 @@ function _node_extract_type($node) { return is_object($node) ? $node->type : $node; } -/** - * Clear the statically cached node type information. - */ -function node_type_clear() { - drupal_static_reset('_node_types_build'); -} - /** * Returns a list of all the available node types. * @@ -448,12 +441,13 @@ function node_type_get_name($node) { } /** - * Resets the database cache of node types, and saves all new or non-modified - * module-defined node types to the database. + * Resets the database cache of node types. + * + * All new or non-modified module-defined node types are saved to the database. */ function node_types_rebuild() { // Reset and load updated node types. - node_type_clear(); + drupal_static_reset('_node_types_build'); foreach (node_type_get_types() as $type => $info) { if (!empty($info->is_new)) { node_type_save($info); @@ -462,9 +456,6 @@ function node_types_rebuild() { node_type_delete($info->type); } } - // Reset cached node type information so that the next access - // will use the updated data. - node_type_clear(); } /** @@ -508,7 +499,7 @@ function node_type_save($info) { } node_configure_fields($type); module_invoke_all('node_type_update', $type); - return SAVED_UPDATED; + $status = SAVED_UPDATED; } else { $fields['orig_type'] = (string) $type->orig_type; @@ -519,8 +510,13 @@ function node_type_save($info) { field_attach_create_bundle($type->type); node_configure_fields($type); module_invoke_all('node_type_insert', $type); - return SAVED_NEW; + $status = SAVED_NEW; } + + // Clear the node type cache. + drupal_static_reset('_node_types_build'); + + return $status; } /** @@ -594,6 +590,9 @@ function node_type_delete($type) { ->condition('type', $type) ->execute(); module_invoke_all('node_type_delete', $info); + + // Clear the node type cache. + drupal_static_reset('_node_types_build'); } /** @@ -1638,8 +1637,9 @@ function node_menu() { 'access arguments' => array('access content'), 'type' => MENU_CALLBACK, ); - // Reset internal static cache of _node_types_build, forces to rebuild the node type information. - node_type_clear(); + // Reset internal static cache of _node_types_build(), forces to rebuild the + // node type information. + drupal_static_reset('_node_types_build'); foreach (node_type_get_types() as $type) { $type_url_str = str_replace('_', '-', $type->type); $items['node/add/' . $type_url_str] = array( diff --git a/modules/simpletest/drupal_web_test_case.php b/modules/simpletest/drupal_web_test_case.php index 24b173251769..548f5a45bf58 100644 --- a/modules/simpletest/drupal_web_test_case.php +++ b/modules/simpletest/drupal_web_test_case.php @@ -1063,7 +1063,7 @@ protected function setUp() { // Install the modules specified by the default profile. drupal_install_modules($profile_details['dependencies'], TRUE); - node_type_clear(); + drupal_static_reset('_node_types_build'); // Install additional modules one at a time in order to make sure that the // list of modules is updated between each module's installation. -- GitLab