From 7e6febe2a6609457eca1f1caf650375534780048 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Wed, 24 Feb 2016 15:19:28 -0800 Subject: add 'requires' field to plugin info to list other dependent plugins/addons and disable if dependencies are not installed/enabled --- include/plugin.php | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'include/plugin.php') diff --git a/include/plugin.php b/include/plugin.php index 5afded542..bd844442f 100755 --- a/include/plugin.php +++ b/include/plugin.php @@ -325,7 +325,8 @@ function get_plugin_info($plugin){ 'description' => '', 'author' => array(), 'maintainer' => array(), - 'version' => '' + 'version' => '', + 'requires' => '' ); if (!is_file("addon/$plugin/$plugin.php")) @@ -383,6 +384,22 @@ function check_plugin_versions($info) { } } + if(array_key_exists('requires',$info)) { + $arr = explode(',',$info['requires']); + $found = true; + if($arr) { + foreach($arr as $test) { + $test = trim($test); + if(! $test) + continue; + if(! in_array($test,get_app()->plugins)) + $found = false; + } + } + if(! $found) + return false; + } + return true; } -- cgit v1.2.3