require_once("wsdl.php");
require_once("www.php");
require_once("db.php");
+require_once("messages.php");
+require_once("datastore.php");
+require_once("updates.php");
// first and foremost, load the plugins
$basedir = dirname(__FILE__);
}
}
}
+
+$db = db_getDB();
+db_createTable("options", "option_name", "option_value");
?>
\ No newline at end of file
--- /dev/null
+<?php
+
+$timerval_t = db_selectData("options", "option_name", "update.check.interval");
+
+//echo "timer check:\n";
+//print_r($timerval_t);
+//echo "timer endcheck\n";
+
+
+if(!isset($timerval_t[0])) {
+ //echo "likely we have no timer check value, setting to default of 3 days\n";
+ $ci = 3*24*3600;
+ db_insertData("options", "update.check.interval", "$ci");
+ $timerval = $ci;
+} else {
+ $timerval = $timerval_t[0]["option_value"];
+}
+
+$lastupdate_t = db_selectData("options", "option_name", "update.check.last");
+
+
+if(!isset($lastupdate_t[0])) {
+ db_insertData("options", "update.check.last", "0");
+ up_doUpdateCheck();
+} else {
+ // no last update, perform one now
+ $lastupdate = $lastupdate_t[0]["option_value"];
+
+ $ctime = time();
+
+ $tdiff = $ctime - $lastupdate;
+
+ if($tdiff > $timerval) {
+ up_doUpdateCheck();
+ }
+}
+//echo "timerval: $timerval\n";
+
+function up_doUpdateCheck()
+{
+ echo "do update check and reset interval\n";
+
+ // db_updateData($tablename, $column, $newdata, $wherecol, $wheredata, $exact=true)
+ $ctime = time();
+
+ db_updateData("options", "option_value", "$ctime", "option_name", "update.check.last");
+}
+?>
\ No newline at end of file