summaryrefslogtreecommitdiffstats
path: root/inc
diff options
context:
space:
mode:
authorSimon Rettberg2015-02-24 16:30:07 +0100
committerSimon Rettberg2015-02-24 16:30:07 +0100
commitbb6432a6158b97cd5b92ab316d9d8b52bca2044d (patch)
treee64f4d92458d2fb501eb0af13c6dc37adc731747 /inc
parentMiniLinux download with version selection (diff)
downloadslx-admin-bb6432a6158b97cd5b92ab316d9d8b52bca2044d.tar.gz
slx-admin-bb6432a6158b97cd5b92ab316d9d8b52bca2044d.tar.xz
slx-admin-bb6432a6158b97cd5b92ab316d9d8b52bca2044d.zip
Various fixes
Diffstat (limited to 'inc')
-rw-r--r--inc/configmodule/adauth.inc.php1
-rw-r--r--inc/configtgz.inc.php1
-rw-r--r--inc/event.inc.php1
-rw-r--r--inc/property.inc.php10
-rw-r--r--inc/taskmanagercallback.inc.php4
-rw-r--r--inc/trigger.inc.php12
6 files changed, 13 insertions, 16 deletions
diff --git a/inc/configmodule/adauth.inc.php b/inc/configmodule/adauth.inc.php
index 828469c3..f2e20e4a 100644
--- a/inc/configmodule/adauth.inc.php
+++ b/inc/configmodule/adauth.inc.php
@@ -18,6 +18,7 @@ class ConfigModule_AdAuth extends ConfigModule
protected function generateInternal($tgz, $parent)
{
+ Trigger::ldadp($this->id(), $parent);
$config = $this->moduleData;
$config['parentTask'] = $parent;
$config['failOnParentFail'] = false;
diff --git a/inc/configtgz.inc.php b/inc/configtgz.inc.php
index 231960bb..8ddd4523 100644
--- a/inc/configtgz.inc.php
+++ b/inc/configtgz.inc.php
@@ -285,6 +285,7 @@ class ConfigTgz
{
if ($this->configId === 0)
Util::traceError('ConfigTgz::markUpdated called with invalid config id!');
+ Event::activeConfigChanged();
if ($this->areAllModulesUpToDate())
return $this->mark('OK');
return $this->mark('OUTDATED');
diff --git a/inc/event.inc.php b/inc/event.inc.php
index 6b303493..5dca20ef 100644
--- a/inc/event.inc.php
+++ b/inc/event.inc.php
@@ -84,6 +84,7 @@ class Event
*/
public static function activeConfigChanged()
{
+ error_log('Active config changed');
$task = Trigger::ldadp();
TaskmanagerCallback::addCallback($task, 'ldadpStartup');
}
diff --git a/inc/property.inc.php b/inc/property.inc.php
index d5a91872..0cb57f81 100644
--- a/inc/property.inc.php
+++ b/inc/property.inc.php
@@ -183,15 +183,5 @@ class Property
{
return self::get('password-type', 'password');
}
-
- public static function setNeedsCallback($value)
- {
- return self::set('need-callback', $value, 5);
- }
-
- public static function getNeedsCallback()
- {
- return self::get('need-callback', 0);
- }
}
diff --git a/inc/taskmanagercallback.inc.php b/inc/taskmanagercallback.inc.php
index 546fbbc9..ba589469 100644
--- a/inc/taskmanagercallback.inc.php
+++ b/inc/taskmanagercallback.inc.php
@@ -38,7 +38,6 @@ class TaskmanagerCallback
} else {
Database::exec("INSERT INTO callback (taskid, dateline, cbfunction) VALUES (:task, UNIX_TIMESTAMP(), :callback)", $data);
}
- Property::setNeedsCallback(1);
}
/**
@@ -73,8 +72,9 @@ class TaskmanagerCallback
return;
if (Taskmanager::isFailed($status) || Taskmanager::isFinished($status)) {
$del = Database::exec("DELETE FROM callback WHERE taskid = :task AND cbfunction = :cb LIMIT 1", array('task' => $callback['taskid'], 'cb' => $callback['cbfunction']));
- if ($del === 0) // No entry deleted, so someone else must have deleted it - race condition, do nothing
+ if ($del === 0) { // No entry deleted, so someone else must have deleted it - race condition, do nothing
return;
+ }
}
if (Taskmanager::isFinished($status)) {
$func = array('TaskmanagerCallback', preg_replace('/\W/', '', $callback['cbfunction']));
diff --git a/inc/trigger.inc.php b/inc/trigger.inc.php
index 0410b2be..0b1f00c5 100644
--- a/inc/trigger.inc.php
+++ b/inc/trigger.inc.php
@@ -78,10 +78,11 @@ class Trigger
/**
* Launch all ldadp instances that need to be running.
*
+ * @param int $exclude if not NULL, id of config module NOT to start
* @param string $parent if not NULL, this will be the parent task of the launch-task
* @return boolean|string false on error, id of task otherwise
*/
- public static function ldadp($parent = NULL)
+ public static function ldadp($exclude = NULL, $parent = NULL)
{
// TODO: Fetch list from ConfigModule_AdAuth (call loadDb first)
$res = Database::simpleQuery("SELECT moduleid, configtgz.filepath FROM configtgz_module"
@@ -92,7 +93,9 @@ class Trigger
$id = array();
while ($row = $res->fetch(PDO::FETCH_ASSOC)) {
if (readlink('/srv/openslx/www/boot/default/config.tgz') === $row['filepath']) {
- $id[] = (int) $row['moduleid'];
+ if (!is_null($exclude) && (int)$row['moduleid'] === (int)$exclude)
+ continue;
+ $id[] = (int)$row['moduleid'];
break;
}
}
@@ -133,6 +136,8 @@ class Trigger
/**
* Check and process all callbacks.
+ *
+ * @return boolean Whether there are still callbacks pending
*/
public static function checkCallbacks()
{
@@ -150,8 +155,7 @@ class Trigger
else
$tasksLeft = true;
}
- if (!$tasksLeft)
- Property::setNeedsCallback(0);
+ return $tasksLeft;
}
private static function triggerDaemons($action, $parent, &$taskids)