r99154 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r99153‎ | r99154 | r99155 >
Date:22:20, 6 October 2011
Author:brion
Status:ok
Tags:
Comment:
* (bug 31352) Fix regression causing relative block times in log display to resolve against current time

Revert r91770, r91786: strtotime() to resolve relative times is unsafe when the base of that relative time might have been days, months, or years ago and isn't provided to the function. :)
Modified paths:
  • /trunk/phase3/languages/Language.php (modified) (history)

Diff [purge]

Index: trunk/phase3/languages/Language.php
@@ -3095,8 +3095,12 @@
30963096 }
30973097
30983098 /**
3099 - * This translates the duration ("1 week", "4 days", etc)
3100 - * as well as the expiry time (which is an absolute timestamp).
 3099+ * @todo Maybe translate block durations. Note that this function is somewhat misnamed: it
 3100+ * deals with translating the *duration* ("1 week", "4 days", etc), not the expiry time
 3101+ * (which is an absolute timestamp). Please note: do NOT add this blindly, as it is used
 3102+ * on old expiry lengths recorded in log entries. You'd need to provide the start date to
 3103+ * match up with it.
 3104+ *
31013105 * @param $str String: the validated block duration in English
31023106 * @return Somehow translated block duration
31033107 * @see LanguageFi.php for example implementation
@@ -3120,8 +3124,8 @@
31213125 }
31223126 }
31233127 }
3124 - // If no duration is given, but a timestamp, display that
3125 - return ( strtotime( $str ) ? $this->timeanddate( strtotime( $str ) ) : $str );
 3128+ // If all else fails, return the original string.
 3129+ return $str;
31263130 }
31273131
31283132 /**

Follow-up revisions

RevisionCommit summaryAuthorDate
r99156MFT r99154demon22:25, 6 October 2011
r99157MFT r99154, r99155 (bug 31352)brion22:26, 6 October 2011
r100379REL1_18 MFT r99135, r99136, r99138, r99154, r99172, r99250, r99252, r99254, r...reedy21:22, 20 October 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r91770Translate the block expiry date...robin23:36, 8 July 2011
r91786Follow-up r91770: only translate when possiblerobin12:54, 9 July 2011

Status & tagging log