From 80c7f081fb0dca61e324834298c1d922f41648c3 Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Sat, 1 Jan 2011 22:35:16 +0000 Subject: [PATCH] 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 --- includes/api/ApiParse.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) 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 -- 2.20.1