uninstall.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. /**
  3. * This file replaces the legacy STATEMENTS section in db/install.xml,
  4. * lib.php/modulename_install() post installation hook and partially defaults.php
  5. *
  6. * @author Patricia Alves Rodrigues
  7. * @author Leônidas O. Brandão
  8. * @author Luciano Oliveira Borges
  9. * @version v 1.2 2013/08/20
  10. * @package mod_iassign_db
  11. * @since 2010/09/27
  12. * @copyright iMatica (<a href="http://www.matematica.br">iMath</a>) - Computer Science Dep. of IME-USP (Brazil)
  13. *
  14. * <b>License</b>
  15. * - http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  16. */
  17. /**
  18. * Moodle core defines constant MOODLE_INTERNAL which shall be used to make sure that the script is included and not called directly.
  19. */
  20. defined('MOODLE_INTERNAL') || die();
  21. /**
  22. * This is called at the beginning of the uninstallation process to give the module
  23. * a chance to clean-up its hacks, bits etc. where possible.
  24. * @return bool Return true if success.
  25. */
  26. require_once ($CFG->dirroot . '/mod/iassign/locallib.php');
  27. function xmldb_iassign_uninstall () {
  28. global $DB;
  29. $fs = get_file_storage();
  30. $context_system = context_system::instance();
  31. $fs->delete_area_files($context_system->id, 'mod_iassign', 'ilm');
  32. $courses = $DB->get_records('course');
  33. foreach ($courses as $course) {
  34. $context_course = context_course::instance($course->id);
  35. $fs->delete_area_files($context_course->id, 'mod_iassign', 'exercise');
  36. $fs->delete_area_files($context_course->id, 'mod_iassign', 'activity');
  37. }
  38. return true;
  39. }