Add wfErrorLog() call before throwing an exception in readStyleFile
[lhc/web/wiklou.git] / includes / Title.php
index 731fc14..ee3e01f 100644 (file)
@@ -387,6 +387,8 @@ class Title {
         * @deprecated since 1.21, use Content::getRedirectTarget instead.
         */
        public static function newFromRedirect( $text ) {
+               ContentHandler::deprecated( __METHOD__, '1.21' );
+
                $content = ContentHandler::makeContent( $text, null, CONTENT_MODEL_WIKITEXT );
                return $content->getRedirectTarget();
        }
@@ -402,6 +404,8 @@ class Title {
         * @deprecated since 1.21, use Content::getUltimateRedirectTarget instead.
         */
        public static function newFromRedirectRecurse( $text ) {
+               ContentHandler::deprecated( __METHOD__, '1.21' );
+
                $content = ContentHandler::makeContent( $text, null, CONTENT_MODEL_WIKITEXT );
                return $content->getUltimateRedirectTarget();
        }
@@ -417,6 +421,8 @@ class Title {
         * @deprecated since 1.21, use Content::getRedirectChain instead.
         */
        public static function newFromRedirectArray( $text ) {
+               ContentHandler::deprecated( __METHOD__, '1.21' );
+
                $content = ContentHandler::makeContent( $text, null, CONTENT_MODEL_WIKITEXT );
                return $content->getRedirectChain();
        }
@@ -691,7 +697,7 @@ class Title {
        /**
         * Convenience method for checking a title's content model name
         *
-        * @param int $id
+        * @param String $id The content model ID (use the CONTENT_MODEL_XXX constants).
         * @return Boolean true if $this->getContentModel() == $id
         */
        public function hasContentModel( $id ) {
@@ -1735,15 +1741,8 @@ class Title {
 
                        if ( !$user->isAllowed( 'move' ) ) {
                                // User can't move anything
-                               global $wgGroupPermissions;
-                               $userCanMove = false;
-                               if ( isset( $wgGroupPermissions['user']['move'] ) ) {
-                                       $userCanMove = $wgGroupPermissions['user']['move'];
-                               }
-                               $autoconfirmedCanMove = false;
-                               if ( isset( $wgGroupPermissions['autoconfirmed']['move'] ) ) {
-                                       $autoconfirmedCanMove = $wgGroupPermissions['autoconfirmed']['move'];
-                               }
+                               $userCanMove = User::groupHasPermission( 'user', 'move' );
+                               $autoconfirmedCanMove = User::groupHasPermission( 'autoconfirmed', 'move' );
                                if ( $user->isAnon() && ( $userCanMove || $autoconfirmedCanMove ) ) {
                                        // custom message if logged-in users without any special rights can move
                                        $errors[] = array( 'movenologintext' );
@@ -2084,13 +2083,13 @@ class Title {
         * @return Array list of errors
         */
        private function checkReadPermissions( $action, $user, $errors, $doExpensiveQueries, $short ) {
-               global $wgWhitelistRead, $wgGroupPermissions, $wgRevokePermissions;
+               global $wgWhitelistRead, $wgRevokePermissions;
                static $useShortcut = null;
 
                # Initialize the $useShortcut boolean, to determine if we can skip quite a bit of code below
                if ( is_null( $useShortcut ) ) {
                        $useShortcut = true;
-                       if ( empty( $wgGroupPermissions['*']['read'] ) ) {
+                       if ( !User::groupHasPermission( '*', 'read' ) ) {
                                # Not a public wiki, so no shortcut
                                $useShortcut = false;
                        } elseif ( !empty( $wgRevokePermissions ) ) {
@@ -2923,10 +2922,10 @@ class Title {
 
                $linkCache = LinkCache::singleton();
                $cached = $linkCache->getGoodLinkFieldObj( $this, 'redirect' );
-               if ( $cached === null ) { # check the assumption that the cache actually knows about this title
-                       # XXX: this does apparently happen, see https://bugzilla.wikimedia.org/show_bug.cgi?id=37209
-                       #      as a stop gap, perhaps log this, but don't throw an exception?
-                       throw new MWException( "LinkCache doesn't currently know about this title: " . $this->getPrefixedDBkey() );
+               if ( $cached === null ) { 
+                       // TODO: check the assumption that the cache actually knows about this title
+                       // and handle this, such as get the title from the database.
+                       // See https://bugzilla.wikimedia.org/show_bug.cgi?id=37209
                }
 
                $this->mRedirect = (bool)$cached;
@@ -3775,7 +3774,8 @@ class Title {
                if ( !is_object( $nullRevision ) ) {
                        throw new MWException( 'No valid null revision produced in ' . __METHOD__ );
                }
-               $nullRevId = $nullRevision->insertOn( $dbw );
+
+               $nullRevision->insertOn( $dbw );
 
                # Change the name of the target page:
                $dbw->update( 'page',