芝麻web文件管理V1.00
编辑当前文件:/home2/sdektunc/www/cepali/blocks/myoverview/db/upgrade.php
. /** * This file keeps track of upgrades to the myoverview block * * @since 3.7.3 * @package block_myoverview * @copyright 2019 Jake Dallimore
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); /** * Upgrade code for the MyOverview block. * * @param int $oldversion */ function xmldb_block_myoverview_upgrade($oldversion) { global $DB; if ($oldversion < 2019052001) { // Remove orphaned course favourites, which weren't being deleted when the course was deleted. $sql = 'SELECT f.id FROM {favourite} f LEFT JOIN {course} c ON (c.id = f.itemid) WHERE f.component = :component AND f.itemtype = :itemtype AND c.id IS NULL'; $params = ['component' => 'core_course', 'itemtype' => 'courses']; if ($records = $DB->get_fieldset_sql($sql, $params)) { $chunks = array_chunk($records, 1000); foreach ($chunks as $chunk) { list($insql, $inparams) = $DB->get_in_or_equal($chunk); $DB->delete_records_select('favourite', "id $insql", $inparams); } } upgrade_block_savepoint(true, 2019052001, 'myoverview', false); } return true; }