コード例 #1
0
ファイル: theme.php プロジェクト: EmmanuelYupit/educursos
 /**
  * Pre-uninstall hook.
  *
  * This is intended for disabling of plugin, some DB table purging, etc.
  *
  * NOTE: to be called from uninstall_plugin() only.
  * @private
  */
 public function uninstall_cleanup()
 {
     global $DB;
     $DB->set_field('course', 'theme', '', array('theme' => $this->name));
     $DB->set_field('course_categories', 'theme', '', array('theme' => $this->name));
     $DB->set_field('user', 'theme', '', array('theme' => $this->name));
     $DB->set_field('mnet_host', 'theme', '', array('theme' => $this->name));
     if (get_config('core', 'thememobile') === $this->name) {
         unset_config('thememobile');
     }
     if (get_config('core', 'themetablet') === $this->name) {
         unset_config('themetablet');
     }
     if (get_config('core', 'themelegacy') === $this->name) {
         unset_config('themelegacy');
     }
     $themelist = get_config('core', 'themelist');
     if (!empty($themelist)) {
         $themes = explode(',', $themelist);
         $key = array_search($this->name, $themes);
         if ($key !== false) {
             unset($themes[$key]);
             set_config('themelist', implode(',', $themes));
         }
     }
     parent::uninstall_cleanup();
 }
コード例 #2
0
 /**
  * Pre-uninstall hook.
  *
  * This is intended for disabling of plugin, some DB table purging, etc.
  *
  * NOTE: to be called from uninstall_plugin() only.
  * @private
  */
 public function uninstall_cleanup()
 {
     global $DB;
     // Do the opposite of db/install.php scripts - deregister the report.
     $DB->delete_records('offlinequiz_reports', array('name' => $this->name));
     parent::uninstall_cleanup();
 }
コード例 #3
0
ファイル: logstore.php プロジェクト: evltuma/moodle
 public function uninstall_cleanup()
 {
     $enabled = get_config('tool_log', 'enabled_stores');
     if ($enabled) {
         $enabled = array_flip(explode(',', $enabled));
         unset($enabled['logstore_' . $this->name]);
         $enabled = array_flip($enabled);
         set_config('enabled_stores', implode(',', $enabled), 'tool_log');
     }
     parent::uninstall_cleanup();
 }
コード例 #4
0
ファイル: theme.php プロジェクト: tyleung/CMPUT401MoodleExams
 /**
  * Pre-uninstall hook.
  *
  * This is intended for disabling of plugin, some DB table purging, etc.
  *
  * NOTE: to be called from uninstall_plugin() only.
  * @private
  */
 public function uninstall_cleanup()
 {
     global $DB;
     $DB->set_field('course', 'theme', '', array('theme' => $this->name));
     $DB->set_field('course_categories', 'theme', '', array('theme' => $this->name));
     $DB->set_field('user', 'theme', '', array('theme' => $this->name));
     $DB->set_field('mnet_host', 'theme', '', array('theme' => $this->name));
     unset_config('thememobile');
     unset_config('themetablet');
     unset_config('themelegacy');
     parent::uninstall_cleanup();
 }
コード例 #5
0
ファイル: portfolio.php プロジェクト: evltuma/moodle
 /**
  * Pre-uninstall hook.
  * This is intended for disabling of plugin, some DB table purging, etc.
  */
 public function uninstall_cleanup()
 {
     global $DB;
     // Get all instances of this portfolio.
     $count = $DB->count_records('portfolio_instance', array('plugin' => $this->name));
     if ($count > 0) {
         // This portfolio is in use, get the it's ID.
         $rec = $DB->get_record('portfolio_instance', array('plugin' => $this->name));
         // Remove all records from portfolio_instance_config.
         $DB->delete_records('portfolio_instance_config', array('instance' => $rec->id));
         // Remove all records from portfolio_instance_user.
         $DB->delete_records('portfolio_instance_user', array('instance' => $rec->id));
         // Remove all records from portfolio_log.
         $DB->delete_records('portfolio_log', array('portfolio' => $rec->id));
         // Remove all records from portfolio_tempdata.
         $DB->delete_records('portfolio_tempdata', array('instance' => $rec->id));
         // Remove the record from the portfolio_instance table.
         $DB->delete_records('portfolio_instance', array('id' => $rec->id));
     }
     parent::uninstall_cleanup();
 }
コード例 #6
0
 /**
  * Pre-uninstall hook.
  * @private
  */
 public function uninstall_cleanup()
 {
     global $DB;
     $DB->delete_records('sepl_plugin_config', array('plugin' => $this->name, 'subtype' => 'seplsubmission'));
     parent::uninstall_cleanup();
 }
コード例 #7
0
ファイル: block.php プロジェクト: evltuma/moodle
 /**
  * Pre-uninstall hook.
  *
  * This is intended for disabling of plugin, some DB table purging, etc.
  *
  * NOTE: to be called from uninstall_plugin() only.
  * @private
  */
 public function uninstall_cleanup()
 {
     global $DB, $CFG;
     if ($block = $DB->get_record('block', array('name' => $this->name))) {
         // Inform block it's about to be deleted.
         if (file_exists("{$CFG->dirroot}/blocks/{$block->name}/block_{$block->name}.php")) {
             $blockobject = block_instance($block->name);
             if ($blockobject) {
                 $blockobject->before_delete();
                 // Only if we can create instance, block might have been already removed.
             }
         }
         // First delete instances and related contexts.
         $instances = $DB->get_records('block_instances', array('blockname' => $block->name));
         foreach ($instances as $instance) {
             blocks_delete_instance($instance);
         }
         // Delete block.
         $DB->delete_records('block', array('id' => $block->id));
     }
     parent::uninstall_cleanup();
 }
コード例 #8
0
ファイル: format.php プロジェクト: evltuma/moodle
 /**
  * Pre-uninstall hook.
  *
  * This is intended for disabling of plugin, some DB table purging, etc.
  *
  * NOTE: to be called from uninstall_plugin() only.
  * @private
  */
 public function uninstall_cleanup()
 {
     global $DB;
     if (($defaultformat = get_config('moodlecourse', 'format')) && $defaultformat !== $this->name) {
         $courses = $DB->get_records('course', array('format' => $this->name), 'id');
         $data = (object) array('id' => null, 'format' => $defaultformat);
         foreach ($courses as $record) {
             $data->id = $record->id;
             update_course($data);
         }
     }
     $DB->delete_records('course_format_options', array('format' => $this->name));
     parent::uninstall_cleanup();
 }
コード例 #9
0
ファイル: filter.php プロジェクト: evltuma/moodle
 /**
  * Pre-uninstall hook.
  *
  * This is intended for disabling of plugin, some DB table purging, etc.
  *
  * NOTE: to be called from uninstall_plugin() only.
  * @private
  */
 public function uninstall_cleanup()
 {
     global $DB, $CFG;
     $DB->delete_records('filter_active', array('filter' => $this->name));
     $DB->delete_records('filter_config', array('filter' => $this->name));
     if (empty($CFG->filterall)) {
         $stringfilters = array();
     } else {
         if (!empty($CFG->stringfilters)) {
             $stringfilters = explode(',', $CFG->stringfilters);
             $stringfilters = array_combine($stringfilters, $stringfilters);
         } else {
             $stringfilters = array();
         }
     }
     unset($stringfilters[$this->name]);
     set_config('stringfilters', implode(',', $stringfilters));
     set_config('filterall', !empty($stringfilters));
     parent::uninstall_cleanup();
 }
コード例 #10
0
ファイル: message.php プロジェクト: evltuma/moodle
 /**
  * Pre-uninstall hook.
  *
  * This is intended for disabling of plugin, some DB table purging, etc.
  *
  * NOTE: to be called from uninstall_plugin() only.
  * @private
  */
 public function uninstall_cleanup()
 {
     global $CFG;
     require_once $CFG->libdir . '/messagelib.php';
     message_processor_uninstall($this->name);
     parent::uninstall_cleanup();
 }
コード例 #11
0
ファイル: qtype.php プロジェクト: tyleung/CMPUT401MoodleExams
 /**
  * Pre-uninstall hook.
  *
  * This is intended for disabling of plugin, some DB table purging, etc.
  *
  * NOTE: to be called from uninstall_plugin() only.
  * @private
  */
 public function uninstall_cleanup()
 {
     // Delete any question configuration records mentioning this plugin.
     unset_config($this->name . '_disabled', 'question');
     unset_config($this->name . '_sortorder', 'question');
     parent::uninstall_cleanup();
 }
コード例 #12
0
 /**
  * Pre-uninstall hook.
  * @private
  */
 public function uninstall_cleanup()
 {
     global $DB;
     parent::uninstall_cleanup();
 }
コード例 #13
0
ファイル: qbehaviour.php プロジェクト: evltuma/moodle
 /**
  * Pre-uninstall hook.
  *
  * This is intended for disabling of plugin, some DB table purging, etc.
  *
  * NOTE: to be called from uninstall_plugin() only.
  * @private
  */
 public function uninstall_cleanup()
 {
     if ($disabledbehaviours = get_config('question', 'disabledbehaviours')) {
         $disabledbehaviours = explode(',', $disabledbehaviours);
         $disabledbehaviours = array_unique($disabledbehaviours);
     } else {
         $disabledbehaviours = array();
     }
     if (($key = array_search($this->name, $disabledbehaviours)) !== false) {
         unset($disabledbehaviours[$key]);
         set_config('disabledbehaviours', implode(',', $disabledbehaviours), 'question');
     }
     if ($behaviourorder = get_config('question', 'behavioursortorder')) {
         $behaviourorder = explode(',', $behaviourorder);
         $behaviourorder = array_unique($behaviourorder);
     } else {
         $behaviourorder = array();
     }
     if (($key = array_search($this->name, $behaviourorder)) !== false) {
         unset($behaviourorder[$key]);
         set_config('behavioursortorder', implode(',', $behaviourorder), 'question');
     }
     parent::uninstall_cleanup();
 }
コード例 #14
0
ファイル: auth.php プロジェクト: evltuma/moodle
 /**
  * Pre-uninstall hook.
  *
  * This is intended for disabling of plugin, some DB table purging, etc.
  *
  * NOTE: to be called from uninstall_plugin() only.
  * @private
  */
 public function uninstall_cleanup()
 {
     global $CFG;
     if (!empty($CFG->auth)) {
         $auths = explode(',', $CFG->auth);
         $auths = array_unique($auths);
     } else {
         $auths = array();
     }
     if (($key = array_search($this->name, $auths)) !== false) {
         unset($auths[$key]);
         set_config('auth', implode(',', $auths));
     }
     if (!empty($CFG->registerauth) and $CFG->registerauth === $this->name) {
         unset_config('registerauth');
     }
     parent::uninstall_cleanup();
 }
コード例 #15
0
ファイル: mod.php プロジェクト: evltuma/moodle
 /**
  * Pre-uninstall hook.
  *
  * This is intended for disabling of plugin, some DB table purging, etc.
  *
  * NOTE: to be called from uninstall_plugin() only.
  * @private
  */
 public function uninstall_cleanup()
 {
     global $DB, $CFG;
     if (!($module = $DB->get_record('modules', array('name' => $this->name)))) {
         parent::uninstall_cleanup();
         return;
     }
     // Delete all the relevant instances from all course sections.
     if ($coursemods = $DB->get_records('course_modules', array('module' => $module->id))) {
         foreach ($coursemods as $coursemod) {
             // Do not verify results, there is not much we can do anyway.
             delete_mod_from_section($coursemod->id, $coursemod->section);
         }
     }
     // Increment course.cacherev for courses that used this module.
     // This will force cache rebuilding on the next request.
     increment_revision_number('course', 'cacherev', "id IN (SELECT DISTINCT course\n                      FROM {course_modules}\n                     WHERE module=?)", array($module->id));
     // Delete all the course module records.
     $DB->delete_records('course_modules', array('module' => $module->id));
     // Delete module contexts.
     if ($coursemods) {
         foreach ($coursemods as $coursemod) {
             \context_helper::delete_instance(CONTEXT_MODULE, $coursemod->id);
         }
     }
     // Delete the module entry itself.
     $DB->delete_records('modules', array('name' => $module->name));
     // Cleanup the gradebook.
     require_once $CFG->libdir . '/gradelib.php';
     grade_uninstalled_module($module->name);
     // Do not look for legacy $module->name . '_uninstall any more,
     // they should have migrated to db/uninstall.php by now.
     parent::uninstall_cleanup();
 }
コード例 #16
0
ファイル: assignfeedback.php プロジェクト: evltuma/moodle
 /**
  * Pre-uninstall hook.
  * @private
  */
 public function uninstall_cleanup()
 {
     global $DB;
     $DB->delete_records('assign_plugin_config', array('plugin' => $this->name, 'subtype' => 'assignfeedback'));
     parent::uninstall_cleanup();
 }
コード例 #17
0
 public function uninstall_cleanup()
 {
     $enabled = get_config('mod_dataform', 'enabled_dataformview');
     if ($enabled) {
         $enabled = array_flip(explode(',', $enabled));
         unset($enabled[$this->name]);
         $enabled = array_flip($enabled);
         set_config('enabled_dataformview', implode(',', $enabled), 'mod_dataform');
     }
     parent::uninstall_cleanup();
 }
コード例 #18
0
ファイル: enrol.php プロジェクト: evltuma/moodle
 /**
  * Pre-uninstall hook.
  *
  * This is intended for disabling of plugin, some DB table purging, etc.
  *
  * NOTE: to be called from uninstall_plugin() only.
  * @private
  */
 public function uninstall_cleanup()
 {
     global $DB, $CFG;
     // NOTE: this is a bit brute force way - it will not trigger events and hooks properly.
     // Nuke all role assignments.
     role_unassign_all(array('component' => 'enrol_' . $this->name));
     // Purge participants.
     $DB->delete_records_select('user_enrolments', "enrolid IN (SELECT id FROM {enrol} WHERE enrol = ?)", array($this->name));
     // Purge enrol instances.
     $DB->delete_records('enrol', array('enrol' => $this->name));
     // Tweak enrol settings.
     if (!empty($CFG->enrol_plugins_enabled)) {
         $enabledenrols = explode(',', $CFG->enrol_plugins_enabled);
         $enabledenrols = array_unique($enabledenrols);
         $enabledenrols = array_flip($enabledenrols);
         unset($enabledenrols[$this->name]);
         $enabledenrols = array_flip($enabledenrols);
         if (is_array($enabledenrols)) {
             set_config('enrol_plugins_enabled', implode(',', $enabledenrols));
         }
     }
     parent::uninstall_cleanup();
 }
コード例 #19
0
ファイル: repository.php プロジェクト: evltuma/moodle
 /**
  * Pre-uninstall hook.
  * This is intended for disabling of plugin, some DB table purging, etc.
  * Converts all linked files to standard files when repository is removed
  * and cleans up all records in the DB for that repository.
  */
 public function uninstall_cleanup()
 {
     global $CFG;
     require_once $CFG->dirroot . '/repository/lib.php';
     $repo = \repository::get_type_by_typename($this->name);
     if ($repo) {
         $repo->delete(true);
     }
     parent::uninstall_cleanup();
 }
コード例 #20
0
ファイル: antivirus.php プロジェクト: evltuma/moodle
 /**
  * Pre-uninstall hook.
  */
 public function uninstall_cleanup()
 {
     global $CFG;
     if (!empty($CFG->antiviruses)) {
         $antiviruses = explode(',', $CFG->antiviruses);
         $antiviruses = array_unique($antiviruses);
     } else {
         $antiviruses = array();
     }
     if (($key = array_search($this->name, $antiviruses)) !== false) {
         unset($antiviruses[$key]);
         set_config('antiviruses', implode(',', $antiviruses));
     }
     parent::uninstall_cleanup();
 }