X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2Fpage%2FWikiPage.php;h=6a6b2a63e4d884b85a8c92fec644386ffc53733b;hb=5196ac32c6;hp=d03d317043aa88160808e080424c24576865b102;hpb=13a1d8957b9d639c69cef251b831ed03319182b1;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/page/WikiPage.php b/includes/page/WikiPage.php index d03d317043..add76db2c7 100644 --- a/includes/page/WikiPage.php +++ b/includes/page/WikiPage.php @@ -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(); @@ -2729,7 +2745,7 @@ class WikiPage implements Page, IDBAccessObject { // in the job queue to avoid simultaneous deletion operations would add overhead. // Number of archived revisions cannot be known beforehand, because edits can be made // while deletion operations are being processed, changing the number of archivals. - $archivedRevisionCount = $dbw->selectField( + $archivedRevisionCount = (int)$dbw->selectField( 'archive', 'COUNT(*)', [ 'ar_namespace' => $this->getTitle()->getNamespace(), @@ -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 ) ) { @@ -3488,7 +3504,11 @@ class WikiPage implements Page, IDBAccessObject { // Do not include the namespace since there can be multiple aliases to it // due to different namespace text definitions on different wikis. This only // means that some cache invalidations happen that are not strictly needed. - $cache->makeGlobalKey( 'interwiki-page', wfWikiID(), $title->getDBkey() ) + $cache->makeGlobalKey( + 'interwiki-page', + WikiMap::getCurrentWikiDbDomain()->getId(), + $title->getDBkey() + ) ); } ); }