summaryrefslogtreecommitdiffstats
path: root/inc/trigger.inc.php
diff options
context:
space:
mode:
authorSimon Rettberg2014-10-06 19:30:06 +0200
committerSimon Rettberg2014-10-06 19:30:06 +0200
commit94cb6009866f4ebc16d92087c0440adb98f18299 (patch)
treefb7deffa2965f92c4561b5111c17a6a5bed270c4 /inc/trigger.inc.php
parentuse eventlog when creating users; show info on main page if no user was creat... (diff)
downloadslx-admin-94cb6009866f4ebc16d92087c0440adb98f18299.tar.gz
slx-admin-94cb6009866f4ebc16d92087c0440adb98f18299.tar.xz
slx-admin-94cb6009866f4ebc16d92087c0440adb98f18299.zip
Use eventlog in init and update API, populate database with default values on init
Diffstat (limited to 'inc/trigger.inc.php')
-rw-r--r--inc/trigger.inc.php14
1 files changed, 9 insertions, 5 deletions
diff --git a/inc/trigger.inc.php b/inc/trigger.inc.php
index e6f7cd31..0b31c7b3 100644
--- a/inc/trigger.inc.php
+++ b/inc/trigger.inc.php
@@ -31,22 +31,25 @@ class Trigger
* Try to automatically determine the primary IP address of the server.
* This only works if the server has either one public IPv4 address (and potentially
* one or more non-public addresses), or one private address.
+ *
+ * @return boolean true if current configured IP address is still valid, or if a new address could
+ * successfully be determined, false otherwise
*/
public static function autoUpdateServerIp()
{
$task = Taskmanager::submit('LocalAddressesList');
if ($task === false)
- return;
+ return false;
$task = Taskmanager::waitComplete($task, 10000);
if (!isset($task['data']['addresses']) || empty($task['data']['addresses']))
- return;
+ return false;
$serverIp = Property::getServerIp();
$publicCandidate = 'none';
$privateCandidate = 'none';
foreach ($task['data']['addresses'] as $addr) {
if ($addr['ip'] === $serverIp)
- return;
+ return true;
if (substr($addr['ip'], 0, 4) === '127.')
continue;
if (Util::isPublicIpv4($addr['ip'])) {
@@ -63,12 +66,13 @@ class Trigger
}
if ($publicCandidate !== 'none' && $publicCandidate !== 'many') {
Property::setServerIp($publicCandidate);
- return;
+ return true;
}
if ($privateCandidate !== 'none' && $privateCandidate !== 'many') {
Property::setServerIp($privateCandidate);
- return;
+ return true;
}
+ return false;
}
/**