diff options
author | Umherirrender <umherirrender_de.wp@web.de> | 2021-12-04 22:14:56 +0100 |
---|---|---|
committer | Krinkle <krinkle@fastmail.com> | 2022-04-12 20:57:18 +0000 |
commit | d7809a41d97a108c0a68d23dfe14d84e57cb1db4 (patch) | |
tree | 3f6f15046c5241dad6082081ebb1b9be1855235f /includes/logging | |
parent | 3dd77b0c470522d591f587c9c89548376be874ba (diff) | |
download | mediawikicore-d7809a41d97a108c0a68d23dfe14d84e57cb1db4.tar.gz mediawikicore-d7809a41d97a108c0a68d23dfe14d84e57cb1db4.zip |
logging: Normalize "infinity" in BlockLogFormatter for pre-T241709 rows
This allows the API to consistently return the new value for old rows.
Bug: T241709
Follow-Up: I36f49dc83718cc78f17fc340e6445030b8fd0c66
Change-Id: Ida69980f62a6ef070ba41b7e826967f424881716
Diffstat (limited to 'includes/logging')
-rw-r--r-- | includes/logging/BlockLogFormatter.php | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/includes/logging/BlockLogFormatter.php b/includes/logging/BlockLogFormatter.php index 87318deb4b66..7e860615ae36 100644 --- a/includes/logging/BlockLogFormatter.php +++ b/includes/logging/BlockLogFormatter.php @@ -51,8 +51,8 @@ class BlockLogFormatter extends LogFormatter { $subtype = $this->entry->getSubtype(); if ( $subtype === 'block' || $subtype === 'reblock' ) { if ( !isset( $params[4] ) ) { - // Very old log entry without duration: means infinite - $params[4] = 'infinite'; + // Very old log entry without duration: means infinity + $params[4] = 'infinity'; } // Localize the duration, and add a tooltip // in English to help visitors from other wikis. @@ -264,7 +264,7 @@ class BlockLogFormatter extends LogFormatter { if ( $subtype === 'block' || $subtype === 'reblock' ) { // Defaults for old log entries missing some fields $params += [ - '5::duration' => 'infinite', + '5::duration' => 'infinity', '6:array:flags' => [], ]; @@ -275,7 +275,10 @@ class BlockLogFormatter extends LogFormatter { : explode( ',', $params['6:array:flags'] ); } - if ( !wfIsInfinity( $params['5::duration'] ) ) { + if ( wfIsInfinity( $params['5::duration'] ) ) { + // Normalize all possible values to one for pre-T241709 rows + $params['5::duration'] = 'infinity'; + } else { $ts = (int)wfTimestamp( TS_UNIX, $entry->getTimestamp() ); $expiry = strtotime( $params['5::duration'], $ts ); if ( $expiry !== false && $expiry > 0 ) { |