From 0d4c13f01d23930bc882e1f8903176c399445c1c Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Thu, 2 Mar 2017 16:07:14 +0100 Subject: [sysconfig] Add hook mechanism for config.tgz building --- modules-available/sysconfig/inc/configtgz.inc.php | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'modules-available/sysconfig') 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) -- cgit v1.2.3-55-g7522