From e61d892fab86b45d92f688e471998ba24a13e8d4 Mon Sep 17 00:00:00 2001 From: catch <catch@35733.no-reply.drupal.org> Date: Wed, 1 May 2013 09:43:48 +0100 Subject: [PATCH] Issue #1844146 by Berdir: Fixed comment_load() call in template_preprocess_comment() re-loads comment parent entities because of disabled static cache. --- core/modules/comment/comment.module | 8 +++----- .../lib/Drupal/comment/Plugin/Core/Entity/Comment.php | 1 - .../comment/lib/Drupal/comment/Tests/CommentTestBase.php | 2 +- .../modules/user/lib/Drupal/user/Tests/UserCancelTest.php | 2 +- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module index c39fcffd0001..23b0fb6323d9 100644 --- a/core/modules/comment/comment.module +++ b/core/modules/comment/comment.module @@ -1354,8 +1354,7 @@ function comment_delete_multiple($cids) { * @param array $cids * (optional) An array of entity IDs. If omitted, all entities are loaded. * @param bool $reset - * Whether to reset the internal static entity cache. Note that the static - * cache is disabled by default. + * (optional) Whether to reset the internal static entity cache. * * @return array * An array of comment objects, indexed by comment ID. @@ -1373,14 +1372,13 @@ function comment_load_multiple(array $cids = NULL, $reset = FALSE) { * @param int $cid * The ID of the comment to be loaded. * @param bool $reset - * Whether to reset the internal static entity cache. Note that the static - * cache is disabled by default. + * (optional) Whether to reset the internal static entity cache. * * @return * The comment object. */ function comment_load($cid, $reset = FALSE) { - return entity_load('comment', $cid); + return entity_load('comment', $cid, $reset); } /** diff --git a/core/modules/comment/lib/Drupal/comment/Plugin/Core/Entity/Comment.php b/core/modules/comment/lib/Drupal/comment/Plugin/Core/Entity/Comment.php index e56bbef5d9a2..059f516e3ba5 100644 --- a/core/modules/comment/lib/Drupal/comment/Plugin/Core/Entity/Comment.php +++ b/core/modules/comment/lib/Drupal/comment/Plugin/Core/Entity/Comment.php @@ -33,7 +33,6 @@ * uri_callback = "comment_uri", * fieldable = TRUE, * translatable = TRUE, - * static_cache = FALSE, * route_base_path = "admin/structure/types/manage/{bundle}/comment", * bundle_prefix = "comment_node_", * entity_keys = { diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentTestBase.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentTestBase.php index c023c562f9e4..fe4a11c245bf 100644 --- a/core/modules/comment/lib/Drupal/comment/Tests/CommentTestBase.php +++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentTestBase.php @@ -146,7 +146,7 @@ function postComment($node, $comment, $subject = '', $contact = NULL) { } if (isset($match[1])) { - $entity = comment_load($match[1]); + $entity = comment_load($match[1], TRUE); return $entity; } } diff --git a/core/modules/user/lib/Drupal/user/Tests/UserCancelTest.php b/core/modules/user/lib/Drupal/user/Tests/UserCancelTest.php index 4103e7137b9c..83aa5b2fb900 100644 --- a/core/modules/user/lib/Drupal/user/Tests/UserCancelTest.php +++ b/core/modules/user/lib/Drupal/user/Tests/UserCancelTest.php @@ -327,7 +327,7 @@ function testUserDelete() { $this->assertFalse(node_load($node->nid, TRUE), 'Node of the user has been deleted.'); $this->assertFalse(node_revision_load($revision), 'Node revision of the user has been deleted.'); $this->assertTrue(node_load($revision_node->nid, TRUE), "Current revision of the user's node was not deleted."); - $this->assertFalse(comment_load($comment->id()), 'Comment of the user has been deleted.'); + $this->assertFalse(comment_load($comment->id(), TRUE), 'Comment of the user has been deleted.'); // Confirm that the confirmation message made it through to the end user. $this->assertRaw(t('%name has been deleted.', array('%name' => $account->name)), "Confirmation message displayed to user."); -- GitLab