jenkins-bot has submitted this change and it was merged.

Change subject: Fix clearExtraLifecycleHandlers
......................................................................


Fix clearExtraLifecycleHandlers

The way we used to do this was by checking for the
listener to be of a certain class. The NotificationListener,
however, had been wrapped in a DeferredInsertLifecycleHandler
so that check was no longer valid.

Bug: T89691
Change-Id: Icbe18fb0becbe0d289ffdc1e03a716398915da2f
---
M container.php
M tests/phpunit/PostRevisionTestCase.php
2 files changed, 41 insertions(+), 41 deletions(-)

Approvals:
  EBernhardson: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/container.php b/container.php
index 7af6cae..41fb15c 100644
--- a/container.php
+++ b/container.php
@@ -206,9 +206,9 @@
 };
 $c['storage.workflow.listeners'] = function( $c ) {
        return array(
-               $c['listener.occupation'],
-               $c['listener.url_generator'],
-               $c['storage.workflow.listeners.topiclist'],
+               'listener.occupation' => $c['listener.occupation'],
+               'listener.url_generator' => $c['listener.url_generator'],
+               'storage.workflow.listeners.topiclist' => 
$c['storage.workflow.listeners.topiclist'],
        );
 };
 $c['storage.workflow'] = function( $c ) {
@@ -313,11 +313,11 @@
 };
 $c['storage.header.listeners'] = function( $c ) {
        return array(
-               $c['reference.recorder'],
-               $c['storage.board_history.indexes.primary'],
-               $c['storage.header.listeners.username'],
-               $c['listener.recentchanges'],
-               $c['listener.editcount'],
+               'reference.recorder' => $c['reference.recorder'],
+               'storage.board_history.indexes.primary' => 
$c['storage.board_history.indexes.primary'],
+               'storage.header.listeners.username' => 
$c['storage.header.listeners.username'],
+               'listener.recentchanges' => $c['listener.recentchanges'],
+               'listener.editcount' => $c['listener.editcount'],
        );
 };
 $c['storage.header.primary_key'] = array( 'rev_id' );
@@ -392,15 +392,15 @@
 };
 $c['storage.post_summary.listeners'] = function( $c ) {
        return array(
-               $c['listener.recentchanges'],
-               $c['storage.post_summary.listeners.username'],
-               $c['storage.board_history.indexes.primary'],
-               $c['listener.editcount'],
+               'listener.recentchanges' => $c['listener.recentchanges'],
+               'storage.post_summary.listeners.username' => 
$c['storage.post_summary.listeners.username'],
+               'storage.board_history.indexes.primary' => 
$c['storage.board_history.indexes.primary'],
+               'listener.editcount' => $c['listener.editcount'],
                // topic history -- to keep a history by topic we have to know 
what topic every post
                // belongs to, not just its parent. TopicHistoryIndex is a 
slight tweak to TopKIndex
                // using TreeRepository for extra information and stuffing it 
into topic_root while indexing
-               $c['storage.topic_history.indexes.primary'],
-               $c['reference.recorder'],
+               'storage.topic_history.indexes.primary' => 
$c['storage.topic_history.indexes.primary'],
+               'reference.recorder' => $c['reference.recorder'],
        );
 };
 $c['storage.post_summary.backend'] = function( $c ) {
@@ -570,19 +570,19 @@
 };
 $c['storage.post.listeners'] = function( $c ) {
        return array(
-               $c['reference.recorder'],
-               $c['collection.cache'],
-               $c['storage.post.listeners.username'],
-               $c['storage.post.listeners.watch_topic'],
-               $c['storage.post.listeners.notification'],
-               $c['storage.post.listeners.moderation_logging'],
-               $c['listener.recentchanges'],
-               $c['listener.editcount'],
+               'reference.recorder' => $c['reference.recorder'],
+               'collection.cache' => $c['collection.cache'],
+               'storage.post.listeners.username' => 
$c['storage.post.listeners.username'],
+               'storage.post.listeners.watch_topic' => 
$c['storage.post.listeners.watch_topic'],
+               'storage.post.listeners.notification' => 
$c['storage.post.listeners.notification'],
+               'storage.post.listeners.moderation_logging' => 
$c['storage.post.listeners.moderation_logging'],
+               'listener.recentchanges' => $c['listener.recentchanges'],
+               'listener.editcount' => $c['listener.editcount'],
                // topic history -- to keep a history by topic we have to know 
what topic every post
                // belongs to, not just its parent. TopicHistoryIndex is a 
slight tweak to TopKIndex
                // using TreeRepository for extra information and stuffing it 
into topic_root while indexing
-               $c['storage.board_history.indexes.primary'],
-               $c['storage.topic_history.indexes.primary'],
+               'storage.board_history.indexes.primary' => 
$c['storage.board_history.indexes.primary'],
+               'storage.topic_history.indexes.primary' => 
$c['storage.topic_history.indexes.primary'],
        );
 };
 $c['storage.post.indexes.primary'] = function( $c ) {
diff --git a/tests/phpunit/PostRevisionTestCase.php 
b/tests/phpunit/PostRevisionTestCase.php
index 8950dc9..7229113 100644
--- a/tests/phpunit/PostRevisionTestCase.php
+++ b/tests/phpunit/PostRevisionTestCase.php
@@ -208,26 +208,26 @@
        }
 
        protected function clearExtraLifecycleHandlers() {
-               $c = Container::getContainer();
-               foreach( array_unique( $c['storage.manager_list'] ) as $key ) {
-                       if ( !isset( $c["$key.listeners"] ) ) {
+               $container = Container::getContainer();
+               foreach( array_unique( $container['storage.manager_list'] ) as 
$storage ) {
+                       if ( !isset( $container["$storage.listeners"] ) ) {
                                continue;
                        }
-                       $c->extend( "$key.listeners", function( $listeners ) 
use ( $key ) {
-                               return array_filter(
-                                       $listeners,
-                                       function( $handler ) {
-                                               // Recent changes logging is 
outside the scope of this test, and
-                                               // causes interaction issues
-                                               return !$handler instanceof 
RecentChangesListener
-                                                       // putting together the 
right metadata for a commit is beyond the
-                                                       // scope of these tests
-                                                       && !$handler instanceof 
NotificationListener
-                                                       // BoardHistory 
requires we also wire together TopicListEntry objects for
-                                                       // each revision, but 
that's also beyond our scope.
-                                                       && !$handler instanceof 
BoardHistoryIndex;
-                                       }
+
+                       $container->extend( "$storage.listeners", function( 
$listeners ) {
+                               unset(
+                                       // putting together the right metadata 
for a commit is beyond the
+                                       // scope of these tests
+                                       
$listeners['storage.post.listeners.notification'],
+                                       // Recent changes logging is outside 
the scope of tests, and
+                                       // causes interaction issues
+                                       $listeners['listener.recentchanges'],
+                                       // BoardHistory requires we also wire 
together TopicListEntry objects for
+                                       // each revision, but that's also 
beyond our scope.
+                                       
$listeners['storage.board_history.indexes.primary']
                                );
+
+                               return $listeners;
                        } );
                }
        }

-- 
To view, visit https://gerrit.wikimedia.org/r/195933
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Icbe18fb0becbe0d289ffdc1e03a716398915da2f
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: Matthias Mullie <mmul...@wikimedia.org>
Gerrit-Reviewer: EBernhardson <ebernhard...@wikimedia.org>
Gerrit-Reviewer: Mattflaschen <mflasc...@wikimedia.org>
Gerrit-Reviewer: Matthias Mullie <mmul...@wikimedia.org>
Gerrit-Reviewer: SG <shah...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to