r93263 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r93262‎ | r93263 | r93264 >
Date:13:14, 27 July 2011
Author:ialex
Status:ok
Tags:
Comment:
* Changed OutputPage::$mIsArticle flag to be false by default. A lot of actions don't change that flag when they should, since about only action=view should have it to true.
* 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)
Modified paths:
  • /trunk/phase3/includes/Article.php (modified) (history)
  • /trunk/phase3/includes/EditPage.php (modified) (history)
  • /trunk/phase3/includes/OutputPage.php (modified) (history)
  • /trunk/phase3/includes/Skin.php (modified) (history)
  • /trunk/phase3/includes/SkinTemplate.php (modified) (history)
  • /trunk/phase3/includes/diff/DifferenceEngine.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/diff/DifferenceEngine.php
@@ -223,7 +223,6 @@
224224 return;
225225 }
226226
227 - $wgOut->setArticleFlag( false );
228227 if ( !$this->loadRevisionData() ) {
229228 // Sounds like a deleted revision... Let's see what we can do.
230229 $t = $this->mTitle->getPrefixedText();
@@ -238,10 +237,6 @@
239238
240239 wfRunHooks( 'DiffViewHeader', array( $this, $this->mOldRev, $this->mNewRev ) );
241240
242 - if ( $this->mNewRev->isCurrent() ) {
243 - $wgOut->setArticleFlag( true );
244 - }
245 -
246241 # mOldid is false if the difference engine is called with a "vague" query for
247242 # a diff between a version V and its previous version V' AND the version V
248243 # is the first version of that article. In that case, V' does not exist.
@@ -521,6 +516,7 @@
522517
523518 $this->loadNewText();
524519 $wgOut->setRevisionId( $this->mNewRev->getId() );
 520+ $wgOut->setArticleFlag( true );
525521
526522 if ( $this->mTitle->isCssJsSubpage() || $this->mTitle->isCssOrJsPage() ) {
527523 // Stolen from Article::view --AG 2007-10-11
@@ -592,12 +588,8 @@
593589 wfProfileOut( __METHOD__ );
594590 return;
595591 }
596 - if ( $this->mNewRev->isCurrent() ) {
597 - $wgOut->setArticleFlag( true );
598 - }
599592
600593 # Check if user is allowed to look at this page. If not, bail out.
601 - #
602594 if ( !$this->mTitle->userCanRead() ) {
603595 $wgOut->loginToUse();
604596 $wgOut->output();
Index: trunk/phase3/includes/Article.php
@@ -364,7 +364,6 @@
365365 return;
366366 }
367367
368 - $wgOut->setArticleFlag( true );
369368 # Set page title (may be overridden by DISPLAYTITLE)
370369 $wgOut->setPageTitle( $this->getTitle()->getPrefixedText() );
371370
@@ -377,6 +376,7 @@
378377 return;
379378 }
380379
 380+ $wgOut->setArticleFlag( true );
381381 # Allow frames by default
382382 $wgOut->allowClickjacking();
383383
Index: trunk/phase3/includes/EditPage.php
@@ -374,9 +374,6 @@
375375 wfProfileIn( __METHOD__ );
376376 wfDebug( __METHOD__.": enter\n" );
377377
378 - // This is not an article
379 - $wgOut->setArticleFlag( false );
380 -
381378 $this->importFormData( $wgRequest );
382379 $this->firsttime = false;
383380
Index: trunk/phase3/includes/OutputPage.php
@@ -47,9 +47,15 @@
4848 var $mHTMLtitle = '';
4949
5050 /// Should be private. Is the displayed content related to the source of the corresponding wiki article.
51 - var $mIsarticle = true;
 51+ var $mIsarticle = false;
5252
5353 /**
 54+ * Should be private. Has get/set methods properly documented.
 55+ * Stores "article flag" toggle.
 56+ */
 57+ var $mIsArticleRelated = true;
 58+
 59+ /**
5460 * Should be private. We have to set isPrintable(). Some pages should
5561 * never be printed (ex: redirections).
5662 */
@@ -145,12 +151,6 @@
146152 // Parser related.
147153 var $mContainsOldMagic = 0, $mContainsNewMagic = 0;
148154
149 - /**
150 - * Should be private. Has get/set methods properly documented.
151 - * Stores "article flag" toggle.
152 - */
153 - var $mIsArticleRelated = true;
154 -
155155 /// lazy initialised, use parserOptions()
156156 protected $mParserOptions = null;
157157
@@ -2303,14 +2303,7 @@
23042304 $bodyAttrs = array();
23052305
23062306 # Crazy edit-on-double-click stuff
2307 - $action = $this->getRequest()->getVal( 'action', 'view' );
2308 -
2309 - if (
2310 - $this->getTitle()->getNamespace() != NS_SPECIAL &&
2311 - in_array( $action, array( 'view', 'purge' ) ) &&
2312 - $this->getUser()->getOption( 'editondblclick' )
2313 - )
2314 - {
 2307+ if ( $this->isArticle() && $this->getUser()->getOption( 'editondblclick' ) ) {
23152308 $editUrl = $this->getTitle()->getLocalUrl( $sk->editUrlOptions() );
23162309 $bodyAttrs['ondblclick'] = "document.location = '" .
23172310 Xml::escapeJsString( $editUrl ) . "'";
Index: trunk/phase3/includes/SkinTemplate.php
@@ -1111,8 +1111,6 @@
11121112
11131113 wfProfileIn( __METHOD__ );
11141114
1115 - $action = $wgRequest->getVal( 'action', 'view' );
1116 -
11171115 $nav_urls = array();
11181116 $nav_urls['mainpage'] = array( 'href' => self::makeMainPageUrl() );
11191117 if( $wgUploadNavigationUrl ) {
@@ -1129,7 +1127,7 @@
11301128
11311129 // A print stylesheet is attached to all pages, but nobody ever
11321130 // figures that out. :) Add a link...
1133 - if( $this->getTitle()->getNamespace() != NS_SPECIAL && ( $action == 'view' || $action == 'purge' ) ) {
 1131+ if( $out->isArticle() ) {
11341132 if ( !$out->isPrintable() ) {
11351133 $nav_urls['print'] = array(
11361134 'text' => wfMsg( 'printableversion' ),
Index: trunk/phase3/includes/Skin.php
@@ -728,9 +728,7 @@
729729 global $wgRightsPage, $wgRightsUrl, $wgRightsText;
730730
731731 if ( $type == 'detect' ) {
732 - $diff = $this->getRequest()->getVal( 'diff' );
733 -
734 - if ( is_null( $diff ) && !$this->isRevisionCurrent() && wfMsgForContent( 'history_copyright' ) !== '-' ) {
 732+ if ( !$this->isRevisionCurrent() && wfMsgForContent( 'history_copyright' ) !== '-' ) {
735733 $type = 'history';
736734 } else {
737735 $type = 'normal';

Status & tagging log