stronk7

Untitled

Apr 25th, 2021 (edited)
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.03 KB | None | 0 0
  1. $ rm -fr mod/forum
  2. $ php test.php || echo "Ouch, something went wrong!"
  3. ERROR: Plugin mod has forum as standard, missing in codebase.
  4. ERROR: Plugin block has search_books, search_glossaries in codebase, missing as standard.
  5. ERROR: Plugin filter has geshi, moodledocs, moodlelinks in codebase, missing as standard.
  6. ERROR: Plugin profilefield has social in codebase, missing as standard.
  7. ERROR: Plugin report has rawrecordscount in codebase, missing as standard.
  8. ERROR: Plugin local has ci, codechecker, moodlecheck in codebase, missing as standard.
  9. Ouch, something went wrong!
  10.  
  11.  
  12. ==== ==== ==== ==== ====
  13. <?php
  14.  
  15. define('IGNORE_COMPONENT_CACHE', 1);
  16. define('MOODLE_INTERNAL', 1);
  17.  
  18. // TODO: The following lines can be replaced by load_core_component_from_moodle()
  19. // from local_ci once integrated within the code there.
  20. $moodledirroot = '/Users/stronk7/git_moodle/moodle';
  21. unset($CFG);
  22. global $CFG;
  23. $CFG = new stdClass();
  24. $CFG->dirroot = $moodledirroot;
  25. $CFG->libdir = $CFG->dirroot . '/lib';
  26. $CFG->admin = 'admin';
  27.  
  28. // Let's inject our fake cache.
  29. class cache {
  30. static function make() {
  31. return new self();
  32. }
  33. function get() { }
  34. function set() { }
  35. }
  36.  
  37. require('lib/classes/plugin_manager.php');
  38. require('lib/classes/component.php');
  39.  
  40. $pm = core_plugin_manager::instance();
  41. $pts = $pm->get_plugin_types();
  42. $stds = [];
  43. $avas = [];
  44. $error = false;
  45. foreach ($pts as $type => $notused) {
  46. $stds[$type] = $pm::standard_plugins_list($type) ?: [];
  47. $avas[$type] = array_keys($pm->get_present_plugins($type) ?? []);
  48. if ($diff = array_diff($stds[$type], $avas[$type])) {
  49. $error = true;
  50. echo "ERROR: Plugin {$type} has " . implode(', ', $diff) . " as standard, missing in codebase.\n";
  51. }
  52. if ($diff = array_diff($avas[$type], $stds[$type])) {
  53. $error = true;
  54. echo "ERROR: Plugin {$type} has " . implode(', ', $diff) . " in codebase, missing as standard.\n";
  55. }
  56. }
  57.  
  58. if (!$error) {
  59. echo "OK: Standard plugins and codebase plugins match.\n";
  60. }
  61. exit((int)$error);
Add Comment
Please, Sign In to add comment