Rename WikiMap DB domain ID methods to reduce confusion with web domains
[lhc/web/wiklou.git] / includes / page / WikiPage.php
index 9f623ba..add76db 100644 (file)
@@ -26,6 +26,7 @@ use MediaWiki\MediaWikiServices;
 use MediaWiki\Revision\RevisionRecord;
 use MediaWiki\Revision\RevisionRenderer;
 use MediaWiki\Revision\RevisionStore;
+use MediaWiki\Revision\SlotRoleRegistry;
 use MediaWiki\Revision\SlotRecord;
 use MediaWiki\Storage\DerivedPageDataUpdater;
 use MediaWiki\Storage\PageUpdater;
@@ -232,6 +233,13 @@ class WikiPage implements Page, IDBAccessObject {
                return MediaWikiServices::getInstance()->getRevisionRenderer();
        }
 
+       /**
+        * @return SlotRoleRegistry
+        */
+       private function getSlotRoleRegistry() {
+               return MediaWikiServices::getInstance()->getSlotRoleRegistry();
+       }
+
        /**
         * @return ParserCache
         */
@@ -952,12 +960,17 @@ class WikiPage implements Page, IDBAccessObject {
                                // links.
                                $hasLinks = (bool)count( $editInfo->output->getLinks() );
                        } else {
-                               // NOTE: keep in sync with revisionRenderer::getLinkCount
+                               // NOTE: keep in sync with RevisionRenderer::getLinkCount
+                               // NOTE: keep in sync with DerivedPageDataUpdater::isCountable
                                $hasLinks = (bool)wfGetDB( DB_REPLICA )->selectField( 'pagelinks', 1,
                                        [ 'pl_from' => $this->getId() ], __METHOD__ );
                        }
                }
 
+               // TODO: MCR: determine $hasLinks for each slot, and use that info
+               // with that slot's Content's isCountable method. That requires per-
+               // slot ParserOutput in the ParserCache, or per-slot info in the
+               // pagelinks table.
                return $content->isCountable( $hasLinks );
        }
 
@@ -1665,6 +1678,7 @@ class WikiPage implements Page, IDBAccessObject {
                        $this, // NOTE: eventually, PageUpdater should not know about WikiPage
                        $this->getRevisionStore(),
                        $this->getRevisionRenderer(),
+                       $this->getSlotRoleRegistry(),
                        $this->getParserCache(),
                        JobQueueGroup::singleton(),
                        MessageCache::singleton(),
@@ -1769,7 +1783,8 @@ class WikiPage implements Page, IDBAccessObject {
                        $this, // NOTE: eventually, PageUpdater should not know about WikiPage
                        $this->getDerivedDataUpdater( $user, null, $forUpdate, true ),
                        $this->getDBLoadBalancer(),
-                       $this->getRevisionStore()
+                       $this->getRevisionStore(),
+                       $this->getSlotRoleRegistry()
                );
 
                $pageUpdater->setUsePageCreationLog( $wgPageCreationLog );
@@ -2132,6 +2147,7 @@ class WikiPage implements Page, IDBAccessObject {
                }
 
                $this->loadPageData( 'fromdbmaster' );
+               $this->mTitle->loadRestrictions( null, Title::READ_LATEST );
                $restrictionTypes = $this->mTitle->getRestrictionTypes();
                $id = $this->getId();
 
@@ -3266,7 +3282,7 @@ class WikiPage implements Page, IDBAccessObject {
 
                if ( $wgUseRCPatrol ) {
                        // Mark all reverted edits as patrolled
-                       $set['rc_patrolled'] = RecentChange::PRC_PATROLLED;
+                       $set['rc_patrolled'] = RecentChange::PRC_AUTOPATROLLED;
                }
 
                if ( count( $set ) ) {
@@ -3490,7 +3506,7 @@ class WikiPage implements Page, IDBAccessObject {
                                // means that some cache invalidations happen that are not strictly needed.
                                $cache->makeGlobalKey(
                                        'interwiki-page',
-                                       WikiMap::getCurrentWikiDomain()->getId(),
+                                       WikiMap::getCurrentWikiDbDomain()->getId(),
                                        $title->getDBkey()
                                )
                        );