// // Moodle is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. /** * Script to refresh the services and external functions. * * @package mdk * @copyright 2015 Frédéric Massart - FMCorz.net * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ define('CLI_SCRIPT', true); require 'config.php'; require $CFG->libdir . '/upgradelib.php'; mtrace('Updating services of core'); external_update_descriptions('moodle'); $plugintypes = core_component::get_plugin_types(); foreach ($plugintypes as $plugintype => $dir) { $plugins = core_component::get_plugin_list($plugintype); foreach ($plugins as $plugin => $dir) { $component = $plugintype . '_' . $plugin; mtrace('Updating services of ' . $component); external_update_descriptions($component); } } external_update_services();
/** * Upgrade/install other parts of moodle * @param bool $verbose * @return void, may throw exception */ function upgrade_noncore($verbose) { global $CFG; raise_memory_limit(MEMORY_EXTRA); // upgrade all plugins types try { // Reset caches before any output. cache_helper::purge_all(true); purge_all_caches(); $plugintypes = core_component::get_plugin_types(); foreach ($plugintypes as $type => $location) { upgrade_plugins($type, 'print_upgrade_part_start', 'print_upgrade_part_end', $verbose); } // Upgrade services. // This function gives plugins and subsystems a chance to add functions to existing built-in services. external_update_services(); // Update cache definitions. Involves scanning each plugin for any changes. cache_helper::update_definitions(); // Mark the site as upgraded. set_config('allversionshash', core_component::get_all_versions_hash()); // Purge caches again, just to be sure we arn't holding onto old stuff now. cache_helper::purge_all(true); purge_all_caches(); } catch (Exception $ex) { upgrade_handle_exception($ex); } catch (Throwable $ex) { // Engine errors in PHP7 throw exceptions of type Throwable (this "catch" will be ignored in PHP5). upgrade_handle_exception($ex); } }