* (bug 22867) "View source" tab is now only displayed if there's source text
authorAlexandre Emsenhuber <ialex@users.mediawiki.org>
Fri, 2 Apr 2010 08:00:40 +0000 (08:00 +0000)
committerAlexandre Emsenhuber <ialex@users.mediawiki.org>
Fri, 2 Apr 2010 08:00:40 +0000 (08:00 +0000)
* Removed comment which is no longer true since the new localisation cache

RELEASE-NOTES
includes/SkinTemplate.php
includes/Title.php
skins/Vector.php

index 0dedf55..f550621 100644 (file)
@@ -72,6 +72,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
   logged in (anonpreviewwarning).
 * (bug 22935) image/x-ms-bmp mime type added for BMP files
 * (bug 23024) Special:ListFiles now escapes file names correctly
+* (bug 22867) "View source" tab is now only displayed if there's source text
 
 === API changes in 1.17 ===
 * (bug 22738) Allow filtering by action type on query=logevent
index 7d45881..619dd5c 100644 (file)
@@ -719,7 +719,7 @@ class SkinTemplate extends Skin {
                                                );
                                        }
                                }
-                       } elseif ( $this->mTitle->isKnown() ) {
+                       } elseif ( $this->mTitle->hasSourceText() ) {
                                $content_actions['viewsource'] = array(
                                        'class' => ($action == 'edit') ? 'selected' : false,
                                        'text' => wfMsg( 'viewsource' ),
index d3bd6ec..3feba53 100644 (file)
@@ -3644,8 +3644,6 @@ class Title {
                        // If the page is form Mediawiki:message/lang, calling wfMsgWeirdKey causes
                        // the full l10n of that language to be loaded. That takes much memory and
                        // isn't needed. So we strip the language part away.
-                       // Also, extension messages which are not loaded, are shown as red, because
-                       // we don't call MessageCache::loadAllMessages.
                        list( $basename, /* rest */ ) = explode( '/', $this->mDbkeyform, 2 );
                        return wfMsgWeirdKey( $basename );  // known system message
                default:
@@ -3665,6 +3663,26 @@ class Title {
                return $this->exists() || $this->isAlwaysKnown();
        }
 
+       /**
+        * Does this page have source text?
+        *
+        * @return Boolean
+        */
+       public function hasSourceText() {
+               if ( $this->exists() )
+                       return true;
+
+               if ( $this->mNamespace == NS_MEDIAWIKI ) {
+                       // If the page is form Mediawiki:message/lang, calling wfMsgWeirdKey causes
+                       // the full l10n of that language to be loaded. That takes much memory and
+                       // isn't needed. So we strip the language part away.
+                       list( $basename, /* rest */ ) = explode( '/', $this->mDbkeyform, 2 );
+                       return wfMsgWeirdKey( $basename );  // known system message
+               }
+
+               return false;
+       }
+
        /**
        * Is this in a namespace that allows actual pages?
        *
index 57f37dd..6d3d0ad 100644 (file)
@@ -169,8 +169,8 @@ class SkinVector extends SkinTemplate {
                                                );
                                        }
                                }
-                       // Checks if the page is known (some kind of viewable content)
-                       } elseif ( $this->mTitle->isKnown() ) {
+                       // Checks if the page has some kind of viewable content
+                       } elseif ( $this->mTitle->hasSourceText() ) {
                                // Adds view source view link
                                $links['views']['viewsource'] = array(
                                        'class' => ( $action == 'edit' ) ? 'selected' : false,