Merge "rdbms: document that IDatabase::selectFieldValues() keeps the order"
[lhc/web/wiklou.git] / includes / Title.php
index 82e79b3..88a7efb 100644 (file)
@@ -437,6 +437,7 @@ class Title implements LinkTarget, IDBAccessObject {
                } else {
                        $title = null;
                }
+
                return $title;
        }
 
@@ -3254,8 +3255,9 @@ class Title implements LinkTarget, IDBAccessObject {
                }
 
                if ( $this->mOldRestrictions === false ) {
-                       $this->mOldRestrictions = $dbr->selectField( 'page', 'page_restrictions',
-                               [ 'page_id' => $this->getArticleID() ], __METHOD__ );
+                       $linkCache = MediaWikiServices::getInstance()->getLinkCache();
+                       $linkCache->addLinkObj( $this ); # in case we already had an article ID
+                       $this->mOldRestrictions = $linkCache->getGoodLinkFieldObj( $this, 'restrictions' );
                }
 
                if ( $this->mOldRestrictions != '' ) {
@@ -4995,9 +4997,7 @@ class Title implements LinkTarget, IDBAccessObject {
        public function canUseNoindex() {
                global $wgExemptFromUserRobotsControl;
 
-               $bannedNamespaces = is_null( $wgExemptFromUserRobotsControl )
-                       ? MWNamespace::getContentNamespaces()
-                       : $wgExemptFromUserRobotsControl;
+               $bannedNamespaces = $wgExemptFromUserRobotsControl ?? MWNamespace::getContentNamespaces();
 
                return !in_array( $this->mNamespace, $bannedNamespaces );
        }