diff options
author | Robin Appelman <icewind1991@gmail.com> | 2010-09-28 22:03:02 +0000 |
---|---|---|
committer | Robin Appelman <icewind1991@gmail.com> | 2010-09-28 22:03:02 +0000 |
commit | f29e3494128cb384fc8595e423994aeb9c0a2100 (patch) | |
tree | 3aa755bfdf9c7c0565e83d8c65022390a7407834 /inc | |
parent | 1b5a0bb31e9af496fd1bea3f20ec5c925f01a923 (diff) | |
download | nextcloud-server-f29e3494128cb384fc8595e423994aeb9c0a2100.tar.gz nextcloud-server-f29e3494128cb384fc8595e423994aeb9c0a2100.zip |
add function to list all plugins
Diffstat (limited to 'inc')
-rw-r--r-- | inc/lib_plugin.php | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/inc/lib_plugin.php b/inc/lib_plugin.php index c846fe25603..1e75a51e30b 100644 --- a/inc/lib_plugin.php +++ b/inc/lib_plugin.php @@ -57,16 +57,34 @@ class OC_PLUGIN{ } /** + * Get a list of all installed plugins + */ + public static function listPlugins() { + global $SERVERROOT; + $plugins = array(); + $fd = opendir($SERVERROOT . '/plugins'); + while ( false !== ($filename = readdir($fd)) ) { + if ( $filename<>'.' AND $filename<>'..' AND ('.' != substr($filename, 0, 1))) { + if(file_exists($SERVERROOT . '/plugins/'.$filename.'/plugin.xml')){ + $plugins[]=$filename; + } + } + } + closedir($fd); + return $plugins; + } + + /** * Load all plugins that aren't blacklisted */ public static function loadPlugins() { global $SERVERROOT; - $plugins = array(); + $plugins = self::listPlugins(); $blacklist=self::loadBlacklist(); $fd = opendir($SERVERROOT . '/plugins'); - while ( false !== ($filename = readdir($fd)) ) { - if ( $filename<>'.' AND $filename<>'..' AND ('.' != substr($filename, 0, 1)) AND array_search($filename,$blacklist)===false) { - self::load($filename); + foreach($plugins as $plugin){ + if (array_search($plugin,$blacklist)===false) { + self::load($plugin); } } closedir($fd); @@ -76,7 +94,7 @@ class OC_PLUGIN{ * load the blacklist from blacklist.txt * @return array */ - private static function loadBlacklist(){ + public static function loadBlacklist(){ global $SERVERROOT; if(count(self::$blacklist)>0){ return self::$blacklist; |