Remove Title::escapeFragmentForURL, deprecated in 1.30, unused
[lhc/web/wiklou.git] / includes / Title.php
index f5904e2..9303a5c 100644 (file)
@@ -38,7 +38,7 @@ use MediaWiki\MediaWikiServices;
  */
 class Title implements LinkTarget, IDBAccessObject {
        /** @var MapCacheLRU */
-       static private $titleCache = null;
+       private static $titleCache = null;
 
        /**
         * Title::newFromText maintains a cache to avoid expensive re-normalization of
@@ -205,7 +205,7 @@ class Title implements LinkTarget, IDBAccessObject {
        }
 
        /**
-        * @access protected
+        * @protected
         */
        function __construct() {
        }
@@ -767,23 +767,6 @@ class Title implements LinkTarget, IDBAccessObject {
                return $name;
        }
 
-       /**
-        * Escape a text fragment, say from a link, for a URL
-        *
-        * @deprecated since 1.30, use Sanitizer::escapeIdForLink() or escapeIdForExternalInterwiki()
-        *
-        * @param string $fragment Containing a URL or link fragment (after the "#")
-        * @return string Escaped string
-        */
-       static function escapeFragmentForURL( $fragment ) {
-               wfDeprecated( __METHOD__, '1.30' );
-               # Note that we don't urlencode the fragment.  urlencoded Unicode
-               # fragments appear not to work in IE (at least up to 7) or in at least
-               # one version of Opera 9.x.  The W3C validator, for one, doesn't seem
-               # to care if they aren't encoded.
-               return Sanitizer::escapeId( $fragment, 'noninitial' );
-       }
-
        /**
         * Callback for usort() to do title sorts by (namespace, title)
         *
@@ -2703,10 +2686,11 @@ class Title implements LinkTarget, IDBAccessObject {
                }
 
                // Determine if the user is blocked from this action on this page.
-               // What gets passed into this method is a user right, not an action nmae.
+               // What gets passed into this method is a user right, not an action name.
                // There is no way to instantiate an action by restriction. However, this
                // will get the action where the restriction is the same. This may result
                // in actions being blocked that shouldn't be.
+               $actionObj = null;
                if ( Action::exists( $action ) ) {
                        // Clone the title to prevent mutations to this object which is done
                        // by Title::loadFromRow() in WikiPage::loadFromRow().
@@ -2714,14 +2698,16 @@ class Title implements LinkTarget, IDBAccessObject {
                        // Creating an action will perform several database queries to ensure that
                        // the action has not been overridden by the content type.
                        // @todo FIXME: Pass the relevant context into this function.
-                       $action = Action::factory( $action, $page, RequestContext::getMain() );
-               } else {
-                       $action = null;
+                       $actionObj = Action::factory( $action, $page, RequestContext::getMain() );
+                       // Ensure that the retrieved action matches the restriction.
+                       if ( $actionObj && $actionObj->getRestriction() !== $action ) {
+                               $actionObj = null;
+                       }
                }
 
                // If no action object is returned, assume that the action requires unblock
                // which is the default.
-               if ( !$action || $action->requiresUnblock() ) {
+               if ( !$actionObj || $actionObj->requiresUnblock() ) {
                        if ( $user->isBlockedFrom( $this, $useReplica ) ) {
                                // @todo FIXME: Pass the relevant context into this function.
                                $errors[] = $block
@@ -4017,13 +4003,6 @@ class Title implements LinkTarget, IDBAccessObject {
                return $urls;
        }
 
-       /**
-        * @deprecated since 1.27 use getCdnUrls()
-        */
-       public function getSquidURLs() {
-               return $this->getCdnUrls();
-       }
-
        /**
         * Purge all applicable CDN URLs
         */