Localisation updates from https://translatewiki.net.
[lhc/web/wiklou.git] / includes / Title.php
index c151f4a..55c5cd9 100644 (file)
@@ -954,6 +954,7 @@ class Title implements LinkTarget {
 
        /**
         * Get the DB key with the initial letter case as specified by the user
+        * @deprecated since 1.33; please use Title::getDBKey() instead
         *
         * @return string DB key
         */
@@ -978,6 +979,8 @@ class Title implements LinkTarget {
        /**
         * Get the page's content model id, see the CONTENT_MODEL_XXX constants.
         *
+        * @todo Deprecate this in favor of SlotRecord::getModel()
+        *
         * @param int $flags A bit field; may be Title::GAID_FOR_UPDATE to select for update
         * @return string Content model id
         */
@@ -1659,7 +1662,7 @@ class Title implements LinkTarget {
                        $p = $this->mInterwiki . ':';
                }
 
-               if ( 0 != $this->mNamespace ) {
+               if ( $this->mNamespace != 0 ) {
                        $nsText = $this->getNsText();
 
                        if ( $nsText === false ) {
@@ -2688,30 +2691,14 @@ class Title implements LinkTarget {
                }
 
                $useReplica = ( $rigor !== 'secure' );
-               $block = $user->getBlock( $useReplica );
-
-               // The block may explicitly allow an action (like "read" or "upload").
-               if ( $block && $block->prevents( $action ) === false ) {
-                       return $errors;
-               }
-
-               // Determine if the user is blocked from this action on this page.
-               try {
+               if ( ( $action == 'edit' || $action == 'create' )
+                       && !$user->isBlockedFrom( $this, $useReplica )
+               ) {
+                       // Don't block the user from editing their own talk page unless they've been
+                       // explicitly blocked from that too.
+               } elseif ( $user->isBlocked() && $user->getBlock()->prevents( $action ) !== false ) {
                        // @todo FIXME: Pass the relevant context into this function.
-                       $action = Action::factory( $action, WikiPage::factory( $this ), RequestContext::getMain() );
-               } catch ( Exception $e ) {
-                       $action = null;
-               }
-
-               // If no action object is returned, assume that the action requires unblock
-               // which is the default.
-               if ( !$action || $action->requiresUnblock() ) {
-                       if ( $user->isBlockedFrom( $this, $useReplica ) ) {
-                               // @todo FIXME: Pass the relevant context into this function.
-                               $errors[] = $block
-                                       ? $block->getPermissionsError( RequestContext::getMain() )
-                                       : [ 'badaccess-group0' ];
-                       }
+                       $errors[] = $user->getBlock()->getPermissionsError( RequestContext::getMain() );
                }
 
                return $errors;
@@ -3587,7 +3574,7 @@ class Title implements LinkTarget {
                        $this->mArticleID = $linkCache->addLinkObj( $this );
                        $linkCache->forUpdate( $oldUpdate );
                } else {
-                       if ( -1 == $this->mArticleID ) {
+                       if ( $this->mArticleID == -1 ) {
                                $this->mArticleID = $linkCache->addLinkObj( $this );
                        }
                }