summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/node/node.admin.inc3
-rw-r--r--modules/node/node.install4
-rw-r--r--modules/node/node.module34
-rw-r--r--modules/simpletest/drupal_web_test_case.php2
4 files changed, 21 insertions, 22 deletions
diff --git a/modules/node/node.admin.inc b/modules/node/node.admin.inc
index fc00a9f76..054ee1a23 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 22bd55152..c53bdf8c9 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 586d2e037..28246c84f 100644
--- a/modules/node/node.module
+++ b/modules/node/node.module
@@ -361,13 +361,6 @@ function _node_extract_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.
*
* @return
@@ -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 24b173251..548f5a45b 100644
--- a/modules/simpletest/drupal_web_test_case.php
+++ b/modules/simpletest/drupal_web_test_case.php
@@ -1063,7 +1063,7 @@ class DrupalWebTestCase extends DrupalTestCase {
// 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.