$this->setRevisionInternal( $rev );
- $this->pruneRevisionSensitiveOutput( $this->revision->getId() );
+ $this->pruneRevisionSensitiveOutput(
+ $this->revision->getId(),
+ $this->revision->getTimestamp()
+ );
}
/**
* Prune any output that depends on the revision ID.
*
- * @param int|bool $actualRevId The actual rev id, to check the used speculative rev ID
+ * @param int|bool $actualRevId The actual rev id, to check the used speculative rev ID
* against, or false to not purge on vary-revision-id, or true to purge on
* vary-revision-id unconditionally.
+ * @param string|bool $actualRevTimestamp The actual rev timestamp, to check against the
+ * parser output revision timestamp, or false to not purge on vary-revision-timestamp
*/
- private function pruneRevisionSensitiveOutput( $actualRevId ) {
+ private function pruneRevisionSensitiveOutput( $actualRevId, $actualRevTimestamp ) {
if ( $this->revisionOutput ) {
- if ( $this->outputVariesOnRevisionMetaData( $this->revisionOutput, $actualRevId ) ) {
+ if ( $this->outputVariesOnRevisionMetaData(
+ $this->revisionOutput,
+ $actualRevId,
+ $actualRevTimestamp
+ ) ) {
$this->revisionOutput = null;
}
} else {
}
foreach ( $this->slotsOutput as $role => $output ) {
- if ( $this->outputVariesOnRevisionMetaData( $output, $actualRevId ) ) {
+ if ( $this->outputVariesOnRevisionMetaData(
+ $output,
+ $actualRevId,
+ $actualRevTimestamp
+ ) ) {
unset( $this->slotsOutput[$role] );
}
}
/**
* @param ParserOutput $out
* @param int|bool $actualRevId The actual rev id, to check the used speculative rev ID
- * against, or false to not purge on vary-revision-id, or true to purge on
+ * against, false to not purge on vary-revision-id, or true to purge on
* vary-revision-id unconditionally.
+ * @param string|bool $actualRevTimestamp The actual rev timestamp, to check against the
+ * parser output revision timestamp, false to not purge on vary-revision-timestamp,
+ * or true to purge on vary-revision-timestamp unconditionally.
* @return bool
*/
- private function outputVariesOnRevisionMetaData( ParserOutput $out, $actualRevId ) {
+ private function outputVariesOnRevisionMetaData(
+ ParserOutput $out,
+ $actualRevId,
+ $actualRevTimestamp
+ ) {
$method = __METHOD__;
if ( $out->getFlag( 'vary-revision' ) ) {
- // If {{PAGEID}} resolved to 0 or {{REVISIONTIMESTAMP}} used the current
- // timestamp rather than that of an actual revision, then those words need
- // to resolve to the actual page ID or revision timestamp, respectively.
+ // If {{PAGEID}} resolved to 0, then that word need to resolve to the actual page ID
$this->saveParseLogger->info(
- "$method: Prepared output has vary-revision...\n"
+ "$method: Prepared output has vary-revision..."
);
return true;
} elseif ( $out->getFlag( 'vary-revision-id' )
&& ( $actualRevId === true || $out->getSpeculativeRevIdUsed() !== $actualRevId )
) {
$this->saveParseLogger->info(
- "$method: Prepared output has vary-revision-id with wrong ID...\n"
+ "$method: Prepared output has vary-revision-id with wrong ID..."
+ );
+ return true;
+ } elseif ( $out->getFlag( 'vary-revision-timestamp' )
+ && $actualRevTimestamp !== false
+ && ( $actualRevTimestamp === true ||
+ $out->getRevisionTimestampUsed() !== $actualRevTimestamp )
+ ) {
+ $this->saveParseLogger->info(
+ "$method: Prepared output has vary-revision-timestamp with wrong timestamp..."
);
return true;
} elseif ( $out->getFlag( 'vary-revision-exists' ) ) {
// Note that edit stashing always uses '-', which can be used for both
// edit filter checks and canonical parser cache.
$this->saveParseLogger->info(
- "$method: Prepared output has vary-revision-exists...\n"
+ "$method: Prepared output has vary-revision-exists..."
);
return true;
} else {
// constructs the ParserOptions: For a null-edit, setCurrentRevisionCallback is called
// with the old, existing revision.
- wfDebug( "$method: Keeping prepared output...\n" );
+ $this->saveParseLogger->debug( "$method: Keeping prepared output..." );
return false;
}
}