diff options
| author | David Severwright | 2014-12-18 16:46:10 +0000 |
|---|---|---|
| committer | Pim van den Berg | 2015-06-22 10:18:54 +0200 |
| commit | d269215a421549e9aa04370db351a97ce4d455bf (patch) | |
| tree | e3e4ff32fcbcff6d4bfb10ac0d125ee078c2706a | |
| parent | plugin/apache: don't use network_datasize for apache_bytes (diff) | |
| download | apt-panopticon_cgp-d269215a421549e9aa04370db351a97ce4d455bf.zip apt-panopticon_cgp-d269215a421549e9aa04370db351a97ce4d455bf.tar.gz apt-panopticon_cgp-d269215a421549e9aa04370db351a97ce4d455bf.tar.bz2 apt-panopticon_cgp-d269215a421549e9aa04370db351a97ce4d455bf.tar.xz | |
Adding support for local plugin json to override the global stuff
Diffstat (limited to '')
| -rw-r--r-- | conf/.gitignore | 1 | ||||
| -rw-r--r-- | graph.php | 22 |
2 files changed, 18 insertions, 5 deletions
diff --git a/conf/.gitignore b/conf/.gitignore index 529bf01..880b7c3 100644 --- a/conf/.gitignore +++ b/conf/.gitignore | |||
| @@ -1 +1,2 @@ | |||
| 1 | config.local.php | 1 | config.local.php |
| 2 | plugin | ||
| @@ -35,12 +35,24 @@ if ($plugin == 'aggregation') { | |||
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | # plugin json | 37 | # plugin json |
| 38 | if (function_exists('json_decode') && file_exists('plugin/'.$plugin.'.json')) { | 38 | if(function_exists('json_decode')) |
| 39 | $json = file_get_contents('plugin/'.$plugin.'.json'); | 39 | { |
| 40 | $plugin_json = json_decode($json, true); | 40 | if (file_exists('plugin/'.$plugin.'.json')) { |
| 41 | $json = file_get_contents('plugin/'.$plugin.'.json'); | ||
| 42 | $plugin_json = json_decode($json, true); | ||
| 43 | |||
| 44 | if (is_null($plugin_json)) | ||
| 45 | error_log('CGP Error: invalid json in plugin/'.$plugin.'.json'); | ||
| 46 | } | ||
| 47 | if (file_exists('conf/plugin/'.$plugin.'.json')) { | ||
| 48 | $json = file_get_contents('conf/plugin/'.$plugin.'.json'); | ||
| 49 | $user_plugin_json = json_decode($json, true); | ||
| 50 | |||
| 51 | if (is_null($user_plugin_json)) | ||
| 52 | error_log('CGP Error: invalid json in conf/plugin/'.$plugin.'.json'); | ||
| 41 | 53 | ||
| 42 | if (is_null($plugin_json)) | 54 | $plugin_json = array_replace_recursive($plugin_json, $user_plugin_json); |
| 43 | error_log('CGP Error: invalid json in plugin/'.$plugin.'.json'); | 55 | } |
| 44 | } | 56 | } |
| 45 | 57 | ||
| 46 | if (!isset($plugin_json[$type]['type'])) | 58 | if (!isset($plugin_json[$type]['type'])) |
