diff --git a/.github/workflows/erpnext.yml b/.github/workflows/erpnext.yml old mode 100644 new mode 100755 diff --git a/.github/workflows/moodle-plugin-ci.yml b/.github/workflows/moodle-plugin-ci.yml old mode 100644 new mode 100755 diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 index 3021130..95e25ad --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +/vue3/node_modules/ +/vue3/coverage .pre-commit-config.yaml .DS_Store ._* diff --git a/LICENSE.md b/LICENSE.md old mode 100644 new mode 100755 diff --git a/README.md b/README.md old mode 100644 new mode 100755 diff --git a/classes/pluginsInstaller.php b/classes/pluginsInstaller.php index f6e08cc..4e0457c 100755 --- a/classes/pluginsInstaller.php +++ b/classes/pluginsInstaller.php @@ -76,9 +76,10 @@ public function execute() { * @return array */ public function download_install_plugins() { - global $CFG; + global $CFG, $DB; require_once($CFG->libdir . '/filelib.php'); require_once($CFG->libdir . '/upgradelib.php'); + require_once($CFG->dirroot . '/cache/lib.php'); $installer = tool_installaddon_installer::instance(); $feedback = []; @@ -102,6 +103,17 @@ public function download_install_plugins() { if (!empty($installable)) { // Perform the upgrade installation process. upgrade_noncore($installable, true, get_string('installfromzip', 'tool_wbinstaller')); + // Clear all caches to ensure Moodle recognizes the new plugins. + purge_all_caches(); + + // Verify that the plugins have been installed. + foreach ($installable as $plugin) { + if ($DB->record_exists('config_plugins', ['plugin' => $plugin->component])) { + $feedback[$plugin->component] = get_string('installed', 'tool_wbinstaller'); + } else { + $feedback[$plugin->component] = get_string('installfailed', 'tool_wbinstaller'); + } + } $feedback['status'] = 'success'; } else { $feedback['status'] = 'no_installable_files'; diff --git a/index.php b/index.php old mode 100644 new mode 100755 index eb33acc..a181082 --- a/index.php +++ b/index.php @@ -26,8 +26,9 @@ require_once($CFG->libdir.'/adminlib.php'); require_once($CFG->libdir.'/moodlelib.php'); -admin_externalpage_setup('tool_wbinstaller'); +global $USER; +admin_externalpage_setup('tool_wbinstaller'); $pluginman = core_plugin_manager::instance(); $installer = tool_installaddon_installer::instance(); @@ -50,11 +51,9 @@ $PAGE->set_pagelayout('maintenance'); $PAGE->set_popup_notification_allowed(false); - // List of plugin ZIP file URLs. $zipurls = [ - 'https://moodle.org/plugins/download.php/32308/block_timezoneclock_moodle44_2023010907.zip', 'https://moodle.org/plugins/download.php/32309/tool_clearbackupfiles_moodle44_2024060900.zip', 'https://moodle.org/plugins/download.php/32294/local_chunkupload_moodle44_2024060400.zip', // Add more URLs as needed. @@ -86,8 +85,13 @@ echo $OUTPUT->notification(get_string('nozipfilesfound', 'tool_wbinstaller'), 'notifyproblem'); } } +$context = context_system::instance(); echo $OUTPUT->header(); +echo $OUTPUT->render_from_template('tool_wbinstaller/initview', [ + 'userid' => $USER->id, + 'contextid' => $context->id, +]); echo 'hello'; // Show the Install button. diff --git a/settings.php b/settings.php old mode 100644 new mode 100755