* Changed OutputPage::$mIsArticle flag to be false by default. A lot of actions don...
authorAlexandre Emsenhuber <ialex@users.mediawiki.org>
Wed, 27 Jul 2011 13:14:28 +0000 (13:14 +0000)
committerAlexandre Emsenhuber <ialex@users.mediawiki.org>
Wed, 27 Jul 2011 13:14:28 +0000 (13:14 +0000)
* Put OutputPage::$mIsArticleRelated declaration just below $mIsArticle's one since they are related
* Made DifferenceEngine consistent with action=view, i.e. setting that flag to true when displaying any version of the page, current or not
* Made Skin::getCopyright() always use history_copyright when displaying an old version, regardless to the diff parameter
* Changed some checks from namespace != NS_SPECIAL && action=view to isArticle() so that they don't get executed when e.g. throwing an Exception (or similar things)

includes/Article.php
includes/EditPage.php
includes/OutputPage.php
includes/Skin.php
includes/SkinTemplate.php
includes/diff/DifferenceEngine.php

index 998f378..9bf3f05 100644 (file)
@@ -364,7 +364,6 @@ class Article extends Page {
                        return;
                }
 
-               $wgOut->setArticleFlag( true );
                # Set page title (may be overridden by DISPLAYTITLE)
                $wgOut->setPageTitle( $this->getTitle()->getPrefixedText() );
 
@@ -377,6 +376,7 @@ class Article extends Page {
                        return;
                }
 
+               $wgOut->setArticleFlag( true );
                # Allow frames by default
                $wgOut->allowClickjacking();
 
index 958ea84..f3b24c5 100644 (file)
@@ -374,9 +374,6 @@ class EditPage {
                wfProfileIn( __METHOD__ );
                wfDebug( __METHOD__.": enter\n" );
 
-               // This is not an article
-               $wgOut->setArticleFlag( false );
-
                $this->importFormData( $wgRequest );
                $this->firsttime = false;
 
index fb7f67e..dcd0675 100644 (file)
@@ -47,7 +47,13 @@ class OutputPage {
        var $mHTMLtitle = '';
 
        /// Should be private. Is the displayed content related to the source of the corresponding wiki article.
-       var $mIsarticle = true;
+       var $mIsarticle = false;
+
+       /**
+        * Should be private. Has get/set methods properly documented.
+        * Stores "article flag" toggle.
+        */
+       var $mIsArticleRelated = true;
 
        /**
         * Should be private. We have to set isPrintable(). Some pages should
@@ -145,12 +151,6 @@ class OutputPage {
        // Parser related.
        var $mContainsOldMagic = 0, $mContainsNewMagic = 0;
 
-       /**
-        * Should be private. Has get/set methods properly documented.
-        * Stores "article flag" toggle.
-        */
-       var $mIsArticleRelated = true;
-
        /// lazy initialised, use parserOptions()
        protected $mParserOptions = null;
 
@@ -2303,14 +2303,7 @@ $templates
                $bodyAttrs = array();
 
                # Crazy edit-on-double-click stuff
-               $action = $this->getRequest()->getVal( 'action', 'view' );
-
-               if (
-                       $this->getTitle()->getNamespace() != NS_SPECIAL &&
-                       in_array( $action, array( 'view', 'purge' ) ) &&
-                       $this->getUser()->getOption( 'editondblclick' )
-               )
-               {
+               if ( $this->isArticle() && $this->getUser()->getOption( 'editondblclick' ) ) {
                        $editUrl = $this->getTitle()->getLocalUrl( $sk->editUrlOptions() );
                        $bodyAttrs['ondblclick'] = "document.location = '" .
                                Xml::escapeJsString( $editUrl ) . "'";
index c8d057a..0871f2f 100644 (file)
@@ -728,9 +728,7 @@ abstract class Skin extends ContextSource {
                global $wgRightsPage, $wgRightsUrl, $wgRightsText;
 
                if ( $type == 'detect' ) {
-                       $diff = $this->getRequest()->getVal( 'diff' );
-
-                       if ( is_null( $diff ) && !$this->isRevisionCurrent() && wfMsgForContent( 'history_copyright' ) !== '-' ) {
+                       if ( !$this->isRevisionCurrent() && wfMsgForContent( 'history_copyright' ) !== '-' ) {
                                $type = 'history';
                        } else {
                                $type = 'normal';
index 9674890..1b8c3f7 100644 (file)
@@ -1111,8 +1111,6 @@ class SkinTemplate extends Skin {
 
                wfProfileIn( __METHOD__ );
 
-               $action = $wgRequest->getVal( 'action', 'view' );
-
                $nav_urls = array();
                $nav_urls['mainpage'] = array( 'href' => self::makeMainPageUrl() );
                if( $wgUploadNavigationUrl ) {
@@ -1129,7 +1127,7 @@ class SkinTemplate extends Skin {
 
                // A print stylesheet is attached to all pages, but nobody ever
                // figures that out. :)  Add a link...
-               if( $this->getTitle()->getNamespace() != NS_SPECIAL && ( $action == 'view' || $action == 'purge' ) ) {
+               if( $out->isArticle() ) {
                        if ( !$out->isPrintable() ) {
                                $nav_urls['print'] = array(
                                        'text' => wfMsg( 'printableversion' ),
index 5f1a962..74b909e 100644 (file)
@@ -223,7 +223,6 @@ CONTROL;
                        return;
                }
 
-               $wgOut->setArticleFlag( false );
                if ( !$this->loadRevisionData() ) {
                        // Sounds like a deleted revision... Let's see what we can do.
                        $t = $this->mTitle->getPrefixedText();
@@ -238,10 +237,6 @@ CONTROL;
 
                wfRunHooks( 'DiffViewHeader', array( $this, $this->mOldRev, $this->mNewRev ) );
 
-               if ( $this->mNewRev->isCurrent() ) {
-                       $wgOut->setArticleFlag( true );
-               }
-
                # mOldid is false if the difference engine is called with a "vague" query for
                # a diff between a version V and its previous version V' AND the version V
                # is the first version of that article. In that case, V' does not exist.
@@ -521,6 +516,7 @@ CONTROL;
 
                        $this->loadNewText();
                        $wgOut->setRevisionId( $this->mNewRev->getId() );
+                       $wgOut->setArticleFlag( true );
 
                        if ( $this->mTitle->isCssJsSubpage() || $this->mTitle->isCssOrJsPage() ) {
                                // Stolen from Article::view --AG 2007-10-11
@@ -592,12 +588,8 @@ CONTROL;
                        wfProfileOut( __METHOD__ );
                        return;
                }
-               if ( $this->mNewRev->isCurrent() ) {
-                       $wgOut->setArticleFlag( true );
-               }
 
                # Check if user is allowed to look at this page. If not, bail out.
-               #
                if ( !$this->mTitle->userCanRead() ) {
                        $wgOut->loginToUse();
                        $wgOut->output();