From 50d28a0ad8dcf5d9fe697278b6ea05aa00f8fb87 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Tue, 5 Nov 2019 18:01:37 +0100 Subject: [baseconfig] Overhaul hook system This enables us to finally properly show the inheritance flow of all the config variables when editing the baseconfig for a certain location or machine. --- .../statistics/inc/statisticshooks.inc.php | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'modules-available/statistics/inc') diff --git a/modules-available/statistics/inc/statisticshooks.inc.php b/modules-available/statistics/inc/statisticshooks.inc.php index ead4917b..746bdabf 100644 --- a/modules-available/statistics/inc/statisticshooks.inc.php +++ b/modules-available/statistics/inc/statisticshooks.inc.php @@ -21,11 +21,6 @@ class StatisticsHooks return self::$row['hostname'] ? self::$row['hostname'] : self::$row['clientip']; } - public static function getBaseconfigParent($machineuuid) - { - return false; // TODO - } - public static function baseconfigLocationResolver($machineuuid) { self::getRow($machineuuid); @@ -34,4 +29,19 @@ class StatisticsHooks return (int)self::$row['locationid']; } + /** + * Hook to get inheritance tree for all config vars + * @param int $machineuuid MachineUUID currently being edited + */ + public static function baseconfigInheritance($machineuuid) + { + self::getRow($machineuuid); + if (self::$row === false) + return []; + BaseConfig::prepareWithOverrides([ + 'locationid' => self::$row['locationid'] + ]); + return ConfigHolder::getRecursiveConfig(true); + } + } \ No newline at end of file -- cgit v1.2.3-55-g7522