diff options
author | Simon Rettberg | 2017-03-02 16:07:14 +0100 |
---|---|---|
committer | Simon Rettberg | 2017-03-02 16:07:14 +0100 |
commit | 0d4c13f01d23930bc882e1f8903176c399445c1c (patch) | |
tree | a51d1267f598ee5e8926d6a398a0daea2ac6c6ce /modules-available/sysconfig | |
parent | [inc/Hook] New helper for loading hooks (diff) | |
download | slx-admin-0d4c13f01d23930bc882e1f8903176c399445c1c.tar.gz slx-admin-0d4c13f01d23930bc882e1f8903176c399445c1c.tar.xz slx-admin-0d4c13f01d23930bc882e1f8903176c399445c1c.zip |
[sysconfig] Add hook mechanism for config.tgz building
Diffstat (limited to 'modules-available/sysconfig')
-rw-r--r-- | modules-available/sysconfig/inc/configtgz.inc.php | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/modules-available/sysconfig/inc/configtgz.inc.php b/modules-available/sysconfig/inc/configtgz.inc.php index b51d2787..7ec58785 100644 --- a/modules-available/sysconfig/inc/configtgz.inc.php +++ b/modules-available/sysconfig/inc/configtgz.inc.php @@ -217,8 +217,8 @@ class ConfigTgz /** * - * @param type $deleteOnError - * @param type $timeoutMs + * @param bool $deleteOnError + * @param int $timeoutMs * @return string - OK (success) * - OUTDATED (updating failed, but old version still exists) * - MISSING (failed and no old version available) @@ -228,10 +228,22 @@ class ConfigTgz if (!($this->configId > 0) || !is_array($this->modules) || $this->file === false) Util::traceError ('configId <= 0 or modules not array in ConfigTgz::rebuild()'); $files = array(); + // Get all config modules for system config foreach ($this->modules as $module) { if (!empty($module['filepath']) && file_exists($module['filepath'])) $files[] = $module['filepath']; } + // Get stuff other modules want to inject + $handler = function($hook) { + include $hook->file; + return isset($file) ? $file : false; + }; + foreach (Hook::load('config-tgz') as $hook) { + $file = $handler($hook); + if ($file !== false) { + $files[] = $file; + } + } // Hand over to tm $task = Taskmanager::submit('RecompressArchive', array( 'inputFiles' => $files, @@ -261,7 +273,7 @@ class ConfigTgz )); return $task['id']; } - + public function delete() { if ($this->configId === 0) |