Merge "Fix incomplete Language::getDatePreferences() documentation"
[lhc/web/wiklou.git] / includes / page / WikiPage.php
index 7044e6a..7489f44 100644 (file)
@@ -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