r38823 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r38822‎ | r38823 | r38824 >
Date:00:01, 8 August 2008
Author:siebrand
Status:old
Tags:
Comment:
Fix on r38763 for "PHP Fatal error: Call to a member function isLoggedIn() on a non-object in /var/www/w/includes/Article.php on line 2773" when editing a subpage of a user talk page.

Fix by demon
Modified paths:
  • /trunk/phase3/includes/Article.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Article.php
@@ -117,7 +117,7 @@
118118 $text = $this->getContent();
119119 return self::followRedirectText( $text );
120120 }
121 -
 121+
122122 /**
123123 * Get the Title object this text redirects to
124124 *
@@ -552,9 +552,9 @@
553553 */
554554 function isRedirect( $text = false ) {
555555 if ( $text === false ) {
556 - if ( $this->mDataLoaded )
 556+ if ( $this->mDataLoaded )
557557 return $this->mIsRedirect;
558 -
 558+
559559 // Apparently loadPageData was never called
560560 $this->loadContent();
561561 $titleObj = Title::newFromRedirect( $this->fetchContent() );
@@ -659,7 +659,7 @@
660660
661661 if ($limit > 0) { $sql .= ' LIMIT '.$limit; }
662662 if ($offset > 0) { $sql .= ' OFFSET '.$offset; }
663 -
 663+
664664 $sql .= ' '. $this->getSelectOptions();
665665
666666 $res = $dbr->query($sql, __METHOD__);
@@ -842,7 +842,7 @@
843843 }
844844 }
845845 }
846 -
 846+
847847 $wgOut->setRevisionId( $this->getRevIdFetched() );
848848
849849 // Pages containing custom CSS or JavaScript get special treatment
@@ -927,13 +927,13 @@
928928 $this->viewUpdates();
929929 wfProfileOut( __METHOD__ );
930930 }
931 -
932 - /*
 931+
 932+ /*
933933 * Should the parser cache be used?
934934 */
935935 protected function useParserCache( $oldid ) {
936936 global $wgUser, $wgEnableParserCache;
937 -
 937+
938938 return $wgEnableParserCache
939939 && intval( $wgUser->getOption( 'stubthreshold' ) ) == 0
940940 && $this->exists()
@@ -941,7 +941,7 @@
942942 && !$this->mTitle->isCssOrJsPage()
943943 && !$this->mTitle->isCssJsSubpage();
944944 }
945 -
 945+
946946 /**
947947 * View redirect
948948 * @param Title $target Title of destination to redirect
@@ -950,11 +950,11 @@
951951 */
952952 public function viewRedirect( $target, $appendSubtitle = true, $forceKnown = false ) {
953953 global $wgParser, $wgOut, $wgContLang, $wgStylePath, $wgUser;
954 -
 954+
955955 # Display redirect
956956 $imageDir = $wgContLang->isRTL() ? 'rtl' : 'ltr';
957957 $imageUrl = $wgStylePath.'/common/images/redirect' . $imageDir . '.png';
958 -
 958+
959959 if( $appendSubtitle ) {
960960 $wgOut->appendSubtitle( wfMsgHtml( 'redirectpagesub' ) );
961961 }
@@ -966,7 +966,7 @@
967967
968968 return '<img src="'.$imageUrl.'" alt="#REDIRECT " />' .
969969 '<span class="redirectText">'.$link.'</span>';
970 -
 970+
971971 }
972972
973973 function addTrackbacks() {
@@ -1546,7 +1546,7 @@
15471547
15481548 # Update the page record with revision data
15491549 $this->updateRevisionOn( $dbw, $revision, 0 );
1550 -
 1550+
15511551 wfRunHooks( 'NewRevisionFromEditComplete', array($this, $revision, false) );
15521552
15531553 if( !( $flags & EDIT_SUPPRESS_RC ) ) {
@@ -1909,14 +1909,14 @@
19101910 'page_id' => $id
19111911 ), 'Article::protect'
19121912 );
1913 -
 1913+
19141914 wfRunHooks( 'NewRevisionFromEditComplete', array($this, $nullRevision, $latest) );
19151915 wfRunHooks( 'ArticleProtectComplete', array( &$this, &$wgUser, $limit, $reason ) );
19161916
19171917 # Update the protection log
19181918 $log = new LogPage( 'protect' );
19191919 if( $protect ) {
1920 - $log->addEntry( $modified ? 'modify' : 'protect', $this->mTitle,
 1920+ $log->addEntry( $modified ? 'modify' : 'protect', $this->mTitle,
19211921 trim( $reason . " [$updated]$cascade_description$expiry_description" ) );
19221922 } else {
19231923 $log->addEntry( 'unprotect', $this->mTitle, $reason );
@@ -2270,9 +2270,9 @@
22712271 function doDelete( $reason, $suppress = false ) {
22722272 global $wgOut, $wgUser;
22732273 wfDebug( __METHOD__."\n" );
2274 -
 2274+
22752275 $id = $this->getId();
2276 -
 2276+
22772277 $error = '';
22782278
22792279 if (wfRunHooks('ArticleDelete', array(&$this, &$wgUser, &$reason, &$error))) {
@@ -2547,14 +2547,14 @@
25482548 if( empty( $summary ) ){
25492549 $summary = wfMsgForContent( 'revertpage' );
25502550 }
2551 -
 2551+
25522552 # Allow the custom summary to use the same args as the default message
25532553 $args = array(
25542554 $target->getUserText(), $from, $s->rev_id,
25552555 $wgLang->timeanddate(wfTimestamp(TS_MW, $s->rev_timestamp), true),
25562556 $current->getId(), $wgLang->timeanddate($current->getTimestamp())
25572557 );
2558 - $summary = wfMsgReplaceArgs( $summary, $args );
 2558+ $summary = wfMsgReplaceArgs( $summary, $args );
25592559
25602560 # Save
25612561 $flags = EDIT_UPDATE;
@@ -2642,7 +2642,7 @@
26432643 . $wgUser->getSkin()->userToolLinks( $target->getUser(), $target->getUserText() );
26442644 $wgOut->addHtml( wfMsgExt( 'rollback-success', array( 'parse', 'replaceafter' ), $old, $new ) );
26452645 $wgOut->returnToMain( false, $this->mTitle );
2646 -
 2646+
26472647 if( !$wgRequest->getBool( 'hidediff', false ) ) {
26482648 $de = new DifferenceEngine( $this->mTitle, $current->getId(), 'next', false, true );
26492649 $de->showDiff( '', '' );
@@ -2770,7 +2770,7 @@
27712771 if( User::isIP( $shortTitle ) ) {
27722772 // An anonymous user
27732773 $other->setNewtalk( true );
2774 - } elseif( $other->isLoggedIn() ) {
 2774+ } elseif( $other instanceof User && $other->isLoggedIn() ) {
27752775 $other->setNewtalk( true );
27762776 } else {
27772777 wfDebug( __METHOD__. ": don't need to notify a nonexistent user\n" );
@@ -3014,7 +3014,7 @@
30153015 $revision->insertOn( $dbw );
30163016 $this->updateRevisionOn( $dbw, $revision );
30173017 $dbw->commit();
3018 -
 3018+
30193019 wfRunHooks( 'NewRevisionFromEditComplete', array($this, $revision, false) );
30203020
30213021 wfProfileOut( __METHOD__ );

Follow-up revisions

RevisionCommit summaryAuthorDate
r38871Fix fix r38823tstarling09:47, 8 August 2008

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r38763Changes for NewUserMessage:...tstarling10:39, 7 August 2008

Status & tagging log