]> git.mjollnir.org Git - moodle.git/commitdiff
"MDL-15349, create a new function to get all repository plugins"
authordongsheng <dongsheng>
Mon, 7 Jul 2008 06:54:39 +0000 (06:54 +0000)
committerdongsheng <dongsheng>
Mon, 7 Jul 2008 06:54:39 +0000 (06:54 +0000)
repository/lib.php

index 109f386ead3c31136a286fc0e68d909d8a08f47f..9cdf579549f659bf7316c18760bf8a9157d45e2a 100644 (file)
@@ -249,5 +249,23 @@ function repository_get_option($id, $position){
     $ret = (array)unserialize($entry->$option);
     return $ret;
 }
+function repository_get_plugins(){
+    global $CFG;
+    $repo = $CFG->dirroot.'/repository/';
+    $ret = array();
+    if($dir = opendir($repo)){
+        while (false !== ($file = readdir($dir))) {
+            if(is_dir($file) && $file != '.' && $file != '..' 
+                && file_exists($repo.$file.'/repository.class.php')){
+                require_once($repo.$file.'/version.php');
+                $ret[] = array('name'=>$plugin->name, 
+                        'version'=>$plugin->version, 
+                        'path'=>$repo.$file,
+                        'settings'=>file_exists($repo.$file.'/settings.php')); 
+            }
+        }
+    }
+    return $ret;
+}
 
 ?>