diff options
author | redmatrix <git@macgirvin.com> | 2016-08-22 17:41:41 -0700 |
---|---|---|
committer | redmatrix <git@macgirvin.com> | 2016-08-22 17:41:41 -0700 |
commit | 38ca3bac405b339367b513037428f796c433819a (patch) | |
tree | e9a0ca2161f037426f8d8fa788d7976fc7a170cc | |
parent | e967bc9c455c27f08a2add12d566e81036819e4e (diff) | |
download | volse-hubzilla-38ca3bac405b339367b513037428f796c433819a.tar.gz volse-hubzilla-38ca3bac405b339367b513037428f796c433819a.tar.bz2 volse-hubzilla-38ca3bac405b339367b513037428f796c433819a.zip |
optional server role compatibility checks for plugins
-rw-r--r-- | Zotlabs/Module/Admin.php | 1 | ||||
-rwxr-xr-x | boot.php | 4 | ||||
-rwxr-xr-x | include/plugin.php | 12 | ||||
-rwxr-xr-x | view/tpl/admin_plugins_details.tpl | 3 |
4 files changed, 18 insertions, 2 deletions
diff --git a/Zotlabs/Module/Admin.php b/Zotlabs/Module/Admin.php index 085d13fd7..eede5a045 100644 --- a/Zotlabs/Module/Admin.php +++ b/Zotlabs/Module/Admin.php @@ -1341,6 +1341,7 @@ class Admin extends \Zotlabs\Web\Controller { '$str_minversion' => t('Minimum project version: '), '$str_maxversion' => t('Maximum project version: '), '$str_minphpversion' => t('Minimum PHP version: '), + '$str_serverroles' => t('Compatible Server Roles: '), '$str_requires' => t('Requires: '), '$disabled' => t('Disabled - version incompatibility'), @@ -612,11 +612,11 @@ function sys_boot() { if(UNO) App::$config['system']['server_role'] = 'basic'; else - App::$config['system']['server_role'] = 'pro'; + App::$config['system']['server_role'] = 'standard'; } if(! (array_key_exists('server_role',App::$config['system']) && App::$config['system']['server_role'])) - App::$config['system']['server_role'] = 'pro'; + App::$config['system']['server_role'] = 'standard'; App::$timezone = ((App::$config['system']['timezone']) ? App::$config['system']['timezone'] : 'UTC'); date_default_timezone_set(App::$timezone); diff --git a/include/plugin.php b/include/plugin.php index cb206d944..663d17959 100755 --- a/include/plugin.php +++ b/include/plugin.php @@ -404,6 +404,18 @@ function check_plugin_versions($info) { return false; } } + if(array_key_exists('serverroles',$info)) { + $role = \Zotlabs\Lib\System::get_server_role(); + if(! ( + stristr($info['serverroles'],'*') + || stristr($info['serverroles'],'any') + || stristr($info['serverroles'],$role))) { + logger('serverrole limit: ' . $info['name'],LOGGER_NORMAL,LOG_WARNING); + return false; + + } + } + if(array_key_exists('requires',$info)) { $arr = explode(',',$info['requires']); diff --git a/view/tpl/admin_plugins_details.tpl b/view/tpl/admin_plugins_details.tpl index b8cc72a04..309fc9569 100755 --- a/view/tpl/admin_plugins_details.tpl +++ b/view/tpl/admin_plugins_details.tpl @@ -24,6 +24,9 @@ {{if $info.minphpversion}} <p class="versionlimit">{{$str_minphpversion}}{{$info.minphpversion}}</p> {{/if}} + {{if $info.serverroles}} + <p class="versionlimit">{{$str_serverroles}}{{$info.serverroles}}</p> + {{/if}} {{if $info.requires}} <p class="versionlimit">{{$str_requires}}{{$info.requires}}</p> {{/if}} |