diff options
author | Gábor Hojtsy <gabor@hojtsy.hu> | 2007-08-30 15:31:46 +0000 |
---|---|---|
committer | Gábor Hojtsy <gabor@hojtsy.hu> | 2007-08-30 15:31:46 +0000 |
commit | 4e0071fb8a44c5a91f46638a8414379fa68dad04 (patch) | |
tree | 71d08d03cbefb370701a758f21078b47ffefe0f4 | |
parent | bfb72d0ec913b9ba423c6c252fb274929d08e2f3 (diff) | |
download | brdo-4e0071fb8a44c5a91f46638a8414379fa68dad04.tar.gz brdo-4e0071fb8a44c5a91f46638a8414379fa68dad04.tar.bz2 |
#111127 rollback by chx, slightly extended: roll back node_load cache, it needs more thought and discussion, so postponed until at least Drupal 7
-rw-r--r-- | modules/book/book.module | 4 | ||||
-rw-r--r-- | modules/comment/comment.module | 1 | ||||
-rw-r--r-- | modules/node/node.module | 28 | ||||
-rw-r--r-- | modules/node/node.schema | 2 | ||||
-rw-r--r-- | modules/system/system.admin.inc | 31 | ||||
-rw-r--r-- | modules/system/system.install | 20 | ||||
-rw-r--r-- | modules/translation/translation.module | 17 |
7 files changed, 18 insertions, 85 deletions
diff --git a/modules/book/book.module b/modules/book/book.module index dcd1be263..2a7c7acfe 100644 --- a/modules/book/book.module +++ b/modules/book/book.module @@ -564,8 +564,6 @@ function book_remove_form_submit($form, &$form_state) { // Only allowed when this is not a book (top-level page). menu_link_delete($node->book['mlid']); db_query('DELETE FROM {book} WHERE nid = %d', $node->nid); - // Clear the node load cache. - cache_clear_all('*', 'cache_node', TRUE); drupal_set_message(t('The post has been removed from the book.')); } $form_state['redirect'] = 'node/'. $node->nid; @@ -611,8 +609,6 @@ function _book_update_outline(&$node) { // Update the bid for this page and all children. book_update_bid($node->book); } - // Clear the node load cache. - cache_clear_all('*', 'cache_node', TRUE); } return TRUE; } diff --git a/modules/comment/comment.module b/modules/comment/comment.module index 05f3ef70f..ca3661020 100644 --- a/modules/comment/comment.module +++ b/modules/comment/comment.module @@ -2035,7 +2035,6 @@ function _comment_update_node_statistics($nid) { $node = db_fetch_object(db_query("SELECT uid, created FROM {node} WHERE nid = %d", $nid)); db_query("UPDATE {node_comment_statistics} SET comment_count = 0, last_comment_timestamp = %d, last_comment_name = '', last_comment_uid = %d WHERE nid = %d", $node->created, $node->uid, $nid); } - cache_clear_all($nid, 'cache_node'); } /** diff --git a/modules/node/node.module b/modules/node/node.module index b2b4613e4..6b6f6c7f8 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -444,7 +444,6 @@ function node_type_delete($type) { */ function node_type_update_nodes($old_type, $type) { db_query("UPDATE {node} SET type = '%s' WHERE type = '%s'", $type, $old_type); - cache_clear_all('*', 'cache_node', TRUE); return db_affected_rows(); } @@ -601,17 +600,6 @@ function node_invoke_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) { /** * Load a node object from the database. * - * This function provides two levels of caching. The internal cache stores - * all nodes loaded in this request. Use the $reset argument to invalidate - * it. The cache API based cache stores all nodes throughout requests, - * until invalidated with cache_clear_all(). - * - * If the load operation was cached previously, we load the data from - * that cache, and no nodeapi load operations are called. That means, - * that we expect all load operations to return the same data and do - * not use any conditions on the user, language or anything else, - * which would limit what is stored in the node_load cache. - * * @param $param * Either the nid of the node or an array of conditions to match against in the database query * @param $revision @@ -633,13 +621,7 @@ function node_load($param = array(), $revision = NULL, $reset = NULL) { $arguments = array(); if (is_numeric($param)) { if ($cachable) { - if (!isset($nodes[$param])) { - if ($cache = cache_get($param, 'cache_node')) { - $nodes[$param] = $cache->data; - } - } - // Either the node was statically cached or we loaded from the - // cache_node table. + // Is the node statically cached? if (isset($nodes[$param])) { return is_object($nodes[$param]) ? drupal_clone($nodes[$param]) : $nodes[$param]; } @@ -685,11 +667,6 @@ function node_load($param = array(), $revision = NULL, $reset = NULL) { } if ($cachable) { $nodes[$node->nid] = is_object($node) ? drupal_clone($node) : $node; - // We can only cache when a nid is given, otherwise the conditions are - // too dynamic to be cacheable. - if (is_numeric($param)) { - cache_set($param, $nodes[$node->nid], 'cache_node'); - } } } @@ -886,8 +863,6 @@ function node_save(&$node) { // Clear the page and block caches. cache_clear_all(); - // Clear the node load cache for this node. - cache_clear_all($node->nid, 'cache_node'); } /** @@ -1218,7 +1193,6 @@ function node_user($op, &$edit, &$user) { if ($op == 'delete') { db_query('UPDATE {node} SET uid = 0 WHERE uid = %d', $user->uid); db_query('UPDATE {node_revisions} SET uid = 0 WHERE uid = %d', $user->uid); - cache_clear_all('*', 'cache_node', TRUE); } } diff --git a/modules/node/node.schema b/modules/node/node.schema index 76e942341..34e77b325 100644 --- a/modules/node/node.schema +++ b/modules/node/node.schema @@ -105,7 +105,5 @@ function node_schema() { 'primary key' => array('type'), ); - $schema['cache_node'] = drupal_get_schema_unprocessed('system', 'cache'); - return $schema; } diff --git a/modules/system/system.admin.inc b/modules/system/system.admin.inc index 8d62dfdd0..1d82333d2 100644 --- a/modules/system/system.admin.inc +++ b/modules/system/system.admin.inc @@ -123,7 +123,7 @@ function system_settings_overview() { /** * Form builder; This function allows selection of the theme to show in administration sections. - * + * * @ingroup forms * @see system_settings_form(). */ @@ -156,7 +156,7 @@ function system_admin_theme_settings() { /** * Menu callback; displays a listing of all themes. - * + * * @ingroup forms * @see system_themes_form_submt(). */ @@ -280,7 +280,7 @@ function system_themes_form_submit($form, &$form_state) { /** * Form builder; display theme configuration for entire site and individual themes. - * + * * @ingroup forms * @see system_theme_settings_submit(). */ @@ -693,7 +693,7 @@ function system_modules_disable($form, $edit) { * elements: the list of dependencies and the list of status * form field values from the previous screen. * @ingroup forms - * @see + * @see */ function system_modules_confirm_form($modules, $storage) { $form = array(); @@ -821,7 +821,6 @@ function system_modules_submit($form, &$form_state) { node_types_rebuild(); menu_rebuild(); cache_clear_all('schema', 'cache'); - cache_clear_all('*', 'cache_node', TRUE); drupal_set_message(t('The configuration options have been saved.')); } @@ -1010,7 +1009,7 @@ function system_modules_uninstall_submit($form, &$form_state) { /** * Form builder; The general site information form. - * + * * @ingroup forms * @see system_settings_form(). */ @@ -1068,7 +1067,7 @@ function system_site_information_settings() { /** * Form builder; Configure error reporting settings. - * + * * @ingroup forms * @see system_settings_form(). */ @@ -1115,7 +1114,7 @@ function system_logging_overview() { /** * Form builder; Configure site performance settings. - * + * * @ingroup forms * @see system_settings_form(). */ @@ -1218,7 +1217,7 @@ function system_performance_settings() { /** * Form builder; Configure the site file handling. - * + * * @ingroup forms * @see system_settings_form(). */ @@ -1255,7 +1254,7 @@ function system_file_system_settings() { /** * Form builder; Configure site image toolkit usage. - * + * * @ingroup forms * @see system_settings_form(). */ @@ -1280,7 +1279,7 @@ function system_image_toolkit_settings() { /** * Form builder; Configure how the site handles RSS feeds. - * + * * @ingroup forms * @see system_settings_form(). */ @@ -1306,7 +1305,7 @@ function system_rss_feeds_settings() { /** * Form builder; Configure the site date and time settings. - * + * * @ingroup forms * @see system_settings_form(). * @see system_date_time_settings(). @@ -1476,7 +1475,7 @@ function system_date_time_lookup() { /** * Form builder; Configure the site's maintenance status. - * + * * @ingroup forms * @see system_settings_form(). */ @@ -1502,7 +1501,7 @@ function system_site_maintenance_settings() { /** * Form builder; Configure Clean URL settings. - * + * * @ingroup forms * @see system_settings_form(). */ @@ -1802,7 +1801,7 @@ function theme_system_admin_by_module($menu_items) { /** * Theme status report - * + * * @ingroup themeable */ function theme_status_report(&$requirements) { @@ -1837,7 +1836,7 @@ function theme_status_report(&$requirements) { /** * Theme call back for the modules form. - * + * * @ingroup themeable */ function theme_system_modules($form) { diff --git a/modules/system/system.install b/modules/system/system.install index 1421ecc2d..0479a5992 100644 --- a/modules/system/system.install +++ b/modules/system/system.install @@ -3698,24 +3698,8 @@ function system_update_6027() { * Add the node load cache table. */ function system_update_6028() { - $ret = array(); - - // Create the cache_node table. - $schema['cache_node'] = array( - 'fields' => array( - 'cid' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''), - 'data' => array('type' => 'blob', 'not null' => FALSE, 'size' => 'big'), - 'expire' => array('type' => 'int', 'not null' => TRUE, 'default' => 0), - 'created' => array('type' => 'int', 'not null' => TRUE, 'default' => 0), - 'headers' => array('type' => 'text', 'not null' => FALSE), - 'serialized' => array('type' => 'int', 'size' => 'small', 'not null' => TRUE, 'default' => 0) - ), - 'indexes' => array('expire' => array('expire')), - 'primary key' => array('cid'), - ); - db_create_table($ret, 'cache_node', $schema['cache_node']); - - return $ret; + // Removed node_load cache to discuss it more for Drupal 7. + return array(); } /** diff --git a/modules/translation/translation.module b/modules/translation/translation.module index 04ee51bb3..a965b0cad 100644 --- a/modules/translation/translation.module +++ b/modules/translation/translation.module @@ -256,7 +256,6 @@ function translation_nodeapi(&$node, $op, $teaser, $page) { db_query("UPDATE {node} SET tnid = %d, translate = %d WHERE nid = %d", $tnid, 0, $node->translation_source->nid); } db_query("UPDATE {node} SET tnid = %d, translate = %d WHERE nid = %d", $tnid, 0, $node->nid); - translation_clear_node_cache($tnid); } break; @@ -268,7 +267,6 @@ function translation_nodeapi(&$node, $op, $teaser, $page) { // This is the source node, asking to mark all translations outdated. db_query("UPDATE {node} SET translate = 1 WHERE tnid = %d AND nid != %d", $node->tnid, $node->nid); } - translation_clear_node_cache($node->tnid); } break; @@ -297,26 +295,11 @@ function translation_remove_from_set($node) { $new_tnid = db_result(db_query('SELECT nid FROM {node} WHERE tnid = %d ORDER BY translate ASC, nid ASC', $node->tnid)); db_query('UPDATE {node} SET tnid = %d WHERE tnid = %d', $new_tnid, $node->tnid); } - translation_clear_node_cache($node->tnid); } } } /** - * Clear node_load cache for all nodes in the translation set, so we have - * the proper translation set information in every node. - * - * @param $tnid - * The translation source nid of the translation set, the identifier - * of the node used to derive all translations in the set. - */ -function translation_clear_node_cache($tnid) { - foreach (translation_node_get_translations($tnid) as $node) { - cache_clear_all($node->nid, 'cache_node'); - } -} - -/** * Get all nodes in a translation set, represented by $tnid. * * @param $tnid |