Skip to content
Snippets Groups Projects
Commit f29e3494 authored by Robin Appelman's avatar Robin Appelman
Browse files

add function to list all plugins

parent 1b5a0bb3
Branches
No related tags found
No related merge requests found
...@@ -56,17 +56,35 @@ class OC_PLUGIN{ ...@@ -56,17 +56,35 @@ class OC_PLUGIN{
return false; return false;
} }
/**
* 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 * Load all plugins that aren't blacklisted
*/ */
public static function loadPlugins() { public static function loadPlugins() {
global $SERVERROOT; global $SERVERROOT;
$plugins = array(); $plugins = self::listPlugins();
$blacklist=self::loadBlacklist(); $blacklist=self::loadBlacklist();
$fd = opendir($SERVERROOT . '/plugins'); $fd = opendir($SERVERROOT . '/plugins');
while ( false !== ($filename = readdir($fd)) ) { foreach($plugins as $plugin){
if ( $filename<>'.' AND $filename<>'..' AND ('.' != substr($filename, 0, 1)) AND array_search($filename,$blacklist)===false) { if (array_search($plugin,$blacklist)===false) {
self::load($filename); self::load($plugin);
} }
} }
closedir($fd); closedir($fd);
...@@ -76,7 +94,7 @@ class OC_PLUGIN{ ...@@ -76,7 +94,7 @@ class OC_PLUGIN{
* load the blacklist from blacklist.txt * load the blacklist from blacklist.txt
* @return array * @return array
*/ */
private static function loadBlacklist(){ public static function loadBlacklist(){
global $SERVERROOT; global $SERVERROOT;
if(count(self::$blacklist)>0){ if(count(self::$blacklist)>0){
return self::$blacklist; return self::$blacklist;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment