1
0

uninstall.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. * @version v 1.2 2013/08/20
  9. * @package mod_iassign_db
  10. * @since 2010/09/27
  11. * @copyright iMatica (<a href="http://www.matematica.br">iMath</a>) - Computer Science Dep. of IME-USP (Brazil)
  12. *
  13. * <b>License</b>
  14. * - http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  15. */
  16. /// Moodle core defines constant MOODLE_INTERNAL which shall be used to make sure that the script is included and not called directly.
  17. defined('MOODLE_INTERNAL') || die();
  18. /// This is called at the beginning of the uninstallation process to give the module
  19. // a chance to clean-up its hacks, bits etc. where possible.
  20. // @return bool Return true if success.
  21. require_once ($CFG->dirroot . '/mod/iassign/locallib.php');
  22. function xmldb_iassign_uninstall () {
  23. global $DB;
  24. $fs = get_file_storage();
  25. $context_system = context_system::instance();
  26. $fs->delete_area_files($context_system->id, 'mod_iassign', 'ilm');
  27. $courses = $DB->get_records('course');
  28. foreach ($courses as $course) {
  29. $context_course = context_course::instance($course->id);
  30. $fs->delete_area_files($context_course->id, 'mod_iassign', 'exercise');
  31. $fs->delete_area_files($context_course->id, 'mod_iassign', 'activity');
  32. }
  33. return true;
  34. }