From 69e66bdfe946ee4e0bdae969f7a4748cb686f34b Mon Sep 17 00:00:00 2001 From: Jure Kajzer Date: Thu, 10 Nov 2011 09:36:18 +0000 Subject: [PATCH] * reverted changes to Block and ApiBlockTest made in r102625 ... PEBKAC --- includes/Block.php | 11 ++++++----- tests/phpunit/includes/api/ApiBlockTest.php | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/includes/Block.php b/includes/Block.php index 6be0348d31..7aa1bc1dc8 100644 --- a/includes/Block.php +++ b/includes/Block.php @@ -81,8 +81,8 @@ class Block { $this->mAuto = $auto; $this->isHardblock( !$anonOnly ); $this->prevents( 'createaccount', $createAccount ); - if ( $expiry == wfGetDB( DB_SLAVE )->getInfinity() ) { - $this->mExpiry = $expiry; + if ( $expiry == 'infinity' || $expiry == wfGetDB( DB_SLAVE )->getInfinity() ) { + $this->mExpiry = 'infinity'; } else { $this->mExpiry = wfTimestamp( TS_MW, $expiry ); } @@ -362,8 +362,9 @@ class Block { $this->mId = $row->ipb_id; // I wish I didn't have to do this - if ( $row->ipb_expiry == wfGetDB( DB_SLAVE )->getInfinity() ) { - $this->mExpiry = $row->ipb_expiry; + $db = wfGetDB( DB_SLAVE ); + if ( $row->ipb_expiry == $db->getInfinity() ) { + $this->mExpiry = 'infinity'; } else { $this->mExpiry = wfTimestamp( TS_MW, $row->ipb_expiry ); } @@ -652,7 +653,7 @@ class Block { $autoblock->mHideName = $this->mHideName; $autoblock->prevents( 'editownusertalk', $this->prevents( 'editownusertalk' ) ); - if ( $this->mExpiry == wfGetDB( DB_SLAVE )->getInfinity() ) { + if ( $this->mExpiry == 'infinity' ) { # Original block was indefinite, start an autoblock now $autoblock->mExpiry = Block::getAutoblockExpiry( $timestamp ); } else { diff --git a/tests/phpunit/includes/api/ApiBlockTest.php b/tests/phpunit/includes/api/ApiBlockTest.php index 514ca852da..514da42120 100644 --- a/tests/phpunit/includes/api/ApiBlockTest.php +++ b/tests/phpunit/includes/api/ApiBlockTest.php @@ -55,7 +55,7 @@ class ApiBlockTest extends ApiTestCase { $this->assertEquals( 'UTApiBlockee', (string)$block->getTarget() ); $this->assertEquals( 'Some reason', $block->mReason ); - $this->assertEquals( $this->db->getInfinity(), $block->mExpiry ); + $this->assertEquals( 'infinity', $block->mExpiry ); } -- 2.20.1