X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fpage%2FWikiPage.php;h=2adc5fbc105017777359e89facf05f1752bb9a52;hb=e2c5a04ba6ba6e233102292160d6837340cf37bc;hp=7044e6a9421a28eea3bdd92d31bd0063a58bc96e;hpb=d1380bfdd134e6b5a0345ab5a280ed9ccb2eca6c;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/page/WikiPage.php b/includes/page/WikiPage.php index 7044e6a942..2adc5fbc10 100644 --- a/includes/page/WikiPage.php +++ b/includes/page/WikiPage.php @@ -24,6 +24,8 @@ use \MediaWiki\Logger\LoggerFactory; use \MediaWiki\MediaWikiServices; use Wikimedia\Rdbms\FakeResultWrapper; use Wikimedia\Rdbms\IDatabase; +use Wikimedia\Rdbms\DBError; +use Wikimedia\Rdbms\DBUnexpectedError; /** * Class representing a MediaWiki article and history. @@ -1175,7 +1177,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 ); @@ -2899,8 +2901,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; @@ -3250,6 +3252,9 @@ class WikiPage implements Page, IDBAccessObject { MediaWikiServices::getInstance()->getLinkCache()->invalidateTitle( $title ); + // Invalidate caches of articles which include this page + DeferredUpdates::addUpdate( new HTMLCacheUpdate( $title, 'templatelinks' ) ); + if ( $title->getNamespace() == NS_CATEGORY ) { // Load the Category object, which will schedule a job to create // the category table row if necessary. Checking a replica DB is ok @@ -3491,7 +3496,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(); + } ); } } }