dépôts
/
lhc
/
web
/
wiklou.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
f9d5f62
)
In SqlBagOStuff: Respect expiry time on get(). Fix incorrect value in _maxdatetime...
author
Tim Starling
<tstarling@users.mediawiki.org>
Fri, 5 Jan 2007 16:54:52 +0000
(16:54 +0000)
committer
Tim Starling
<tstarling@users.mediawiki.org>
Fri, 5 Jan 2007 16:54:52 +0000
(16:54 +0000)
includes/BagOStuff.php
patch
|
blob
|
history
diff --git
a/includes/BagOStuff.php
b/includes/BagOStuff.php
index
6edef87
..
c720807
100644
(file)
--- a/
includes/BagOStuff.php
+++ b/
includes/BagOStuff.php
@@
-240,6
+240,13
@@
abstract class SqlBagOStuff extends BagOStuff {
}
if($row=$this->_fetchobject($res)) {
$this->_debug("get: retrieved data; exp time is " . $row->exptime);
}
if($row=$this->_fetchobject($res)) {
$this->_debug("get: retrieved data; exp time is " . $row->exptime);
+ if ( $row->exptime != $this->_maxdatetime() &&
+ wfTimestamp( TS_UNIX, $row->exptime ) < time() )
+ {
+ $this->_debug("get: key has expired, deleting");
+ $this->delete($key);
+ return false;
+ }
return $this->_unserialize($this->_blobdecode($row->value));
} else {
$this->_debug('get: no matching rows');
return $this->_unserialize($this->_blobdecode($row->value));
} else {
$this->_debug('get: no matching rows');
@@
-253,7
+260,7
@@
abstract class SqlBagOStuff extends BagOStuff {
if($exptime == 0) {
$exp = $this->_maxdatetime();
} else {
if($exptime == 0) {
$exp = $this->_maxdatetime();
} else {
- if($exptime < 3
600*24*30)
+ if($exptime < 3
.16e8) # ~10 years
$exptime += time();
$exp = $this->_fromunixtime($exptime);
}
$exptime += time();
$exp = $this->_fromunixtime($exptime);
}
@@
-407,7
+414,11
@@
class MediaWikiBagOStuff extends SqlBagOStuff {
}
function _maxdatetime() {
$dbw =& wfGetDB(DB_MASTER);
}
function _maxdatetime() {
$dbw =& wfGetDB(DB_MASTER);
- return $dbw->timestamp('9999-12-31 12:59:59');
+ if ( time() > 0x7fffffff ) {
+ return $this->_fromunixtime( 1<<62 );
+ } else {
+ return $this->_fromunixtime( 0x7fffffff );
+ }
}
function _fromunixtime($ts) {
$dbw =& wfGetDB(DB_MASTER);
}
function _fromunixtime($ts) {
$dbw =& wfGetDB(DB_MASTER);