From 76b6b5105448dd2eced3b3de3419b00d7b3b9453 Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Fri, 8 Aug 2008 00:01:53 +0000 Subject: [PATCH] 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 --- includes/Article.php | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/includes/Article.php b/includes/Article.php index a86d6ee8b7..2b933bce0b 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -117,7 +117,7 @@ class Article { $text = $this->getContent(); return self::followRedirectText( $text ); } - + /** * Get the Title object this text redirects to * @@ -552,9 +552,9 @@ class Article { */ function isRedirect( $text = false ) { if ( $text === false ) { - if ( $this->mDataLoaded ) + if ( $this->mDataLoaded ) return $this->mIsRedirect; - + // Apparently loadPageData was never called $this->loadContent(); $titleObj = Title::newFromRedirect( $this->fetchContent() ); @@ -659,7 +659,7 @@ class Article { if ($limit > 0) { $sql .= ' LIMIT '.$limit; } if ($offset > 0) { $sql .= ' OFFSET '.$offset; } - + $sql .= ' '. $this->getSelectOptions(); $res = $dbr->query($sql, __METHOD__); @@ -842,7 +842,7 @@ class Article { } } } - + $wgOut->setRevisionId( $this->getRevIdFetched() ); // Pages containing custom CSS or JavaScript get special treatment @@ -927,13 +927,13 @@ class Article { $this->viewUpdates(); wfProfileOut( __METHOD__ ); } - - /* + + /* * Should the parser cache be used? */ protected function useParserCache( $oldid ) { global $wgUser, $wgEnableParserCache; - + return $wgEnableParserCache && intval( $wgUser->getOption( 'stubthreshold' ) ) == 0 && $this->exists() @@ -941,7 +941,7 @@ class Article { && !$this->mTitle->isCssOrJsPage() && !$this->mTitle->isCssJsSubpage(); } - + /** * View redirect * @param Title $target Title of destination to redirect @@ -950,11 +950,11 @@ class Article { */ public function viewRedirect( $target, $appendSubtitle = true, $forceKnown = false ) { global $wgParser, $wgOut, $wgContLang, $wgStylePath, $wgUser; - + # Display redirect $imageDir = $wgContLang->isRTL() ? 'rtl' : 'ltr'; $imageUrl = $wgStylePath.'/common/images/redirect' . $imageDir . '.png'; - + if( $appendSubtitle ) { $wgOut->appendSubtitle( wfMsgHtml( 'redirectpagesub' ) ); } @@ -966,7 +966,7 @@ class Article { return '#REDIRECT ' . ''.$link.''; - + } function addTrackbacks() { @@ -1546,7 +1546,7 @@ class Article { # Update the page record with revision data $this->updateRevisionOn( $dbw, $revision, 0 ); - + wfRunHooks( 'NewRevisionFromEditComplete', array($this, $revision, false) ); if( !( $flags & EDIT_SUPPRESS_RC ) ) { @@ -1909,14 +1909,14 @@ class Article { 'page_id' => $id ), 'Article::protect' ); - + wfRunHooks( 'NewRevisionFromEditComplete', array($this, $nullRevision, $latest) ); wfRunHooks( 'ArticleProtectComplete', array( &$this, &$wgUser, $limit, $reason ) ); # Update the protection log $log = new LogPage( 'protect' ); if( $protect ) { - $log->addEntry( $modified ? 'modify' : 'protect', $this->mTitle, + $log->addEntry( $modified ? 'modify' : 'protect', $this->mTitle, trim( $reason . " [$updated]$cascade_description$expiry_description" ) ); } else { $log->addEntry( 'unprotect', $this->mTitle, $reason ); @@ -2270,9 +2270,9 @@ class Article { function doDelete( $reason, $suppress = false ) { global $wgOut, $wgUser; wfDebug( __METHOD__."\n" ); - + $id = $this->getId(); - + $error = ''; if (wfRunHooks('ArticleDelete', array(&$this, &$wgUser, &$reason, &$error))) { @@ -2547,14 +2547,14 @@ class Article { if( empty( $summary ) ){ $summary = wfMsgForContent( 'revertpage' ); } - + # Allow the custom summary to use the same args as the default message $args = array( $target->getUserText(), $from, $s->rev_id, $wgLang->timeanddate(wfTimestamp(TS_MW, $s->rev_timestamp), true), $current->getId(), $wgLang->timeanddate($current->getTimestamp()) ); - $summary = wfMsgReplaceArgs( $summary, $args ); + $summary = wfMsgReplaceArgs( $summary, $args ); # Save $flags = EDIT_UPDATE; @@ -2642,7 +2642,7 @@ class Article { . $wgUser->getSkin()->userToolLinks( $target->getUser(), $target->getUserText() ); $wgOut->addHtml( wfMsgExt( 'rollback-success', array( 'parse', 'replaceafter' ), $old, $new ) ); $wgOut->returnToMain( false, $this->mTitle ); - + if( !$wgRequest->getBool( 'hidediff', false ) ) { $de = new DifferenceEngine( $this->mTitle, $current->getId(), 'next', false, true ); $de->showDiff( '', '' ); @@ -2770,7 +2770,7 @@ class Article { if( User::isIP( $shortTitle ) ) { // An anonymous user $other->setNewtalk( true ); - } elseif( $other->isLoggedIn() ) { + } elseif( $other instanceof User && $other->isLoggedIn() ) { $other->setNewtalk( true ); } else { wfDebug( __METHOD__. ": don't need to notify a nonexistent user\n" ); @@ -3014,7 +3014,7 @@ class Article { $revision->insertOn( $dbw ); $this->updateRevisionOn( $dbw, $revision ); $dbw->commit(); - + wfRunHooks( 'NewRevisionFromEditComplete', array($this, $revision, false) ); wfProfileOut( __METHOD__ ); -- 2.20.1