diff options
author | jenkins-bot <jenkins-bot@gerrit.wikimedia.org> | 2024-08-26 16:00:08 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@wikimedia.org> | 2024-08-26 16:00:08 +0000 |
commit | 672f5d7e6b85c59efa376f49212adf5372e3e24d (patch) | |
tree | 26aea65c69cee91fffb369c92ae830e2d9c04bd2 | |
parent | f272d5dd8e5f76eab01f663088e3fec25d50c282 (diff) | |
parent | c668d33d215c43b0ea23cf39ec8459b0dc30d468 (diff) | |
download | mediawikicore-672f5d7e6b85c59efa376f49212adf5372e3e24d.tar.gz mediawikicore-672f5d7e6b85c59efa376f49212adf5372e3e24d.zip |
Merge "parser: Avoid cache stampede on pages which use {{CURRENTYEAR}}"
-rw-r--r-- | includes/parser/CoreMagicVariables.php | 2 | ||||
-rw-r--r-- | tests/phpunit/includes/parser/MagicVariableTest.php | 60 |
2 files changed, 31 insertions, 31 deletions
diff --git a/includes/parser/CoreMagicVariables.php b/includes/parser/CoreMagicVariables.php index b3c28d5a28af..7e0ccd9c5ae6 100644 --- a/includes/parser/CoreMagicVariables.php +++ b/includes/parser/CoreMagicVariables.php @@ -351,7 +351,7 @@ class CoreMagicVariables { $ttl = max( $deadlineUnix - $tsUnix, self::MIN_DEADLINE_TTL ); $ttl += self::DEADLINE_TTL_CLOCK_FUDGE; - $ttl += ( $deadlineUnix % self::DEADLINE_TTL_STAGGER_MAX ); + $ttl += ( $tsUnix % self::DEADLINE_TTL_STAGGER_MAX ); $parser->getOutput()->updateCacheExpiry( $ttl ); } diff --git a/tests/phpunit/includes/parser/MagicVariableTest.php b/tests/phpunit/includes/parser/MagicVariableTest.php index 8ed99b6fb4e5..d12bad4b45e7 100644 --- a/tests/phpunit/includes/parser/MagicVariableTest.php +++ b/tests/phpunit/includes/parser/MagicVariableTest.php @@ -170,13 +170,13 @@ class MagicVariableTest extends MediaWikiIntegrationTestCase { [ 'currentmonthname', '20200208153011', 'February', 604800 ], [ 'currentmonthnamegen', '20200208153011', 'February', 604800 ], [ 'currentmonthabbrev', '20200208153011', 'Feb', 604800 ], - [ 'currentday', '20200208153011', '8', 30590 ], - [ 'currentday2', '20200208153011', '08', 30590 ], - [ 'currentdayname', '20200208153011', 'Saturday', 30590 ], + [ 'currentday', '20200208153011', '8', 30601 ], + [ 'currentday2', '20200208153011', '08', 30601 ], + [ 'currentdayname', '20200208153011', 'Saturday', 30601 ], [ 'currentyear', '20200208153011', '2020', 604800 ], - [ 'currenthour', '20200208153011', '15', 1790 ], - [ 'currentweek', '20200208153011', '6', 30590 ], - [ 'currentdow', '20200208153011', '6', 30590 ], + [ 'currenthour', '20200208153011', '15', 1801 ], + [ 'currentweek', '20200208153011', '6', 30601 ], + [ 'currentdow', '20200208153011', '6', 30601 ], [ 'currenttime', '20200208153011', '15:30', 3600 ], // Night [ 'currentmonth', '20200208223011', '02', 604800 ], @@ -184,13 +184,13 @@ class MagicVariableTest extends MediaWikiIntegrationTestCase { [ 'currentmonthname', '20200208223011', 'February', 604800 ], [ 'currentmonthnamegen', '20200208223011', 'February', 604800 ], [ 'currentmonthabbrev', '20200208223011', 'Feb', 604800 ], - [ 'currentday', '20200208223011', '8', 5390 ], - [ 'currentday2', '20200208223011', '08', 5390 ], - [ 'currentdayname', '20200208223011', 'Saturday', 5390 ], + [ 'currentday', '20200208223011', '8', 5401 ], + [ 'currentday2', '20200208223011', '08', 5401 ], + [ 'currentdayname', '20200208223011', 'Saturday', 5401 ], [ 'currentyear', '20200208223011', '2020', 604800 ], - [ 'currenthour', '20200208223011', '22', 1790 ], - [ 'currentweek', '20200208223011', '6', 5390 ], - [ 'currentdow', '20200208223011', '6', 5390 ], + [ 'currenthour', '20200208223011', '22', 1801 ], + [ 'currentweek', '20200208223011', '6', 5401 ], + [ 'currentdow', '20200208223011', '6', 5401 ], [ 'currenttime', '20200208223011', '22:30', 3600 ] ]; } @@ -204,13 +204,13 @@ class MagicVariableTest extends MediaWikiIntegrationTestCase { [ 'localmonthname', '20200208153011', 'February', 604800 ], [ 'localmonthnamegen', '20200208153011', 'February', 604800 ], [ 'localmonthabbrev', '20200208153011', 'Feb', 604800 ], - [ 'localday', '20200208153011', '8', 26990 ], - [ 'localday2', '20200208153011', '08', 26990 ], - [ 'localdayname', '20200208153011', 'Saturday', 26990 ], + [ 'localday', '20200208153011', '8', 27001 ], + [ 'localday2', '20200208153011', '08', 27001 ], + [ 'localdayname', '20200208153011', 'Saturday', 27001 ], [ 'localyear', '20200208153011', '2020', 604800 ], - [ 'localhour', '20200208153011', '16', 1790 ], - [ 'localweek', '20200208153011', '6', 26990 ], - [ 'localdow', '20200208153011', '6', 26990 ], + [ 'localhour', '20200208153011', '16', 1801 ], + [ 'localweek', '20200208153011', '6', 27001 ], + [ 'localdow', '20200208153011', '6', 27001 ], [ 'localtime', '20200208153011', '16:30', 3600 ], // Night [ 'localmonth', '20200208223011', '02', 604800 ], @@ -218,13 +218,13 @@ class MagicVariableTest extends MediaWikiIntegrationTestCase { [ 'localmonthname', '20200208223011', 'February', 604800 ], [ 'localmonthnamegen', '20200208223011', 'February', 604800 ], [ 'localmonthabbrev', '20200208223011', 'Feb', 604800 ], - [ 'localday', '20200208223011', '8', 1790 ], - [ 'localday2', '20200208223011', '08', 1790 ], - [ 'localdayname', '20200208223011', 'Saturday', 1790 ], + [ 'localday', '20200208223011', '8', 1801 ], + [ 'localday2', '20200208223011', '08', 1801 ], + [ 'localdayname', '20200208223011', 'Saturday', 1801 ], [ 'localyear', '20200208223011', '2020', 604800 ], - [ 'localhour', '20200208223011', '23', 1790 ], - [ 'localweek', '20200208223011', '6', 1790 ], - [ 'localdow', '20200208223011', '6', 1790 ], + [ 'localhour', '20200208223011', '23', 1801 ], + [ 'localweek', '20200208223011', '6', 1801 ], + [ 'localdow', '20200208223011', '6', 1801 ], [ 'localtime', '20200208223011', '23:30', 3600 ], // Late night / early morning [ 'localmonth', '20200208233011', '02', 604800 ], @@ -232,13 +232,13 @@ class MagicVariableTest extends MediaWikiIntegrationTestCase { [ 'localmonthname', '20200208233011', 'February', 604800 ], [ 'localmonthnamegen', '20200208233011', 'February', 604800 ], [ 'localmonthabbrev', '20200208233011', 'Feb', 604800 ], - [ 'localday', '20200208233011', '9', 84590 ], - [ 'localday2', '20200208233011', '09', 84590 ], - [ 'localdayname', '20200208233011', 'Sunday', 84590 ], + [ 'localday', '20200208233011', '9', 84601 ], + [ 'localday2', '20200208233011', '09', 84601 ], + [ 'localdayname', '20200208233011', 'Sunday', 84601 ], [ 'localyear', '20200208233011', '2020', 604800 ], - [ 'localhour', '20200208233011', '00', 1790 ], - [ 'localweek', '20200208233011', '6', 84590 ], - [ 'localdow', '20200208233011', '0', 84590 ], + [ 'localhour', '20200208233011', '00', 1801 ], + [ 'localweek', '20200208233011', '6', 84601 ], + [ 'localdow', '20200208233011', '0', 84601 ], [ 'localtime', '20200208233011', '00:30', 3600 ] ]; } |