X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fpage%2FWikiPage.php;h=f7f25289b5e00a202d4833f9fe5e3f5bf63bf07a;hb=b51076a84446d157bed511246450e70d26e0f945;hp=5e72151e5b150d2566ed8b6c3f4ce28c43175893;hpb=5b74a93eff8d3ead5cb1c21ca38391ecb39a9575;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/page/WikiPage.php b/includes/page/WikiPage.php index 5e72151e5b..f7f25289b5 100644 --- a/includes/page/WikiPage.php +++ b/includes/page/WikiPage.php @@ -1082,13 +1082,13 @@ class WikiPage implements Page, IDBAccessObject { * Should the parser cache be used? * * @param ParserOptions $parserOptions ParserOptions to check - * @param int $oldid + * @param int $oldId * @return bool */ - public function isParserCacheUsed( ParserOptions $parserOptions, $oldid ) { + public function shouldCheckParserCache( ParserOptions $parserOptions, $oldId ) { return $parserOptions->getStubThreshold() == 0 && $this->exists() - && ( $oldid === null || $oldid === 0 || $oldid === $this->getLatest() ) + && ( $oldId === null || $oldId === 0 || $oldId === $this->getLatest() ) && $this->getContentHandler()->isParserCacheSupported(); } @@ -1105,7 +1105,7 @@ class WikiPage implements Page, IDBAccessObject { */ public function getParserOutput( ParserOptions $parserOptions, $oldid = null ) { - $useParserCache = $this->isParserCacheUsed( $parserOptions, $oldid ); + $useParserCache = $this->shouldCheckParserCache( $parserOptions, $oldid ); wfDebug( __METHOD__ . ': using parser cache: ' . ( $useParserCache ? 'yes' : 'no' ) . "\n" ); if ( $parserOptions->getStubThreshold() ) { wfIncrStats( 'pcache.miss.stub' ); @@ -3024,7 +3024,7 @@ class WikiPage implements Page, IDBAccessObject { ) ); } - // Get the last edit not by this guy... + // Get the last edit not by this person... // Note: these may not be public values $user = intval( $current->getUser( Revision::RAW ) ); $user_text = $dbw->addQuotes( $current->getUserText( Revision::RAW ) ); @@ -3046,29 +3046,6 @@ class WikiPage implements Page, IDBAccessObject { return array( array( 'notvisiblerev' ) ); } - // Set patrolling and bot flag on the edits, which gets rollbacked. - // This is done before the rollback edit to have patrolling also on failure (bug 62157). - $set = array(); - if ( $bot && $guser->isAllowed( 'markbotedits' ) ) { - // Mark all reverted edits as bot - $set['rc_bot'] = 1; - } - - if ( $wgUseRCPatrol ) { - // Mark all reverted edits as patrolled - $set['rc_patrolled'] = 1; - } - - if ( count( $set ) ) { - $dbw->update( 'recentchanges', $set, - array( /* WHERE */ - 'rc_cur_id' => $current->getPage(), - 'rc_user_text' => $current->getUserText(), - 'rc_timestamp > ' . $dbw->addQuotes( $s->rev_timestamp ), - ), __METHOD__ - ); - } - // Generate the edit summary if necessary $target = Revision::newFromId( $s->rev_id, Revision::READ_LATEST ); if ( empty( $summary ) ) { @@ -3117,6 +3094,30 @@ class WikiPage implements Page, IDBAccessObject { $guser ); + // Set patrolling and bot flag on the edits, which gets rollbacked. + // This is done even on edit failure to have patrolling in that case (bug 62157). + $set = array(); + if ( $bot && $guser->isAllowed( 'markbotedits' ) ) { + // Mark all reverted edits as bot + $set['rc_bot'] = 1; + } + + if ( $wgUseRCPatrol ) { + // Mark all reverted edits as patrolled + $set['rc_patrolled'] = 1; + } + + if ( count( $set ) ) { + $dbw->update( 'recentchanges', $set, + array( /* WHERE */ + 'rc_cur_id' => $current->getPage(), + 'rc_user_text' => $current->getUserText(), + 'rc_timestamp > ' . $dbw->addQuotes( $s->rev_timestamp ), + ), + __METHOD__ + ); + } + if ( !$status->isOK() ) { return $status->getErrorsArray(); }