Index: trunk/phase3/includes/ProtectionForm.php |
— | — | @@ -158,7 +158,7 @@ |
159 | 159 | $value = $this->mExpirySelection[$action]; |
160 | 160 | } |
161 | 161 | if ( $value == 'infinite' || $value == 'indefinite' || $value == 'infinity' ) { |
162 | | - $time = Block::infinity(); |
| 162 | + $time = wfGetDB( DB_SLAVE )->getInfinity(); |
163 | 163 | } else { |
164 | 164 | $unix = strtotime( $value ); |
165 | 165 | |
Index: trunk/phase3/includes/Article.php |
— | — | @@ -2615,7 +2615,7 @@ |
2616 | 2616 | $protect_description = ''; |
2617 | 2617 | foreach ( $limit as $action => $restrictions ) { |
2618 | 2618 | if ( !isset( $expiry[$action] ) ) |
2619 | | - $expiry[$action] = Block::infinity(); |
| 2619 | + $expiry[$action] = $dbw->getInfinity(); |
2620 | 2620 | |
2621 | 2621 | $encodedExpiry[$action] = $dbw->encodeExpiry( $expiry[$action] ); |
2622 | 2622 | if ( $restrictions != '' ) { |
Index: trunk/phase3/includes/OutputPage.php |
— | — | @@ -1909,15 +1909,7 @@ |
1910 | 1910 | |
1911 | 1911 | $blockid = $wgUser->mBlock->mId; |
1912 | 1912 | |
1913 | | - $blockExpiry = $wgUser->mBlock->mExpiry; |
1914 | | - if ( $blockExpiry == Block::infinity() ) { |
1915 | | - $blockExpiry = wfMessage( 'infiniteblock' ); |
1916 | | - } else { |
1917 | | - $blockExpiry = $wgLang->timeanddate( |
1918 | | - wfTimestamp( TS_MW, $blockExpiry ), |
1919 | | - true |
1920 | | - ); |
1921 | | - } |
| 1913 | + $blockExpiry = $wgLang->formatExpiry( $wgUser->mBlock->mExpiry ); |
1922 | 1914 | |
1923 | 1915 | if ( $wgUser->mBlock->mAuto ) { |
1924 | 1916 | $msg = 'autoblockedtext'; |
Index: trunk/phase3/includes/api/ApiProtect.php |
— | — | @@ -63,6 +63,7 @@ |
64 | 64 | } |
65 | 65 | |
66 | 66 | $restrictionTypes = $titleObj->getRestrictionTypes(); |
| 67 | + $dbr = wfGetDB( DB_SLAVE ); |
67 | 68 | |
68 | 69 | $protections = array(); |
69 | 70 | $expiryarray = array(); |
— | — | @@ -86,7 +87,7 @@ |
87 | 88 | } |
88 | 89 | |
89 | 90 | if ( in_array( $expiry[$i], array( 'infinite', 'indefinite', 'never' ) ) ) { |
90 | | - $expiryarray[$p[0]] = Block::infinity(); |
| 91 | + $expiryarray[$p[0]] = $dbr->getInfinity(); |
91 | 92 | } else { |
92 | 93 | $exp = strtotime( $expiry[$i] ); |
93 | 94 | if ( $exp < 0 || !$exp ) { |
— | — | @@ -100,7 +101,7 @@ |
101 | 102 | $expiryarray[$p[0]] = $exp; |
102 | 103 | } |
103 | 104 | $resultProtections[] = array( $p[0] => $protections[$p[0]], |
104 | | - 'expiry' => ( $expiryarray[$p[0]] == Block::infinity() ? |
| 105 | + 'expiry' => ( $expiryarray[$p[0]] == $dbr->getInfinity() ? |
105 | 106 | 'infinite' : |
106 | 107 | wfTimestamp( TS_ISO_8601, $expiryarray[$p[0]] ) ) ); |
107 | 108 | } |
Index: trunk/phase3/includes/api/ApiBlock.php |
— | — | @@ -104,7 +104,7 @@ |
105 | 105 | |
106 | 106 | $block = Block::newFromTargetAndType( $target, $type ); |
107 | 107 | if( $block instanceof Block ){ |
108 | | - $res['expiry'] = $block->mExpiry == Block::infinity() |
| 108 | + $res['expiry'] = $block->mExpiry == wfGetDB( DB_SLAVE )->getInfinity() |
109 | 109 | ? 'infinite' |
110 | 110 | : wfTimestamp( TS_ISO_8601, $block->mExpiry ); |
111 | 111 | } else { |
Index: trunk/phase3/includes/specials/SpecialBlockList.php |
— | — | @@ -301,9 +301,7 @@ |
302 | 302 | break; |
303 | 303 | |
304 | 304 | case 'ipb_expiry': |
305 | | - $formatted = $value == Block::infinity() |
306 | | - ? $msg['infiniteblock'] |
307 | | - : $wgLang->timeanddate( $value ); |
| 305 | + $formatted = $wgLang->formatExpiry( $value ); |
308 | 306 | if( $wgUser->isAllowed( 'block' ) ){ |
309 | 307 | if( $row->ipb_auto ){ |
310 | 308 | $links[] = $sk->linkKnown( |
Index: trunk/phase3/includes/specials/SpecialBlock.php |
— | — | @@ -120,7 +120,7 @@ |
121 | 121 | 'validation-callback' => array( __CLASS__, 'validateTargetField' ), |
122 | 122 | ), |
123 | 123 | 'Expiry' => array( |
124 | | - 'type' => self::getSuggestedDurations() === array() ? 'text' : 'selectorother', |
| 124 | + 'type' => !count( self::getSuggestedDurations() ) ? 'text' : 'selectorother', |
125 | 125 | 'label-message' => 'ipbexpiry', |
126 | 126 | 'required' => true, |
127 | 127 | 'tabindex' => '2', |
— | — | @@ -668,8 +668,12 @@ |
669 | 669 | * @return String: timestamp or "infinity" string for the DB implementation |
670 | 670 | */ |
671 | 671 | public static function parseExpiryInput( $expiry ) { |
| 672 | + static $infinity; |
| 673 | + if( $infinity == null ){ |
| 674 | + $infinity = wfGetDB( DB_READ )->getInfinity(); |
| 675 | + } |
672 | 676 | if ( $expiry == 'infinite' || $expiry == 'indefinite' ) { |
673 | | - $expiry = Block::infinity(); |
| 677 | + $expiry = $infinity; |
674 | 678 | } else { |
675 | 679 | $expiry = strtotime( $expiry ); |
676 | 680 | if ( $expiry < 0 || $expiry === false ) { |
Index: trunk/phase3/includes/specials/SpecialProtectedpages.php |
— | — | @@ -80,11 +80,11 @@ |
81 | 81 | |
82 | 82 | wfProfileIn( __METHOD__ ); |
83 | 83 | |
84 | | - static $skin = null, $dbr = null; |
| 84 | + static $skin = null, $infinity = null; |
85 | 85 | |
86 | 86 | if( is_null( $skin ) ){ |
87 | 87 | $skin = $wgUser->getSkin(); |
88 | | - $dbr = wfGetDB( DB_READ ); |
| 88 | + $infinity = wfGetDB( DB_READ )->getInfinity(); |
89 | 89 | } |
90 | 90 | |
91 | 91 | $title = Title::makeTitleSafe( $row->page_namespace, $row->page_title ); |
— | — | @@ -103,7 +103,7 @@ |
104 | 104 | $stxt = ''; |
105 | 105 | |
106 | 106 | $expiry = $wgLang->formatExpiry( $row->pr_expiry, TS_MW ); |
107 | | - if( $expiry != $dbr->getInfinity() ) { |
| 107 | + if( $expiry != $infinity ) { |
108 | 108 | |
109 | 109 | $expiry_description = wfMsg( |
110 | 110 | 'protect-expiring', |
Index: trunk/phase3/includes/Block.php |
— | — | @@ -781,11 +781,7 @@ |
782 | 782 | * @deprecated since 1.18; use $dbw->encodeExpiry() instead |
783 | 783 | */ |
784 | 784 | public static function encodeExpiry( $expiry, $db ) { |
785 | | - if ( $expiry == '' || $expiry == Block::infinity() ) { |
786 | | - return Block::infinity(); |
787 | | - } else { |
788 | | - return $db->timestamp( $expiry ); |
789 | | - } |
| 785 | + return $db->encodeExpiry( $expiry ); |
790 | 786 | } |
791 | 787 | |
792 | 788 | /** |
— | — | @@ -859,7 +855,7 @@ |
860 | 856 | /** |
861 | 857 | * Get a value to insert into expiry field of the database when infinite expiry |
862 | 858 | * is desired |
863 | | - * |
| 859 | + * @deprecated since 1.18, call $dbr->getInfinity() directly |
864 | 860 | * @return String |
865 | 861 | */ |
866 | 862 | public static function infinity() { |
— | — | @@ -887,7 +883,7 @@ |
888 | 884 | } |
889 | 885 | |
890 | 886 | $expiry = $wgContLang->formatExpiry( $encoded_expiry, TS_MW ); |
891 | | - if ( $expiry == self::infinity() ) { |
| 887 | + if ( $expiry == wfGetDB( DB_SLAVE )->getInfinity() ) { |
892 | 888 | $expirystr = $msg['infiniteblock']; |
893 | 889 | } else { |
894 | 890 | global $wgLang; |