Merge "Document the 'sitewide' option for the Block class"
[lhc/web/wiklou.git] / includes / Title.php
index b24f120..0b74a17 100644 (file)
@@ -1280,17 +1280,6 @@ class Title implements LinkTarget, IDBAccessObject {
                );
        }
 
-       /**
-        * @return bool
-        * @deprecated Since 1.31; use ::isSiteConfigPage() instead (which also checks for JSON pages)
-        */
-       public function isCssOrJsPage() {
-               wfDeprecated( __METHOD__, '1.31' );
-               return ( NS_MEDIAWIKI == $this->mNamespace
-                               && ( $this->hasContentModel( CONTENT_MODEL_CSS )
-                                       || $this->hasContentModel( CONTENT_MODEL_JAVASCRIPT ) ) );
-       }
-
        /**
         * Is this a "config" (.css, .json, or .js) sub-page of a user page?
         *
@@ -1305,17 +1294,6 @@ class Title implements LinkTarget, IDBAccessObject {
                );
        }
 
-       /**
-        * @return bool
-        * @deprecated Since 1.31; use ::isUserConfigPage() instead (which also checks for JSON pages)
-        */
-       public function isCssJsSubpage() {
-               wfDeprecated( __METHOD__, '1.31' );
-               return ( NS_USER == $this->mNamespace && $this->isSubpage()
-                               && ( $this->hasContentModel( CONTENT_MODEL_CSS )
-                                       || $this->hasContentModel( CONTENT_MODEL_JAVASCRIPT ) ) );
-       }
-
        /**
         * Trim down a .css, .json, or .js subpage title to get the corresponding skin name
         *
@@ -1332,15 +1310,6 @@ class Title implements LinkTarget, IDBAccessObject {
                return substr( $subpage, 0, $lastdot );
        }
 
-       /**
-        * @deprecated Since 1.31; use ::getSkinFromConfigSubpage() instead
-        * @return string Containing skin name from .css, .json, or .js subpage title
-        */
-       public function getSkinFromCssJsSubpage() {
-               wfDeprecated( __METHOD__, '1.31' );
-               return $this->getSkinFromConfigSubpage();
-       }
-
        /**
         * Is this a CSS "config" sub-page of a user page?
         *
@@ -1355,15 +1324,6 @@ class Title implements LinkTarget, IDBAccessObject {
                );
        }
 
-       /**
-        * @deprecated Since 1.31; use ::isUserCssConfigPage()
-        * @return bool
-        */
-       public function isCssSubpage() {
-               wfDeprecated( __METHOD__, '1.31' );
-               return $this->isUserCssConfigPage();
-       }
-
        /**
         * Is this a JSON "config" sub-page of a user page?
         *
@@ -1392,15 +1352,6 @@ class Title implements LinkTarget, IDBAccessObject {
                );
        }
 
-       /**
-        * @deprecated Since 1.31; use ::isUserJsConfigPage()
-        * @return bool
-        */
-       public function isJsSubpage() {
-               wfDeprecated( __METHOD__, '1.31' );
-               return $this->isUserJsConfigPage();
-       }
-
        /**
         * Is this a sitewide CSS "config" page?
         *
@@ -2669,8 +2620,9 @@ class Title implements LinkTarget, IDBAccessObject {
                $useReplica = ( $rigor !== 'secure' );
                $block = $user->getBlock( $useReplica );
 
-               // The block may explicitly allow an action (like "read" or "upload").
-               if ( $block && $block->prevents( $action ) === false ) {
+               // If the user does not have a block, or the block they do have explicitly
+               // allows the action (like "read" or "upload").
+               if ( !$block || $block->appliesToRight( $action ) === false ) {
                        return $errors;
                }
 
@@ -2699,9 +2651,7 @@ class Title implements LinkTarget, IDBAccessObject {
                if ( !$actionObj || $actionObj->requiresUnblock() ) {
                        if ( $user->isBlockedFrom( $this, $useReplica ) ) {
                                // @todo FIXME: Pass the relevant context into this function.
-                               $errors[] = $block
-                                       ? $block->getPermissionsError( RequestContext::getMain() )
-                                       : [ 'actionblockedtext' ];
+                               $errors[] = $block->getPermissionsError( RequestContext::getMain() );
                        }
                }
 
@@ -3387,7 +3337,7 @@ class Title implements LinkTarget, IDBAccessObject {
                                $dbr = wfGetDB( DB_MASTER );
                                $rows = $loadRestrictionsFromDb( $dbr );
                        } else {
-                               $cache = ObjectCache::getMainWANInstance();
+                               $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
                                $rows = $cache->getWithSetCallback(
                                        // Page protections always leave a new null revision
                                        $cache->makeKey( 'page-restrictions', $id, $this->getLatestRevID() ),
@@ -4033,28 +3983,6 @@ class Title implements LinkTarget, IDBAccessObject {
                return $errors ?: true;
        }
 
-       /**
-        * Check if the requested move target is a valid file move target
-        * @todo move this to MovePage
-        * @param Title $nt Target title
-        * @return array List of errors
-        */
-       protected function validateFileMoveOperation( $nt ) {
-               global $wgUser;
-
-               $errors = [];
-
-               $destFile = wfLocalFile( $nt );
-               $destFile->load( File::READ_LATEST );
-               if ( !$wgUser->isAllowed( 'reupload-shared' )
-                       && !$destFile->exists() && wfFindFile( $nt )
-               ) {
-                       $errors[] = [ 'file-exists-sharedrepo' ];
-               }
-
-               return $errors;
-       }
-
        /**
         * Move a title to a new location
         *