r42820 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r42819‎ | r42820 | r42821 >
Date:16:21, 30 October 2008
Author:aaron
Status:old
Tags:
Comment:
Minor cleanup
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedArticle.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedArticle.php
@@ -16,13 +16,12 @@
1717 */
1818 public static function getGlobalInstance() {
1919 global $wgArticle, $wgTitle;
20 - if ( !empty( $wgArticle ) ) {
 20+ if( !empty( $wgArticle ) ) {
2121 return self::getInstance( $wgArticle );
22 - } elseif ( !empty( $wgTitle ) ) {
 22+ } else if( !empty( $wgTitle ) ) {
2323 return self::getTitleInstance( $wgTitle );
24 - } else {
25 - return false;
2624 }
 25+ return null;
2726 }
2827
2928 /**
@@ -30,7 +29,7 @@
3130 * getInstance() is preferred if you have an Article available.
3231 */
3332 public static function getTitleInstance( $title ) {
34 - if ( !isset( $title->flaggedRevsArticle ) ) {
 33+ if( !isset( $title->flaggedRevsArticle ) ) {
3534 $article = MediaWiki::articleFromTitle( $title );
3635 $article->flaggedRevsArticle = new FlaggedArticle( $article );
3736 $title->flaggedRevsArticle =& $article->flaggedRevsArticle;
@@ -50,6 +49,7 @@
5150 if( isset( $article->getTitle()->flaggedRevsArticle ) ) {
5251 // Already have a FlaggedArticle cached in the Title object
5352 $article->flaggedRevsArticle =& $article->getTitle()->flaggedRevsArticle;
 53+ $article->flaggedRevsArticle->parent =& $article;
5454 } else {
5555 // Create new FlaggedArticle
5656 $article->flaggedRevsArticle = new FlaggedArticle( $article );
@@ -776,10 +776,7 @@
777777 */
778778 public function setActionTabs( $skin, &$contentActions ) {
779779 global $wgRequest, $wgUser, $wgFlaggedRevTabs;
780 - # Get the subject page, not all skins have it :(
781 - if( !isset($skin->mTitle) )
782 - return true;
783 - $title = $skin->mTitle->getSubjectPage();
 780+ $title = $this->parent->getTitle()->getSubjectPage();
784781 # Non-content pages cannot be validated
785782 if( !FlaggedRevs::isPageReviewable( $title ) || !$title->exists() )
786783 return true;

Status & tagging log