From e3440bbebb27ae9aa552e8ee13ab3c606d7ee13e Mon Sep 17 00:00:00 2001 From: paulr Date: Wed, 27 Apr 2011 01:19:12 +1000 Subject: [PATCH] the start of the auto-update code --- lib/lib.php | 6 ++++++ lib/updates.php | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ unittests/libload.php | 5 +++++ 3 files changed, 59 insertions(+), 0 deletions(-) create mode 100644 lib/updates.php create mode 100644 unittests/libload.php diff --git a/lib/lib.php b/lib/lib.php index 63462fe..dde9335 100644 --- a/lib/lib.php +++ b/lib/lib.php @@ -4,6 +4,9 @@ require_once("config.php"); 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__); @@ -46,4 +49,7 @@ function urlInterpretter() } } } + +$db = db_getDB(); +db_createTable("options", "option_name", "option_value"); ?> \ No newline at end of file diff --git a/lib/updates.php b/lib/updates.php new file mode 100644 index 0000000..8e92481 --- /dev/null +++ b/lib/updates.php @@ -0,0 +1,48 @@ + $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 diff --git a/unittests/libload.php b/unittests/libload.php new file mode 100644 index 0000000..bf99490 --- /dev/null +++ b/unittests/libload.php @@ -0,0 +1,5 @@ + \ No newline at end of file -- 1.7.0.4