X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;ds=sidebyside;f=includes%2Fpage%2FWikiPage.php;h=0e23a88c1de63be85963a995545a5bd9c31a2df3;hb=7f3d6713e7191c476adb3d3c30344a0327b853d3;hp=a687900431d7c565d74aa6cc73fa5b516e6fd656;hpb=3fcff810915af88e2a2fa021a6726d616263d263;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/page/WikiPage.php b/includes/page/WikiPage.php index a687900431..0e23a88c1d 100644 --- a/includes/page/WikiPage.php +++ b/includes/page/WikiPage.php @@ -1055,6 +1055,13 @@ class WikiPage implements Page, IDBAccessObject { ) { $useParserCache = ( !$forceParse ) && $this->shouldCheckParserCache( $parserOptions, $oldid ); + + if ( $useParserCache && !$parserOptions->isSafeToCache() ) { + throw new InvalidArgumentException( + 'The supplied ParserOptions are not safe to cache. Fix the options or set $forceParse = true.' + ); + } + wfDebug( __METHOD__ . ': using parser cache: ' . ( $useParserCache ? 'yes' : 'no' ) . "\n" ); if ( $parserOptions->getStubThreshold() ) { @@ -1177,7 +1184,7 @@ class WikiPage implements Page, IDBAccessObject { ); if ( $dbw->affectedRows() > 0 ) { - $newid = $pageId ?: $dbw->insertId(); + $newid = $pageId ? (int)$pageId : $dbw->insertId(); $this->mId = $newid; $this->mTitle->resetArticleID( $newid ); @@ -2901,8 +2908,8 @@ class WikiPage implements Page, IDBAccessObject { $status->value = $logid; // Show log excerpt on 404 pages rather than just a link - $cache = ObjectCache::getMainStashInstance(); - $key = wfMemcKey( 'page-recent-delete', md5( $logTitle->getPrefixedText() ) ); + $cache = MediaWikiServices::getInstance()->getMainObjectStash(); + $key = $cache->makeKey( 'page-recent-delete', md5( $logTitle->getPrefixedText() ) ); $cache->set( $key, 1, $cache::TTL_DAY ); return $status; @@ -3496,7 +3503,10 @@ class WikiPage implements Page, IDBAccessObject { ); foreach ( $rows as $row ) { $cat = Category::newFromRow( $row ); - $cat->refreshCounts(); + // T166757: do the update after this DB commit + DeferredUpdates::addCallableUpdate( function () use ( $cat ) { + $cat->refreshCounts(); + } ); } } }