Skip to content

Commit

Permalink
Function: plugin installation setup
Browse files Browse the repository at this point in the history
  • Loading branch information
WunderJacob committed Jul 25, 2024
1 parent 56c6a19 commit 6cdc932
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 4 deletions.
Empty file modified .github/workflows/erpnext.yml
100644 → 100755
Empty file.
Empty file modified .github/workflows/moodle-plugin-ci.yml
100644 → 100755
Empty file.
2 changes: 2 additions & 0 deletions .gitignore
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/vue3/node_modules/
/vue3/coverage
.pre-commit-config.yaml
.DS_Store
._*
Empty file modified LICENSE.md
100644 → 100755
Empty file.
Empty file modified README.md
100644 → 100755
Empty file.
14 changes: 13 additions & 1 deletion classes/pluginsInstaller.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];
Expand All @@ -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';
Expand Down
10 changes: 7 additions & 3 deletions index.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
Empty file modified settings.php
100644 → 100755
Empty file.

0 comments on commit 6cdc932

Please sign in to comment.