From: Tim Starling Date: Thu, 7 Jun 2007 17:53:26 +0000 (+0000) Subject: SqlBagOStuff: Don't write to the database during read-only mode X-Git-Tag: 1.31.0-rc.0~52628 X-Git-Url: http://git.cyclocoop.org/%22.%24redirect_annul.%22?a=commitdiff_plain;h=510fd3ad72d70776a5f35802da04edd697267953;p=lhc%2Fweb%2Fwiklou.git SqlBagOStuff: Don't write to the database during read-only mode --- diff --git a/includes/BagOStuff.php b/includes/BagOStuff.php index 5469bef929..1174997d0c 100644 --- a/includes/BagOStuff.php +++ b/includes/BagOStuff.php @@ -253,6 +253,9 @@ abstract class SqlBagOStuff extends BagOStuff { } function set($key,$value,$exptime=0) { + if ( wfReadOnly() ) { + return false; + } $exptime = intval($exptime); if($exptime < 0) $exptime = 0; if($exptime == 0) { @@ -272,6 +275,9 @@ abstract class SqlBagOStuff extends BagOStuff { } function delete($key,$time=0) { + if ( wfReadOnly() ) { + return false; + } $this->_query( "DELETE FROM $0 WHERE keyname='$1'", $key ); return true; /* ? */ @@ -339,12 +345,18 @@ abstract class SqlBagOStuff extends BagOStuff { function expireall() { /* Remove any items that have expired */ + if ( wfReadOnly() ) { + return false; + } $now = $this->_fromunixtime( time() ); $this->_query( "DELETE FROM $0 WHERE exptime < '$now'" ); } function deleteall() { /* Clear *all* items from cache table */ + if ( wfReadOnly() ) { + return false; + } $this->_query( "DELETE FROM $0" ); }