From: Aaron Schulz Date: Sat, 10 Jan 2009 13:41:22 +0000 (+0000) Subject: * Added getRawText() convenience function to always get the current revision X-Git-Tag: 1.31.0-rc.0~43470 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/comptes/journal.php?a=commitdiff_plain;h=2f23d5378875b517f44d8bda4f5831b896868b9d;p=lhc%2Fweb%2Fwiklou.git * Added getRawText() convenience function to always get the current revision * Fix incorrect usage of getContent() which broke if ?oldid was set --- diff --git a/includes/Article.php b/includes/Article.php index 5bd3488993..5d91a432e5 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -228,6 +228,21 @@ class Article { return $this->mContent; } } + + /** + * Get the text of the current revision. No side-effects... + * + * @return Return the text of the current revision + */ + public function getRawText() { + // Check process cache for current revision + if( $this->mContentLoaded && $this->mOldId == 0 ) { + return $this->mContent; + } + $rev = Revision::newFromTitle( $this->mTitle ); + $text = $rev ? $rev->getRawText() : false; + return $text; + } /** * This function returns the text of a section, specified by a number ($section). @@ -1128,7 +1143,7 @@ class Article { if( $this->getID() == 0 ) { $text = false; } else { - $text = $this->getContent(); + $text = $this->getRawText(); } $wgMessageCache->replace( $this->mTitle->getDBkey(), $text ); } @@ -1490,7 +1505,7 @@ class Article { $isminor = ( $flags & EDIT_MINOR ) && $user->isAllowed('minoredit'); $bot = $flags & EDIT_FORCE_BOT; - $oldtext = $this->getContent(); + $oldtext = $this->getRawText(); // current revision $oldsize = strlen( $oldtext ); # Provide autosummaries if one is not provided and autosummaries are enabled. @@ -2398,7 +2413,7 @@ class Article { return false; } - $u = new SiteStatsUpdate( 0, 1, -(int)$this->isCountable( $this->getContent() ), -1 ); + $u = new SiteStatsUpdate( 0, 1, -(int)$this->isCountable( $this->getRawText() ), -1 ); array_push( $wgDeferredUpdateList, $u ); // Bitfields to further suppress the content