]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-16438 centralise information about plugins to avoid duplication, includes local...
authorskodak <skodak>
Fri, 19 Jun 2009 14:25:56 +0000 (14:25 +0000)
committerskodak <skodak>
Fri, 19 Jun 2009 14:25:56 +0000 (14:25 +0000)
60 files changed:
admin/auth.php
admin/cron.php
admin/enrol.php
admin/enrol_config.php
admin/report/unittest/test_tables.php
admin/settings/courses.php
admin/settings/grades.php
admin/settings/plugins.php
admin/settings/users.php
admin/uploaduser.php
admin/xmldb/actions/XMLDBAction.class.php
blocks/admin/block_admin.php
course/edit_form.php
course/import.php
course/report.php
grade/edit/settings/form.php
grade/lib.php
grade/report/index.php
lib/accesslib.php
lib/adminlib.php
lib/db/messages.php
lib/db/upgrade.php
lib/ddl/database_manager.php
lib/editorlib.php
lib/eventslib.php
lib/gradelib.php
lib/javascript-mod.php
lib/locallib.php [deleted file]
lib/messagelib.php
lib/moodlelib.php
lib/portfoliolib.php
lib/questionlib.php
lib/setup.php
lib/upgradelib.php
lib/weblib.php
local/readme.txt [new file with mode: 0644]
message/db/messages.php [deleted file]
mod/assignment/lib.php
mod/assignment/restorelib.php
mod/chat/lib.php
mod/choice/lib.php
mod/choice/mod_form.php
mod/data/lib.php
mod/feedback/lib.php
mod/forum/lib.php
mod/hotpot/lib.php
mod/label/lib.php
mod/lesson/lib.php
mod/quiz/lib.php
mod/quiz/report/reportlib.php
mod/quiz/settingstree.php
mod/resource/lib.php
mod/scorm/lib.php
mod/survey/lib.php
mod/wiki/lib.php
rss/file.php
theme/index.php
user/editadvanced_form.php
user/filters/lib.php
version.php

index 7115ff04cf38ddd078f7daf751aae9642d2cc06c..fbd9a7cd46d00792dec77a5e6f95a7defb1925e6 100644 (file)
@@ -19,9 +19,6 @@ $returnurl = "$CFG->wwwroot/$CFG->admin/settings.php?section=manageauths";
 $action = optional_param('action', '', PARAM_ACTION);
 $auth   = optional_param('auth', '', PARAM_SAFEDIR);
 
-// get currently installed and enabled auth plugins
-$authsavailable = get_list_of_plugins('auth');
-
 get_enabled_auth_plugins(true); // fix the list of enabled auths
 if (empty($CFG->auth)) {
     $authsenabled = array();
index 2af42acc751adfefd13d03853230eeaf773e674e..eee679d26f32d34d92407304e3f82dcf40d27885 100644 (file)
     // report includes cron.php with function report_reportname_cron() if it wishes
     // to be cronned. It is up to cron.php to handle e.g. if it only needs to
     // actually do anything occasionally.
-    $reports = get_list_of_plugins($CFG->admin.'/report');
-    foreach($reports as $report) {
-        $cronfile = $CFG->dirroot.'/'.$CFG->admin.'/report/'.$report.'/cron.php';
+    $reports = get_plugin_list('report');
+    foreach($reports as $report => $reportdir) {
+        $cronfile = $reportdir.'/cron.php';
         if (file_exists($cronfile)) {
             require_once($cronfile);
             $cronfunction = 'report_'.$report.'_cron';
     }
 
     // run gradebook import/export/report cron
-    if ($gradeimports = get_list_of_plugins('grade/import')) {
-        foreach ($gradeimports as $gradeimport) {           
-            if (file_exists($CFG->dirroot.'/grade/import/'.$gradeimport.'/lib.php')) {
-                require_once($CFG->dirroot.'/grade/import/'.$gradeimport.'/lib.php');
+    if ($gradeimports = get_plugin_list('gradeimport')) {
+        foreach ($gradeimports as $gradeimport => $plugindir) {           
+            if (file_exists($plugindir.'/lib.php')) {
+                require_once($plugindir.'/lib.php');
                 $cron_function = 'grade_import_'.$gradeimport.'_cron';                                    
                 if (function_exists($cron_function)) {
                     mtrace("Processing gradebook import function $cron_function ...", '');
         }      
     }
 
-    if ($gradeexports = get_list_of_plugins('grade/export')) {
-        foreach ($gradeexports as $gradeexport) {           
-            if (file_exists($CFG->dirroot.'/grade/export/'.$gradeexport.'/lib.php')) {
-                require_once($CFG->dirroot.'/grade/export/'.$gradeexport.'/lib.php');
+    if ($gradeexports = get_plugin_list('gradeexport')) {
+        foreach ($gradeexports as $gradeexport => $plugindir) {           
+            if (file_exists($plugindir.'/lib.php')) {
+                require_once($plugindir.'/lib.php');
                 $cron_function = 'grade_export_'.$gradeexport.'_cron';                                    
                 if (function_exists($cron_function)) {
                     mtrace("Processing gradebook export function $cron_function ...", '');
         }
     }
 
-    if ($gradereports = get_list_of_plugins('grade/report')) {
-        foreach ($gradereports as $gradereport) {           
-            if (file_exists($CFG->dirroot.'/grade/report/'.$gradereport.'/lib.php')) {
-                require_once($CFG->dirroot.'/grade/report/'.$gradereport.'/lib.php');
+    if ($gradereports = get_plugin_list('gradereport')) {
+        foreach ($gradereports as $gradereport => $plugindir) {           
+            if (file_exists($plugindir.'/lib.php')) {
+                require_once($plugindir.'/lib.php');
                 $cron_function = 'grade_report_'.$gradereport.'_cron';                                    
                 if (function_exists($cron_function)) {
                     mtrace("Processing gradebook report function $cron_function ...", '');
     $fs->cron();
 
     // run any customized cronjobs, if any
-    // looking for functions in lib/local/cron.php
-    if (file_exists($CFG->dirroot.'/local/cron.php')) {
-        mtrace('Processing customized cron script ...', '');
-        include_once($CFG->dirroot.'/local/cron.php');
+    if ($locals = get_plugin_list('local')) {
+        mtrace('Processing customized cron scripts ...', '');
+        foreach ($locals as $local => $localdir) {
+            if (file_exists("$localdir/cron.php")) {
+                include("$localdir/cron.php");
+            }
+        }
         mtrace('done.');
     }
 
index bed502be41a7ba71928cdcbf53791582519b43ef..5e68bd10566a036538a9a45a69bb7e32036e8d0e 100644 (file)
@@ -51,9 +51,9 @@
 
     admin_externalpage_print_header();
 
-    $modules = get_list_of_plugins("enrol");
+    $modules = get_plugin_list('enrol');
     $options = array();
-    foreach ($modules as $module) {
+    foreach ($modules as $module => $moduledir) {
         $options[$module] = get_string("enrolname", "enrol_$module");
     }
     asort($options);
     $table->width = '700';
     $table->data = array();
 
-    $modules = get_list_of_plugins("enrol");
     $enabledplugins = explode(',', $CFG->enrol_plugins_enabled);
-    foreach ($modules as $module) {
+    foreach ($modules as $module => $moduledir) {
 
         // skip if directory is empty
-        if (!file_exists("$CFG->dirroot/enrol/$module/enrol.php")) {
+        if (!file_exists("$moduledir/enrol.php")) {
             continue;
         }
 
index cb48a975b4ce4cc68ed959c1e5b00025a7c7c006..95990d454f46185d791a603d28c6dec790bb72b2 100644 (file)
@@ -34,8 +34,8 @@
 
     unset($options);
 
-    $modules = get_list_of_plugins("enrol");
-    foreach ($modules as $module) {
+    $modules = get_plugin_list('enrol');
+    foreach ($modules as $module => $enroldir) {
         $options[$module] = get_string("enrolname", "enrol_$module");
     }
     asort($options);
index 6cbaaaa8ea94eca1a75e11dec76cf72dd5bd3ecd..c0baa05a363ba5cef1b281c9b9ef57ed931d857c 100644 (file)
@@ -83,10 +83,9 @@ die;die;die;
 
 
 /// upgrade all plugins types
-    $upgradedplugins = false;
     $plugintypes = get_plugin_types();
-    foreach ($plugintypes as $type=>$location) {
-        $upgradedplugins = upgrade_plugins($type, $location) || $upgradedplugins;
+    foreach ($plugintypes as $type => $location) {
+        upgrade_plugins($type);
     }
 
 /// Check for changes to RPC functions
@@ -95,11 +94,6 @@ die;die;die;
         upgrade_RPC_functions($return_url);  // Return here afterwards
     }
 
-/// Check for local database customisations
-/// first old *.php update and then the new upgrade.php script
-    require_once("$CFG->dirroot/lib/locallib.php");
-    upgrade_local_db($return_url);  // Return here afterwards
-
 /// just make sure upgrade logging is properly terminated
     upgrade_finished();
 
index a131cf4621eae4c65619a621b14ec88b1ee05d1f..a6b9073fb56184c30a9cd8eae440262e13959a56 100644 (file)
@@ -17,9 +17,9 @@ if ($hassiteconfig
 /// NOTE: these settings must be applied after all other settings because they depend on them
     ///main course settings
     $temp = new admin_settingpage('coursesettings', get_string('coursesettings'));
-    $courseformats = get_list_of_plugins('course/format');
+    $courseformats = get_plugin_list('format');
     $formcourseformats = array();
-    foreach ($courseformats as $courseformat) {
+    foreach ($courseformats as $courseformat => $courseformatdir) {
         $formcourseformats["$courseformat"] = get_string("format$courseformat","format_$courseformat");
         if ($formcourseformats["$courseformat"]=="[[format$courseformat]]") {
             $formcourseformats["$courseformat"] = get_string("format$courseformat");
index ac902c48d765520afe129500f2d89cf465dcd0dd..414b79549b27b8b1647524de5d0df72810bee8c3 100644 (file)
@@ -173,12 +173,12 @@ if (has_capability('moodle/grade:manage', $systemcontext)
 
     // Reports
     $ADMIN->add('grades', new admin_category('gradereports', get_string('reportsettings', 'grades')));
-    foreach (get_list_of_plugins('grade/report') as $plugin) {
+    foreach (get_plugin_list('gradereport') as $plugin => $plugindir) {
      // Include all the settings commands for this plugin if there are any
-        if (file_exists($CFG->dirroot.'/grade/report/'.$plugin.'/settings.php')) {
+        if (file_exists($plugindir.'/settings.php')) {
             $settings = new admin_settingpage('gradereport'.$plugin, get_string('modulename', 'gradereport_'.$plugin), 'moodle/grade:manage');
             if ($ADMIN->fulltree) {
-                include($CFG->dirroot.'/grade/report/'.$plugin.'/settings.php');
+                include($plugindir.'/settings.php');
             }
             $ADMIN->add('gradereports', $settings);
         }
@@ -186,13 +186,13 @@ if (has_capability('moodle/grade:manage', $systemcontext)
 
     // Imports
     $ADMIN->add('grades', new admin_category('gradeimports', get_string('importsettings', 'grades')));
-    foreach (get_list_of_plugins('grade/import') as $plugin) {
+    foreach (get_plugin_list('gradeimport') as $plugin => $plugindir) {
 
      // Include all the settings commands for this plugin if there are any
-        if (file_exists($CFG->dirroot.'/grade/import/'.$plugin.'/settings.php')) {
+        if (file_exists($plugindir.'/settings.php')) {
             $settings = new admin_settingpage('gradeimport'.$plugin, get_string('modulename', 'gradeimport_'.$plugin), 'moodle/grade:manage');
             if ($ADMIN->fulltree) {
-                include($CFG->dirroot.'/grade/import/'.$plugin.'/settings.php');
+                include($plugindir.'/settings.php');
             }
             $ADMIN->add('gradeimports', $settings);
         }
@@ -201,12 +201,12 @@ if (has_capability('moodle/grade:manage', $systemcontext)
 
     // Exports
     $ADMIN->add('grades', new admin_category('gradeexports', get_string('exportsettings', 'grades')));
-    foreach (get_list_of_plugins('grade/export') as $plugin) {
+    foreach (get_plugin_list('gradeexport') as $plugin => $plugindir) {
      // Include all the settings commands for this plugin if there are any
-        if (file_exists($CFG->dirroot.'/grade/export/'.$plugin.'/settings.php')) {
+        if (file_exists($plugindir.'/settings.php')) {
             $settings = new admin_settingpage('gradeexport'.$plugin, get_string('modulename', 'gradeexport_'.$plugin), 'moodle/grade:manage');
             if ($ADMIN->fulltree) {
-                include($CFG->dirroot.'/grade/export/'.$plugin.'/settings.php');
+                include($plugindir.'/settings.php');
             }
             $ADMIN->add('gradeexports', $settings);
         }
@@ -214,4 +214,3 @@ if (has_capability('moodle/grade:manage', $systemcontext)
 
 } // end of speedup
 
-?>
index bffb8b11a1073ea9202b6000e90e4aac480609c5..e5105cdc0041c8a8a8d0bd3d52a890ef45a3cfe3 100644 (file)
@@ -258,20 +258,30 @@ if ($hassiteconfig || has_capability('moodle/question:config', $systemcontext))
 
 /// Now add reports
 
-foreach (get_list_of_plugins($CFG->admin.'/report') as $plugin) {
-    $settings_path = "$CFG->dirroot/$CFG->admin/report/$plugin/settings.php";
+foreach (get_plugin_list('report') as $plugin => $plugindir) {
+    $settings_path = "$plugindir/settings.php";
     if (file_exists($settings_path)) {
         include($settings_path);
         continue;
     }
 
-    $index_path = "$CFG->dirroot/$CFG->admin/report/$plugin/index.php";
+    $index_path = "$plugindir/index.php";
     if (!file_exists($index_path)) {
         continue;
     }
     // old style 3rd party plugin without settings.php
-    $www_path = "$CFG->dirroot/$CFG->admin/report/$plugin/index.php";
+    $www_path = "$CFG->wwwroot/$CFG->admin/report/$plugin/index.php";
     $reportname = get_string($plugin, 'report_' . $plugin);
     $ADMIN->add('reports', new admin_externalpage('report'.$plugin, $reportname, $www_path, 'moodle/site:viewreports'));
 }
 
+
+/// Add all local plugins - must be always last!
+
+foreach (get_plugin_list('local') as $plugin => $plugindir) {
+    $settings_path = "$plugindir/settings.php";
+    if (file_exists($settings_path)) {
+        include($settings_path);
+        continue;
+    }
+}
\ No newline at end of file
index c725cf4e1c88c72c58e28dcd9f78c5017800fde3..9d61028e830f20ec474c6a4009ee3cdca42432e7 100644 (file)
@@ -36,22 +36,22 @@ if ($hassiteconfig
     $ADMIN->add('authsettings', $temp);
 
 
-    if ($auths = get_list_of_plugins('auth')) {
+    if ($auths = get_plugin_list('auth')) {
         $authsenabled = get_enabled_auth_plugins();
         $authbyname = array();
 
-        foreach ($auths as $auth) {
+        foreach ($auths as $auth => $authdir) {
             $strauthname = auth_get_plugin_title($auth);
             $authbyname[$strauthname] = $auth;
         }
         ksort($authbyname);
 
         foreach ($authbyname as $strauthname=>$authname) {
-            if (file_exists($CFG->dirroot.'/auth/'.$authname.'/settings.php')) {
+            if (file_exists($authdir.'/settings.php')) {
                 // do not show disabled auths in tree, keep only settings link on manage page
                 $settings = new admin_settingpage('authsetting'.$authname, $strauthname, 'moodle/site:config', !in_array($authname, $authsenabled));
                 if ($ADMIN->fulltree) {
-                    include($CFG->dirroot.'/auth/'.$authname.'/settings.php');
+                    include($authdir.'/settings.php');
                 }
                 // TODO: finish implementation of common settings - locking, etc.
                 $ADMIN->add('authsettings', $settings);
index 9b55b3c484c975b4a3337d9019a61b5e0c3b8ebb..5d67b4f0089f90d6f4e3bc756b39fa5158a0ab1f 100755 (executable)
@@ -159,7 +159,8 @@ if ($formdata = $mform->is_cancelled()) {
 
     $allowedauths   = uu_allowed_auths();
     $allowedauths   = array_keys($allowedauths);
-    $availableauths = get_list_of_plugins('auth');
+    $availableauths = get_plugin_list('auth');
+    $availableauths = array_keys($availableauths);
 
     $allowedroles = uu_allowed_roles(true);
     foreach ($allowedroles as $rid=>$rname) {
index 149858c08b40d3fb400a9a01610459c72f82e186..c0cb9031b1d03474d59ab8e2c36915c13a7b5a8a 100644 (file)
@@ -201,23 +201,23 @@ class XMLDBAction {
      * @param xmldb_structure structure object containing all the info
      * @return string PHP code to be used to stabilish a savepoint
      */
-    function upgrade_savepoint_php ($structure) {
+    function upgrade_savepoint_php($structure) {
 
         $path = $structure->getPath();
 
     /// Trim "db" from path
         $path = dirname($path);
 
-    /// Get all the available plugin types
-        $plugintypes = get_plugin_types();
-
     /// Get pluginname, plugindir and plugintype
         $pluginname = basename($path);
         if ($path == 'lib') { /// exception for lib (not proper plugin)
             $plugindir = 'lib';
             $plugintype = 'lib';
         } else { /// rest of plugins
+            //TODO: this is not nice and may fail, plugintype should be passed around somehow instead
+            $plugintypes = get_plugin_types(false);
             $plugindir = dirname($path);
+            $plugindir = str_replace('\\', '/', $plugindir);
             $plugintype = array_search($plugindir, $plugintypes);
         }
 
index bb82b72713797befe32e206b92ea0c7bf04dd678..5432733a98972508384585143d3af605bb4d5314 100644 (file)
@@ -62,9 +62,9 @@ class block_admin extends block_list {
             if (has_capability('moodle/grade:viewall', $context)) {
                 $reportavailable = true;
             } else if (!empty($course->showgrades)) {
-                if ($reports = get_list_of_plugins('grade/report')) {     // Get all installed reports
+                if ($reports = get_plugin_list('gradereport')) {     // Get all installed reports
                     arsort($reports); // user is last, we want to test it first
-                    foreach ($reports as $plugin) {
+                    foreach ($reports as $plugin => $plugindir) {
                         if (has_capability('gradereport/'.$plugin.':view', $context)) {
                             //stop when the first visible plugin is found
                             $reportavailable = true;
index 1cb7a83bbb5f38887a906ffabb08a371786a7cfc..abcd88c6bb71f62a39682968f77d3f2a088efc9d 100644 (file)
@@ -112,10 +112,10 @@ class course_edit_form extends moodleform {
         $mform->setHelpButton('summary', array('text2', get_string('helptext')), true);
         $mform->setType('summary', PARAM_RAW);
 
-        $courseformats = get_list_of_plugins('course/format');
+        $courseformats = get_plugin_list('format');
         $formcourseformats = array();
-        foreach ($courseformats as $courseformat) {
-            $formcourseformats["$courseformat"] = get_string("format$courseformat","format_$courseformat");
+        foreach ($courseformats as $courseformat => $formatdir) {
+            $formcourseformats["$courseformat"] = get_string("format$courseformat", "format_$courseformat");
             if($formcourseformats["$courseformat"]=="[[format$courseformat]]") {
                 $formcourseformats["$courseformat"] = get_string("format$courseformat");
             }
index f33b64a9779f3ce51efdd5756199d0719c8fe446..4853bb66402837c6a35a8a5608ad99f543bc2653 100644 (file)
 
     print_header($course->fullname.': '.$strimport, $course->fullname.': '.$strimport, $navigation);
 
-    $directories = get_list_of_plugins('course/import');
+    $imports = get_plugin_list('import');
 
-    foreach ($directories as $directory) {
+    foreach ($imports as $import => $importdir) {
         echo '<div class="plugin">';
-        include_once($CFG->dirroot.'/course/import/'.$directory.'/mod.php');
+        include($importdir.'/mod.php');
         echo '</div>';
     }
 
index 593da6bc3b2c94da362916ae981be69ce5e885bc..07b8218d7556aa883b46786ff3d98764c0f82440 100644 (file)
     $navigation = build_navigation($navlinks);
     print_header($course->fullname.': '.$strreports, $course->fullname.': '.$strreports, $navigation);
 
-    $directories = get_list_of_plugins('course/report');
+    $reports = get_plugin_list('report');
 
-    foreach ($directories as $directory) {
-        $pluginfile = $CFG->dirroot.'/course/report/'.$directory.'/mod.php';
+    foreach ($reports as $report => $reportdirectory) {
+        $pluginfile = $reportdirectory.'/mod.php';
         if (file_exists($pluginfile)) {
             ob_start();
             include($pluginfile);  // Fragment for listing
index 9c7232e7905364d65b16dfad6f1e311790a52dcd..acc35917a1d76ec41e4f25582f6a57ca316d0157 100644 (file)
@@ -100,10 +100,10 @@ class course_settings_form extends moodleform {
         $types = array('report', 'export', 'import');
 
         foreach($types as $type) {
-            foreach (get_list_of_plugins('grade/'.$type) as $plugin) {
+            foreach (get_plugin_list('grade'.$type) as $plugin => $plugindir) {
              // Include all the settings commands for this plugin if there are any
-                if (file_exists($CFG->dirroot.'/grade/'.$type.'/'.$plugin.'/lib.php')) {
-                    require_once($CFG->dirroot.'/grade/'.$type.'/'.$plugin.'/lib.php');
+                if (file_exists($plugindir.'/lib.php')) {
+                    require_once($plugindir.'/lib.php');
                     $functionname = 'grade_'.$type.'_'.$plugin.'_settings_definition';
                     if (function_exists($functionname)) {
                         $mform->addElement('header', 'grade_'.$type.$plugin, get_string('modulename', 'grade'.$type.'_'.$plugin, NULL));
index 924da2240bd81ab6aa420efd54d300511c21fb93..81c63f6bbb6fa36e3682a78f31e657978e9ac525 100644 (file)
@@ -494,10 +494,10 @@ function grade_get_plugin_info($courseid, $active_type, $active_plugin) {
     // report plugins with its special structure
 
     // Get all installed reports
-    if ($reports = get_list_of_plugins('grade/report', 'CVS')) {
+    if ($reports = get_plugin_list('gradereport')) {
 
         // Remove ones we can't see
-        foreach ($reports as $key => $plugin) {
+        foreach ($reports as $plugin => $unused) {
             if (!has_capability('gradereport/'.$plugin.':view', $context)) {
                 unset($reports[$key]);
             }
@@ -507,7 +507,7 @@ function grade_get_plugin_info($courseid, $active_type, $active_plugin) {
     $reportnames = array();
 
     if (!empty($reports)) {
-        foreach ($reports as $plugin) {
+        foreach ($reports as $plugin => $plugindir) {
             $pluginstr = get_string('modulename', 'gradereport_'.$plugin);
             $url = $url_prefix.'report/'.$plugin.'/index.php?id='.$courseid;
             if ($active_type == 'report' and $active_plugin == $plugin ) {
@@ -516,7 +516,7 @@ function grade_get_plugin_info($courseid, $active_type, $active_plugin) {
             $reportnames[$plugin] = new grade_plugin_info($plugin, $url, $pluginstr);
 
             // Add link to preferences tab if such a page exists
-            if (file_exists($CFG->dirroot . '/grade/report/'.$plugin.'/preferences.php')) {
+            if (file_exists($plugindir.'/preferences.php')) {
                 $pref_url = $url_prefix.'report/'.$plugin.'/preferences.php?id='.$courseid;
                 $plugin_info['preferences'][$plugin] = new grade_plugin_info($plugin, $pref_url, $pluginstr);
             }
@@ -631,8 +631,8 @@ function grade_get_plugin_info($courseid, $active_type, $active_plugin) {
     }
 
     // standard import plugins
-    if ($imports = get_list_of_plugins('grade/import', 'CVS')) { // Get all installed import plugins
-        foreach ($imports as $key => $plugin) { // Remove ones we can't see
+    if ($imports = get_plugin_list('gradeimport')) { // Get all installed import plugins
+        foreach ($imports as $plugin => $plugindir) { // Remove ones we can't see
             if (!has_capability('gradeimport/'.$plugin.':view', $context)) {
                 unset($imports[$key]);
             }
@@ -656,7 +656,7 @@ function grade_get_plugin_info($courseid, $active_type, $active_plugin) {
     }
 
     // standard export plugins
-    if ($exports = get_list_of_plugins('grade/export', 'CVS')) { // Get all installed export plugins
+    if ($exports = get_plugin_list('gradeexport')) { // Get all installed export plugins
         foreach ($exports as $key => $plugin) { // Remove ones we can't see
             if (!has_capability('gradeexport/'.$plugin.':view', $context)) {
                 unset($exports[$key]);
@@ -665,7 +665,7 @@ function grade_get_plugin_info($courseid, $active_type, $active_plugin) {
     }
     $exportnames = array();
     if (!empty($exports)) {
-        foreach ($exports as $plugin) {
+        foreach ($exports as $plugin => $plugindir) {
             $pluginstr = get_string('modulename', 'gradeexport_'.$plugin);
             $url = $url_prefix.'export/'.$plugin.'/index.php?id='.$courseid;
             if ($active_type == 'export' and $active_plugin == $plugin ) {
index 4092346aeaeb6b1317ad725d04ec0b3bff4f5597..e50c3c4b4a5a83b12c1340a7c25101ac4468ae7f 100644 (file)
@@ -34,11 +34,12 @@ require_login($course);
 $context = get_context_instance(CONTEXT_COURSE, $course->id);
 
 /// find all accessible reports
-if ($reports = get_list_of_plugins('grade/report', 'CVS')) {     // Get all installed reports
-    foreach ($reports as $key => $plugin) {                      // Remove ones we can't see
-        if (!has_capability('gradereport/'.$plugin.':view', $context)) {
-            unset($reports[$key]);
-        }
+$reports = get_plugin_list('gradereport');     // Get all installed reports
+$reports = array_keys($reports);
+
+foreach ($reports as $plugin => $plugindir) {                      // Remove ones we can't see
+    if (!has_capability('gradereport/'.$plugin.':view', $context)) {
+        unset($reports[$key]);
     }
 }
 
@@ -75,4 +76,3 @@ if (empty($last)) {
 //redirect to last or guessed report
 redirect($CFG->wwwroot.'/grade/report/'.$last.'/index.php?id='.$course->id);
 
-?>
index bd303244fd8c3c484ad2b52f89e2b2e2b40c5081..b55a65cd1b74de2b9d525383198306bd626f927d 100755 (executable)
@@ -3025,13 +3025,12 @@ function role_assign($roleid, $userid, $groupid, $contextid, $timestart=0, $time
     }
 
 /// Ask all the modules if anything needs to be done for this user
-    if ($mods = get_list_of_plugins('mod')) {
-        foreach ($mods as $mod) {
-            include_once($CFG->dirroot.'/mod/'.$mod.'/lib.php');
-            $functionname = $mod.'_role_assign';
-            if (function_exists($functionname)) {
-                $functionname($userid, $context, $roleid);
-            }
+    $mods = get_plugin_list('mod');
+    foreach ($mods as $mod => $moddir) {
+        include_once($moddir.'/lib.php');
+        $functionname = $mod.'_role_assign';
+        if (function_exists($functionname)) {
+            $functionname($userid, $context, $roleid);
         }
     }
 
@@ -3087,7 +3086,7 @@ function role_unassign($roleid=0, $userid=0, $groupid=0, $contextid=0, $enrol=NU
 
     if ($select) {
         if ($ras = $DB->get_records_select('role_assignments', implode(' AND ', $select), $params)) {
-            $mods = get_list_of_plugins('mod');
+            $mods = get_plugin_list('mod');
             foreach($ras as $ra) {
                 $fireevent = false;
                 /// infinite loop protection when deleting recursively
@@ -3117,8 +3116,8 @@ function role_unassign($roleid=0, $userid=0, $groupid=0, $contextid=0, $enrol=NU
                 }
 
                 /// Ask all the modules if anything needs to be done for this user
-                foreach ($mods as $mod) {
-                    include_once($CFG->dirroot.'/mod/'.$mod.'/lib.php');
+                foreach ($mods as $mod=>$moddir) {
+                    include_once($moddir.'/lib.php');
                     $functionname = $mod.'_role_unassign';
                     if (function_exists($functionname)) {
                         $functionname($ra->userid, $context); // watch out, $context might be NULL if something goes wrong
@@ -3208,101 +3207,34 @@ function enrol_into_course($course, $user, $enrol) {
  * capabilities are defined for the component, we simply return an empty array.
  *
  * @global object
- * @param string $component examples: 'moodle', 'mod/forum', 'block/quiz_results'
+ * @param string $component full plugin name, examples: 'moodle', 'mod_forum'
  * @return array array of capabilities
  */
 function load_capability_def($component) {
-    global $CFG;
-
-    if ($component == 'moodle') {
-        $defpath = $CFG->libdir.'/db/access.php';
-        $varprefix = 'moodle';
-    } else {
-        $compparts = explode('/', $component);
-
-        if ($compparts[0] == 'report') {
-            $defpath = $CFG->dirroot.'/'.$CFG->admin.'/report/'.$compparts[1].'/db/access.php';
-            $varprefix = $compparts[0].'_'.$compparts[1];
-
-        } else if ($compparts[0] == 'block') {
-            // Blocks are an exception. Blocks directory is 'blocks', and not
-            // 'block'. So we need to jump through hoops.
-            $defpath = $CFG->dirroot.'/'.$compparts[0].
-                                's/'.$compparts[1].'/db/access.php';
-            $varprefix = $compparts[0].'_'.$compparts[1];
-
-        } else if ($compparts[0] == 'format') {
-            // Similar to the above, course formats are 'format' while they
-            // are stored in 'course/format'.
-            $defpath = $CFG->dirroot.'/course/'.$component.'/db/access.php';
-            $varprefix = $compparts[0].'_'.$compparts[1];
+    $defpath = get_component_directory($component).'/db/access.php';
 
-        } else if ($compparts[0] == 'editor') {
-            $defpath = $CFG->dirroot.'/lib/editor/'.$compparts[1].'/db/access.php';
-            $varprefix = $compparts[0].'_'.$compparts[1];
-
-        } else if ($compparts[0] == 'gradeimport') {
-            $defpath = $CFG->dirroot.'/grade/import/'.$compparts[1].'/db/access.php';
-            $varprefix = $compparts[0].'_'.$compparts[1];
-
-        } else if ($compparts[0] == 'gradeexport') {
-            $defpath = $CFG->dirroot.'/grade/export/'.$compparts[1].'/db/access.php';
-            $varprefix = $compparts[0].'_'.$compparts[1];
-
-        } else if ($compparts[0] == 'gradereport') {
-            $defpath = $CFG->dirroot.'/grade/report/'.$compparts[1].'/db/access.php';
-            $varprefix = $compparts[0].'_'.$compparts[1];
-
-        } else if ($compparts[0] == 'quizreport') {
-            $defpath = $CFG->dirroot.'/mod/quiz/report/'.$compparts[1].'/db/access.php';
-            $varprefix = $compparts[0].'_'.$compparts[1];
-
-        } else if ($compparts[0] == 'coursereport') {
-            $defpath = $CFG->dirroot.'/course/report/'.$compparts[1].'/db/access.php';
-            $varprefix = $compparts[0].'_'.$compparts[1];
-
-        } else {
-            $defpath = $CFG->dirroot.'/'.$component.'/db/access.php';
-            $varprefix = str_replace('/', '_', $component);
-        }
-    }
     $capabilities = array();
-
     if (file_exists($defpath)) {
         require($defpath);
-        $capabilities = ${$varprefix.'_capabilities'};
+        $capabilities = ${$component.'_capabilities'};
     }
+
     return $capabilities;
 }
 
 
 /**
  * Gets the capabilities that have been cached in the database for this component.
- *
- * @global object
- * @param string $component - examples: 'moodle', 'mod/forum', 'block/quiz_results'
+ * @param string $component - examples: 'moodle', 'mod_forum'
  * @return array array of capabilities
  */
 function get_cached_capabilities($component='moodle') {
     global $DB;
-
-    if ($component == 'moodle') {
-        $storedcaps = $DB->get_records_select('capabilities', "name LIKE ?", array('moodle/%:%'));
-
-    } else if ($component == 'local') {
-        $storedcaps = $DB->get_records_select('capabilities', "name LIKE ?", array('moodle/local:%'));
-
-    } else {
-        $storedcaps = $DB->get_records_select('capabilities', "name LIKE ?", array("$component:%"));
-    }
-
-    return $storedcaps;
+    return $DB->get_records('capabilities', array('component'=>$component));
 }
 
 /**
  * Returns default capabilities for given legacy role type.
- *
- * @global object
  * @param string $legacyrole legacy role name
  * @return array
  */
@@ -3336,8 +3268,6 @@ function get_default_capabilities($legacyrole) {
  * Reset role capabilitites to default according to selected legacy capability.
  * If several legacy caps selected, use the first from get_default_capabilities.
  * If no legacy selected, removes all capabilities.
- *
- * @global object
  * @param int @roleid
  */
 function reset_role_capabilities($roleid) {
index ebec3dfeebdef3d967a8cf4294a10308e35cb0a1..75a74a2d99349a4b9002e77d75cea786c22b946d 100644 (file)
@@ -198,38 +198,6 @@ function get_used_table_names() {
     return $table_names;
 }
 
-/**
- * Lists all plugin types
- *
- * @global object
- * @return array Array of strings - name=>location
- */
-function get_plugin_types() {
-    global $CFG;
-
-    return array('mod'           => 'mod',
-                 'qtype'         => 'question/type',
-                 'block'         => 'blocks',
-                 'auth'          => 'auth',
-                 'enrol'         => 'enrol',
-                 'format'        => 'course/format',
-                 'editor'        => 'lib/editor',
-                 'gradeexport'   => 'grade/export',
-                 'gradeimport'   => 'grade/import',
-                 'gradereport'   => 'grade/report',
-                 'message'       => 'message/output',
-                 'coursereport'  => 'course/report',
-                 'report'        => $CFG->admin.'/report',
-                 'portfolio'     => 'portfolio/type',
-                 'repository'    => 'repository',
-
-        // following types a very ugly hacks - we should not make exceptions like this - all plugins should be equal;
-        // these plugins may cause problems such as when wanting to uninstall them
-                 'quizreport'      => 'mod/quiz/report',
-                 'assignment_type' => 'mod/assignment/type',
-                );
-}
-
 /**
  * Returns list of all directories where we expect install.xml files
  *
@@ -245,21 +213,15 @@ function get_db_directories() {
     $dbdirs[] = $CFG->libdir.'/db';
 
 /// Then, all the ones defined by get_plugin_types()
-    if ($plugintypes = get_plugin_types()) {
-        foreach ($plugintypes as $plugintype => $pluginbasedir) {
-            if ($plugins = get_list_of_plugins($pluginbasedir, 'db')) {
-                foreach ($plugins as $plugin) {
-                    $dbdirs[] = $CFG->dirroot . '/' . $pluginbasedir . '/' . $plugin . '/db';
-                }
+    $plugintypes = get_plugin_types();
+    foreach ($plugintypes as $plugintype => $pluginbasedir) {
+        if ($plugins = get_plugin_list($plugintype)) {
+            foreach ($plugins as $plugin => $plugindir) {
+                $dbdirs[] = $plugindir.'/db';
             }
         }
     }
 
-/// Local database changes, if the local folder exists.
-    if (file_exists($CFG->dirroot . '/local')) {
-        $dbdirs[] = $CFG->dirroot.'/local/db';
-    }
-
     return $dbdirs;
 }
 
@@ -4125,8 +4087,8 @@ class admin_setting_special_gradeexport extends admin_setting_configmulticheckbo
         }
         $this->choices = array();
 
-        if ($plugins = get_list_of_plugins('grade/export')) {
-            foreach($plugins as $plugin) {
+        if ($plugins = get_plugin_list('gradeexport')) {
+            foreach($plugins as $plugin => $unused) {
                 $this->choices[$plugin] = get_string('modulename', 'gradeexport_'.$plugin);
             }
         }
@@ -4301,9 +4263,9 @@ class admin_setting_grade_profilereport extends admin_setting_configselect {
         global $CFG;
         require_once($CFG->libdir.'/gradelib.php');
 
-        foreach (get_list_of_plugins('grade/report') as $plugin) {
-            if (file_exists($CFG->dirroot.'/grade/report/'.$plugin.'/lib.php')) {
-                require_once($CFG->dirroot.'/grade/report/'.$plugin.'/lib.php');
+        foreach (get_plugin_list('gradereport') as $plugin => $plugindir) {
+            if (file_exists($plugindir.'/lib.php')) {
+                require_once($plugindir.'/lib.php');
                 $functionname = 'grade_report_'.$plugin.'_profilereport';
                 if (function_exists($functionname)) {
                     $this->choices[$plugin] = get_string('modulename', 'gradereport_'.$plugin);
@@ -4457,9 +4419,9 @@ class admin_enrolment_page extends admin_externalpage {
 
         $found = false;
 
-        if ($modules = get_list_of_plugins('enrol')) {
+        if ($modules = get_plugin_list('enrol')) {
             $textlib = textlib_get_instance();
-            foreach ($modules as $plugin) {
+            foreach ($modules as $plugin => $dir) {
                 if (strpos($plugin, $query) !== false) {
                     $found = true;
                     break;
@@ -4655,8 +4617,8 @@ class admin_setting_manageauths extends admin_setting {
         }
 
         $textlib = textlib_get_instance();
-        $authsavailable = get_list_of_plugins('auth');
-        foreach ($authsavailable as $auth) {
+        $authsavailable = get_plugin_list('auth');
+        foreach ($authsavailable as $auth => $dir) {
             if (strpos($auth, $query) !== false) {
                 return true;
             }
@@ -4687,7 +4649,7 @@ class admin_setting_manageauths extends admin_setting {
                                  'up', 'down', 'none'));
         $txt->updown = "$txt->up/$txt->down";
 
-        $authsavailable = get_list_of_plugins('auth');
+        $authsavailable = get_plugin_list('auth');
         get_enabled_auth_plugins(true); // fix the list of enabled auths
         if (empty($CFG->auth)) {
             $authsenabled = array();
@@ -4710,7 +4672,7 @@ class admin_setting_manageauths extends admin_setting {
             }
         }
 
-        foreach ($authsavailable as $auth) {
+        foreach ($authsavailable as $auth => $dir) {
             if (array_key_exists($auth, $displayauths)) {
                 continue; //already in the list
             }
@@ -5081,8 +5043,8 @@ class admin_setting_manageportfolio extends admin_setting {
         }
 
         $textlib = textlib_get_instance();
-        $portfolios= get_list_of_plugins('portfolio/type');
-        foreach ($portfolios as $p) {
+        $portfolios = get_plugin_list('portfolio');
+        foreach ($portfolios as $p => $dir) {
             if (strpos($p, $query) !== false) {
                 return true;
             }
@@ -5112,7 +5074,8 @@ class admin_setting_manageportfolio extends admin_setting {
         $namestr = get_string('name');
         $pluginstr = get_string('plugin', 'portfolio');
 
-        $plugins = get_list_of_plugins('portfolio/type');
+        $plugins = get_plugin_list('portfolio');
+        $plugins = array_keys($plugins);
         $instances = portfolio_instances(false, false);
         $alreadyplugins = array();
 
@@ -5418,10 +5381,6 @@ function admin_get_root($reload=false, $requirefulltree=true) {
         }
         require($CFG->dirroot.'/'.$CFG->admin.'/settings/plugins.php');
 
-        if (file_exists($CFG->dirroot.'/local/settings.php')) {
-            require($CFG->dirroot.'/local/settings.php');
-        }
-
         $ADMIN->loaded = true;
     }
 
@@ -5882,9 +5841,9 @@ function print_plugin_tables() {
     $plugins_installed['filter'] = array();
 
     $plugins_ondisk = array();
-    $plugins_ondisk['mod'] = get_list_of_plugins('mod', 'db');
-    $plugins_ondisk['blocks'] = get_list_of_plugins('blocks', 'db');
-    $plugins_ondisk['filter'] = get_list_of_plugins('filter', 'db');
+    $plugins_ondisk['mod']    = array_keys(get_plugin_list('mod'));
+    $plugins_ondisk['blocks'] = array_keys(get_plugin_list('block'));
+    $plugins_ondisk['filter'] = array_keys(get_plugin_list('filter'));
 
     $strstandard    = get_string('standard');
     $strnonstandard = get_string('nonstandard');
@@ -6048,8 +6007,8 @@ class admin_setting_managerepository extends admin_setting {
         }
 
         $textlib = textlib_get_instance();
-        $repositories= get_list_of_plugins('repository');
-        foreach ($repositories as $p) {
+        $repositories= get_plugin_list('repository');
+        foreach ($repositories as $p => $dir) {
             if (strpos($p, $query) !== false) {
                 return true;
             }
@@ -6080,7 +6039,7 @@ class admin_setting_managerepository extends admin_setting {
         $updownstr = get_string('updown', 'repository');
         $hiddenstr = get_string('hiddenshow', 'repository');
         $deletestr = get_string('delete');
-        $plugins = get_list_of_plugins('repository');
+        $plugins = get_plugin_list('repository');
         $instances = repository::get_types();
         $instancesnumber = count($instances);
         $alreadyplugins = array();
@@ -6161,7 +6120,7 @@ class admin_setting_managerepository extends admin_setting {
         $instancehtml .= get_string('addplugin', 'repository');
         $instancehtml .= '</h3><ul>';
         $addable = 0;
-        foreach ($plugins as $p) {
+        foreach ($plugins as $p=>$dir) {
             if (!in_array($p, $alreadyplugins)) {
                 $instancehtml .= '<li><a href="'.$CFG->wwwroot.'/'.$CFG->admin.'/repository.php?sesskey='
                     .sesskey().'&amp;new='.$p.'">'.get_string('add', 'repository')
index dc827a79c078140f61466affda99af6cf3b2cd32..44fd8f89a40a06d5a9eb9e989a0e5816307b8b6a 100644 (file)
@@ -36,11 +36,9 @@ $messageproviders = array (
 /// Important errors that an admin ought to know about
     'errors' => array (
          'capability'  => 'moodle/site:config'
-    )
+    ),
 
+    'instantmessage' => array (
+    ),
+    
 );
-
-
-
-
-?>
index f2a1519d8697aa2a72a28782d993f6eccbe82a80..3e838c8ebd6f4ad44c0aa323933a6bd5323e78c0 100644 (file)
@@ -2191,6 +2191,66 @@ WHERE gradeitemid IS NOT NULL AND grademax IS NOT NULL");
         upgrade_main_savepoint($result, 2009061600);
     }
 
+    if ($result && $oldversion < 2009061702) {
+        // standardizing plugin names
+        if ($configs = $DB->get_records_select('config_plugins', "plugin LIKE 'quizreport_%'")) {
+            foreach ($configs as $config) {
+                $config->plugin = str_replace('quizreport_', 'quiz_', $config->plugin);
+                $DB->update_record('config_plugins', $config);
+            }
+        }
+        unset($configs);
+        upgrade_main_savepoint($result, 2009061702);
+    }
+
+    if ($result && $oldversion < 2009061703) {
+        // standardizing plugin names
+        if ($configs = $DB->get_records_select('config_plugins', "plugin LIKE 'assignment_type_%'")) {
+            foreach ($configs as $config) {
+                $config->plugin = str_replace('assignment_type_', 'assignment_', $config->plugin);
+                $DB->update_record('config_plugins', $config);
+            }
+        }
+        unset($configs);
+        upgrade_main_savepoint($result, 2009061703);
+    }
+
+    if ($result && $oldversion < 2009061704) {
+        // change component string in capability records to new "_" format 
+        if ($caps = $DB->get_records('capabilities')) {
+            foreach ($caps as $cap) {
+                $cap->component = str_replace('/', '_', $cap->component);
+                $DB->update_record('capabilities', $cap);
+            }
+        }
+        unset($caps);
+        upgrade_main_savepoint($result, 2009061704);
+    }
+
+    if ($result && $oldversion < 2009061705) {
+        // change component string in events_handlers records to new "_" format 
+        if ($handlers = $DB->get_records('events_handlers')) {
+            foreach ($handlers as $handler) {
+                $handler->handlermodule = str_replace('/', '_', $handler->handlermodule);
+                $DB->update_record('events_handlers', $handler);
+            }
+        }
+        unset($handlers);
+        upgrade_main_savepoint($result, 2009061705);
+    }
+
+    if ($result && $oldversion < 2009061706) {
+        // change component string in message_providers records to new "_" format 
+        if ($mps = $DB->get_records('message_providers')) {
+            foreach ($mps as $mp) {
+                $mp->component = str_replace('/', '_', $mp->component);
+                $DB->update_record('message_providers', $cap);
+            }
+        }
+        unset($caps);
+        upgrade_main_savepoint($result, 2009061706);
+    }
+    
     return $result;
 }
 
index 965b453064c7bac1c13d2ab310b97ea96157bf98..0808d8ce8e4654f0f6346636500254b98b962d97 100644 (file)
@@ -1002,7 +1002,7 @@ class database_manager {
             unset($dbtables[$tablename]);
         }
 
-        // look for unsupported tables - local custom tables should be in /local/db/install.xml ;-)
+        // look for unsupported tables - local custom tables should be in /local/xxxx/db/install.xml ;-)
         // if there is no prefix, we can not say if tale is ours :-(
         if ($this->generator->prefix !== '') {
             foreach ($dbtables as $tablename=>$unused) {
index f68292d7372d543b59964ed6808bc873a307f8f5..f42ed7eb5a252902dca06956a31a0644b798b188 100644 (file)
@@ -105,7 +105,7 @@ function get_texteditor($editorname) {
  */
 function get_available_editors() {
     $editors = array();
-    foreach (get_list_of_plugins('lib/editor') as $editorname) {
+    foreach (get_plugin_list('editor') as $editorname => $dir) {
         $editors[$editorname] = get_string('modulename', 'editor_'.$editorname);
     }
     return $editors;
index ef9cae6bb48b32a5e6344c7d69c6367aeb9af69f..faba2a34c45263c1bf1735edba79ea093aa83853 100755 (executable)
  * @return array of capabilities or empty array if not exists
  */
 function events_load_def($component) {
-    global $CFG;
-
-    if ($component == 'moodle') {
-        $defpath = $CFG->libdir.'/db/events.php';
-
-    } else if ($component == 'unittest') {
-        $defpath = $CFG->libdir.'/simpletest/fixtures/events.php';
-
-    } else {
-        $compparts = explode('/', $component);
-
-        if ($compparts[0] == 'block') {
-            // Blocks are an exception. Blocks directory is 'blocks', and not
-            // 'block'. So we need to jump through hoops.
-            $defpath = $CFG->dirroot.'/blocks/'.$compparts[1].'/db/events.php';
-
-        } else if ($compparts[0] == 'format') {
-            // Similar to the above, course formats are 'format' while they
-            // are stored in 'course/format'.
-            $defpath = $CFG->dirroot.'/course/format/'.$compparts[1].'/db/events.php';
-
-        } else if ($compparts[0] == 'editor') {
-            $defpath = $CFG->dirroot.'/lib/editor/'.$compparts[1].'/db/events.php';
-
-        } else if ($compparts[0] == 'gradeimport') {
-            $defpath = $CFG->dirroot.'/grade/import/'.$compparts[1].'/db/events.php';  
-        
-        } else if ($compparts[0] == 'gradeexport') {
-            $defpath = $CFG->dirroot.'/grade/export/'.$compparts[1].'/db/events.php'; 
-        
-        } else if ($compparts[0] == 'gradereport') {
-            $defpath = $CFG->dirroot.'/grade/report/'.$compparts[1].'/db/events.php'; 
-        } else if ($compparts[0] == 'portfolio'){
-            $defpath = $CFG->dirroot.'/portfolio/type/'.$compparts[1].'/db/events.php';
-        } else {
-            $defpath = $CFG->dirroot.'/'.$component.'/db/events.php';
-        }
-    }
+    $defpath = get_component_directory($component).'/db/events.php';
 
     $handlers = array();
 
@@ -121,7 +84,7 @@ function events_get_cached($component) {
  * the database.
  *
  * @global object
- * @param string $component examples: 'moodle', 'mod/forum', 'block/quiz_results'
+ * @param string $component examples: 'moodle', 'mod_forum', 'block_quiz_results'
  * @return boolean
  */
 function events_update_definition($component='moodle') {
index 015b09015dbd159e2c30debff139ae5e45caba96..db3d001e803d35a206ce139a27dc190e59532a7f 100644 (file)
@@ -1044,17 +1044,15 @@ function grade_grab_course_grades($courseid, $modname=null) {
         return;
     }
 
-    if (!$mods = get_list_of_plugins('mod') ) {
+    if (!$mods = get_plugin_list('mod') ) {
         print_error('nomodules', 'debug');
     }
 
-    foreach ($mods as $mod) {
+    foreach ($mods as $mod => $fullmod) {
         if ($mod == 'NEWMODULE') {   // Someone has unzipped the template, ignore it
             continue;
         }
 
-        $fullmod = $CFG->dirroot.'/mod/'.$mod;
-
         // include the module lib once
         if (file_exists($fullmod.'/lib.php')) {
             // get all instance of the activity
index 4a6956193bdbb43aff0823399f5c504f766684a6..a53179ffe63b2d5bcadb03f277c0e99817e7e0c1 100644 (file)
  * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 
-/** NO_MOODLE_COOKIES = true */
     define('NO_MOODLE_COOKIES', true);
-    /** NO_UPGRADE_CHECK = true */
     define('NO_UPGRADE_CHECK', true);
 
     include('../config.php');
 
     $output = "// Javascript from Moodle modules\n";
 
-    if ($mods = get_list_of_plugins('mod')) {
-        foreach ($mods as $mod) {
-            if (is_readable($CFG->dirroot.'/mod/'.$mod.'/javascript.php')) {
-                $output .= file_get_contents($CFG->dirroot.'/mod/'.$mod.'/javascript.php');
+    $plugintypes = array('mod', 'filter', 'block');
+    foreach ($plugintypes as $plugintype) {
+        if ($mods = get_plugin_list($plugintype)) {
+            foreach ($mods as $mod => $moddir) {
+                if (is_readable($moddir.'/javascript.php')) {
+                    $output .= file_get_contents($moddir.'/javascript.php');
+                }
             }
         }
     }
 
-    if ($filters = get_list_of_plugins('filter')) {
-        foreach ($filters as $filter) {
-            if (is_readable($CFG->dirroot.'/filter/'.$filter.'/javascript.php')) {
-                $output .= file_get_contents($CFG->dirroot.'/filter/'.$filter.'/javascript.php');
-            }
-        }
-    }
-
-    if ($blocks = get_list_of_plugins('blocks')) {
-        foreach ($blocks as $block) {
-            if (is_readable($CFG->dirroot.'/blocks/'.$block.'/javascript.php')) {
-                $output .= file_get_contents($CFG->dirroot.'/blocks/'.$block.'/javascript.php');
-            }
-        }
-    }
-
-
     $lifetime = '86400';
 
     @header('Content-type: text/javascript'); 
@@ -68,5 +52,3 @@
     @header('Pragma: ');
 
     echo $output;
-
-?>
diff --git a/lib/locallib.php b/lib/locallib.php
deleted file mode 100644 (file)
index 4d29c51..0000000
+++ /dev/null
@@ -1,175 +0,0 @@
-<?php
-
-// This file is part of Moodle - http://moodle.org/
-//
-// Moodle is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// Moodle is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
-
-/**
- * This file provides hooks from moodle core into custom code.
- *
- * Important note
- * --------------
- *
- * If at all possible, the facilities provided here should not be used.
- * Wherever possible, customisations should be written using one of the
- * standard plug-in points like modules, blocks, auth plugins, themes, ...
- *
- * However, sometimes that is just not possible, because of the nature
- * of the change you want to make. In which case the second best plan is
- * to implement your feature in a generally useful way, which can
- * be contributed back to the moodle project so that everyone benefits.
- *
- * But supposing you are forced to implement some nasty hack that only
- * you will ever want, then the local folder is for you. The idea is that
- * instead of scattering your changes throughout the code base, you
- * put them all in a folder called 'local'. Then you won't have to
- * deal with merging problems when you upgrade the rest of your moodle
- * installation.
- *
- *
- * Available hooks
- * ===============
- *
- * These are similar to the module interface, however, not all the the
- * facilities that are available to modules are available to local code (yet).
- * See also http://docs.moodle.org/en/Development:Local_customisation for more
- * information.
- *
- *
- * Local database customisations
- * -----------------------------
- *
- * If your local customisations require changes to the database, use the files:
- *
- * local/version.php
- * local/db/upgrade.php
- * local/db/install.php
- *
- * In the file version.php, set the variable $local_version to a versionstamp
- * value like 2006030300 (a concatenation of year, month, day, serial).
- *
- * In the file upgrade.php, implement the
- * function xmldb_local_upgrade($oldversion) to make the database changes.
- *
- * Note that you don't need to have an install.xml file. Instead,
- * when your moodle instance is first installed, xmldb_local_install() will be called.
- *
- * Please note that modifying of core tables is NOT supported at all!
- *
- * Local capabilities
- * ------------------
- *
- * If your local customisations require their own capabilities, use
- *
- * local/db/access.php
- *
- * You should create an array called $local_capabilities, which looks like:
- *
- * $local_capabilities = array(
- *         'moodle/local:capability' => array(
- *         'captype' => 'read',
- *         'contextlevel' => CONTEXT_SYSTEM,
- *      ),
- * );
- *
- * Note that for all local capabilities you add, you'll need to add language strings.
- * Moodle will expect to find them in local/lang/en_utf8/local.php (eg for English)
- * with a key (following the above example) of local:capability
- * See the next section for local language support.
- *
- *
- * Local language support
- * ----------------------
- *
- * Moodle already supports local overriding of any language strings, or the
- * creation of new strings. Just create a folder lang/XX_utf8_local where XX is
- * a language code. Any language files you put in there will be used before
- * the standard files. So, for example, can can create a file
- * lang/en_utf8_local/moodle.php containing
- *   $strings['login'] = 'Sign in';
- * and that will change the string 'Login' to 'Sign in'. (See also
- * http://docs.moodle.org/en/Language_editing for another way to achieve this.)
- *
- * This mechanism can also be used to create completely new language files. For
- * example, suppose you have created some code in local/myfeature.php that needs
- * some language strings. You can put those strings in the file
- * lang/en_utf8_local/local_myfeature.php, and then access then using
- * get_string('mystring', 'local_myfeature'). (Note that you do not have to call
- * the file local_myfeature.php, you can call it anything you like, however,
- * the convention of calling lang files for local/ code local_somthing is recommended.)
- *
- * In addition, there is one other mechanism that is available. Strings from the
- * 'local' langauge file (for example get_string('mystring', 'local') will be
- * found if the string is found in the file local/lang/en_utf8/local.php. Since
- * the lang file 'local' is used for a lot of things like capability names, you
- * can use this file for things like that.
- *
- *
- * Local admin menu items
- * ----------------------
- *
- * It is possible to add new items to the admin_tree block.
- * To do this, create a file, local/settings.php
- * which can access the $ADMIN variable directly and add things to it.
- * You might do something like:
- * $ADMIN->add('root', new admin_category($name, $title);
- * $ADMIN->add('foo', new admin_externalpage($name, $title, $url, $cap);
- *
- *
- * Course deletion
- * ---------------
- *
- * To have your local customisations notified when a course is deleted,
- * make a file called
- *
- * local/lib.php
- *
- * In there, implement the function local_delete_course($courseid). This
- * function will then be called whenever the functions remove_course_contents()
- * or delete_course() from moodlelib are called.
- *
- * @package   moodlecore
- * @copyright 1999 onwards Martin Dougiamas  {@link http://moodle.com}
- * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-
-/**
- * Notify local code that a course is being deleted.
- * Look for a function local_delete_course() in a file called
- * local/lib.php andn call it if it is there.
- *
- * @global object
- * @param int $courseid the course that is being deleted.
- * @param bool $showfeedback Whether to display notifications on success.
- * @return bool false if local_delete_course failed, or true if
- *          there was noting to do or local_delete_course succeeded.
- */
-function notify_local_delete_course($courseid, $showfeedback) {
-    global $CFG;
-    $localfile = $CFG->dirroot .'/local/lib.php';
-    if (file_exists($localfile)) {
-        require_once($localfile);
-        if (function_exists('local_delete_course')) {
-            if (local_delete_course($courseid)) {
-                if ($showfeedback) {
-                    notify(get_string('deleted') . ' local data');
-                }
-            } else {
-                return false;
-            }
-        }
-    }
-    return true;
-}
-?>
index 5a48b5ede5f7761b63265d99da247c94ed1b02e7..00838a4e5b527261c60a1d3e6d52925e89794f93 100644 (file)
@@ -118,7 +118,7 @@ function message_send_handler($eventdata){
 
 /**
  * This code updates the message_providers table with the current set of providers
- * @param $component - examples: 'moodle', 'mod/forum', 'block/quiz_results'
+ * @param $component - examples: 'moodle', 'mod_forum', 'block_quiz_results'
  * @return boolean
  */
 function message_update_providers($component='moodle') {
@@ -210,46 +210,13 @@ function message_get_providers_from_db($component) {
 /**
  * Loads the messages definitions for the component (from file). If no
  * messages are defined for the component, we simply return an empty array.
- * @param $component - examples: 'moodle', 'mod/forum', 'block/quiz_results'
+ * @param $component - examples: 'moodle', 'mod_forum', 'block_quiz_results'
  * @return array of message providerss or empty array if not exists
  *
  * INTERNAL - to be used from messagelib only
  */
 function message_get_providers_from_file($component) {
-    global $CFG;
-
-    if ($component == 'moodle') {
-        $defpath = $CFG->libdir.'/db/messages.php';
-
-    } else if ($component == 'unittest') {
-        $defpath = $CFG->libdir.'/simpletest/fixtures/messages.php';
-
-    } else {
-        $compparts = explode('/', $component);
-
-        if ($compparts[0] == 'block') {
-            // Blocks are an exception. Blocks directory is 'blocks', and not
-            // 'block'. So we need to jump through hoops.
-            $defpath = $CFG->dirroot.'/blocks/'.$compparts[1].'/db/messages.php';
-
-        } else if ($compparts[0] == 'format') {
-            // Similar to the above, course formats are 'format' while they
-            // are stored in 'course/format'.
-            $defpath = $CFG->dirroot.'/course/format/'.$compparts[1].'/db/messages.php';
-
-        } else if ($compparts[0] == 'gradeimport') {
-            $defpath = $CFG->dirroot.'/grade/import/'.$compparts[1].'/db/messages.php';  
-        
-        } else if ($compparts[0] == 'gradeexport') {
-            $defpath = $CFG->dirroot.'/grade/export/'.$compparts[1].'/db/messages.php'; 
-        
-        } else if ($compparts[0] == 'gradereport') {
-            $defpath = $CFG->dirroot.'/grade/report/'.$compparts[1].'/db/messages.php'; 
-        
-        } else {
-            $defpath = $CFG->dirroot.'/'.$component.'/db/messages.php';
-        }
-    }
+    $defpath = get_component_directory($component).'/db/messages.php';
 
     $messageproviders = array();
 
index 8708db492acbe1f0f770a6ee20ccac810131aff5..9655b17ba825a91cd0a160b169fe04a8a97513d2 100644 (file)
@@ -314,6 +314,8 @@ define('FEATURE_GROUPMEMBERSONLY', 'groupmembersonly');
 
 /** True if module supports intro editor */
 define('FEATURE_MOD_INTRO', 'mod_intro');
+/** True if module supports subplugins */
+define('FEATURE_MOD_SUBPLUGINS', 'mod_subplugins');
 /** True if module has default completion */
 define('FEATURE_MODEDIT_DEFAULT_COMPLETION', 'modedit_default_completion');
 
@@ -3882,10 +3884,10 @@ function remove_course_contents($courseid, $showfeedback=true) {
     $strdeleted = get_string('deleted');
 
 /// Clean up course formats (iterate through all formats in the even the course format was ever changed)
-    $formats = get_list_of_plugins('course/format');
-    foreach ($formats as $format) {
+    $formats = get_plugin_list('format');
+    foreach ($formats as $format=>$formatdir) {
         $formatdelete = $format.'_course_format_delete_course';
-        $formatlib    = "$CFG->dirroot/course/format/$format/lib.php";
+        $formatlib    = "$formatdir/lib.php";
         if (file_exists($formatlib)) {
             include_once($formatlib);
             if (function_exists($formatdelete)) {
@@ -3946,10 +3948,6 @@ function remove_course_contents($courseid, $showfeedback=true) {
         print_error('nomodules', 'debug');
     }
 
-/// Give local code a chance to delete its references to this course.
-    require_once($CFG->libdir.'/locallib.php');
-    notify_local_delete_course($courseid, $showfeedback);
-
 /// Delete course blocks
     blocks_delete_all_for_context($context->id);
 
@@ -5692,29 +5690,12 @@ class string_manager {
             $dirroot . '/lang/' => '',
             $dataroot . '/lang/' => '',
         );
-        $this->searchplacesbyplugintype = array(
-            'assignment_' => array('mod/assignment/type'),
-            'auth_' => array('auth'),
-            'block_' => array('blocks'),
-            'datafield_' => array('mod/data/field'),
-            'datapreset_' => array('mod/data/preset'),
-            'enrol_' => array('enrol'),
-            'filter_' => array('filter'),
-            'format_' => array('course/format'),
-            'editor_' => array('lib/editor'),
-            'quiz_' => array('mod/quiz/report'),
-            'qtype_' => array('question/type'),
-            'qformat_' => array('question/format'),
-            'report_' => array($admin.'/report', 'course/report'),
-            'repository_'=>array('repository'),
-            'resource_' => array('mod/resource/type'),
-            'gradereport_' => array('grade/report'),
-            'gradeimport_' => array('grade/import'),
-            'gradeexport_' => array('grade/export'),
-            'profilefield_' => array('user/profile/field'),
-            'portfolio_' => array('portfolio/type'),
-            '' => array('mod')
-        );
+        $this->searchplacesbyplugintype = array(''=>array('mod'));
+        $plugintypes = get_plugin_types(false);
+        foreach ($plugintypes as $plugintype => $dir) {
+            $this->searchplacesbyplugintype[$plugintype.'_'] = array($dir);
+        }
+        unset($this->searchplacesbyplugintype['mod_']);
         $this->restore_extra_locations_from_session();
         if ($runninginstaller) {
             $stringnames = file($dirroot . '/install/stringnames.txt');
@@ -5822,14 +5803,10 @@ class string_manager {
             foreach ($locations as $location => $ignored) {
                 $locations[$location] = $module . '/';
             }
-            if ($module == 'local') {
-                $locations[$this->dirroot . '/local/lang/'] = 'local/';
-            } else {
-                list($type, $plugin) = $this->parse_module_name($module);
-                if (isset($this->searchplacesbyplugintype[$type])) {
-                    foreach ($this->searchplacesbyplugintype[$type] as $location) {
-                        $locations[$this->dirroot . "/$location/$plugin/lang/"] = $plugin . '/';
-                    }
+            list($type, $plugin) = $this->parse_module_name($module);
+            if (isset($this->searchplacesbyplugintype[$type])) {
+                foreach ($this->searchplacesbyplugintype[$type] as $location) {
+                    $locations[$this->dirroot . "/$location/$plugin/lang/"] = $plugin . '/';
                 }
             }
         }
@@ -6371,7 +6348,7 @@ function get_list_of_themes() {
     if (!empty($CFG->themelist)) {       // use admin's list of themes
         $themelist = explode(',', $CFG->themelist);
     } else {
-        $themelist = get_list_of_plugins("theme");
+        $themelist = array_keys(get_plugin_list("theme"));
     }
 
     foreach ($themelist as $key => $theme) {
@@ -6759,33 +6736,196 @@ function show_event($event) {
 /// ENVIRONMENT CHECKING  ////////////////////////////////////////////////////////////
 
 /**
- * Lists plugin directories within some directory
+ * Return exact path to plugin directory
+ * @param string $plugintype type of plugin
+ * @param string $name name of the plugin
+ * @param bool $fullpaths false means relative paths from dirroot
+ * @return directory path, full or relative to dirroot
+ */
+function get_plugin_directory($plugintype, $name, $fullpaths=true) {
+    if ($plugintype === '') {
+        $plugintype = 'mod';
+    }
+
+    $types = get_plugin_types($fullpaths);
+    if (!array_key_exists($plugintype, $types)) {
+        return null;
+    }
+    $name = clean_param($name, PARAM_SAFEDIR); // just in case ;-)
+
+    return $types[$plugintype].'/'.$name;
+}
+
+/**
+ * Return exact path to plugin directory,
+ * this method support "simpletest_" prefix designed for unit testing.
+ * @param string $component name such as 'moodle', 'mod_forum' or special simpletest value
+ * @param bool $fullpaths false means relative paths from dirroot
+ * @return directory path, full or relative to dirroot
+ */
+function get_component_directory($component, $fullpaths=true) {
+    global $CFG;
+
+    $simpletest = false;
+    if (strpos($component, 'simpletest_') === 0) {
+        $subdir = substr($component, strlen('simpletest_'));
+        return $subdir;
+    }
+    if ($component == 'moodle') {
+        $path = ($fullpaths ? $CFG->libdir : 'lib');
+    } else {
+        list($type, $plugin) = explode('_', $component, 2);
+        $path = get_plugin_directory($type, $plugin, $fullpaths);
+    }        
+
+    return $path;
+}
+
+/**
+ * Lists all plugin types
+ * @param bool $fullpaths false means relative paths from dirroot
+ * @return array Array of strings - name=>location
+ */
+function get_plugin_types($fullpaths=true) {
+    global $CFG;
+
+    static $info     = null;
+    static $fullinfo = null;
+
+    if (!$info) {
+        $info = array('mod'           => 'mod',
+                      'auth'          => 'auth',
+                      'enrol'         => 'enrol',
+                      'message'       => 'message/output',
+                      'block'         => 'blocks',
+                      'filter'        => 'filter',
+                      'editor'        => 'lib/editor',
+                      'format'        => 'course/format',
+                      'import'        => 'course/import',
+                      'profilefield'  => 'user/profile/field',
+                      'report'        => $CFG->admin.'/report',
+                      'coursereport'  => 'course/report', // must be after system reports
+                      'gradeexport'   => 'grade/export',
+                      'gradeimport'   => 'grade/import',
+                      'gradereport'   => 'grade/report',
+                      'repository'    => 'repository',
+                      'portfolio'     => 'portfolio/type',
+                      'qtype'         => 'question/type',
+                      'qformat'       => 'question/format');
+/*
+        $mods = get_plugin_list('mod');
+        foreach ($mods as $mod => $moddir) {
+            if (!$subplugins = plugin_supports('mod', $mod, FEATURE_MOD_SUBPLUGINS, false)) {
+                continue;
+            }
+            foreach ($subplugins as $subtype=>$dir) {
+                $info[$subtype] = $dir;
+            }
+        }
+*/
+        // do not include themes if in non-standard location
+        if ($CFG->themedir === $CFG->dirroot.'/theme') {
+            $info['theme'] = 'theme';
+        }
+
+        // local is always last
+        $info['local'] = 'local';
+
+        $fullinfo = array();
+        foreach ($info as $type => $dir) {
+            $fullinfo[$type] = $CFG->dirroot.'/'.$dir;
+        }
+        $fullinfo['theme'] = $CFG->themedir;
+    }
+
+    return ($fullpaths ? $fullinfo : $info);
+}
+
+/**
+ * Simplified version of get_list_of_plugins()
+ * @param string $plugintype type of plugin
+ * @param bool $fullpaths false means relative paths from dirroot
+ * @return array name=>fulllocation pairs of plugins of given type
+ */
+function get_plugin_list($plugintype, $fullpaths=true) {
+    global $CFG;
+
+    $ignored = array('CVS', '_vti_cnf', 'simpletest', 'db');
+
+    if ($plugintype === '') {
+        $plugintype = 'mod';
+    }
+
+    if ($plugintype === 'mod') {
+        // mod is eán exception because we have to call this function from get_plugin_types()
+        $fulldir = $CFG->dirroot.'/mod';
+        $dir = $fullpaths ? $fulldir : 'mod';
+
+    } else {
+        $fulltypes = get_plugin_types(true);
+        $types     = get_plugin_types($fullpaths);
+        if (!array_key_exists($plugintype, $types)) {
+            return array();
+        }
+        $fulldir = $fulltypes[$plugintype];
+        $dir     = $types[$plugintype];
+        if (!file_exists($fulldir)) {
+            return array();
+        }
+    }
+
+    $result = array();
+
+    $items = new DirectoryIterator($fulldir);
+    foreach ($items as $item) {
+        if ($item->isDot() or !$item->isDir()) {
+            continue;
+        }
+        $pluginname = $item->getFilename();
+        if (in_array($pluginname, $ignored)) {
+            continue;
+        }
+        if ($pluginname !== clean_param($pluginname, PARAM_SAFEDIR)) {
+            // better ignore plugins with problematic names here
+            continue;
+        }
+        $result[$pluginname] = $dir.'/'.$pluginname;
+    }
+
+    ksort($result);
+    return $result;
+}
+
+/**
+ * Lists plugin-like directories within specified directory
  *
- * @global object
- * @param string $plugin dir under we'll look for plugins (defaults to 'mod')
+ * This function was originally used for standar Moodle plugins, please use
+ * new get_plugin_list() now.
+ *
+ * This function is used for general directory listing and backwards compability. 
+ *
+ * @param string $directory relatice directory from root
  * @param string $exclude dir name to exclude from the list (defaults to none)
  * @param string $basedir full path to the base dir where $plugin resides (defaults to $CFG->dirroot)
- * @return array Array of plugins found under the requested parameters
+ * @return array Sorted array of directory names found under the requested parameters
  */
-function get_list_of_plugins($plugin='mod', $exclude='', $basedir='') {
+function get_list_of_plugins($directory='mod', $exclude='', $basedir='') {
     global $CFG;
 
     $plugins = array();
 
     if (empty($basedir)) {
-
-        # This switch allows us to use the appropiate theme directory - and potentialy alternatives for other plugins
-        switch ($plugin) {
-        case "theme":
-            $basedir = $CFG->themedir;
-            break;
-
-        default:
-            $basedir = $CFG->dirroot .'/'. $plugin;
+        // This switch allows us to use the appropiate theme directory - and potentialy alternatives for other plugins
+        switch ($directory) {
+            case "theme":
+                $basedir = $CFG->themedir;
+                break;
+            default:
+                $basedir = $CFG->dirroot .'/'. $directory;
         }
 
     } else {
-        $basedir = $basedir .'/'. $plugin;
+        $basedir = $basedir .'/'. $directory;
     }
 
     if (file_exists($basedir) && filetype($basedir) == 'dir') {
@@ -7121,19 +7261,17 @@ function moodle_needs_upgrading() {
         if ($version > $CFG->version) {
             return true;
         }
-        if ($mods = get_list_of_plugins('mod')) {
-            foreach ($mods as $mod) {
-                $fullmod = $CFG->dirroot .'/mod/'. $mod;
-                $module = new object();
-                if (!is_readable($fullmod .'/version.php')) {
-                    notify('Module "'. $mod .'" is not readable - check permissions');
-                    continue;
-                }
-                include_once($fullmod .'/version.php');  # defines $module with version etc
-                if ($currmodule = $DB->get_record('modules', array('name'=>$mod))) {
-                    if ($module->version > $currmodule->version) {
-                        return true;
-                    }
+        $mods = get_plugin_list('mod');
+        foreach ($mods as $mod => $fullmod) {
+            $module = new object();
+            if (!is_readable($fullmod .'/version.php')) {
+                notify('Module "'. $mod .'" is not readable - check permissions');
+                continue;
+            }
+            include_once($fullmod .'/version.php');  # defines $module with version etc
+            if ($currmodule = $DB->get_record('modules', array('name'=>$mod))) {
+                if ($module->version > $currmodule->version) {
+                    return true;
                 }
             }
         }
index c0a4041784d139fa16c4bcba013a421e86a3a89b..4bd415dea48ae4c79f31bc697a644a5f3ced135e 100644 (file)
@@ -669,11 +669,11 @@ function portfolio_plugin_sanity_check($plugins=null) {
     if (is_string($plugins)) {
        $plugins = array($plugins);
     } else if (empty($plugins)) {
-        $plugins = get_list_of_plugins('portfolio/type');
+        $plugins = get_plugin_list('portfolio');
     }
 
     $insane = array();
-    foreach ($plugins as $plugin) {
+    foreach ($plugins as $plugin => $dir) {
         if ($result = portfolio_static_function($plugin, 'plugin_sanity_check')) {
             $insane[$plugin] = $result;
         }
index b4753ad5c652241a4432446f89f59e58d69a1e15..0114058ad819df59e83e4a596021f87f497b1065 100644 (file)
@@ -166,10 +166,10 @@ require_once("$CFG->dirroot/question/type/questiontype.php");
 // Load the questiontype.php file for each question type
 // These files in turn call question_register_questiontype()
 // with a new instance of each qtype class.
-$qtypenames = get_list_of_plugins('question/type');
-foreach($qtypenames as $qtypename) {
+$qtypenames = get_plugin_list('qtype');
+foreach($qtypenames as $qtypename => $qdir) {
     // Instanciates all plug-in question types
-    $qtypefilepath= "$CFG->dirroot/question/type/$qtypename/questiontype.php";
+    $qtypefilepath= "$qdir/questiontype.php";
 
     // echo "Loading $qtypename<br/>"; // Uncomment for debugging
     if (is_readable($qtypefilepath)) {
@@ -2590,14 +2590,14 @@ function question_categorylist($categoryid) {
 function get_import_export_formats( $type ) {
 
     global $CFG;
-    $fileformats = get_list_of_plugins("question/format");
+    $fileformats = get_plugin_list("qformat");
 
     $fileformatname=array();
     require_once( "{$CFG->dirroot}/question/format.php" );
-    foreach ($fileformats as $key => $fileformat) {
-        $format_file = $CFG->dirroot . "/question/format/$fileformat/format.php";
-        if (file_exists( $format_file ) ) {
-            require_once( $format_file );
+    foreach ($fileformats as $fileformat=>$fdir) {
+        $format_file = "$fdir/format.php";
+        if (file_exists($format_file) ) {
+            require_once($format_file);
         }
         else {
             continue;
index c0c8b6f28516eceb11d248b36cb38d8804cc1d54..633cfb0ce993ea20a402c30bcf815f01c485c3b4 100644 (file)
@@ -187,6 +187,11 @@ global $SCRIPT;
 
     $CFG->libdir   = $CFG->dirroot .'/lib';
 
+    if (!isset($CFG->themedir)) {
+        $CFG->themedir = $CFG->dirroot.'/theme';
+        $CFG->themewww = $CFG->wwwroot.'/theme';
+    }
+
     require_once($CFG->libdir .'/setuplib.php');        // Functions that MUST be loaded first
 
 /// Time to start counting
@@ -509,10 +514,6 @@ global $SCRIPT;
 
 /// Load up theme variables (colours etc)
 
-    if (!isset($CFG->themedir)) {
-        $CFG->themedir = $CFG->dirroot.'/theme';
-        $CFG->themewww = $CFG->wwwroot.'/theme';
-    }
     $CFG->httpsthemewww = $CFG->themewww;
 
     if (isset($_GET['theme'])) {
index edbaee21428e542561678a8d088c76f6013109f3..8317655a5c0a2f27f4aef7362a093b8f5c6c90da 100644 (file)
@@ -77,7 +77,7 @@ class upgrade_requires_exception extends moodle_exception {
         $a->pluginname     = $plugin;
         $a->pluginversion  = $pluginversion;
         $a->currentmoodle  = $currentmoodle;
-        $a->requiremoodle  = $currentmoodle;
+        $a->requiremoodle  = $requiremoodle;
         parent::__construct('pluginrequirementsnotmet', 'error', "$CFG->wwwroot/$CFG->admin/index.php", $a);
     }
 }
@@ -256,23 +256,19 @@ function upgrade_block_savepoint($result, $version, $blockname, $allowabort=true
  * @param bool $allowabort allow user to abort script execution here
  * @return void
  */
-function upgrade_plugin_savepoint($result, $version, $type, $dir, $allowabort=true) {
+function upgrade_plugin_savepoint($result, $version, $type, $plugin, $allowabort=true) {
+    $component = $type.'_'.$plugin;
+
     if (!$result) {
-        throw new upgrade_exception("$type/$dir", $version);
+        throw new upgrade_exception($component, $version);
     }
 
-    /// TODO: Check that $type is a correct type - based on get_plugin_types()
-    /// TODO: Check that $dir (that perhaps should be named $name) is an existing plugin
-
-    $fullname = $type.'_'.$dir;
-    $component = $type.'/'.$dir;
-
-    $installedversion = get_config($fullname, 'version');
+    $installedversion = get_config($component, 'version');
     if ($installedversion >= $version) {
         // Something really wrong is going on in the upgrade script
         throw new downgrade_exception($component, $installedversion, $version);
     }
-    set_config('version', $version, $fullname);
+    set_config('version', $version, $component);
     upgrade_log(UPGRADE_LOG_NORMAL, $component, 'Upgrade savepoint reached');
 
     // Reset upgrade timeout to default
@@ -287,14 +283,10 @@ function upgrade_plugin_savepoint($result, $version, $type, $dir, $allowabort=tr
 
 /**
  * Upgrade plugins
- *
- * @global object
- * @global object
  * @param string $type The type of plugins that should be updated (e.g. 'enrol', 'qtype')
- * @param string $dir  The directory where the plugins are located (e.g. 'question/questiontypes')
- * @param string $return The url to prompt the user to continue to
+ * return void
  */
-function upgrade_plugins($type, $dir, $startcallback, $endcallback, $verbose) {
+function upgrade_plugins($type, $startcallback, $endcallback, $verbose) {
     global $CFG, $DB;
 
 /// special cases
@@ -304,12 +296,10 @@ function upgrade_plugins($type, $dir, $startcallback, $endcallback, $verbose) {
         return upgrade_plugins_blocks($startcallback, $endcallback, $verbose);
     }
 
-    $plugs = get_list_of_plugins($dir);
+    $plugs = get_plugin_list($type);
 
-    foreach ($plugs as $plug) {
-
-        $fullplug  = $CFG->dirroot.'/'.$dir.'/'.$plug;
-        $component = $type.'/'.$plug; // standardised plugin name
+    foreach ($plugs as $plug=>$fullplug) {
+        $component = $type.'_'.$plug; // standardised plugin name
 
         if (!is_readable($fullplug.'/version.php')) {
             continue;
@@ -322,8 +312,8 @@ function upgrade_plugins($type, $dir, $startcallback, $endcallback, $verbose) {
             throw new plugin_defective_exception($component, 'Missing version value in version.php');
         }
 
-        $plugin->name     = $plug;   // The name MUST match the directory
-        $plugin->fullname = $type.'_'.$plug;   // The name MUST match the directory
+        $plugin->name     = $plug;
+        $plugin->fullname = $component;
 
 
         if (!empty($plugin->requires)) {
@@ -399,16 +389,15 @@ function upgrade_plugins($type, $dir, $startcallback, $endcallback, $verbose) {
 function upgrade_plugins_modules($startcallback, $endcallback, $verbose) {
     global $CFG, $DB;
 
-    $mods = get_list_of_plugins('mod');
+    $mods = get_plugin_list('mod');
 
-    foreach ($mods as $mod) {
+    foreach ($mods as $mod=>$fullmod) {
 
         if ($mod == 'NEWMODULE') {   // Someone has unzipped the template, ignore it
             continue;
         }
 
-        $fullmod   = $CFG->dirroot.'/mod/'.$mod;
-        $component = 'mod/'.$mod;
+        $component = 'mod_'.$mod;
 
         if (!is_readable($fullmod.'/version.php')) {
             throw new plugin_defective_exception($component, 'Missing version.php');
@@ -510,9 +499,9 @@ function upgrade_plugins_blocks($startcallback, $endcallback, $verbose) {
     //Is this a first install
     $first_install = null;
 
-    $blocks = get_list_of_plugins('blocks');
+    $blocks = get_plugin_list('block');
 
-    foreach ($blocks as $blockname) {
+    foreach ($blocks as $blockname=>$fullblock) {
 
         if (is_null($first_install)) {
             $first_install = ($DB->count_records('block') == 0);
@@ -522,8 +511,7 @@ function upgrade_plugins_blocks($startcallback, $endcallback, $verbose) {
             continue;
         }
 
-        $fullblock = $CFG->dirroot.'/blocks/'.$blockname;
-        $component = 'block/'.$blockname;
+        $component = 'block_'.$blockname;
 
         if (!is_readable($fullblock.'/block_'.$blockname.'.php')) {
             throw new plugin_defective_exception('block/'.$blockname, 'Missing main block class file.');
@@ -611,8 +599,8 @@ function upgrade_plugins_blocks($startcallback, $endcallback, $verbose) {
             }
 
             // Upgrade various componebts
-            events_update_definition($component);
             update_capabilities($component);
+            events_update_definition($component);
             message_update_providers($component);
 
             $endcallback($component, false, $verbose);
@@ -636,71 +624,9 @@ function upgrade_plugins_blocks($startcallback, $endcallback, $verbose) {
     }
 }
 
-/**
- * This function checks to see whether local database customisations are up-to-date
- * by comparing $CFG->local_version to the variable $local_version defined in
- * local/version.php. If not, it looks for a function called 'xmldb_local_upgrade'
- * in a file called 'local/db/upgrade.php', and if it's there calls it with the
- * appropiate $oldversion parameter. Then it updates $CFG->local_version.
- *
- * @global object
- * @global object
- */
-function upgrade_local_db($startcallback, $endcallback) {
-    global $CFG, $DB;
-
-    // if we don't have code version, just return false
-    if (!file_exists($CFG->dirroot.'/local/version.php')) {
-        return;
-    }
-
-    $local_version = null;
-    require($CFG->dirroot.'/local/version.php');  // Get code versions
-
-    if (empty($CFG->local_version)) { // install
-        $startcallback('local', true);
-
-        if (file_exists($CFG->dirroot.'/local/db/install.php')) {
-            require_once($CFG->dirroot.'/local/db/install.php');
-            xmldb_local_install();
-        }
-        set_config('local_version', $local_version);
-
-        /// Install various components
-        events_update_definition('local');
-        update_capabilities('local');
-        message_update_providers('local');
-
-        $endcallback('local', true);
-
-    } else if ($local_version > $CFG->local_version) { // upgrade!
-        $startcallback('local', false);
-
-        if (file_exists($CFG->dirroot.'/local/db/upgrade.php')) {
-            require_once($CFG->dirroot.'/local/db/upgrade.php');
-            xmldb_local_upgrade($CFG->local_version);
-        }
-        set_config('local_version', $local_version);
-
-        /// Upgrade various components
-        events_update_definition('local');
-        update_capabilities('local');
-        message_update_providers('local');
-
-        $endcallback('local', false);
-
-    } else if ($local_version < $CFG->local_version) {
-        throw new downgrade_exception('local', $CFG->local_version, $local_version);
-    }
-}
-
-
 /**
  * upgrade logging functions
- *
- * @global object
  */
-
 function upgrade_handle_exception($ex, $plugin=null) {
     global $CFG;
 
@@ -1040,7 +966,6 @@ function install_core($version, $verbose) {
         // Continue with the instalation
         events_update_definition('moodle');
         message_update_providers('moodle');
-        message_update_providers('message');
 
         // Write default settings unconditionlly
         admin_apply_default_settings(NULL, true);
@@ -1070,6 +995,17 @@ function upgrade_core($version, $verbose) {
 
         print_upgrade_part_start('moodle', false, $verbose);
 
+        // one time special local migration pre 2.0 upgrade script
+        if ($version < 2007101600) {
+            $pre20upgradefile = "$CFG->dirrot/local/upgrade_pre20.php";
+            if (file_exists($pre20upgradefile)) {
+                set_time_limit(0);
+                require($pre20upgradefile);
+                // reset upgrade timeout to default
+                upgrade_set_timeout();
+            }
+        }
+
         $result = xmldb_main_upgrade($CFG->version);
         if ($version > $CFG->version) {
             // store version if not already there
@@ -1080,7 +1016,6 @@ function upgrade_core($version, $verbose) {
         update_capabilities('moodle');
         events_update_definition('moodle');
         message_update_providers('moodle');
-        message_update_providers('message');
 
         remove_dir($CFG->dataroot . '/cache', true); // flush cache
 
@@ -1102,7 +1037,7 @@ function upgrade_noncore($verbose) {
     try {
         $plugintypes = get_plugin_types();
         foreach ($plugintypes as $type=>$location) {
-            upgrade_plugins($type, $location, 'print_upgrade_part_start', 'print_upgrade_part_end', $verbose);
+            upgrade_plugins($type, 'print_upgrade_part_start', 'print_upgrade_part_end', $verbose);
         }
     } catch (Exception $ex) {
         upgrade_handle_exception($ex);
@@ -1119,14 +1054,6 @@ function upgrade_noncore($verbose) {
             upgrade_handle_exception($ex);
         }
     }
-
-    // Check for local database customisations
-    try {
-        require_once("$CFG->dirroot/lib/locallib.php");
-        upgrade_local_db('print_upgrade_part_start', 'print_upgrade_part_end', $verbose);
-    } catch (Exception $ex) {
-        upgrade_handle_exception($ex);
-    }
 }
 
 /**
index 71db25fdf12d13be44a6e385f11604eb71d0252e..424a0b5826e11023044cdb5dc553f9bf6f16f026 100644 (file)
@@ -3029,41 +3029,37 @@ function style_sheet_setup($lastmodified=0, $lifetime=300, $themename='', $force
 
     if ($themename == 'standard') {          // Add any standard styles included in any modules
         if (!empty($THEME->modsheets)) {     // Search for styles.php within activity modules
-            if ($mods = get_list_of_plugins('mod')) {
-                foreach ($mods as $mod) {
-                    if (file_exists($CFG->dirroot.'/mod/'.$mod.'/styles.php')) {
-                        $files[] = array($CFG->dirroot, '/mod/'.$mod.'/styles.php');
-                    }
+            $mods = get_plugin_list('mod');
+            foreach ($mods as $mod => $moddir) {
+                if (file_exists($moddir.'/styles.php')) {
+                    $files[] = array($moddir.'/styles.php');
                 }
             }
         }
 
         if (!empty($THEME->blocksheets)) {     // Search for styles.php within block modules
-            if ($mods = get_list_of_plugins('blocks')) {
-                foreach ($mods as $mod) {
-                    if (file_exists($CFG->dirroot.'/blocks/'.$mod.'/styles.php')) {
-                        $files[] = array($CFG->dirroot, '/blocks/'.$mod.'/styles.php');
-                    }
+            $mods = get_plugin_list('blocks');
+            foreach ($mods as $mod => $moddir) {
+                if (file_exists($moddir.'/styles.php')) {
+                    $files[] = array($moddir.'/styles.php');
                 }
             }
         }
 
         if (!isset($THEME->courseformatsheets) || $THEME->courseformatsheets) { // Search for styles.php in course formats
-            if ($mods = get_list_of_plugins('format','',$CFG->dirroot.'/course')) {
-                foreach ($mods as $mod) {
-                    if (file_exists($CFG->dirroot.'/course/format/'.$mod.'/styles.php')) {
-                        $files[] = array($CFG->dirroot, '/course/format/'.$mod.'/styles.php');
-                    }
+            $mods = get_plugin_list('format');
+            foreach ($mods as $mod => $moddir) {
+                if (file_exists($moddir.'/styles.php')) {
+                    $files[] = array($moddir.'/styles.php');
                 }
             }
         }
 
         if (!isset($THEME->gradereportsheets) || $THEME->gradereportsheets) { // Search for styles.php in grade reports
-            if ($reports = get_list_of_plugins('grade/report')) {
-                foreach ($reports as $report) {
-                    if (file_exists($CFG->dirroot.'/grade/report/'.$report.'/styles.php')) {
-                        $files[] = array($CFG->dirroot, '/grade/report/'.$report.'/styles.php');
-                    }
+            $reports = get_plugin_list('gradereport');
+            foreach ($reports as $report => $reportdir) {
+                if (file_exists($reportdir.'/styles.php')) {
+                    $files[] = array($reportdir.'/styles.php');
                 }
             }
         }
diff --git a/local/readme.txt b/local/readme.txt
new file mode 100644 (file)
index 0000000..b4cb651
--- /dev/null
@@ -0,0 +1,174 @@
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * Readme file for local customisations
+ *
+ * @package    local
+ * @copyright  2009 Petr Skoda (http://skodak.org)
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+Local customisations directory
+==============================
+This directory is the recommended place for local customisations. 
+
+Wherever possible, customisations should be written using one of the
+standard plug-in points like modules, blocks, auth plugins, themes, etc.
+
+See also http://docs.moodle.org/en/Development:Local_customisation for more
+information.
+
+
+Directory structure
+-------------------
+This directory has standard plugin structure. All standard plugin features
+are supported. There may be some extra files with special meaning in /local/.
+
+Sample /local/ directory listing:
+/local/nicehack/         - first customisation plugin
+/local/otherhack/        - other customisation plugin
+/local/upgrade_pre20.php - one time upgrade and migration script which is
+                           executed before main 2.0 upgrade
+/local/defaults.php      - custom admin setting defaults
+
+
+Custom capabilities
+-------------------
+Each plugin may define own capabilities. It is not recommended to define
+capabilities belonging to other plugins here, but it should work too.
+
+/local/nicehack/access.php content
+<?php
+$local_nicehack_capabilities = array(
+    'local/nicehack:nicecapability' => array(
+        'captype' => 'read',
+        'contextlevel' => CONTEXT_SYSTEM,
+    ),
+);
+?>
+
+
+Custom language strings
+-----------------------
+If customisation needs new strings it is recommended to use normal plugin
+strings.
+
+sample language file /local/nicehack/lang/en_utf8.php
+<?php
+$string['hello'] = 'Hi $a';
+$string['nicehack:nicecapability'] = 'Some capability';
+?>
+
+use of the new string in code
+echo get_string('hello', 'local_nicehack', 'petr');
+
+
+Custom admin menu items
+----------------------
+It is possible to add new items and categories to the admin_tree block.
+I you need to define new admin setting classes put them into separate
+file and require_once() from settings.php
+
+For example if you want to add new external page use following
+/local/nicehack/settings.php
+<?php
+$ADMIN->add('root', new admin_category('tweaks', 'Custom tweaks'));
+$ADMIN->add('tweaks', new admin_externalpage('nicehackery', 'Tweak something',
+            $CFG->wwwroot.'/local/nicehack/setuppage.php'));
+?>
+
+
+Custom event handlers
+---------------------
+Events intended primarily for communication "core --> plugins". (It should not
+be use in opposite direction!) In theory it could be also used for 
+"plugin --> plugin" communication too. The list of core events is documented
+in lib/db/events.php
+
+sample files
+/local/nicehack/db/events.php
+$handlers = array (
+    'user_deleted' => array (
+         'handlerfile'      => '/local/nicehack/lib.php',
+         'handlerfunction'  => 'nicehack_userdeleted_handler', 
+         'schedule'         => 'instant'
+     ),
+);
+
+NOTE: events are not yet fulyl implemented in current Moodle 2.0dev.
+
+
+Custom db tables
+----------------
+XMLDB editors is the recommended tool. Please note that modification
+of core table structure is highly discouraged.
+
+If you really really really need to modify core tables you might want to do
+that in install.php and later upgrade.php
+
+List of upgrade related files:
+/local/nicehack/db/install.xml - contains XML definition of new tables
+/local/nicehack/db/install.php - executed after db creation, may be also used
+                                 for general install code
+/local/nicehack/db/upgrade.php - executed when version changes
+/local/nicehack/version.php    - version specification file
+
+
+Customised site defaults
+------------------------
+Different default site settings can be stored in file /local/defaults.php.
+These new defaults are used during installation, upgrade and later are
+displayed as default values in admin settings.
+
+Sample /local/defaults.php file content:
+<?php
+$defaults['moodle']['forcelogin'] = 1;
+$defaults['scorm']['maxgrade'] = 20;
+$defaults['moodlecourse']['numsections'] = 11;
+?>
+
+First bracket contains string from column plugin of config_plugins table.
+Second bracket is the name of setting. In the admin settings UI the plugin and
+name of setting is separated by "|".
+
+Please note that not all settings are converted to admin_tree yet.
+
+
+1.9.x upgrade notes
+-------------------
+1.9.x contains basic support for local hacks placed directly into
+/local/ directory. This old local API is not supported any more in 2.0.
+
+You an use /local/upgrade_pre20.php script for any code that needs to
+be executed before the main upgrade to 2.0.
+
+
+
+Other customisation information
+===============================
+
+Local language pack modifications
+---------------------------------
+Moodle supports other type of local customisation of standard language
+packs. If you want to create your own language pack based on another
+language create new dataroot directory with "_local" suffix, for example
+following file with content changes string "Login" to "Sign in":
+moodledata/lang/en_utf8_local
+<?php
+  $string['login'] = 'Sign in';
+?>
+
+See also http://docs.moodle.org/en/Language_editing
diff --git a/message/db/messages.php b/message/db/messages.php
deleted file mode 100644 (file)
index 78ebf7d..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-<?php // $Id$
-
-///////////////////////////////////////////////////////////////////////////
-// Defines message providers (types of messages being sent)              //
-///////////////////////////////////////////////////////////////////////////
-//                                                                       //
-// NOTICE OF COPYRIGHT                                                   //
-//                                                                       //
-// Moodle - Modular Object-Oriented Dynamic Learning Environment         //
-//          http://moodle.org                                            //
-//                                                                       //
-// Copyright (C) 1999 onwards  Martin Dougiamas  http://moodle.com       //
-//                                                                       //
-// This program is free software; you can redistribute it and/or modify  //
-// it under the terms of the GNU General Public License as published by  //
-// the Free Software Foundation; either version 2 of the License, or     //
-// (at your option) any later version.                                   //
-//                                                                       //
-// This program is distributed in the hope that it will be useful,       //
-// but WITHOUT ANY WARRANTY; without even the implied warranty of        //
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         //
-// GNU General Public License for more details:                          //
-//                                                                       //
-//          http://www.gnu.org/copyleft/gpl.html                         //
-//                                                                       //
-///////////////////////////////////////////////////////////////////////////
-
-
-$messageproviders = array (
-
-    'instantmessage' => array (
-    )
-
-);
-
-
-?>
index 73bc7543c67b0b7c54420b802c7a13efebe4128f..6ce51f22379db734f345276afd6a0f92a40654f6 100644 (file)
@@ -2156,9 +2156,9 @@ function assignment_cron () {
     global $CFG, $USER, $DB;
 
     /// first execute all crons in plugins
-    if ($plugins = get_list_of_plugins('mod/assignment/type')) {
-        foreach ($plugins as $plugin) {
-            require_once("$CFG->dirroot/mod/assignment/type/$plugin/assignment.class.php");
+    if ($plugins = get_plugin_list('assignment')) {
+        foreach ($plugins as $plugin=>$dir) {
+            require_once("$dir/assignment.class.php");
             $assignmentclass = "assignment_$plugin";
             $ass = new $assignmentclass();
             $ass->cron();
@@ -2966,8 +2966,8 @@ function assignment_get_coursemodule_info($coursemodule) {
  */
 function assignment_types() {
     $types = array();
-    $names = get_list_of_plugins('mod/assignment/type');
-    foreach ($names as $name) {
+    $names = get_plugin_list('assignment');
+    foreach ($names as $name=>$dir) {
         $types[$name] = get_string('type'.$name, 'assignment');
     }
     asort($types);
@@ -3137,7 +3137,8 @@ function assignment_get_types() {
     }
 
     /// Drop-in extra assignment types
-    $assignmenttypes = get_list_of_plugins('mod/assignment/type');
+    $assignmenttypes = get_plugin_list('assignment');
+    $assignmenttypes = array_keys($assignmenttypes);
     foreach ($assignmenttypes as $assignmenttype) {
         if (!empty($CFG->{'assignment_hide_'.$assignmenttype})) {  // Not wanted
             continue;
@@ -3197,8 +3198,8 @@ function assignment_reset_userdata($data) {
 
     $status = array();
 
-    foreach (get_list_of_plugins('mod/assignment/type') as $type) {
-        require_once("$CFG->dirroot/mod/assignment/type/$type/assignment.class.php");
+    foreach (get_plugin_list('mod/assignment/type') as $type=>$dir) {
+        require_once("$dir/assignment.class.php");
         $assignmentclass = "assignment_$type";
         $ass = new $assignmentclass();
         $status = array_merge($status, $ass->reset_userdata($data));
@@ -3342,6 +3343,7 @@ function assignment_supports($feature) {
         case FEATURE_COMPLETION_TRACKS_VIEWS: return true;
         case FEATURE_GRADE_HAS_GRADE:         return true;
         case FEATURE_GRADE_OUTCOMES:          return true;
+        case FEATURE_MOD_SUBPLUGINS:          return array('assignment'=>'mod/assignment/type'); // to be hopefully removed in 2.0
 
         default: return null;
     }
index 370d6ab95dec40dee3363cc5e2c9ab1a405d11d8..c33217458f9e8e1bc6dbf784b52bada20789381b 100644 (file)
@@ -81,7 +81,7 @@
             // skip restore of plugins that are not installed
             static $plugins;
             if (!isset($plugins)) {
-                $plugins = get_list_of_plugins('mod/assignment/type');
+                $plugins = array_keys(get_plugin_list('assignment'));
             }
 
             if (!in_array($assignment->assignmenttype, $plugins)) {
index 530a92a059d2078f51e3246c032743b540167242..2c7e44e4c9c78aeb126558bf8ad5302fe998dbe2 100644 (file)
@@ -30,9 +30,11 @@ $CFG->chat_ajax_debug  = false;
 $CFG->chat_use_cache   = false;
 
 // The HTML head for the message window to start with (<!-- nix --> is used to get some browsers starting with output
+global $CHAT_HTMLHEAD;
 $CHAT_HTMLHEAD = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\" \"http://www.w3.org/TR/REC-html40/loose.dtd\"><html><head></head>\n<body>\n\n".padding(200);
 
 // The HTML head for the message window to start with (with js scrolling)
+global $CHAT_HTMLHEAD_JS;
 $CHAT_HTMLHEAD_JS = <<<EOD
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
 <html><head><script type="text/javascript">
@@ -49,15 +51,19 @@ move();
 </head>
 <body onBlur="scroll_active = true" onFocus="scroll_active = false">
 EOD;
+global $CHAT_HTMLHEAD_JS;
 $CHAT_HTMLHEAD_JS .= padding(200);
 
 // The HTML code for standard empty pages (e.g. if a user was kicked out)
+global $CHAT_HTMLHEAD_OUT;
 $CHAT_HTMLHEAD_OUT = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\" \"http://www.w3.org/TR/REC-html40/loose.dtd\"><html><head><title>You are out!</title></head><body></body></html>";
 
 // The HTML head for the message input page
+global $CHAT_HTMLHEAD_MSGINPUT;
 $CHAT_HTMLHEAD_MSGINPUT = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\" \"http://www.w3.org/TR/REC-html40/loose.dtd\"><html><head><title>Message Input</title></head><body>";
 
 // The HTML code for the message input page, with JavaScript
+global $CHAT_HTMLHEAD_MSGINPUT_JS;
 $CHAT_HTMLHEAD_MSGINPUT_JS = <<<EOD
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
 <html>
@@ -78,6 +84,7 @@ $CHAT_HTMLHEAD_MSGINPUT_JS = <<<EOD
 EOD;
 
 // Dummy data that gets output to the browser as needed, in order to make it show output
+global $CHAT_DUMMY_DATA;
 $CHAT_DUMMY_DATA = padding(200);
 
 /**
@@ -1164,4 +1171,3 @@ function chat_supports($feature) {
         default: return null;
     }
 }
-
index 3e570c6182947930eac5f1093e2113a32a2abb80..73cf853e8e8a6dac711d4556b9a4464ae2c82654 100644 (file)
@@ -21,8 +21,9 @@
  * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 
-/** @global int $COLUMN_HEIGHT */
-$COLUMN_HEIGHT = 300;
+/** @global int $CHOICE_COLUMN_HEIGHT */
+global $CHOICE_COLUMN_HEIGHT;
+$CHOICE_COLUMN_HEIGHT = 300;
 
 define('CHOICE_PUBLISH_ANONYMOUS', '0');
 define('CHOICE_PUBLISH_NAMES',     '1');
@@ -36,16 +37,19 @@ define('CHOICE_DISPLAY_HORIZONTAL',  '0');
 define('CHOICE_DISPLAY_VERTICAL',    '1');
 
 /** @global array $CHOICE_PUBLISH */
+global $CHOICE_PUBLISH;
 $CHOICE_PUBLISH = array (CHOICE_PUBLISH_ANONYMOUS  => get_string('publishanonymous', 'choice'),
                          CHOICE_PUBLISH_NAMES      => get_string('publishnames', 'choice'));
 
 /** @global array $CHOICE_SHOWRESULTS */
+global $CHOICE_SHOWRESULTS;
 $CHOICE_SHOWRESULTS = array (CHOICE_SHOWRESULTS_NOT          => get_string('publishnot', 'choice'),
                          CHOICE_SHOWRESULTS_AFTER_ANSWER => get_string('publishafteranswer', 'choice'),
                          CHOICE_SHOWRESULTS_AFTER_CLOSE  => get_string('publishafterclose', 'choice'),
                          CHOICE_SHOWRESULTS_ALWAYS       => get_string('publishalways', 'choice'));
 
 /** @global array $CHOICE_DISPLAY */
+global $CHOICE_DISPLAY;
 $CHOICE_DISPLAY = array (CHOICE_DISPLAY_HORIZONTAL   => get_string('displayhorizontal', 'choice'),
                          CHOICE_DISPLAY_VERTICAL     => get_string('displayvertical','choice'));
 
@@ -406,7 +410,7 @@ function choice_show_reportlink($user, $cm) {
  * @return void Output is echo'd
  */
 function choice_show_results($choice, $course, $cm, $allresponses, $forcepublish='') {
-    global $CFG, $COLUMN_HEIGHT, $FULLSCRIPT;
+    global $CFG, $CHOICE_COLUMN_HEIGHT, $FULLSCRIPT;
 
     print_heading(get_string("responses", "choice"));
     if (empty($forcepublish)) { //alow the publish setting to be overridden
@@ -593,7 +597,7 @@ function choice_show_results($choice, $course, $cm, $allresponses, $forcepublish
 
             if ($choice->showunanswered) {
                 if ($maxcolumn) {
-                    $height = $COLUMN_HEIGHT * ((float)$column[0] / (float)$maxcolumn);
+                    $height = $CHOICE_COLUMN_HEIGHT * ((float)$column[0] / (float)$maxcolumn);
                 }
                 echo "<td style=\"vertical-align:bottom\" align=\"center\" class=\"col0 data\">";
                 echo "<img src=\"column.png\" height=\"$height\" width=\"49\" alt=\"\" />";
@@ -602,7 +606,7 @@ function choice_show_results($choice, $course, $cm, $allresponses, $forcepublish
             $count = 1;
             foreach ($choice->option as $optionid => $optiontext) {
                 if ($maxcolumn) {
-                    $height = $COLUMN_HEIGHT * ((float)$column[$optionid] / (float)$maxcolumn);
+                    $height = $CHOICE_COLUMN_HEIGHT * ((float)$column[$optionid] / (float)$maxcolumn);
                 }
                 echo "<td style=\"vertical-align:bottom\" align=\"center\" class=\"col$count data\">";
                 echo "<img src=\"column.png\" height=\"$height\" width=\"49\" alt=\"\" />";
@@ -913,4 +917,3 @@ function choice_supports($feature) {
         default: return null;
     }
 }
-?>
index b093c9be47172595d2c35277243ec97a192b49f1..a9f84da258ae179bf1451b8f79ff64656dd6b561 100644 (file)
@@ -86,7 +86,7 @@ class mod_choice_mod_form extends moodleform_mod {
 
 
 //-------------------------------------------------------------------------------
-        $this->standard_coursemodule_elements($features);
+        $this->standard_coursemodule_elements();
 //-------------------------------------------------------------------------------
         $this->add_action_buttons();
     }
index 9d85061e93001b5ebb4eb7d81103dd011c88c00c..89eb2a3198ccd1b3e9a9e5dbb5c9ca3f018cee73 100755 (executable)
@@ -2677,9 +2677,10 @@ function data_supports($feature) {
         case FEATURE_COMPLETION_TRACKS_VIEWS: return true;
         case FEATURE_GRADE_HAS_GRADE:         return true;
         case FEATURE_GRADE_OUTCOMES:          return true;
+        case FEATURE_MOD_SUBPLUGINS:          return array('datafield'=>'mod/data/field', 'datapreset'=>'mod/data/preset');
 
         default: return null;
-            }
+    }
 }
 /**
  * @global object
@@ -3210,4 +3211,3 @@ class data_portfolio_caller extends portfolio_module_caller_base {
         return array($formats, $includedfiles);
     }
 }
-?>
index 2b6a8b1cf550bb4edd390a433f57a7917987044c..6777d6ee0943d34a4eb961cb8f139e4b6b88d118 100644 (file)
@@ -38,9 +38,11 @@ define('FEEDBACK_RESETFORM_RESET', 'feedback_reset_data_');
 define('FEEDBACK_RESETFORM_DROP', 'feedback_drop_feedback_');
 define('FEEDBACK_MAX_PIX_LENGTH', '400'); //max. Breite des grafischen Balkens in der Auswertung
 
+global $feedback_names; // not nice 
 $feedback_names = feedback_load_feedback_items('mod/feedback/item');
 
-//initialize the feedback-Session
+//initialize the feedback-Session - not nice at all!!
+global $SESSION;
 if(!isset($SESSION->feedback) OR !is_object($SESSION->feedback)) {
     $SESSION->feedback = new object();
 }
@@ -2312,4 +2314,3 @@ function feedback_encode_target_url($url) {
         return $url;
     }
 }
-?>
index e3bb1242401cba4adc46e0c74bd7005fb0fcddd0..f6f1862ebaf995be893fc72c1685975b66ecde90 100644 (file)
@@ -8172,5 +8172,3 @@ class forum_portfolio_caller extends portfolio_module_caller_base {
         return get_string('modulename', 'forum');
     }
 }
-
-?>
index 49ce746d1c99d0ef7d1d73e51a6b46caa40aeeec..e881757a1b3162333ce9f4655cfeb3c063d4ff75 100644 (file)
@@ -44,6 +44,7 @@ define ("HOTPOT_TEXTSOURCE_SPECIFIC", "3");
 define("HOTPOT_LOCATION_COURSEFILES", "0");
 define("HOTPOT_LOCATION_SITEFILES",   "1");
 
+global $HOTPOT_LOCATION;
 $HOTPOT_LOCATION = array (
     HOTPOT_LOCATION_COURSEFILES => get_string("coursefiles"),
     HOTPOT_LOCATION_SITEFILES   => get_string("sitefiles"),
@@ -59,6 +60,7 @@ define("HOTPOT_OUTPUTFORMAT_V6_PLUS", "15");
 define("HOTPOT_OUTPUTFORMAT_FLASH",   "20");
 define("HOTPOT_OUTPUTFORMAT_MOBILE",  "30");
 
+global $HOTPOT_OUTPUTFORMAT;
 $HOTPOT_OUTPUTFORMAT = array (
     HOTPOT_OUTPUTFORMAT_BEST    => get_string("outputformat_best", "hotpot"),
     HOTPOT_OUTPUTFORMAT_V6_PLUS => get_string("outputformat_v6_plus", "hotpot"),
@@ -70,6 +72,7 @@ $HOTPOT_OUTPUTFORMAT = array (
     HOTPOT_OUTPUTFORMAT_FLASH   => get_string("outputformat_flash", "hotpot"),
     HOTPOT_OUTPUTFORMAT_MOBILE  => get_string("outputformat_mobile", "hotpot"),
 );
+global $HOTPOT_OUTPUTFORMAT_DIR;
 $HOTPOT_OUTPUTFORMAT_DIR = array (
     HOTPOT_OUTPUTFORMAT_V6_PLUS => 'v6',
     HOTPOT_OUTPUTFORMAT_V6      => 'v6',
@@ -96,6 +99,7 @@ define("HOTPOT_NAVIGATION_BUTTONS", "4");
 define("HOTPOT_NAVIGATION_GIVEUP",  "5");
 define("HOTPOT_NAVIGATION_NONE",    "6");
 
+global $HOTPOT_NAVIGATION;
 $HOTPOT_NAVIGATION = array (
     HOTPOT_NAVIGATION_BAR     => get_string("navigation_bar", "hotpot"),
     HOTPOT_NAVIGATION_FRAME   => get_string("navigation_frame", "hotpot"),
@@ -114,6 +118,7 @@ define("HOTPOT_JQUIZ",  "6");
 define("HOTPOT_TEXTOYS_RHUBARB",   "7");
 define("HOTPOT_TEXTOYS_SEQUITUR",  "8");
 
+global $HOTPOT_QUIZTYPE;
 $HOTPOT_QUIZTYPE = array(
     HOTPOT_JCB    => 'JCB',
     HOTPOT_JCLOZE => 'JCloze',
@@ -135,6 +140,7 @@ define("HOTPOT_GRADEMETHOD_AVERAGE", "2");
 define("HOTPOT_GRADEMETHOD_FIRST",   "3");
 define("HOTPOT_GRADEMETHOD_LAST",    "4");
 
+global $HOTPOT_GRADEMETHOD;
 $HOTPOT_GRADEMETHOD = array (
     HOTPOT_GRADEMETHOD_HIGHEST => get_string("gradehighest", "quiz"),
     HOTPOT_GRADEMETHOD_AVERAGE => get_string("gradeaverage", "quiz"),
@@ -147,6 +153,7 @@ define("HOTPOT_STATUS_TIMEDOUT",   "2");
 define("HOTPOT_STATUS_ABANDONED",  "3");
 define("HOTPOT_STATUS_COMPLETED",  "4");
 
+global $HOTPOT_STATUS;
 $HOTPOT_STATUS = array (
     HOTPOT_STATUS_INPROGRESS => get_string("inprogress", "hotpot"),
     HOTPOT_STATUS_TIMEDOUT   => get_string("timedout",   "hotpot"),
@@ -160,6 +167,7 @@ define("HOTPOT_FEEDBACK_FORMMAIL", "2");
 define("HOTPOT_FEEDBACK_MOODLEFORUM", "3");
 define("HOTPOT_FEEDBACK_MOODLEMESSAGING", "4");
 
+global $HOTPOT_FEEDBACK;
 $HOTPOT_FEEDBACK = array (
     HOTPOT_FEEDBACK_NONE => get_string("feedbacknone", "hotpot"),
     HOTPOT_FEEDBACK_WEBPAGE => get_string("feedbackwebpage",  "hotpot"),
@@ -2974,4 +2982,3 @@ function hotpot_reset_course_form_definition(&$mform) {
 function hotpot_reset_course_form_defaults($course) {
     return array('reset_hotpot_deleteallattempts' => 1);
 }
-?>
index 31b877da109788cf48c246a7508433fdeb459eec..052959ef9a918f4311a024b831ff229cc62f4a4d 100644 (file)
@@ -224,4 +224,3 @@ function label_supports($feature) {
     }
 }
 
-?>
index a371b35e740eec406ba5c607f5bf3f0e5bdfe153..58349af0e9ab97005cb06de6db65add3acbef64b 100644 (file)
@@ -811,5 +811,3 @@ function lesson_supports($feature) {
         default: return null;
     }
 }
-
-?>
index 58b7e1a832012b068630c5e352e5b5edcb71f307..d4fa9c22a81f72509699979e2fd6d69f15ff3320 100644 (file)
@@ -1386,6 +1386,7 @@ function quiz_supports($feature) {
         case FEATURE_COMPLETION_TRACKS_VIEWS: return true;
         case FEATURE_GRADE_HAS_GRADE:         return true;
         case FEATURE_GRADE_OUTCOMES:          return true;
+        case FEATURE_MOD_SUBPLUGINS:          return array('quiz'=>'mod/quiz/report');
 
         default: return null;
     }
@@ -1405,4 +1406,3 @@ function quiz_get_extra_capabilities() {
     $caps[] = 'moodle/site:accessallgroups';
     return $caps;
 }
-
index 0a0e6b2b371c7dbca7b2b14b79a747901bad8606..fd8433ae413450f0b1e436dd8a3efc01a093c3ae 100644 (file)
@@ -355,7 +355,7 @@ function quiz_report_list($context){
     }
     $reports = $DB->get_records('quiz_report', null, 'displayorder DESC', 'name, capability');
 
-    $reportdirs = get_list_of_plugins("mod/quiz/report");
+    $reportdirs = get_plugin_list("quiz");
     //order the reports tab in descending order of displayorder
     $reportcaps = array();
     if ($reports){
@@ -367,7 +367,7 @@ function quiz_report_list($context){
     }
 
     //add any other reports on the end
-    foreach ($reportdirs as $reportname) {
+    foreach ($reportdirs as $reportname => $reportdir) {
         if (!isset($reportcaps[$reportname])) {
             $reportcaps[$reportname]= null;
         }
index 9e1d272d88d0e75b4546c67f2a07cd6d5cf4b7b6..351e6666a9e240af0d3a9d691779421c11d27300 100644 (file)
@@ -13,9 +13,9 @@ require_once($CFG->dirroot . '/mod/quiz/settingslib.php');
 // First get a list of quiz reports with there own settings pages. If there none,
 // we use a simpler overall menu structure.
 $reportsbyname = array();
-if ($reports = get_list_of_plugins('mod/quiz/report')) {
-    foreach ($reports as $report) {
-        if (file_exists($CFG->dirroot . "/mod/quiz/report/$report/settings.php")) {
+if ($reports = get_plugin_list('quiz')) {
+    foreach ($reports as $report => $reportdir) {
+        if (file_exists("$reportdir/settings.php")) {
             $strreportname = get_string($report . 'report', 'quiz_'.$report);
             // Deal with reports which are lacking the language string
             if ($strreportname[0] == '[') {
index 1feece92930a4766b9afd5dc79e7ccdcaa8e96e0..6bfc27b6f7dde013d4721bfb6f4c73c0544b248d 100644 (file)
@@ -661,8 +661,8 @@ function resource_get_types() {
     }
 
     /// Drop-in extra resource types
-    $resourcetypes = get_list_of_plugins('mod/resource/type');
-    foreach ($resourcetypes as $resourcetype) {
+    $resourcetypes = get_plugin_list('resource');
+    foreach ($resourcetypes as $resourcetype => $dir) {
         if (!empty($CFG->{'resource_hide_'.$resourcetype})) {  // Not wanted
             continue;
         }
@@ -986,6 +986,7 @@ function resource_supports($feature) {
         case FEATURE_COMPLETION_TRACKS_VIEWS: return true;
         case FEATURE_GRADE_HAS_GRADE:         return false;
         case FEATURE_GRADE_OUTCOMES:          return false;
+        case FEATURE_MOD_SUBPLUGINS:          return array('resource'=>'mod/resource/type'); // to be removed in 2.0
 
         default: return null;
     }
@@ -1006,5 +1007,3 @@ function resource_get_name($type) {
     }
     return $name;
 }
-
-?>
index 3f294ab112d682c3a5d6adabd868142a15ad19df..cd453caa5fd1083bd70ceb27f82f8f49668780eb 100755 (executable)
@@ -916,4 +916,3 @@ function scorm_supports($feature) {
         default: return null;
     }
 }
-
index af1c69b0ceea94623c47acbf3cc134c63dbf2498..f5ab7c3621a25907341ec7bc4156d51f18403f43 100644 (file)
  * Graph size
  * @global int $SURVEY_GHEIGHT
  */
+global $SURVEY_GHEIGHT;
 $SURVEY_GHEIGHT = 500;
 /**
  * Graph size
  * @global int $SURVEY_GWIDTH
  */
+global $SURVEY_GWIDTH;
 $SURVEY_GWIDTH  = 900;
 /**
  * Question Type
  * @global array $SURVEY_QTYPE
  */
+global $SURVEY_QTYPE;
 $SURVEY_QTYPE = array (
         "-3" => "Virtual Actual and Preferred",
         "-2" => "Virtual Preferred",
@@ -787,4 +790,4 @@ function survey_supports($feature) {
 
         default: return null;
     }
-}
\ No newline at end of file
+}
index 9dbd5929a7b9bde85ae4d0a92bb0fbbeb7bf5a26..ce2a61776dd141d3c30527162ac36663fc9a683f 100644 (file)
  * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 
-/** @global int $wiki_CONSTANT */
-$wiki_CONSTANT = 7;     /// for example
-/** @global object $site */
-$site = get_site();
 /** @global array $WIKI_TYPES */
+global $WIKI_TYPES;
 $WIKI_TYPES = array ('teacher' =>   get_string('defaultcourseteacher'),
                      'group' =>     get_string('groups',"wiki"),
                      'student' =>   get_string('defaultcoursestudent') );
@@ -2137,4 +2134,4 @@ function wiki_supports($feature) {
 
         default: return null;
     }
-}
\ No newline at end of file
+}
index 1c1bb1a7b066bdbf1906a0392666b8b4bcf73fd6..35cac5fe7408504e92fac2429a1444ea0c9ebd95 100644 (file)
@@ -65,7 +65,8 @@
 
     //Check name of module
     if (!$isblog) {
-        $mods = get_list_of_plugins('mod');
+        $mods = get_plugin_list('mod');
+        $mods = array_keys($mods);
         if (!in_array(strtolower($modulename), $mods)) {
             rss_not_found();
         }
index dfd65e9e35042fb0297e7462d366645fcd86cfa7..8821d2a43501600c20b2888c8e73ea0f17a0b177 100644 (file)
@@ -56,7 +56,7 @@
 
     print_heading($strthemes);
 
-    $themes = get_list_of_plugins("theme");
+    $themes = get_plugin_list("theme");
     $sesskey = sesskey();
 
     echo "<table style=\"margin-left:auto;margin-right:auto;\" cellpadding=\"7\" cellspacing=\"5\">\n";
 
     $original_theme = fullclone($THEME);
 
-    foreach ($themes as $theme) {
+    foreach ($themes as $theme => $themedir) {
 
         unset($THEME);
 
-        if (!file_exists($CFG->themedir.'/'.$theme.'/config.php')) {   // bad folder
+        if (!file_exists($themedir.'/config.php')) {   // bad folder
             continue;
         }
 
-        include($CFG->themedir.'/'.$theme.'/config.php');
+        include($themedir.'/config.php');
 
         $readme = '';
         $screenshot = '';
index 0a7b5748aba833232fd2b6a43308bb4c3c146b8d..c7f09108fc11ef30d882a9321f94fc4c5ad30ff5 100644 (file)
@@ -24,10 +24,10 @@ class user_editadvanced_form extends moodleform {
         $mform->addRule('username', $strrequired, 'required', null, 'client');
         $mform->setType('username', PARAM_RAW);
 
-        $modules = get_list_of_plugins('auth');
+        $auths = get_plugin_list('auth');
         $auth_options = array();
-        foreach ($modules as $module) {
-            $auth_options[$module] = auth_get_plugin_title ($module);
+        foreach ($auths as $auth => $unused) {
+            $auth_options[$auth] = auth_get_plugin_title($auth);
         }
         $mform->addElement('select', 'auth', get_string('chooseauthmethod','auth'), $auth_options);
         $mform->setHelpButton('auth', array('authchange', get_string('chooseauthmethod','auth')));
index a71db1583fdc96dd2a25cc28b09825b860f0b548..15e473197caa3d2494f87ed5c9a48fc6622ac153 100644 (file)
@@ -115,9 +115,9 @@ class user_filtering {
             case 'lastaccess':  return new user_filter_date('lastaccess', get_string('lastaccess'), $advanced, 'lastaccess');
             case 'lastlogin':   return new user_filter_date('lastlogin', get_string('lastlogin'), $advanced, 'lastlogin');
             case 'auth':
-                $plugins = get_list_of_plugins('auth');
+                $plugins = get_plugin_list('auth');
                 $choices = array();
-                foreach ($plugins as $auth) {
+                foreach ($plugins as $auth => $unused) {
                     $choices[$auth] = auth_get_plugin_title ($auth);
                 }
                 return new user_filter_simpleselect('auth', get_string('authentication'), $advanced, 'auth', $choices);
index 78dc4c75901dcf3f0428b521967b5616e5ba61a7..60a7e923f7ed34b1153c09a609257745fd7125e3 100644 (file)
@@ -6,7 +6,7 @@
 // This is compared against the values stored in the database to determine
 // whether upgrades should be performed (see lib/db/*.php)
 
-    $version = 2009061600;  // YYYYMMDD   = date of the last version bump
+    $version = 2009061706;  // YYYYMMDD   = date of the last version bump
                             //         XX = daily increments
 
     $release = '2.0 dev (Build: 20090619)';  // Human-friendly version name