summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apis/cron.inc.php2
-rw-r--r--inc/property.inc.php8
-rw-r--r--inc/util.inc.php2
-rw-r--r--modules-available/serversetup-bwlp/page.inc.php9
-rw-r--r--modules-available/statistics_reporting/inc/remotereport.inc.php8
5 files changed, 17 insertions, 12 deletions
diff --git a/apis/cron.inc.php b/apis/cron.inc.php
index a0042e61..0bcd2490 100644
--- a/apis/cron.inc.php
+++ b/apis/cron.inc.php
@@ -50,7 +50,7 @@ foreach (Hook::load('cron') as $hook) {
continue;
}
}
- $value = $hook . '|' . time();
+ $value = $hook->moduleId . '|' . time();
Property::addToList(CRON_KEY_STATUS, $value, 1800);
handleModule($hook->file);
Property::removeFromList(CRON_KEY_STATUS, $value);
diff --git a/inc/property.inc.php b/inc/property.inc.php
index b3d8081a..b33e1bff 100644
--- a/inc/property.inc.php
+++ b/inc/property.inc.php
@@ -146,19 +146,19 @@ class Property
public static function getVersionCheckInformation()
{
- $data = json_decode(self::get('versioncheck-data'), true);
- if (isset($data['time']) && $data['time'] + 120 > time())
+ $data = json_decode(self::get('versioncheck-data', '[]'), true);
+ if (isset($data['time']) && $data['time'] + 60 > time())
return $data;
$task = Taskmanager::submit('DownloadText', array(
'url' => CONFIG_REMOTE_ML . '/list.php'
));
if (!isset($task['id']))
return 'Could not start list download (' . Message::asString() . ')';
- if ($task['statusCode'] !== TASK_FINISHED) {
+ if (!Taskmanager::isFinished($task)) {
$task = Taskmanager::waitComplete($task['id'], 5000);
}
if ($task['statusCode'] !== TASK_FINISHED || !isset($task['data']['content'])) {
- return $task['data']['error'];
+ return isset($task['data']['error']) ? $task['data']['error'] : 'Timeout';
}
$data = json_decode($task['data']['content'], true);
$data['time'] = time();
diff --git a/inc/util.inc.php b/inc/util.inc.php
index d454d18d..f5e10ebc 100644
--- a/inc/util.inc.php
+++ b/inc/util.inc.php
@@ -375,7 +375,7 @@ SADFACE;
* @param bool $secure true = only use strong random sources
* @return string|bool string of requested length, false on error
*/
- public static function randomBytes($length, $secure)
+ public static function randomBytes($length, $secure = true)
{
if (function_exists('random_bytes')) {
return random_bytes($length);
diff --git a/modules-available/serversetup-bwlp/page.inc.php b/modules-available/serversetup-bwlp/page.inc.php
index 9bea4b50..9d7d11ac 100644
--- a/modules-available/serversetup-bwlp/page.inc.php
+++ b/modules-available/serversetup-bwlp/page.inc.php
@@ -81,8 +81,13 @@ class Page_ServerSetup extends Page
return false;
}
- if ($this->taskStatus['statusCode'] === TASK_WAITING) { // TODO: Async if just displaying
- $this->taskStatus = Taskmanager::waitComplete($this->taskStatus['id']);
+ if (!Taskmanager::isFinished($this->taskStatus)) { // TODO: Async if just displaying
+ $this->taskStatus = Taskmanager::waitComplete($this->taskStatus['id'], 4000);
+ }
+
+ if (Taskmanager::isFailed($this->taskStatus) || !isset($this->taskStatus['data']['addresses'])) {
+ $this->taskStatus['data']['addresses'] = false;
+ return false;
}
$sortIp = array();
diff --git a/modules-available/statistics_reporting/inc/remotereport.inc.php b/modules-available/statistics_reporting/inc/remotereport.inc.php
index 7aad8b3a..a2234849 100644
--- a/modules-available/statistics_reporting/inc/remotereport.inc.php
+++ b/modules-available/statistics_reporting/inc/remotereport.inc.php
@@ -40,7 +40,7 @@ class RemoteReport
if ($ts === 0) {
// No timestamp stored yet - might be a fresh install
// schedule for next time
- self::updateNextReportingTimestamp();
+ self::writeNextReportingTimestamp();
$ts = Property::get(self::NEXT_SUBMIT_ID, 0);
} elseif ($ts < strtotime('last monday')) {
// Too long ago, move forward to last monday
@@ -63,14 +63,14 @@ class RemoteReport
* Generate the multi-dimensional array containing the anonymized
* (weekly) statistics to report.
*
- * @param $from start timestamp
- * @param $to end timestamp
+ * @param int $from start timestamp
+ * @param int $to end timestamp
* @return array wrapped up statistics, ready for reporting
*/
public static function generateReport($from, $to) {
GetData::$from = $from;
GetData::$to = $to;
- GetData::$salt = bin2hex(Util::randomBytes(20));
+ GetData::$salt = bin2hex(Util::randomBytes(20, false));
$data = GetData::total(GETDATA_ANONYMOUS);
$data['perLocation'] = GetData::perLocation(GETDATA_ANONYMOUS);
$data['perClient'] = GetData::perClient(GETDATA_ANONYMOUS);