r22817 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r22816‎ | r22817 | r22818 >
Date:17:53, 7 June 2007
Author:tstarling
Status:old
Tags:
Comment:
SqlBagOStuff: Don't write to the database during read-only mode
Modified paths:
  • /trunk/phase3/includes/BagOStuff.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/BagOStuff.php
@@ -253,6 +253,9 @@
254254 }
255255
256256 function set($key,$value,$exptime=0) {
 257+ if ( wfReadOnly() ) {
 258+ return false;
 259+ }
257260 $exptime = intval($exptime);
258261 if($exptime < 0) $exptime = 0;
259262 if($exptime == 0) {
@@ -272,6 +275,9 @@
273276 }
274277
275278 function delete($key,$time=0) {
 279+ if ( wfReadOnly() ) {
 280+ return false;
 281+ }
276282 $this->_query(
277283 "DELETE FROM $0 WHERE keyname='$1'", $key );
278284 return true; /* ? */
@@ -339,12 +345,18 @@
340346
341347 function expireall() {
342348 /* Remove any items that have expired */
 349+ if ( wfReadOnly() ) {
 350+ return false;
 351+ }
343352 $now = $this->_fromunixtime( time() );
344353 $this->_query( "DELETE FROM $0 WHERE exptime < '$now'" );
345354 }
346355
347356 function deleteall() {
348357 /* Clear *all* items from cache table */
 358+ if ( wfReadOnly() ) {
 359+ return false;
 360+ }
349361 $this->_query( "DELETE FROM $0" );
350362 }
351363

Follow-up revisions

RevisionCommit summaryAuthorDate
r22857Merged revisions 22811-22855 via svnmerge from...david00:48, 9 June 2007

Status & tagging log