summaryrefslogtreecommitdiffstats
path: root/inc/property.inc.php
diff options
context:
space:
mode:
authorSimon Rettberg2014-05-26 22:49:54 +0200
committerSimon Rettberg2014-05-26 22:49:54 +0200
commita4f4147b6fe5f2a003a61cf8a8f7508c94130b31 (patch)
treede34472a2b9bd83909469affb884619b4858efc1 /inc/property.inc.php
parentWIP (diff)
downloadslx-admin-a4f4147b6fe5f2a003a61cf8a8f7508c94130b31.tar.gz
slx-admin-a4f4147b6fe5f2a003a61cf8a8f7508c94130b31.tar.xz
slx-admin-a4f4147b6fe5f2a003a61cf8a8f7508c94130b31.zip
WIP
Diffstat (limited to 'inc/property.inc.php')
-rw-r--r--inc/property.inc.php47
1 files changed, 47 insertions, 0 deletions
diff --git a/inc/property.inc.php b/inc/property.inc.php
index d186193a..5c316517 100644
--- a/inc/property.inc.php
+++ b/inc/property.inc.php
@@ -84,5 +84,52 @@ class Property
{
self::set('ipxe-menu', json_encode($value));
}
+
+ public static function getVersionCheckTaskId()
+ {
+ return self::get('versioncheck-task');
+ }
+
+ public static function setVersionCheckTaskId($value)
+ {
+ self::set('versioncheck-task', $value);
+ }
+
+ public static function getVersionCheckInformation()
+ {
+ $data = json_decode(self::get('versioncheck-data'), true);
+ if (isset($data['time']) && $data['time'] + 120 > time())
+ return $data;
+ $task = Taskmanager::submit('DownloadText', array(
+ 'url' => CONFIG_REMOTE_ML . '/list.php'
+ ));
+ if (!isset($task['id']))
+ return false;
+ if ($task['statusCode'] !== TASK_FINISHED) {
+ $task = Taskmanager::waitComplete($task['id']);
+ }
+ if ($task['statusCode'] !== TASK_FINISHED || !isset($task['data']['content'])) {
+ return $task['data']['error'];
+ }
+ $data = json_decode($task['data']['content'], true);
+ $data['time'] = time();
+ self::setVersionCheckInformation($data);
+ return $data;
+ }
+
+ public static function setVersionCheckInformation($value)
+ {
+ self::set('versioncheck-data', json_encode($value));
+ }
+
+ public static function getVmStoreConfig()
+ {
+ return json_decode(self::get('vmstore-config'), true);
+ }
+
+ public static function setVmStoreConfig($value)
+ {
+ self::set('vmstore-config', json_encode($value));
+ }
}