<?php
+# $Id$
+#
# Copyright (C) 2003-2004 Brion Vibber <brion@pobox.com>
# http://www.mediawiki.org/
#
function _debug($text) {
if($this->debugmode)
- echo "\ndebug: $text\n";
+ wfDebug("BagOStuff debug: $text\n");
}
}
}
$this->delete( $key );
$this->_query(
- "INSERT INTO $0 (keyname,value,exptime) VALUES('$1','$2',$exp)",
+ "INSERT INTO $0 (keyname,value,exptime) VALUES('$1','$2','$exp')",
$key, serialize(&$value));
return true; /* ? */
}
}
}
-class MysqlBagOStuff extends SqlBagOStuff {
+class MediaWikiBagOStuff extends SqlBagOStuff {
function _doquery($sql) {
- return mysql_query($sql);
+ return wfQuery($sql, DB_READ, "MediaWikiBagOStuff:_doquery");
}
function _fetchrow($result) {
- return mysql_fetch_array($result);
+ return wfFetchRow($result);
}
function _freeresult($result) {
- return mysql_free_result($result);
+ return wfFreeResult($result);
}
function _dberror($result) {
- if($result)
- return mysql_error($result);
- else
- return mysql_error();
+ return wfLastError();
}
-
function _maxdatetime() {
- return "'9999-12-31 12:59:59'";
+ return "9999-12-31 12:59:59";
}
-
function _fromunixtime($ts) {
- return "FROM_UNIXTIME($ts)";
+ return gmdate( "Y-m-d H:i:s", $ts );
}
-
function _strencode($s) {
- return mysql_escape_string($s);
- }
-}
-
-class MediaWikiBagOStuff extends MysqlBagOStuff {
- function _doquery($sql) {
- return wfQuery($sql, DB_READ, "MediaWikiBagOStuff:_doquery");
- }
- function _freeresult($result) {
- return wfFreeResult($result);
+ return wfStrEncode($s);
}
}