jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/382989 )

Change subject: Re-instate $wgWBClientSettings['injectRecentChanges']
......................................................................


Re-instate $wgWBClientSettings['injectRecentChanges']

This reverts commit cb9cdd33f7414b74eb54c1c2ee59d1004f98aff0 and a small
part of I19f29d7784fae19c544a6a69c220cc2ccb0edcdc too

Allows us to cleanly disable injectRecentChanges to stop RC bloat

Bug: T171027

Change-Id: I3e68bfc818238037f82eaafc6e8db10bf200013f
---
M client/config/WikibaseClient.default.php
M client/config/WikibaseClient.example.php
M client/includes/Changes/ChangeHandler.php
M client/includes/WikibaseClient.php
M client/tests/phpunit/includes/Changes/ChangeHandlerTest.php
M docs/options.wiki
6 files changed, 24 insertions(+), 5 deletions(-)

Approvals:
  Brian Wolff: Looks good to me, but someone else must approve
  Ladsgroup: Looks good to me, approved
  jenkins-bot: Verified
  Thiemo Mättig (WMDE): Looks good to me, but someone else must approve



diff --git a/client/config/WikibaseClient.default.php 
b/client/config/WikibaseClient.default.php
index f0df283..c8943de 100644
--- a/client/config/WikibaseClient.default.php
+++ b/client/config/WikibaseClient.default.php
@@ -25,6 +25,7 @@
                // but we will need to make sure the caching works good enough
                'siteLocalID' => $wgLanguageCode,
                'languageLinkSiteGroup' => null,
+               'injectRecentChanges' => true,
                'showExternalRecentChanges' => true,
                'sendEchoNotification' => false,
                'echoIcon' => false,
diff --git a/client/config/WikibaseClient.example.php 
b/client/config/WikibaseClient.example.php
index 03f0878..7a5b509 100644
--- a/client/config/WikibaseClient.example.php
+++ b/client/config/WikibaseClient.example.php
@@ -20,6 +20,7 @@
 // Defaults to $wgDBname.
 // $wgWBClientSettings['siteGlobalID'] = "mywiki";
 
+$wgWBClientSettings['injectRecentChanges'] = true;
 $wgWBClientSettings['showExternalRecentChanges'] = true;
 
 // If this wiki also runs the Wikibase repo extension,
diff --git a/client/includes/Changes/ChangeHandler.php 
b/client/includes/Changes/ChangeHandler.php
index d14fb8a..9a36677 100644
--- a/client/includes/Changes/ChangeHandler.php
+++ b/client/includes/Changes/ChangeHandler.php
@@ -50,11 +50,17 @@
        private $siteLookup;
 
        /**
+        * @var bool
+        */
+       private $injectRecentChanges;
+
+       /**
         * @param AffectedPagesFinder $affectedPagesFinder
         * @param TitleFactory $titleFactory
         * @param PageUpdater $updater
         * @param ChangeRunCoalescer $changeRunCoalescer
         * @param SiteLookup $siteLookup
+        * @param bool $injectRecentChanges
         *
         * @throws InvalidArgumentException
         */
@@ -63,13 +69,19 @@
                TitleFactory $titleFactory,
                PageUpdater $updater,
                ChangeRunCoalescer $changeRunCoalescer,
-               SiteLookup $siteLookup
+               SiteLookup $siteLookup,
+               $injectRecentChanges = true
        ) {
+               if ( !is_bool( $injectRecentChanges ) ) {
+                       throw new InvalidArgumentException( 
'$injectRecentChanges must be a bool' );
+               }
+
                $this->affectedPagesFinder = $affectedPagesFinder;
                $this->titleFactory = $titleFactory;
                $this->updater = $updater;
                $this->changeRunCoalescer = $changeRunCoalescer;
                $this->siteLookup = $siteLookup;
+               $this->injectRecentChanges = $injectRecentChanges;
        }
 
        /**
@@ -129,7 +141,9 @@
                // NOTE: signature depends on change ID, effectively disabling 
deduplication
                $changeSignature = $this->getChangeSignature( $change );
                $rootJobParams['rootJobSignature'] = $titleBatchSignature . '&' 
. $changeSignature;
-               $this->updater->injectRCRecords( $titlesToUpdate, $change, 
$rootJobParams );
+               if ( $this->injectRecentChanges ) {
+                       $this->updater->injectRCRecords( $titlesToUpdate, 
$change, $rootJobParams );
+               }
        }
 
        /**
diff --git a/client/includes/WikibaseClient.php 
b/client/includes/WikibaseClient.php
index 256042c..53d1a6a 100644
--- a/client/includes/WikibaseClient.php
+++ b/client/includes/WikibaseClient.php
@@ -1169,7 +1169,8 @@
                        new TitleFactory(),
                        $pageUpdater,
                        $changeListTransformer,
-                       $this->siteLookup
+                       $this->siteLookup,
+                       $this->settings->getSetting( 'injectRecentChanges' )
                );
        }
 
diff --git a/client/tests/phpunit/includes/Changes/ChangeHandlerTest.php 
b/client/tests/phpunit/includes/Changes/ChangeHandlerTest.php
index 67b9858..7ab5082 100644
--- a/client/tests/phpunit/includes/Changes/ChangeHandlerTest.php
+++ b/client/tests/phpunit/includes/Changes/ChangeHandlerTest.php
@@ -79,7 +79,8 @@
                        $titleFactory,
                        $updater ?: new MockPageUpdater(),
                        $this->getChangeRunCoalescer(),
-                       $this->getMock( SiteLookup::class )
+                       $this->getMock( SiteLookup::class ),
+                       true
                );
 
                return $handler;
diff --git a/docs/options.wiki b/docs/options.wiki
index 70959b6..e6d55c5 100644
--- a/docs/options.wiki
+++ b/docs/options.wiki
@@ -105,7 +105,8 @@
 ;propertyOrderUrl: URL to use for retrieving the property order used for 
sorting properties by property ID. Will be ignored if set to null.
 
 === Expert Settings ===
-;showExternalRecentChanges: Whether changes on the repository should be 
displayed on Special:RecentChanges, Special:Watchlist, etc on the client wiki.
+;injectRecentChanges: Whether changes on the repository should be injected 
into this wiki's recent changes table, so they show up on watchlists, etc. 
Requires the <code>dispatchChanges.php</code> script to run, and this wiki to 
be listed in the <code>localClientDatabases</code> setting on the repository.
+;showExternalRecentChanges: Whether changes on the repository should be 
displayed on Special:RecentChanges, Special:Watchlist, etc on the client wiki. 
In contrast to <code>injectRecentChanges</code>, this setting just removes the 
changes from the user interface. The default is <code>false</code>. This is 
intended to temporarily prevent external changes from showing in order to find 
or fix some issue on a live site.
 ;sendEchoNotification: If true, allows users on the client wiki to get a 
notification when a page they created is connected to a repo item. This 
requires the Echo extension.
 ;echoIcon: If <code>sendEchoNotification</code> is set to <code>true</code>, 
you can also provide what icon the user will see. The correct syntax is <code>[ 
'url' => '...' ]</code> or <code>[ 'path' => '...' ]</code> where 
<code>path</code> is relative to <code>$wgExtensionAssetsPath</code>. Defaults 
to <code>false</code> which means that there will be the default Echo icon.
 ;disabledUsageAspects: Array of usage aspects that should not be saved in the 
<code>wbc_entity_usage</code> table. This currently only supports aspect codes 
(like "T", "L" or "X"), but not full aspect keys (like "L.de").

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I3e68bfc818238037f82eaafc6e8db10bf200013f
Gerrit-PatchSet: 6
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Reedy <re...@wikimedia.org>
Gerrit-Reviewer: Addshore <addshorew...@gmail.com>
Gerrit-Reviewer: Aude <aude.w...@gmail.com>
Gerrit-Reviewer: Brian Wolff <bawolff...@gmail.com>
Gerrit-Reviewer: Daniel Kinzler <daniel.kinz...@wikimedia.de>
Gerrit-Reviewer: Hoo man <h...@online.de>
Gerrit-Reviewer: Ladsgroup <ladsgr...@gmail.com>
Gerrit-Reviewer: Thiemo Mättig (WMDE) <thiemo.maet...@wikimedia.de>
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