fixed problem with updateTimestamp() altering existing IP blocks
authorTim Starling <tstarling@users.mediawiki.org>
Fri, 27 Feb 2004 08:25:56 +0000 (08:25 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Fri, 27 Feb 2004 08:25:56 +0000 (08:25 +0000)
includes/Block.php

index 0f688a0..d98b07b 100644 (file)
@@ -191,17 +191,19 @@ class Block
                return $this->mAddress != "";
        }
        
-       function updateTimestamp() {
-               
-               $this->mTimestamp = wfTimestampNow();
-               $this->mExpiry = Block::getAutoblockExpiry( $this->mTimestamp );
-
-               wfQuery( "UPDATE ipblocks SET " .
-                       "ipb_timestamp='" . $this->mTimestamp . "', " .
-                       "ipb_expiry='" . $this->mExpiry . "' " .
-                       "WHERE ipb_address='" . wfStrencode( $this->mAddress ) . "'", DB_WRITE, "Block::updateTimestamp" );
-               
-               $this->clearCache();
+       function updateTimestamp() 
+       {
+               if ( $this->mAuto ) {
+                       $this->mTimestamp = wfTimestampNow();
+                       $this->mExpiry = Block::getAutoblockExpiry( $this->mTimestamp );
+
+                       wfQuery( "UPDATE ipblocks SET " .
+                               "ipb_timestamp='" . $this->mTimestamp . "', " .
+                               "ipb_expiry='" . $this->mExpiry . "' " .
+                               "WHERE ipb_address='" . wfStrencode( $this->mAddress ) . "'", DB_WRITE, "Block::updateTimestamp" );
+                       
+                       $this->clearCache();
+               }
        }
 
        /* private */ function clearCache()