Index: trunk/phase3/includes/Block.php |
— | — | @@ -77,7 +77,11 @@ |
78 | 78 | $this->mAuto = $auto; |
79 | 79 | $this->isHardblock( !$anonOnly ); |
80 | 80 | $this->prevents( 'createaccount', $createAccount ); |
81 | | - $this->mExpiry = $expiry; |
| 81 | + if ( $expiry == 'infinity' || $expiry == Block::infinity() ) { |
| 82 | + $this->mExpiry = 'infinity'; |
| 83 | + } else { |
| 84 | + $this->mExpiry = wfTimestamp( TS_MW, $expiry ); |
| 85 | + } |
82 | 86 | $this->isAutoblocking( $enableAutoblock ); |
83 | 87 | $this->mHideName = $hideName; |
84 | 88 | $this->prevents( 'sendemail', $blockEmail ); |
— | — | @@ -342,13 +346,20 @@ |
343 | 347 | protected function initFromRow( $row ) { |
344 | 348 | $this->setTarget( $row->ipb_address ); |
345 | 349 | $this->setBlocker( User::newFromId( $row->ipb_by ) ); |
346 | | - |
| 350 | + |
347 | 351 | $this->mReason = $row->ipb_reason; |
348 | 352 | $this->mTimestamp = wfTimestamp( TS_MW, $row->ipb_timestamp ); |
349 | 353 | $this->mAuto = $row->ipb_auto; |
350 | 354 | $this->mHideName = $row->ipb_deleted; |
351 | 355 | $this->mId = $row->ipb_id; |
352 | | - $this->mExpiry = $row->ipb_expiry; |
| 356 | + |
| 357 | + // I wish I didn't have to do this |
| 358 | + $db = wfGetDB( DB_SLAVE ); |
| 359 | + if ( $row->ipb_expiry == $db->getInfinity() ) { |
| 360 | + $this->mExpiry = 'infinity'; |
| 361 | + } else { |
| 362 | + $this->mExpiry = wfTimestamp( TS_MW, $row->ipb_expiry ); |
| 363 | + } |
353 | 364 | |
354 | 365 | $this->isHardblock( !$row->ipb_anon_only ); |
355 | 366 | $this->isAutoblocking( $row->ipb_enable_autoblock ); |
— | — | @@ -455,7 +466,7 @@ |
456 | 467 | if( !$db ){ |
457 | 468 | $db = wfGetDB( DB_SLAVE ); |
458 | 469 | } |
459 | | - $this->mExpiry = $db->encodeExpiry( $this->mExpiry ); |
| 470 | + $expiry = $db->encodeExpiry( $this->mExpiry ); |
460 | 471 | |
461 | 472 | $a = array( |
462 | 473 | 'ipb_address' => (string)$this->target, |
— | — | @@ -468,7 +479,7 @@ |
469 | 480 | 'ipb_anon_only' => !$this->isHardblock(), |
470 | 481 | 'ipb_create_account' => $this->prevents( 'createaccount' ), |
471 | 482 | 'ipb_enable_autoblock' => $this->isAutoblocking(), |
472 | | - 'ipb_expiry' => $this->mExpiry, |
| 483 | + 'ipb_expiry' => $expiry, |
473 | 484 | 'ipb_range_start' => $this->getRangeStart(), |
474 | 485 | 'ipb_range_end' => $this->getRangeEnd(), |
475 | 486 | 'ipb_deleted' => intval( $this->mHideName ), // typecast required for SQLite |