* (bug 1184) expiry time of indefinite blocks shown as the current time
authorBrion Vibber <brion@users.mediawiki.org>
Tue, 11 Jan 2005 09:29:29 +0000 (09:29 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Tue, 11 Jan 2005 09:29:29 +0000 (09:29 +0000)
This code's a bit hacky, and may not work with PostgreSQL (check NULLs etc)

includes/Block.php

index 61143f8..e18b80b 100644 (file)
@@ -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' 
                );