X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fapi%2FApiStashEdit.php;h=d03fca87a0b58efea8c043fa32eb5b21de45f761;hp=37ee3e76232b4d654cb163b81beea6be996c56ae;hb=12601ff7d2796752404bfb331fccc41083d31f9f;hpb=24dc5218b18bfa065a101057523f39a9c046d046 diff --git a/includes/api/ApiStashEdit.php b/includes/api/ApiStashEdit.php index 37ee3e7623..d03fca87a0 100644 --- a/includes/api/ApiStashEdit.php +++ b/includes/api/ApiStashEdit.php @@ -16,7 +16,6 @@ * http://www.gnu.org/copyleft/gpl.html * * @file - * @author Aaron Schulz */ use MediaWiki\Logger\LoggerFactory; @@ -45,6 +44,7 @@ class ApiStashEdit extends ApiBase { const PRESUME_FRESH_TTL_SEC = 30; const MAX_CACHE_TTL = 300; // 5 minutes + const MAX_SIGNATURE_TTL = 60; public function execute() { $user = $this->getUser(); @@ -392,6 +392,12 @@ class ApiStashEdit extends ApiBase { // Put an upper limit on the TTL for sanity to avoid extreme template/file staleness. $since = time() - wfTimestamp( TS_UNIX, $parserOutput->getTimestamp() ); $ttl = min( $parserOutput->getCacheExpiry() - $since, self::MAX_CACHE_TTL ); + + // Avoid extremely stale user signature timestamps (T84843) + if ( $parserOutput->getFlag( 'user-signature' ) ) { + $ttl = min( $ttl, self::MAX_SIGNATURE_TTL ); + } + if ( $ttl <= 0 ) { return [ null, 0, 'no_ttl' ]; }