return false;
}
- $age = time() - wfTimestamp( TS_UNIX, $editInfo->output->getCacheTime() );
+ $age = time() - (int)wfTimestamp( TS_UNIX, $editInfo->output->getCacheTime() );
$context['age'] = $age;
$isCacheUsable = true;
if ( $editInfo->output->getFlag( 'vary-revision' ) ) {
// This can be used for the initial parse, e.g. for filters or doEditContent(),
- // but a second parse will be triggered in doEditUpdates(). This is not optimal.
+ // but a second parse will be triggered in doEditUpdates() no matter what
$logger->info(
- "Cache for key '{key}' has vary_revision; post-insertion parse inevitable.",
- $context
- );
- } elseif ( $editInfo->output->getFlag( 'vary-revision-id' ) ) {
- // Similar to the above if we didn't guess the ID correctly.
- $logger->debug(
- "Cache for key '{key}' has vary_revision_id; post-insertion parse possible.",
- $context
- );
- } elseif ( $editInfo->output->getFlag( 'vary-revision-timestamp' ) ) {
- // Similar to the above if we didn't guess the timestamp correctly.
- $logger->debug(
- "Cache for key '{key}' has vary_revision_timestamp; post-insertion parse possible.",
+ "Cache for key '{key}' has vary-revision; post-insertion parse inevitable.",
$context
);
+ } else {
+ static $flagsMaybeReparse = [
+ // Similar to the above if we didn't guess the ID correctly
+ 'vary-revision-id',
+ // Similar to the above if we didn't guess the timestamp correctly
+ 'vary-revision-timestamp',
+ // Similar to the above if we didn't guess the content correctly
+ 'vary-revision-sha1',
+ // Similar to the above if we didn't guess page ID correctly
+ 'vary-page-id'
+ ];
+ foreach ( $flagsMaybeReparse as $flag ) {
+ if ( $editInfo->output->getFlag( $flag ) ) {
+ $logger->debug(
+ "Cache for key '{key}' has $flag; post-insertion parse possible.",
+ $context
+ );
+ }
+ }
}
return $editInfo;
) {
// If an item is renewed, mind the cache TTL determined by config and parser functions.
// Put an upper limit on the TTL for sanity to avoid extreme template/file staleness.
- $age = time() - wfTimestamp( TS_UNIX, $parserOutput->getCacheTime() );
+ $age = time() - (int)wfTimestamp( TS_UNIX, $parserOutput->getCacheTime() );
$ttl = min( $parserOutput->getCacheExpiry() - $age, self::MAX_CACHE_TTL );
// Avoid extremely stale user signature timestamps (T84843)
if ( $parserOutput->getFlag( 'user-signature' ) ) {