From 2a5f05499edde1df546fb31e134d43b3ca2db78f Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Thu, 10 May 2018 13:44:46 -0400 Subject: [PATCH 1/4] Munge the config in the global configvals into the configs array before returning it. --- web/api/app/Controller/ConfigsController.php | 21 +++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/web/api/app/Controller/ConfigsController.php b/web/api/app/Controller/ConfigsController.php index 48f50ae8e..b0a87e080 100644 --- a/web/api/app/Controller/ConfigsController.php +++ b/web/api/app/Controller/ConfigsController.php @@ -21,15 +21,18 @@ class ConfigsController extends AppController { * * @return void */ - public function index() { - $this->Config->recursive = 0; - $configs = $this->Config->find('all'); - $this->set(array( - 'configs' => $configs, - '_serialize' => array('configs') - )); - } - + public function index() { + global $configvals; + $this->Config->recursive = 0; + $configs = $this->Config->find('all'); + foreach ( $configvals as $k=>$v ) { + $configs[] = array( 'Config'=>array('Name'=>$k, 'Value'=>$v ) ); + } + $this->set(array( + 'configs' => $configs, + '_serialize' => array('configs') + )); + } /** * view method From 2f15f1ddd54faa53f540a133bac50d06c7200b95 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 20 Jan 2017 09:43:27 -0500 Subject: [PATCH 2/4] Allow Path to be NULL --- db/zm_update-1.30.12.sql | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 db/zm_update-1.30.12.sql diff --git a/db/zm_update-1.30.12.sql b/db/zm_update-1.30.12.sql new file mode 100644 index 000000000..c22b1a474 --- /dev/null +++ b/db/zm_update-1.30.12.sql @@ -0,0 +1,7 @@ +-- This updates a 1.30.9 database to 1.30.10 +-- +-- Alter type of Messages column from VARCHAR(255) to TEXT +-- + +-- ALTER TABLE Logs ALTER Message DROP DEFAULT; +ALTER TABLE Monitors MODIFY Path VARCHAR(255); From 271848a06fc68c962118e21ba172cb315dcda813 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Thu, 21 Jun 2018 21:42:51 -0400 Subject: [PATCH 3/4] clean up rebase --- db/zm_update-1.30.12.sql | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 db/zm_update-1.30.12.sql diff --git a/db/zm_update-1.30.12.sql b/db/zm_update-1.30.12.sql deleted file mode 100644 index c22b1a474..000000000 --- a/db/zm_update-1.30.12.sql +++ /dev/null @@ -1,7 +0,0 @@ --- This updates a 1.30.9 database to 1.30.10 --- --- Alter type of Messages column from VARCHAR(255) to TEXT --- - --- ALTER TABLE Logs ALTER Message DROP DEFAULT; -ALTER TABLE Monitors MODIFY Path VARCHAR(255); From e04eac57aea240e1092cf224ea7c5125bd0c68eb Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Mon, 25 Jun 2018 15:43:01 -0400 Subject: [PATCH 4/4] Include values in /etc/zm files in viewByName --- web/api/app/Controller/ConfigsController.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/web/api/app/Controller/ConfigsController.php b/web/api/app/Controller/ConfigsController.php index b0a87e080..2084a84b3 100644 --- a/web/api/app/Controller/ConfigsController.php +++ b/web/api/app/Controller/ConfigsController.php @@ -56,8 +56,14 @@ class ConfigsController extends AppController { public function viewByName($name = null) { $config = $this->Config->findByName($name, array('fields' => 'Value')); - if (!$config) { - throw new NotFoundException(__('Invalid config')); + if ( !$config ) { + global $configvals; + if ( $configvals[$name] ) { + $config = array( 'Config'=>array('Value'=>$configvals[$name]) ); + } else { + throw new NotFoundException(__('Invalid config')); + } + } else { } $this->set(array(