From: Jackmcbarn Date: Fri, 29 Aug 2014 15:30:37 +0000 (-0400) Subject: Don't break existing expiry time of "infinity" when modifying protection X-Git-Tag: 1.31.0-rc.0~13969^2 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/bilan.php?a=commitdiff_plain;h=e0400a2da02a06896944812af8439e411e0755f7;p=lhc%2Fweb%2Fwiklou.git Don't break existing expiry time of "infinity" when modifying protection Currently, modifying protection with infinite expiry time causes it to be set to a blank "Other time", which causes an error. This fixes it to act the same way as existing expiry times. Bug: 70062 Change-Id: I3a7d45a677151597a941ecb11584bc1d67001136 --- diff --git a/includes/ProtectionForm.php b/includes/ProtectionForm.php index 4aa65d9403..57d17dc462 100644 --- a/includes/ProtectionForm.php +++ b/includes/ProtectionForm.php @@ -384,13 +384,18 @@ class ProtectionForm { ); $expiryFormOptions = ''; - if ( $this->mExistingExpiry[$action] && $this->mExistingExpiry[$action] != 'infinity' ) { - $timestamp = $lang->timeanddate( $this->mExistingExpiry[$action], true ); - $d = $lang->date( $this->mExistingExpiry[$action], true ); - $t = $lang->time( $this->mExistingExpiry[$action], true ); + if ( $this->mExistingExpiry[$action] ) { + if ( $this->mExistingExpiry[$action] == 'infinity' ) { + $existingExpiryMessage = wfMessage( 'protect-existing-expiry-infinity' ); + } else { + $timestamp = $lang->timeanddate( $this->mExistingExpiry[$action], true ); + $d = $lang->date( $this->mExistingExpiry[$action], true ); + $t = $lang->time( $this->mExistingExpiry[$action], true ); + $existingExpiryMessage = wfMessage( 'protect-existing-expiry', $timestamp, $d, $t ); + } $expiryFormOptions .= Xml::option( - wfMessage( 'protect-existing-expiry', $timestamp, $d, $t )->text(), + $existingExpiryMessage->text(), 'existing', $this->mExpirySelection[$action] == 'existing' ) . "\n"; diff --git a/languages/i18n/en.json b/languages/i18n/en.json index e1143b50c6..477437e0a7 100644 --- a/languages/i18n/en.json +++ b/languages/i18n/en.json @@ -1928,6 +1928,7 @@ "protect-othertime": "Other time:", "protect-othertime-op": "other time", "protect-existing-expiry": "Existing expiry time: $3, $2", + "protect-existing-expiry-infinity": "Existing expiry time: infinite", "protect-otherreason": "Other/additional reason:", "protect-otherreason-op": "Other reason", "protect-dropdown": "*Common protection reasons\n** Excessive vandalism\n** Excessive spamming\n** Counter-productive edit warring\n** High traffic page", diff --git a/languages/i18n/qqq.json b/languages/i18n/qqq.json index c6d5f12547..c9a6d954c5 100644 --- a/languages/i18n/qqq.json +++ b/languages/i18n/qqq.json @@ -2089,7 +2089,8 @@ "protect-cantedit": "Used as error message when changing the protection levels of the page.", "protect-othertime": "Used on the page protection form as label for the following input field (text)\n{{Identical|Other time}}", "protect-othertime-op": "Used on the page protection form in the drop down menu\n{{Identical|Other time}}", - "protect-existing-expiry": "Shows the existing expiry time in the drop down menu of the protection form ([{{canonicalurl:User:Raymond/test|action=unprotect}} example])\n\nParameters:\n* $1 - (Unused) date and time of the existing expiry time (kept for backward compatibility purposes)\n* $2 - date of the existing expiry time\n* $3 - time of the existing expiry time", + "protect-existing-expiry": "Shows the existing expiry time in the drop down menu of the protection form ([{{canonicalurl:User:Raymond/test|action=unprotect}} example])\n\nParameters:\n* $1 - (Unused) date and time of the existing expiry time (kept for backward compatibility purposes)\n* $2 - date of the existing expiry time\n* $3 - time of the existing expiry time\n\nSee also:\n* {{msg-mw|protect-existing-expiry-infinity}}", + "protect-existing-expiry-infinity": "Shows the existing expiry time in the drop down menu of the protection form, in the special case that it is infinity\n\nSee also:\n* {{msg-mw|protect-existing-expiry}}", "protect-otherreason": "Shown on the page protection form as label for the following input field (text)\n{{Identical|Other/additional reason}}", "protect-otherreason-op": "Shown on the page protection form in the drop down menu\n{{Identical|Other reason}}", "protect-dropdown": "Shown on the page protection form as drop down menu for protection reasons.\n\n* * Groupname - defines a new group\n* ** Reason - defines a reason in this group",