Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ rm -fr mod/forum
- $ php test.php || echo "Ouch, something went wrong!"
- ERROR: Plugin mod has forum as standard, missing in codebase.
- ERROR: Plugin block has search_books, search_glossaries in codebase, missing as standard.
- ERROR: Plugin filter has geshi, moodledocs, moodlelinks in codebase, missing as standard.
- ERROR: Plugin profilefield has social in codebase, missing as standard.
- ERROR: Plugin report has rawrecordscount in codebase, missing as standard.
- ERROR: Plugin local has ci, codechecker, moodlecheck in codebase, missing as standard.
- Ouch, something went wrong!
- ==== ==== ==== ==== ====
- <?php
- define('IGNORE_COMPONENT_CACHE', 1);
- define('MOODLE_INTERNAL', 1);
- // TODO: The following lines can be replaced by load_core_component_from_moodle()
- // from local_ci once integrated within the code there.
- $moodledirroot = '/Users/stronk7/git_moodle/moodle';
- unset($CFG);
- global $CFG;
- $CFG = new stdClass();
- $CFG->dirroot = $moodledirroot;
- $CFG->libdir = $CFG->dirroot . '/lib';
- $CFG->admin = 'admin';
- // Let's inject our fake cache.
- class cache {
- static function make() {
- return new self();
- }
- function get() { }
- function set() { }
- }
- require('lib/classes/plugin_manager.php');
- require('lib/classes/component.php');
- $pm = core_plugin_manager::instance();
- $pts = $pm->get_plugin_types();
- $stds = [];
- $avas = [];
- $error = false;
- foreach ($pts as $type => $notused) {
- $stds[$type] = $pm::standard_plugins_list($type) ?: [];
- $avas[$type] = array_keys($pm->get_present_plugins($type) ?? []);
- if ($diff = array_diff($stds[$type], $avas[$type])) {
- $error = true;
- echo "ERROR: Plugin {$type} has " . implode(', ', $diff) . " as standard, missing in codebase.\n";
- }
- if ($diff = array_diff($avas[$type], $stds[$type])) {
- $error = true;
- echo "ERROR: Plugin {$type} has " . implode(', ', $diff) . " in codebase, missing as standard.\n";
- }
- }
- if (!$error) {
- echo "OK: Standard plugins and codebase plugins match.\n";
- }
- exit((int)$error);
Add Comment
Please, Sign In to add comment