code optimisation
This commit is contained in:
parent
9c9d6363af
commit
ed16660867
@ -27,27 +27,11 @@ class Siteinfo extends \Zotlabs\Web\Controller {
|
|||||||
else {
|
else {
|
||||||
$version = $commit = '';
|
$version = $commit = '';
|
||||||
}
|
}
|
||||||
$visible_plugins = array();
|
|
||||||
if(is_array(\App::$plugins) && count(\App::$plugins)) {
|
$plugins_list = implode(', ',visible_plugin_list());
|
||||||
$r = q("select * from addon where hidden = 0");
|
|
||||||
if(count($r))
|
if($plugins_list)
|
||||||
foreach($r as $rr)
|
$plugins_text = t('Installed plugins/addons/apps:');
|
||||||
$visible_plugins[] = $rr['aname'];
|
|
||||||
}
|
|
||||||
$plugins_list = '';
|
|
||||||
if(count($visible_plugins)) {
|
|
||||||
$plugins_text = t('Installed plugins/addons/apps:');
|
|
||||||
$sorted = $visible_plugins;
|
|
||||||
$s = '';
|
|
||||||
sort($sorted);
|
|
||||||
foreach($sorted as $p) {
|
|
||||||
if(strlen($p)) {
|
|
||||||
if(strlen($s)) $s .= ', ';
|
|
||||||
$s .= $p;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$plugins_list .= $s;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
$plugins_text = t('No installed plugins/addons/apps');
|
$plugins_text = t('No installed plugins/addons/apps');
|
||||||
|
|
||||||
|
@ -1992,14 +1992,7 @@ function get_site_info() {
|
|||||||
else
|
else
|
||||||
$service_class = false;
|
$service_class = false;
|
||||||
|
|
||||||
$visible_plugins = array();
|
$visible_plugins = visible_plugin_list();
|
||||||
if(is_array(App::$plugins) && count(App::$plugins)) {
|
|
||||||
$r = q("select * from addon where hidden = 0");
|
|
||||||
if(count($r))
|
|
||||||
foreach($r as $rr)
|
|
||||||
$visible_plugins[] = $rr['aname'];
|
|
||||||
}
|
|
||||||
sort($visible_plugins);
|
|
||||||
|
|
||||||
if(@is_dir('.git') && function_exists('shell_exec'))
|
if(@is_dir('.git') && function_exists('shell_exec'))
|
||||||
$commit = trim(@shell_exec('git log -1 --format="%h"'));
|
$commit = trim(@shell_exec('git log -1 --format="%h"'));
|
||||||
|
@ -167,6 +167,12 @@ function reload_plugins() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function visible_plugin_list() {
|
||||||
|
$r = q("select * from addon where hidden = 0 order by aname asc");
|
||||||
|
return(($r) ? ids_to_array($r,'aname') : array());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief registers a hook.
|
* @brief registers a hook.
|
||||||
|
@ -2050,7 +2050,7 @@ function ids_to_array($arr,$idx = 'id') {
|
|||||||
$t = array();
|
$t = array();
|
||||||
if($arr) {
|
if($arr) {
|
||||||
foreach($arr as $x) {
|
foreach($arr as $x) {
|
||||||
if(! in_array($x[$idx],$t)) {
|
if(strlen($x[$idx]) && (! in_array($x[$idx],$t))) {
|
||||||
$t[] = $x[$idx];
|
$t[] = $x[$idx];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user