Commit 65654b29 authored by webchick's avatar webchick

#574796 by sun: Fixed 'Article' content-type permissions not granted to admin...

#574796 by sun: Fixed 'Article' content-type permissions not granted to admin role after installation.
parent 02d18aa6
......@@ -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');
}
......@@ -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'])) {
......
......@@ -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(
......
......@@ -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.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment