Ignore:
Timestamp:
May 2, 2016, 12:09:23 PM (3 years ago)
Author:
jrpelegrina
Message:

Updated to moodle 3.0.3

File:
1 edited

Legend:

Unmodified
Added
Removed
  • moodle/trunk/fuentes/lib/classes/plugininfo/repository.php

    r136 r1331  
    6868        return new moodle_url('/admin/repository.php');
    6969    }
     70
     71    /**
     72     * Defines if there should be a way to uninstall the plugin via the administration UI.
     73     * @return boolean
     74     */
     75    public function is_uninstall_allowed() {
     76        if ($this->name === 'upload' || $this->name === 'coursefiles' || $this->name === 'user' || $this->name === 'recent') {
     77            return false;
     78        } else {
     79            return true;
     80        }
     81    }
     82
     83    /**
     84     * Pre-uninstall hook.
     85     * This is intended for disabling of plugin, some DB table purging, etc.
     86     * Converts all linked files to standard files when repository is removed
     87     * and cleans up all records in the DB for that repository.
     88     */
     89    public function uninstall_cleanup() {
     90        global $CFG;
     91        require_once($CFG->dirroot.'/repository/lib.php');
     92
     93        $repo = \repository::get_type_by_typename($this->name);
     94        if ($repo) {
     95            $repo->delete(true);
     96        }
     97
     98        parent::uninstall_cleanup();
     99    }
    70100}
Note: See TracChangeset for help on using the changeset viewer.