From: Brion Vibber Date: Tue, 11 Jan 2005 09:29:29 +0000 (+0000) Subject: * (bug 1184) expiry time of indefinite blocks shown as the current time X-Git-Tag: 1.5.0alpha1~966 X-Git-Url: https://git.cyclocoop.org/admin/?a=commitdiff_plain;h=7d099581bad37d0811f24b17dbd7e75d4cf07f50;p=lhc%2Fweb%2Fwiklou.git * (bug 1184) expiry time of indefinite blocks shown as the current time This code's a bit hacky, and may not work with PostgreSQL (check NULLs etc) --- diff --git a/includes/Block.php b/includes/Block.php index 61143f83d3..e18b80b41a 100644 --- a/includes/Block.php +++ b/includes/Block.php @@ -35,7 +35,11 @@ class Block $this->mReason = $reason; $this->mTimestamp = wfTimestamp(TS_MW,$timestamp); $this->mAuto = $auto; - $this->mExpiry = wfTimestamp(TS_MW,$expiry); + if( empty( $expiry ) ) { + $this->mExpiry = $expiry; + } else { + $this->mExpiry = wfTimestamp( TS_MW, $expiry ); + } $this->mForUpdate = false; $this->initialiseRange(); @@ -134,7 +138,9 @@ class Block $this->mBy = $row->ipb_by; $this->mAuto = $row->ipb_auto; $this->mId = $row->ipb_id; - $this->mExpiry = wfTimestamp(TS_MW,$row->ipb_expiry); + $this->mExpiry = $row->ipb_expiry ? + wfTimestamp(TS_MW,$row->ipb_expiry) : + $row->ipb_expiry; $this->initialiseRange(); } @@ -201,6 +207,7 @@ class Block function insert() { + wfDebug( "Block::insert; timestamp {$this->mTimestamp}\n" ); $dbw =& wfGetDB( DB_MASTER ); $dbw->insert( 'ipblocks', array( @@ -210,7 +217,9 @@ class Block 'ipb_reason' => $this->mReason, 'ipb_timestamp' => $dbw->timestamp($this->mTimestamp), 'ipb_auto' => $this->mAuto, - 'ipb_expiry' => $dbw->timestamp($this->mExpiry), + 'ipb_expiry' => $this->mExpiry ? + $dbw->timestamp($this->mExpiry) : + $this->mExpiry, ), 'Block::insert' );