From: Sam Reed Date: Sat, 1 Jan 2011 22:35:16 +0000 (+0000) Subject: Followup r75334. Change to int == string, rather than int === string (not going to... X-Git-Tag: 1.31.0-rc.0~32909 X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dcompta/comptes/Foo_bar_baz?a=commitdiff_plain;h=80c7f081fb0dca61e324834298c1d922f41648c3;p=lhc%2Fweb%2Fwiklou.git Followup r75334. Change to int == string, rather than int === string (not going to work) Attempt to load/save an article object, rather than an title object from the parser cache. Per Bryan, and per bug 26534 now logged, this really needs refactoring more cleanly. As if latestRevId == oldid set, it's doing exactly the same lookup/parse --- diff --git a/includes/api/ApiParse.php b/includes/api/ApiParse.php index acb89051ee..d2e1920d2d 100644 --- a/includes/api/ApiParse.php +++ b/includes/api/ApiParse.php @@ -94,18 +94,21 @@ class ApiParse extends ApiBase { $wgTitle = $titleObj; // If for some reason the "oldid" is actually the current revision, it may be cached - if ( $titleObj->getLatestRevID() === $oldid ) { + if ( $titleObj->getLatestRevID() == $oldid ) { $p_result = false; $pcache = ParserCache::singleton(); + + $articleObj = new Article( $titleObj ); + if ( $wgEnableParserCache ) { - $p_result = $pcache->get( $titleObj, $popts ); + $p_result = $pcache->get( $articleObj, $popts ); } if ( !$p_result ) { $text = $rev->getText( Revision::FOR_THIS_USER ); $p_result = $wgParser->parse( $text, $titleObj, $popts ); if ( $wgEnableParserCache ) { - $pcache->save( $p_result, $titleObj, $popts ); + $pcache->save( $p_result, $articleObj, $popts ); } } } else { @@ -157,7 +160,9 @@ class ApiParse extends ApiBase { } if ( $this->section !== false ) { - $text = $this->getSectionText( $text, !is_null ( $pageid ) ? 'page id ' . $pageid : $titleObj->getText() ); + $text = $this->getSectionText( $text, !is_null ( $pageid ) + ? 'page id ' . $pageid : $titleObj->getText() ); + $p_result = $wgParser->parse( $text, $titleObj, $popts ); } else { // Try the parser cache first