Merge "Improve docs for Title::getInternalURL/getCanonicalURL"
[lhc/web/wiklou.git] / includes / resourceloader / ResourceLoaderWikiModule.php
index fe77576..9fad348 100644 (file)
@@ -26,6 +26,7 @@ use MediaWiki\Linker\LinkTarget;
 use Wikimedia\Assert\Assert;
 use Wikimedia\Rdbms\Database;
 use Wikimedia\Rdbms\IDatabase;
+use MediaWiki\MediaWikiServices;
 
 /**
  * Abstraction for ResourceLoader modules which pull from wiki pages
@@ -432,7 +433,7 @@ class ResourceLoaderWikiModule extends ResourceLoaderModule {
                                // Avoid including ids or timestamps of revision/page tables so
                                // that versions are not wasted
                                $title = new TitleValue( (int)$row->page_namespace, $row->page_title );
-                               $titleInfo[ self::makeTitleKey( $title ) ] = [
+                               $titleInfo[self::makeTitleKey( $title )] = [
                                        'page_len' => $row->page_len,
                                        'page_latest' => $row->page_latest,
                                        'page_touched' => $row->page_touched,
@@ -482,7 +483,7 @@ class ResourceLoaderWikiModule extends ResourceLoaderModule {
                $func = [ static::class, 'fetchTitleInfo' ];
                $fname = __METHOD__;
 
-               $cache = ObjectCache::getMainWANInstance();
+               $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
                $allInfo = $cache->getWithSetCallback(
                        $cache->makeGlobalKey( 'resourceloader', 'titleinfo', $db->getDomainID(), $hash ),
                        $cache::TTL_HOUR,
@@ -528,15 +529,15 @@ class ResourceLoaderWikiModule extends ResourceLoaderModule {
         * @param Title $title
         * @param Revision|null $old Prior page revision
         * @param Revision|null $new New page revision
-        * @param string $wikiId
+        * @param string $domain Database domain ID
         * @since 1.28
         */
        public static function invalidateModuleCache(
-               Title $title, Revision $old = null, Revision $new = null, $wikiId
+               Title $title, Revision $old = null, Revision $new = null, $domain
        ) {
                static $formats = [ CONTENT_FORMAT_CSS, CONTENT_FORMAT_JAVASCRIPT ];
 
-               Assert::parameterType( 'string', $wikiId, '$wikiId' );
+               Assert::parameterType( 'string', $domain, '$domain' );
 
                // TODO: MCR: differentiate between page functionality and content model!
                //       Not all pages containing CSS or JS have to be modules! [PageType]
@@ -549,8 +550,8 @@ class ResourceLoaderWikiModule extends ResourceLoaderModule {
                }
 
                if ( $purge ) {
-                       $cache = ObjectCache::getMainWANInstance();
-                       $key = $cache->makeGlobalKey( 'resourceloader', 'titleinfo', $wikiId );
+                       $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
+                       $key = $cache->makeGlobalKey( 'resourceloader', 'titleinfo', $domain );
                        $cache->touchCheckKey( $key );
                }
        }