Merge "RevisionStoreDbTestBase, remove redundant needsDB override"
[lhc/web/wiklou.git] / includes / Title.php
index ca62e0e..59164e0 100644 (file)
@@ -1665,7 +1665,7 @@ class Title implements LinkTarget {
                        if ( $nsText === false ) {
                                // See T165149. Awkward, but better than erroneously linking to the main namespace.
                                $nsText = MediaWikiServices::getInstance()->getContentLanguage()->
-                                       getNsText( NS_SPECIAL ) .  ":Badtitle/NS{$this->mNamespace}";
+                                       getNsText( NS_SPECIAL ) . ":Badtitle/NS{$this->mNamespace}";
                        }
 
                        $p .= $nsText . ':';
@@ -3354,11 +3354,12 @@ class Title implements LinkTarget {
                $id = $this->getArticleID();
                if ( $id ) {
                        $cache = ObjectCache::getMainWANInstance();
+                       $fname = __METHOD__;
                        $rows = $cache->getWithSetCallback(
                                // Page protections always leave a new null revision
                                $cache->makeKey( 'page-restrictions', $id, $this->getLatestRevID() ),
                                $cache::TTL_DAY,
-                               function ( $curValue, &$ttl, array &$setOpts ) {
+                               function ( $curValue, &$ttl, array &$setOpts ) use ( $fname ) {
                                        $dbr = wfGetDB( DB_REPLICA );
 
                                        $setOpts += Database::getCacheSetOptions( $dbr );
@@ -3368,7 +3369,7 @@ class Title implements LinkTarget {
                                                        'page_restrictions',
                                                        [ 'pr_type', 'pr_expiry', 'pr_level', 'pr_cascade' ],
                                                        [ 'pr_page' => $this->getArticleID() ],
-                                                       __METHOD__
+                                                       $fname
                                                )
                                        );
                                }
@@ -4427,7 +4428,7 @@ class Title implements LinkTarget {
                                $revQuery['joins']
                        );
                        if ( $row ) {
-                               return new Revision( $row );
+                               return new Revision( $row, 0, $this );
                        }
                }
                return null;