Merge "Improve docs for Title::getInternalURL/getCanonicalURL"
[lhc/web/wiklou.git] / includes / deferred / WANCacheReapUpdate.php
index 5ffc938..a218f76 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use MediaWiki\MediaWikiServices;
+use MediaWiki\Linker\LinkTarget;
 use Psr\Log\LoggerInterface;
 use Wikimedia\Rdbms\IDatabase;
 
@@ -10,7 +12,7 @@ use Wikimedia\Rdbms\IDatabase;
  * recentchanges table as a reliable stream to make certain keys reach consistency
  * as soon as the underlying replica database catches up. These means that critical
  * keys will not escape getting purged simply due to brief hiccups in the network,
- * which are more prone to happen accross datacenters.
+ * which are more prone to happen across datacenters.
  *
  * ----
  * "I was trying to cheat death. I was only trying to surmount for a little while the
@@ -38,7 +40,7 @@ class WANCacheReapUpdate implements DeferrableUpdate {
 
        function doUpdate() {
                $reaper = new WANObjectCacheReaper(
-                       ObjectCache::getMainWANInstance(),
+                       MediaWikiServices::getInstance()->getMainWANObjectCache(),
                        ObjectCache::getLocalClusterInstance(),
                        [ $this, 'getTitleChangeEvents' ],
                        [ $this, 'getEventAffectedKeys' ],
@@ -97,10 +99,10 @@ class WANCacheReapUpdate implements DeferrableUpdate {
         *
         * @see WANObjectCacheRepear
         * @param WANObjectCache $cache
-        * @param TitleValue $t
+        * @param LinkTarget $t
         * @return string[]
         */
-       public function getEventAffectedKeys( WANObjectCache $cache, TitleValue $t ) {
+       public function getEventAffectedKeys( WANObjectCache $cache, LinkTarget $t ) {
                /** @var WikiPage[]|LocalFile[]|User[] $entities */
                $entities = [];
 
@@ -108,7 +110,7 @@ class WANCacheReapUpdate implements DeferrableUpdate {
                // namespaces, but special pages do appear in RC sometimes, e.g. for logs
                // of AbuseFilter filter changes.
                if ( $t->getNamespace() >= 0 ) {
-                       $entities[] = WikiPage::factory( Title::newFromTitleValue( $t ) );
+                       $entities[] = WikiPage::factory( Title::newFromLinkTarget( $t ) );
                }
 
                if ( $t->inNamespace( NS_FILE ) ) {