Merge "Push all DeferredUpdates to POSTSEND queue when running that queue"
[lhc/web/wiklou.git] / includes / api / ApiStashEdit.php
index e29fda5..d03fca8 100644 (file)
@@ -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();
@@ -168,7 +168,7 @@ class ApiStashEdit extends ApiBase {
         * @param Content $content Edit content
         * @param User $user
         * @param string $summary Edit summary
-        * @return integer ApiStashEdit::ERROR_* constant
+        * @return string ApiStashEdit::ERROR_* constant
         * @since 1.25
         */
        public static function parseAndStash( WikiPage $page, Content $content, User $user, $summary ) {
@@ -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' ];
                }