diff --git a/core/modules/comment/lib/Drupal/comment/CommentStorageController.php b/core/modules/comment/lib/Drupal/comment/CommentStorageController.php index 713491a..d1bb171a 100644 --- a/core/modules/comment/lib/Drupal/comment/CommentStorageController.php +++ b/core/modules/comment/lib/Drupal/comment/CommentStorageController.php @@ -64,7 +64,7 @@ protected function attachLoad(&$records, $load_revision = FALSE) { * @param \Drupal\comment\Plugin\Core\Entity\Comment $comment * The comment being saved. */ - protected function updateEntityStatistics($comment) { + public function updateEntityStatistics($comment) { global $user; // Allow bulk updates and inserts to temporarily disable the // maintenance of the {comment_entity_statistics} table. diff --git a/core/modules/comment/lib/Drupal/comment/CommentStorageControllerInterface.php b/core/modules/comment/lib/Drupal/comment/CommentStorageControllerInterface.php index 00a6edb..0240359 100644 --- a/core/modules/comment/lib/Drupal/comment/CommentStorageControllerInterface.php +++ b/core/modules/comment/lib/Drupal/comment/CommentStorageControllerInterface.php @@ -51,19 +51,19 @@ public function getChildCids(array $comments); /** * Updates the comment statistics for a given node. * - * The {node_comment_statistics} table has the following fields: - * - last_comment_timestamp: The timestamp of the last comment for this node, - * or the node created timestamp if no comments exist for the node. + * The {comment_entity_statistics} table has the following fields: + * - last_comment_timestamp: The timestamp of the last comment for this entity, + * or the entity created timestamp if no comments exist for the entity. * - last_comment_name: The name of the anonymous poster for the last comment. * - last_comment_uid: The user ID of the poster for the last comment for - * this node, or the node author's user ID if no comments exist for the - * node. + * this entity, or the entity author's user ID if no comments exist for the + * entity. * - comment_count: The total number of approved/published comments on this - * node. + * entity. * - * @param $nid - * The node ID. + * @param \Drupal\comment\Plugin\Core\Entity\Comment $comment + * The comment being saved. */ - public function updateNodeStatistics($nid); + public function updateEntityStatistics($comment); } 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 a629a49..e42683a 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 @@ -300,7 +300,7 @@ public function preSave(EntityStorageControllerInterface $storage_controller) { // has the lock, just move to the next integer. do { $thread = $prefix . comment_int_to_alphadecimal(++$n) . '/'; - } while (!lock()->acquire("comment:{$this->nid->target_id}:$thread")); + } while (!lock()->acquire("comment:{$this->entity_id->value}:$thread")); $this->threadLock = $thread; } if (empty($this->created->value)) {