Merge branch 'MDL-86087-main' of https://github.com/HuongNV13/moodle
This commit is contained in:
@@ -62,7 +62,7 @@ jobs:
|
||||
include:
|
||||
# MySQL builds always run with the lowest PHP supported version.
|
||||
- os: ubuntu-24.04
|
||||
php: 8.2
|
||||
php: 8.3
|
||||
extensions:
|
||||
db: mysqli
|
||||
# PostgreSQL builds always run with the highest PHP supported version.
|
||||
@@ -88,7 +88,7 @@ jobs:
|
||||
if: ${{ matrix.db == 'pgsql' }}
|
||||
uses: m4nu56/postgresql-action@v1
|
||||
with:
|
||||
postgresql version: 15
|
||||
postgresql version: 16
|
||||
postgresql db: test
|
||||
postgresql user: test
|
||||
postgresql password: test
|
||||
|
||||
@@ -59,7 +59,7 @@ jobs:
|
||||
db: pgsql
|
||||
extensions: exif, fileinfo, gd, intl, pgsql, mysql, redis, soap, sodium, zip
|
||||
- os: windows-latest
|
||||
php: 8.2
|
||||
php: 8.3
|
||||
db: pgsql
|
||||
extensions: exif, fileinfo, gd, intl, pgsql, mysql, redis, soap, sodium, zip
|
||||
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@
|
||||
"minimum-stability": "dev",
|
||||
"prefer-stable": true,
|
||||
"require": {
|
||||
"php": ">=8.2.0",
|
||||
"php": ">=8.3.0",
|
||||
"ext-iconv": "*",
|
||||
"ext-mbstring": "*",
|
||||
"ext-curl": "*",
|
||||
|
||||
Generated
+517
-311
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ruleset name="MoodleCore">
|
||||
<rule ref="moodle"/>
|
||||
<config name="testVersion" value="8.2-"/>
|
||||
<config name="testVersion" value="8.3-"/>
|
||||
</ruleset>
|
||||
|
||||
@@ -5108,4 +5108,208 @@
|
||||
</CUSTOM_CHECK>
|
||||
</CUSTOM_CHECKS>
|
||||
</MOODLE>
|
||||
<MOODLE version="5.2" requires="4.4.0">
|
||||
<UNICODE level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="unicoderequired" />
|
||||
</FEEDBACK>
|
||||
</UNICODE>
|
||||
<DATABASE level="required">
|
||||
<VENDOR name="mariadb" version="10.11.0" />
|
||||
<VENDOR name="mysql" version="8.4" />
|
||||
<VENDOR name="postgres" version="16" />
|
||||
<VENDOR name="mssql" version="15.0" />
|
||||
<VENDOR name="auroramysql" version="8.0" />
|
||||
</DATABASE>
|
||||
<PHP version="8.3.0" level="required">
|
||||
</PHP>
|
||||
<PCREUNICODE level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="pcreunicodewarning" />
|
||||
</FEEDBACK>
|
||||
</PCREUNICODE>
|
||||
<PHP_EXTENSIONS>
|
||||
<PHP_EXTENSION name="iconv" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="iconvrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="mbstring" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="mbstringrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="curl" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="curlrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="openssl" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="opensslrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="tokenizer" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="tokenizerrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="soap" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="soaprecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="ctype" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="ctyperequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="zip" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="ziprequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="zlib" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="gd" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="gdrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="simplexml" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="simplexmlrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="spl" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="splrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="pcre" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="dom" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="xml" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="xmlreader" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="intl" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="intlrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="json" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="hash" level="required"/>
|
||||
<PHP_EXTENSION name="fileinfo" level="required"/>
|
||||
<PHP_EXTENSION name="sodium" level="required"/>
|
||||
<PHP_EXTENSION name="exif" level="optional"/>
|
||||
<PHP_EXTENSION name="filter" level="required"/>
|
||||
</PHP_EXTENSIONS>
|
||||
<PHP_SETTINGS>
|
||||
<PHP_SETTING name="memory_limit" value="96M" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="settingmemorylimit" />
|
||||
</FEEDBACK>
|
||||
</PHP_SETTING>
|
||||
<PHP_SETTING name="file_uploads" value="1" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="settingfileuploads" />
|
||||
</FEEDBACK>
|
||||
</PHP_SETTING>
|
||||
<PHP_SETTING name="opcache.enable" value="1" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="opcacherecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_SETTING>
|
||||
<PHP_SETTING name="zend.exception_ignore_args" value="1" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="settingzendexceptionignoreargs" />
|
||||
</FEEDBACK>
|
||||
</PHP_SETTING>
|
||||
</PHP_SETTINGS>
|
||||
<CUSTOM_CHECKS>
|
||||
<CUSTOM_CHECK function="\core\environment::check_composer_dependencies_installed" level="optional" />
|
||||
<CUSTOM_CHECK function="\core\environment::check_composer_developer_dependencies_not_installed" level="optional" />
|
||||
<CUSTOM_CHECK function="\core\environment::check_composer_dependencies_optimised" level="optional" />
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_database_storage_engine" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="unsupporteddbstorageengine" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="question/engine/upgrade/upgradelib.php" function="quiz_attempts_upgraded" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="quizattemptsupgradedmessage" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_slasharguments" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="slashargumentswarning" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_database_tables_row_format" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="unsupporteddbtablerowformat" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_unoconv_version" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="unoconvwarning" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_libcurl_version" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="libcurlwarning" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_file_format" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="unsupporteddbfileformat" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_file_per_table" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="unsupporteddbfilepertable" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_large_prefix" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="unsupporteddblargeprefix" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_is_https" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="ishttpswarning" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_incomplete_unicode_support" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="incompleteunicodesupport" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_sixtyfour_bits" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="sixtyfourbitsrequired" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_max_input_vars" level="optional">
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_admin_dir_usage" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="iscustomadminwarnings" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_xmlrpc_usage" level="optional">
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mod_assignment" level="required">
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_db_prefix_length" level="required">
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_async_backup" level="recommended">
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_aurora_version" level="optional">
|
||||
</CUSTOM_CHECK>
|
||||
</CUSTOM_CHECKS>
|
||||
</MOODLE>
|
||||
</COMPATIBILITY_MATRIX>
|
||||
|
||||
@@ -29,22 +29,6 @@
|
||||
* @return bool result
|
||||
*/
|
||||
function xmldb_tool_cohortroles_upgrade($oldversion) {
|
||||
global $DB;
|
||||
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2023042401) {
|
||||
// Delete any tool_cohortroles mappings for users who no longer exist.
|
||||
$DB->delete_records_select('tool_cohortroles', 'userid NOT IN (SELECT id FROM {user} WHERE deleted = 0)');
|
||||
|
||||
// Cohortroles savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2023042401, 'tool', 'cohortroles');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -24,12 +24,6 @@
|
||||
*/
|
||||
|
||||
function xmldb_tool_customlang_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -29,77 +29,6 @@
|
||||
* @return bool result
|
||||
*/
|
||||
function xmldb_tool_dataprivacy_upgrade($oldversion) {
|
||||
global $CFG, $DB;
|
||||
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2023062700) {
|
||||
// Define table tool_dataprivacy_contextlist to be created.
|
||||
$table = new xmldb_table('tool_dataprivacy_contextlist');
|
||||
|
||||
// Adding fields to table tool_dataprivacy_contextlist.
|
||||
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
|
||||
$table->add_field('component', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0');
|
||||
$table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0');
|
||||
|
||||
// Adding keys to table tool_dataprivacy_contextlist.
|
||||
$table->add_key('primary', XMLDB_KEY_PRIMARY, ['id']);
|
||||
|
||||
// Conditionally launch create table for tool_dataprivacy_contextlist.
|
||||
if (!$dbman->table_exists($table)) {
|
||||
$dbman->create_table($table);
|
||||
}
|
||||
|
||||
// Define table tool_dataprivacy_ctxlst_ctx to be created.
|
||||
$table = new xmldb_table('tool_dataprivacy_ctxlst_ctx');
|
||||
|
||||
// Adding fields to table tool_dataprivacy_ctxlst_ctx.
|
||||
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
|
||||
$table->add_field('contextid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('contextlistid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('status', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, '0');
|
||||
$table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0');
|
||||
$table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0');
|
||||
|
||||
// Adding keys to table tool_dataprivacy_ctxlst_ctx.
|
||||
$table->add_key('primary', XMLDB_KEY_PRIMARY, ['id']);
|
||||
$table->add_key('contextlistid', XMLDB_KEY_FOREIGN, ['contextlistid'], 'tool_dataprivacy_contextlist', ['id']);
|
||||
|
||||
// Conditionally launch create table for tool_dataprivacy_ctxlst_ctx.
|
||||
if (!$dbman->table_exists($table)) {
|
||||
$dbman->create_table($table);
|
||||
}
|
||||
|
||||
// Define table tool_dataprivacy_rqst_ctxlst to be created.
|
||||
$table = new xmldb_table('tool_dataprivacy_rqst_ctxlst');
|
||||
|
||||
// Adding fields to table tool_dataprivacy_rqst_ctxlst.
|
||||
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
|
||||
$table->add_field('requestid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('contextlistid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
|
||||
// Adding keys to table tool_dataprivacy_rqst_ctxlst.
|
||||
$table->add_key('primary', XMLDB_KEY_PRIMARY, ['id']);
|
||||
$table->add_key('requestid', XMLDB_KEY_FOREIGN, ['requestid'], 'tool_dataprivacy_request', ['id']);
|
||||
$table->add_key('contextlistid', XMLDB_KEY_FOREIGN, ['contextlistid'], 'tool_dataprivacy_contextlist', ['id']);
|
||||
$table->add_key('requestidcontextlistid', XMLDB_KEY_UNIQUE, ['requestid', 'contextlistid']);
|
||||
|
||||
// Conditionally launch create table for tool_dataprivacy_rqst_ctxlst.
|
||||
if (!$dbman->table_exists($table)) {
|
||||
$dbman->create_table($table);
|
||||
}
|
||||
|
||||
// Dataprivacy savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2023062700, 'tool', 'dataprivacy');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -29,12 +29,6 @@
|
||||
* @return bool always true
|
||||
*/
|
||||
function xmldb_tool_log_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -23,12 +23,6 @@
|
||||
*/
|
||||
|
||||
function xmldb_logstore_database_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -23,12 +23,6 @@
|
||||
*/
|
||||
|
||||
function xmldb_logstore_standard_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -28,26 +28,6 @@
|
||||
* @param int $oldversion
|
||||
*/
|
||||
function xmldb_factor_auth_upgrade($oldversion) {
|
||||
if ($oldversion < 2021020500) {
|
||||
$authtypes = get_enabled_auth_plugins(true);
|
||||
// Upgrade goodauth config from number to name.
|
||||
$goodauth = explode(',', get_config('factor_auth', 'goodauth'));
|
||||
$newauths = [];
|
||||
foreach ($goodauth as $auth) {
|
||||
// Check if index exists before access. If not, ignore, settings were out of sync.
|
||||
if (array_key_exists($auth, $authtypes)) {
|
||||
$newauths[] = $authtypes[$auth];
|
||||
}
|
||||
}
|
||||
set_config('goodauth', implode(',', $newauths), 'factor_auth');
|
||||
|
||||
// MFA savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2021020500, 'factor', 'auth');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -29,12 +29,6 @@
|
||||
* @return bool always true
|
||||
*/
|
||||
function xmldb_tool_mobile_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -29,12 +29,6 @@
|
||||
* @return bool always true
|
||||
*/
|
||||
function xmldb_tool_monitor_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -29,12 +29,6 @@
|
||||
* @return bool always true
|
||||
*/
|
||||
function xmldb_tool_moodlenet_upgrade(int $oldversion) {
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -30,12 +30,6 @@
|
||||
* @return bool
|
||||
*/
|
||||
function xmldb_tool_policy_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -33,12 +33,6 @@ function xmldb_tool_recyclebin_upgrade($oldversion) {
|
||||
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -32,20 +32,6 @@ use tool_usertours\tour;
|
||||
* @return bool
|
||||
*/
|
||||
function xmldb_tool_usertours_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2023053000) {
|
||||
// Update shipped tours.
|
||||
// Normally, we just bump the version numbers because we need to call update_shipped_tours only once.
|
||||
manager::update_shipped_tours();
|
||||
|
||||
upgrade_plugin_savepoint(true, 2023053000, 'tool', 'usertours');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ final class model_test extends \advanced_testcase {
|
||||
|
||||
public function setUp(): void {
|
||||
parent::setUp();
|
||||
|
||||
$this->resetAfterTest();
|
||||
$this->setAdminUser();
|
||||
|
||||
$target = \core_analytics\manager::get_target('test_target_shortname');
|
||||
@@ -68,8 +68,6 @@ final class model_test extends \advanced_testcase {
|
||||
}
|
||||
|
||||
public function test_enable(): void {
|
||||
$this->resetAfterTest(true);
|
||||
|
||||
$this->assertEquals(0, $this->model->get_model_obj()->enabled);
|
||||
$this->assertEquals(0, $this->model->get_model_obj()->trained);
|
||||
$this->assertEquals('', $this->model->get_model_obj()->timesplitting);
|
||||
@@ -81,8 +79,6 @@ final class model_test extends \advanced_testcase {
|
||||
}
|
||||
|
||||
public function test_create(): void {
|
||||
$this->resetAfterTest(true);
|
||||
|
||||
$target = \core_analytics\manager::get_target('\core_course\analytics\target\course_dropout');
|
||||
$indicators = array(
|
||||
\core_analytics\manager::get_indicator('\core\analytics\indicator\any_write_action'),
|
||||
@@ -194,7 +190,6 @@ final class model_test extends \advanced_testcase {
|
||||
*/
|
||||
public function test_clear_static(): void {
|
||||
global $DB;
|
||||
$this->resetAfterTest();
|
||||
|
||||
$statictarget = new \test_static_target_shortname();
|
||||
$indicators['test_indicator_max'] = \core_analytics\manager::get_indicator('test_indicator_max');
|
||||
@@ -211,8 +206,6 @@ final class model_test extends \advanced_testcase {
|
||||
}
|
||||
|
||||
public function test_model_manager(): void {
|
||||
$this->resetAfterTest(true);
|
||||
|
||||
$this->assertCount(3, $this->model->get_indicators());
|
||||
$this->assertInstanceOf('\core_analytics\local\target\binary', $this->model->get_target());
|
||||
|
||||
@@ -225,8 +218,6 @@ final class model_test extends \advanced_testcase {
|
||||
}
|
||||
|
||||
public function test_output_dir(): void {
|
||||
$this->resetAfterTest(true);
|
||||
|
||||
$dir = make_request_directory();
|
||||
set_config('modeloutputdir', $dir, 'analytics');
|
||||
|
||||
@@ -237,9 +228,6 @@ final class model_test extends \advanced_testcase {
|
||||
|
||||
public function test_unique_id(): void {
|
||||
global $DB;
|
||||
|
||||
$this->resetAfterTest(true);
|
||||
|
||||
$originaluniqueid = $this->model->get_unique_id();
|
||||
|
||||
// Same id across instances.
|
||||
@@ -283,8 +271,6 @@ final class model_test extends \advanced_testcase {
|
||||
* @return void
|
||||
*/
|
||||
public function test_exists(): void {
|
||||
$this->resetAfterTest(true);
|
||||
|
||||
$target = \core_analytics\manager::get_target('\core_course\analytics\target\no_teaching');
|
||||
$this->assertTrue(\core_analytics\model::exists($target));
|
||||
|
||||
@@ -302,9 +288,6 @@ final class model_test extends \advanced_testcase {
|
||||
*/
|
||||
public function test_model_timelimit(): void {
|
||||
global $DB;
|
||||
|
||||
$this->resetAfterTest(true);
|
||||
|
||||
set_config('modeltimelimit', 2, 'analytics');
|
||||
|
||||
$courses = array();
|
||||
@@ -365,8 +348,6 @@ final class model_test extends \advanced_testcase {
|
||||
* Test model_config::get_class_component.
|
||||
*/
|
||||
public function test_model_config_get_class_component(): void {
|
||||
$this->resetAfterTest(true);
|
||||
|
||||
$this->assertEquals('core',
|
||||
\core_analytics\model_config::get_class_component('\\core\\analytics\\indicator\\read_actions'));
|
||||
$this->assertEquals('core',
|
||||
@@ -387,8 +368,6 @@ final class model_test extends \advanced_testcase {
|
||||
$this->markTestSkipped('mlbackend_python is not configured.');
|
||||
}
|
||||
|
||||
$this->resetAfterTest(true);
|
||||
|
||||
$this->model->enable('\\core\\analytics\\time_splitting\\quarters');
|
||||
$zipfilepath = $this->model->export_model('yeah-config.zip');
|
||||
|
||||
@@ -408,8 +387,6 @@ final class model_test extends \advanced_testcase {
|
||||
* Test can export configuration
|
||||
*/
|
||||
public function test_can_export_configuration(): void {
|
||||
$this->resetAfterTest(true);
|
||||
|
||||
// No time splitting method.
|
||||
$this->assertFalse($this->model->can_export_configuration());
|
||||
|
||||
@@ -433,8 +410,6 @@ final class model_test extends \advanced_testcase {
|
||||
$this->markTestSkipped('mlbackend_python is not configured.');
|
||||
}
|
||||
|
||||
$this->resetAfterTest(true);
|
||||
|
||||
$this->model->enable('\\core\\analytics\\time_splitting\\quarters');
|
||||
|
||||
$modelconfig = new \core_analytics\model_config($this->model);
|
||||
@@ -463,8 +438,6 @@ final class model_test extends \advanced_testcase {
|
||||
public function test_inplace_editable_name(): void {
|
||||
global $PAGE;
|
||||
|
||||
$this->resetAfterTest();
|
||||
|
||||
$output = new \core_renderer($PAGE, RENDERER_TARGET_GENERAL);
|
||||
|
||||
// Check as a user with permission to edit the name.
|
||||
@@ -489,8 +462,6 @@ final class model_test extends \advanced_testcase {
|
||||
public function test_get_name_and_rename(): void {
|
||||
global $PAGE;
|
||||
|
||||
$this->resetAfterTest();
|
||||
|
||||
$output = new \core_renderer($PAGE, RENDERER_TARGET_GENERAL);
|
||||
|
||||
// By default, the model exported for template uses its target's name in the name inplace editable element.
|
||||
@@ -518,8 +489,6 @@ final class model_test extends \advanced_testcase {
|
||||
* Tests model::get_potential_timesplittings()
|
||||
*/
|
||||
public function test_potential_timesplittings(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$this->assertArrayNotHasKey('\core\analytics\time_splitting\no_splitting', $this->model->get_potential_timesplittings());
|
||||
$this->assertArrayHasKey('\core\analytics\time_splitting\single_range', $this->model->get_potential_timesplittings());
|
||||
$this->assertArrayHasKey('\core\analytics\time_splitting\quarters', $this->model->get_potential_timesplittings());
|
||||
@@ -531,8 +500,6 @@ final class model_test extends \advanced_testcase {
|
||||
* @return null
|
||||
*/
|
||||
public function test_get_samples(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
if (!PHPUNIT_LONGTEST) {
|
||||
$this->markTestSkipped('PHPUNIT_LONGTEST is not defined');
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ final class stats_test extends \advanced_testcase {
|
||||
*/
|
||||
public function setUp(): void {
|
||||
parent::setUp();
|
||||
|
||||
$this->resetAfterTest();
|
||||
$this->setAdminUser();
|
||||
}
|
||||
|
||||
@@ -47,9 +47,6 @@ final class stats_test extends \advanced_testcase {
|
||||
* Test the {@link \core_analytics\stats::enabled_models()} implementation.
|
||||
*/
|
||||
public function test_enabled_models(): void {
|
||||
|
||||
$this->resetAfterTest(true);
|
||||
|
||||
// By default, sites have {@link \core_course\analytics\target\no_teaching} and
|
||||
// {@link \core_user\analytics\target\upcoming_activities_due} enabled.
|
||||
$this->assertEquals(4, \core_analytics\stats::enabled_models());
|
||||
@@ -77,8 +74,6 @@ final class stats_test extends \advanced_testcase {
|
||||
$this->markTestSkipped('mlbackend_python is not configured.');
|
||||
}
|
||||
|
||||
$this->resetAfterTest(true);
|
||||
|
||||
$model = \core_analytics\model::create(
|
||||
\core_analytics\manager::get_target('test_target_shortname'),
|
||||
[
|
||||
@@ -127,8 +122,6 @@ final class stats_test extends \advanced_testcase {
|
||||
$this->markTestSkipped('mlbackend_python is not configured.');
|
||||
}
|
||||
|
||||
$this->resetAfterTest(true);
|
||||
|
||||
$model = \core_analytics\model::create(
|
||||
\core_analytics\manager::get_target('test_target_shortname'),
|
||||
[
|
||||
|
||||
@@ -28,12 +28,6 @@
|
||||
* @return bool result
|
||||
*/
|
||||
function xmldb_auth_db_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -28,12 +28,6 @@
|
||||
* @return bool result
|
||||
*/
|
||||
function xmldb_auth_email_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -28,12 +28,6 @@
|
||||
* @return bool result
|
||||
*/
|
||||
function xmldb_auth_ldap_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -29,12 +29,6 @@
|
||||
* @return bool result.
|
||||
*/
|
||||
function xmldb_auth_lti_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -28,12 +28,6 @@
|
||||
* @return bool result
|
||||
*/
|
||||
function xmldb_auth_manual_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -28,12 +28,6 @@
|
||||
* @return bool result
|
||||
*/
|
||||
function xmldb_auth_none_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -29,12 +29,6 @@
|
||||
* @return bool result
|
||||
*/
|
||||
function xmldb_auth_oauth2_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -28,12 +28,6 @@
|
||||
* @return bool result
|
||||
*/
|
||||
function xmldb_auth_shibboleth_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -43,12 +43,6 @@
|
||||
* @param object $block
|
||||
*/
|
||||
function xmldb_block_badges_upgrade($oldversion, $block) {
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -43,12 +43,6 @@
|
||||
* @param object $block
|
||||
*/
|
||||
function xmldb_block_calendar_month_upgrade($oldversion, $block) {
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -43,12 +43,6 @@
|
||||
* @param object $block
|
||||
*/
|
||||
function xmldb_block_calendar_upcoming_upgrade($oldversion, $block) {
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -44,12 +44,6 @@
|
||||
* @param object $block
|
||||
*/
|
||||
function xmldb_block_completionstatus_upgrade($oldversion, $block) {
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -44,12 +44,6 @@
|
||||
* @param object $block
|
||||
*/
|
||||
function xmldb_block_course_summary_upgrade($oldversion, $block) {
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -43,12 +43,6 @@
|
||||
* @param object $block
|
||||
*/
|
||||
function xmldb_block_feedback_upgrade($oldversion, $block) {
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -29,12 +29,6 @@
|
||||
* @param int $oldversion
|
||||
*/
|
||||
function xmldb_block_html_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -29,12 +29,6 @@
|
||||
* @param int $oldversion
|
||||
*/
|
||||
function xmldb_block_myoverview_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -51,12 +51,6 @@
|
||||
* @param object $block
|
||||
*/
|
||||
function xmldb_block_navigation_upgrade($oldversion, $block) {
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -43,12 +43,6 @@
|
||||
* @param object $block
|
||||
*/
|
||||
function xmldb_block_recent_activity_upgrade($oldversion, $block) {
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -43,12 +43,6 @@
|
||||
* @return bool
|
||||
*/
|
||||
function xmldb_block_recentlyaccesseditems_upgrade($oldversion, $block) {
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -29,12 +29,6 @@
|
||||
* @return boolean
|
||||
*/
|
||||
function xmldb_block_rss_client_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -44,12 +44,6 @@
|
||||
* @param object $block
|
||||
*/
|
||||
function xmldb_block_selfcompletion_upgrade($oldversion, $block) {
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -51,12 +51,6 @@
|
||||
* @param object $block
|
||||
*/
|
||||
function xmldb_block_settings_upgrade($oldversion, $block) {
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -28,12 +28,6 @@
|
||||
* @param int $oldversion
|
||||
*/
|
||||
function xmldb_block_tag_youtube_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -43,12 +43,6 @@
|
||||
* @param object $block
|
||||
*/
|
||||
function xmldb_block_timeline_upgrade($oldversion, $block) {
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -28,32 +28,6 @@
|
||||
* @return bool
|
||||
*/
|
||||
function xmldb_communication_matrix_upgrade($oldversion) {
|
||||
global $DB;
|
||||
|
||||
$dbman = $DB->get_manager();
|
||||
if ($oldversion < 2023060101) {
|
||||
$table = new xmldb_table('matrix_rooms');
|
||||
$field = new xmldb_field('topic', XMLDB_TYPE_CHAR, '255', null, false, false, null, 'roomid');
|
||||
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Plugin savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2023060101, 'communication', 'matrix');
|
||||
}
|
||||
|
||||
if ($oldversion < 2023071900) {
|
||||
$table = new xmldb_table('matrix_rooms');
|
||||
$dbman->rename_table($table, 'matrix_room');
|
||||
|
||||
// Plugin savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2023071900, 'communication', 'matrix');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -29,32 +29,6 @@
|
||||
* @return bool result
|
||||
*/
|
||||
function xmldb_format_topics_upgrade($oldversion) {
|
||||
global $DB;
|
||||
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2023100901) {
|
||||
// During the migration to version 4.4, ensure that sections with null names are renamed to their corresponding
|
||||
// previous 'Topic X' for continuity.
|
||||
$newsectionname = $DB->sql_concat("'Topic '", 'section');
|
||||
$sql = <<<EOF
|
||||
UPDATE {course_sections}
|
||||
SET name = $newsectionname
|
||||
WHERE section > 0 AND (name IS NULL OR name = '')
|
||||
AND course IN (SELECT id FROM {course} WHERE format = 'topics')
|
||||
EOF;
|
||||
$DB->execute(
|
||||
sql: $sql,
|
||||
);
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2023100901, 'format', 'topics');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -31,12 +31,6 @@
|
||||
function xmldb_format_weeks_upgrade($oldversion) {
|
||||
global $CFG, $DB;
|
||||
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -24,11 +24,6 @@
|
||||
|
||||
function xmldb_enrol_database_upgrade($oldversion) {
|
||||
global $DB;
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
@@ -23,12 +23,6 @@
|
||||
*/
|
||||
|
||||
function xmldb_enrol_flatfile_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -23,12 +23,6 @@
|
||||
*/
|
||||
|
||||
function xmldb_enrol_guest_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -29,12 +29,6 @@
|
||||
* @return bool true
|
||||
*/
|
||||
function xmldb_enrol_imsenterprise_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -35,12 +35,6 @@
|
||||
* @return boolean
|
||||
*/
|
||||
function xmldb_enrol_lti_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -23,12 +23,6 @@
|
||||
*/
|
||||
|
||||
function xmldb_enrol_manual_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -41,12 +41,6 @@
|
||||
// before any action that may take longer time to finish.
|
||||
|
||||
function xmldb_enrol_paypal_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -23,12 +23,6 @@
|
||||
*/
|
||||
|
||||
function xmldb_enrol_self_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -29,12 +29,6 @@
|
||||
* @return bool result
|
||||
*/
|
||||
function xmldb_filter_displayh5p_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -28,12 +28,6 @@
|
||||
* @return bool result
|
||||
*/
|
||||
function xmldb_filter_mediaplugin_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -28,12 +28,6 @@
|
||||
* @return bool result
|
||||
*/
|
||||
function xmldb_filter_tex_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -33,12 +33,6 @@
|
||||
* @throws upgrade_exception
|
||||
*/
|
||||
function xmldb_gradingform_guide_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -29,12 +29,6 @@
|
||||
* @return bool true
|
||||
*/
|
||||
function xmldb_gradingform_rubric_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -29,54 +29,6 @@
|
||||
* @return bool result
|
||||
*/
|
||||
function xmldb_gradereport_grader_upgrade(int $oldversion): bool {
|
||||
global $DB;
|
||||
|
||||
if ($oldversion < 2023032100) {
|
||||
// Remove grade_report_showquickfeedback, grade_report_enableajax, grade_report_showeyecons,
|
||||
// grade_report_showlocks, grade_report_showanalysisicon preferences for every user.
|
||||
$DB->delete_records('user_preferences', ['name' => 'grade_report_showquickfeedback']);
|
||||
$DB->delete_records('user_preferences', ['name' => 'grade_report_enableajax']);
|
||||
$DB->delete_records('user_preferences', ['name' => 'grade_report_showeyecons']);
|
||||
$DB->delete_records('user_preferences', ['name' => 'grade_report_showlocks']);
|
||||
$DB->delete_records('user_preferences', ['name' => 'grade_report_showanalysisicon']);
|
||||
|
||||
// Remove grade_report_showactivityicons, grade_report_showcalculations preferences for every user.
|
||||
$DB->delete_records('user_preferences', ['name' => 'grade_report_showactivityicons']);
|
||||
$DB->delete_records('user_preferences', ['name' => 'grade_report_showcalculations']);
|
||||
|
||||
// The grade_report_showquickfeedback, grade_report_enableajax, grade_report_showeyecons,
|
||||
// grade_report_showlocks, grade_report_showanalysisicon settings have been removed.
|
||||
unset_config('grade_report_showquickfeedback');
|
||||
unset_config('grade_report_enableajax');
|
||||
unset_config('grade_report_showeyecons');
|
||||
unset_config('grade_report_showlocks');
|
||||
unset_config('grade_report_showanalysisicon');
|
||||
|
||||
// The grade_report_showactivityicons, grade_report_showcalculations settings have been removed.
|
||||
unset_config('grade_report_showactivityicons');
|
||||
unset_config('grade_report_showcalculations');
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2023032100, 'gradereport', 'grader');
|
||||
}
|
||||
|
||||
if ($oldversion < 2023032700) {
|
||||
unset_config('grade_report_studentsperpage');
|
||||
upgrade_plugin_savepoint(true, 2023032700, 'gradereport', 'grader');
|
||||
}
|
||||
|
||||
if ($oldversion < 2023032800) {
|
||||
// Remove plugin entry created by previously incorrect 2023032100 savepoint.
|
||||
$DB->delete_records('config_plugins', ['plugin' => 'grade_gradereport_grader']);
|
||||
upgrade_plugin_savepoint(true, 2023032800, 'gradereport', 'grader');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -29,12 +29,6 @@
|
||||
* @return bool result
|
||||
*/
|
||||
function xmldb_gradereport_history_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -29,12 +29,6 @@
|
||||
* @return bool result
|
||||
*/
|
||||
function xmldb_gradereport_overview_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -27,12 +27,6 @@
|
||||
* @return bool result
|
||||
*/
|
||||
function xmldb_gradereport_user_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -29,12 +29,6 @@
|
||||
* @return bool
|
||||
*/
|
||||
function xmldb_antivirus_clamav_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -99,757 +99,6 @@ function xmldb_main_upgrade($oldversion) {
|
||||
upgrade_main_savepoint(true, 2022112802);
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2023051500.00) {
|
||||
// Define communication table.
|
||||
$table = new xmldb_table('communication');
|
||||
|
||||
// Adding fields to table communication.
|
||||
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE);
|
||||
$table->add_field('instanceid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null, 'id');
|
||||
$table->add_field('component', XMLDB_TYPE_CHAR, '100', null, XMLDB_NOTNULL, null, null, 'instanceid');
|
||||
$table->add_field('instancetype', XMLDB_TYPE_CHAR, '100', null, XMLDB_NOTNULL, null, null, 'component');
|
||||
$table->add_field('provider', XMLDB_TYPE_CHAR, '100', null, XMLDB_NOTNULL, null, null, 'instancerype');
|
||||
$table->add_field('roomname', XMLDB_TYPE_CHAR, '255', null, null, null, null, 'provider');
|
||||
$table->add_field('avatarfilename', XMLDB_TYPE_CHAR, '100', null, null, null, null, 'roomname');
|
||||
$table->add_field('active', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, 1, 'avatarfilename');
|
||||
|
||||
// Add key.
|
||||
$table->add_key('primary', XMLDB_KEY_PRIMARY, ['id']);
|
||||
|
||||
// Conditionally launch create table for communication.
|
||||
if (!$dbman->table_exists($table)) {
|
||||
$dbman->create_table($table);
|
||||
}
|
||||
|
||||
// Define communication user table.
|
||||
$table = new xmldb_table('communication_user');
|
||||
|
||||
// Adding fields to table communication.
|
||||
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE);
|
||||
$table->add_field('commid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null, 'id');
|
||||
$table->add_field('userid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null, 'commid');
|
||||
$table->add_field('synced', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, 0, 'userid');
|
||||
$table->add_field('deleted', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, 0, 'synced');
|
||||
|
||||
// Add keys.
|
||||
$table->add_key('primary', XMLDB_KEY_PRIMARY, ['id']);
|
||||
$table->add_key('commid', XMLDB_KEY_FOREIGN, ['commid'], 'communication', ['id']);
|
||||
$table->add_key('userid', XMLDB_KEY_FOREIGN, ['userid'], 'user', ['id']);
|
||||
|
||||
// Conditionally launch create table for communication.
|
||||
if (!$dbman->table_exists($table)) {
|
||||
$dbman->create_table($table);
|
||||
}
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2023051500.00);
|
||||
}
|
||||
|
||||
if ($oldversion < 2023062200.00) {
|
||||
// Remove device specific fields for themes from config table.
|
||||
unset_config('thememobile');
|
||||
unset_config('themelegacy');
|
||||
unset_config('themetablet');
|
||||
|
||||
upgrade_main_savepoint(true, 2023062200.00);
|
||||
}
|
||||
|
||||
if ($oldversion < 2023062700.01) {
|
||||
// Define field name to be added to external_tokens.
|
||||
$table = new xmldb_table('external_tokens');
|
||||
$field = new xmldb_field('name', XMLDB_TYPE_CHAR, '255', null, null, null, null, 'lastaccess');
|
||||
// Conditionally launch add field name.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
// Update the old external tokens.
|
||||
$sql = 'UPDATE {external_tokens}
|
||||
SET name = ' . $DB->sql_concat(
|
||||
// We only need the prefix, so leave the third param with an empty string.
|
||||
"'" . get_string('tokennameprefix', 'webservice', '') . "'",
|
||||
"id"
|
||||
);
|
||||
$DB->execute($sql);
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2023062700.01);
|
||||
}
|
||||
|
||||
if ($oldversion < 2023062900.01) {
|
||||
// Define field avatarsynced to be added to communication.
|
||||
$table = new xmldb_table('communication');
|
||||
$field = new xmldb_field('avatarsynced', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, 0, 'active');
|
||||
|
||||
// Conditionally launch add field avatarsynced.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2023062900.01);
|
||||
}
|
||||
|
||||
if ($oldversion < 2023080100.00) {
|
||||
// Upgrade yaml mime type for existing yaml and yml files.
|
||||
$filetypes = [
|
||||
'%.yaml' => 'application/yaml',
|
||||
'%.yml' => 'application/yaml,',
|
||||
];
|
||||
|
||||
$select = $DB->sql_like('filename', '?', false);
|
||||
foreach ($filetypes as $extension => $mimetype) {
|
||||
$DB->set_field_select(
|
||||
'files',
|
||||
'mimetype',
|
||||
$mimetype,
|
||||
$select,
|
||||
[$extension]
|
||||
);
|
||||
}
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2023080100.00);
|
||||
}
|
||||
|
||||
if ($oldversion < 2023081500.00) {
|
||||
upgrade_core_licenses();
|
||||
upgrade_main_savepoint(true, 2023081500.00);
|
||||
}
|
||||
|
||||
if ($oldversion < 2023081800.01) {
|
||||
// Remove enabledevicedetection and devicedetectregex from config table.
|
||||
unset_config('enabledevicedetection');
|
||||
unset_config('devicedetectregex');
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2023081800.01);
|
||||
}
|
||||
|
||||
if ($oldversion < 2023082200.01) {
|
||||
// Some MIME icons have been removed and replaced with existing icons. They need to be upgraded for custom MIME types.
|
||||
$replacedicons = [
|
||||
'avi' => 'video',
|
||||
'base' => 'database',
|
||||
'bmp' => 'image',
|
||||
'html' => 'markup',
|
||||
'jpeg' => 'image',
|
||||
'mov' => 'video',
|
||||
'mp3' => 'audio',
|
||||
'mpeg' => 'video',
|
||||
'png' => 'image',
|
||||
'quicktime' => 'video',
|
||||
'tiff' => 'image',
|
||||
'wav' => 'audio',
|
||||
'wmv' => 'video',
|
||||
];
|
||||
|
||||
$custom = [];
|
||||
if (!empty($CFG->customfiletypes)) {
|
||||
if (array_key_exists('customfiletypes', $CFG->config_php_settings)) {
|
||||
// It's set in config.php, so the MIME icons can't be upgraded automatically.
|
||||
echo("\nYou need to manually check customfiletypes in config.php because some MIME icons have been removed!\n");
|
||||
} else {
|
||||
// It's a JSON string in the config table.
|
||||
$custom = json_decode($CFG->customfiletypes);
|
||||
}
|
||||
}
|
||||
|
||||
$changed = false;
|
||||
foreach ($custom as $customentry) {
|
||||
if (!empty($customentry->icon) && array_key_exists($customentry->icon, $replacedicons)) {
|
||||
$customentry->icon = $replacedicons[$customentry->icon];
|
||||
$changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ($changed) {
|
||||
// Save the new customfiletypes.
|
||||
set_config('customfiletypes', json_encode($custom));
|
||||
}
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2023082200.01);
|
||||
}
|
||||
|
||||
if ($oldversion < 2023082200.02) {
|
||||
// Some MIME icons have been removed. They need to be replaced to 'unknown' for custom MIME types.
|
||||
$removedicons = array_flip([
|
||||
'clip-353',
|
||||
'edit',
|
||||
'env',
|
||||
'explore',
|
||||
'folder-open',
|
||||
'help',
|
||||
'move',
|
||||
'parent',
|
||||
]);
|
||||
|
||||
$custom = [];
|
||||
if (!empty($CFG->customfiletypes)) {
|
||||
if (array_key_exists('customfiletypes', $CFG->config_php_settings)) {
|
||||
// It's set in config.php, so the MIME icons can't be upgraded automatically.
|
||||
echo("\nYou need to manually check customfiletypes in config.php because some MIME icons have been removed!\n");
|
||||
} else {
|
||||
// It's a JSON string in the config table.
|
||||
$custom = json_decode($CFG->customfiletypes);
|
||||
}
|
||||
}
|
||||
|
||||
$changed = false;
|
||||
foreach ($custom as $customentry) {
|
||||
if (!empty($customentry->icon) && array_key_exists($customentry->icon, $removedicons)) {
|
||||
// The icon has been removed, so set it to unknown.
|
||||
$customentry->icon = 'unknown';
|
||||
$changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ($changed) {
|
||||
// Save the new customfiletypes.
|
||||
set_config('customfiletypes', json_encode($custom));
|
||||
}
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2023082200.02);
|
||||
}
|
||||
|
||||
if ($oldversion < 2023082200.04) {
|
||||
// Remove any non-unique filters/conditions.
|
||||
$duplicates = $DB->get_records_sql("
|
||||
SELECT MIN(id) AS id, reportid, uniqueidentifier, iscondition
|
||||
FROM {reportbuilder_filter}
|
||||
GROUP BY reportid, uniqueidentifier, iscondition
|
||||
HAVING COUNT(*) > 1");
|
||||
|
||||
foreach ($duplicates as $duplicate) {
|
||||
$DB->delete_records_select(
|
||||
'reportbuilder_filter',
|
||||
'id <> :id AND reportid = :reportid AND uniqueidentifier = :uniqueidentifier AND iscondition = :iscondition',
|
||||
(array) $duplicate
|
||||
);
|
||||
}
|
||||
|
||||
// Define index report-filter (unique) to be added to reportbuilder_filter.
|
||||
$table = new xmldb_table('reportbuilder_filter');
|
||||
$index = new xmldb_index('report-filter', XMLDB_INDEX_UNIQUE, ['reportid', 'uniqueidentifier', 'iscondition']);
|
||||
|
||||
// Conditionally launch add index report-filter.
|
||||
if (!$dbman->index_exists($table, $index)) {
|
||||
$dbman->add_index($table, $index);
|
||||
}
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2023082200.04);
|
||||
}
|
||||
|
||||
if ($oldversion < 2023082600.02) {
|
||||
// Get all the ids of users who still have md5 hashed passwords.
|
||||
if ($DB->sql_regex_supported()) {
|
||||
// If the database supports regex, we can add an exact check for md5.
|
||||
$condition = 'password ' . $DB->sql_regex() . ' :pattern';
|
||||
$params = ['pattern' => "^[a-fA-F0-9]{32}$"];
|
||||
} else {
|
||||
// Otherwise, we need to use a NOT LIKE condition and rule out bcrypt.
|
||||
$condition = $DB->sql_like('password', ':pattern', true, false, true);
|
||||
$params = ['pattern' => '$2y$%'];
|
||||
}
|
||||
|
||||
// Regardless of database regex support we check the hash length which should be enough.
|
||||
// But extra regex or like matching makes sure.
|
||||
$sql = "SELECT id FROM {user} WHERE " . $DB->sql_length('password') . " = 32 AND $condition";
|
||||
$userids = $DB->get_fieldset_sql($sql, $params);
|
||||
|
||||
// Update the password for each user with a new SHA-512 hash.
|
||||
// Users won't know this password, but they can reset it. This is a security measure,
|
||||
// in case the database is compromised or the hash has been leaked elsewhere.
|
||||
foreach ($userids as $userid) {
|
||||
$password = base64_encode(random_bytes(24)); // Generate a new password for the user.
|
||||
|
||||
$user = new \stdClass();
|
||||
$user->id = $userid;
|
||||
$user->password = hash_internal_user_password($password);
|
||||
$DB->update_record('user', $user, true);
|
||||
}
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2023082600.02);
|
||||
}
|
||||
|
||||
if ($oldversion < 2023082600.03) {
|
||||
// The previous default configuration had a typo, check for its presence and correct if necessary.
|
||||
$sensiblesettings = get_config('adminpresets', 'sensiblesettings');
|
||||
if (strpos($sensiblesettings, 'smtppass@none') !== false) {
|
||||
$newsensiblesettings = str_replace('smtppass@none', 'smtppass@@none', $sensiblesettings);
|
||||
set_config('sensiblesettings', $newsensiblesettings, 'adminpresets');
|
||||
}
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2023082600.03);
|
||||
}
|
||||
|
||||
if ($oldversion < 2023082600.05) {
|
||||
unset_config('completiondefault');
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2023082600.05);
|
||||
}
|
||||
|
||||
if ($oldversion < 2023090100.00) {
|
||||
// Upgrade MIME type for existing PSD files.
|
||||
$DB->set_field_select(
|
||||
'files',
|
||||
'mimetype',
|
||||
'image/vnd.adobe.photoshop',
|
||||
$DB->sql_like('filename', '?', false),
|
||||
['%.psd']
|
||||
);
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2023090100.00);
|
||||
}
|
||||
|
||||
if ($oldversion < 2023090200.01) {
|
||||
// Define table moodlenet_share_progress to be created.
|
||||
$table = new xmldb_table('moodlenet_share_progress');
|
||||
|
||||
// Adding fields to table moodlenet_share_progress.
|
||||
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
|
||||
$table->add_field('type', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('courseid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('cmid', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
|
||||
$table->add_field('userid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('resourceurl', XMLDB_TYPE_CHAR, '255', null, null, null, null);
|
||||
$table->add_field('status', XMLDB_TYPE_INTEGER, '2', null, null, null, null);
|
||||
|
||||
// Adding keys to table moodlenet_share_progress.
|
||||
$table->add_key('primary', XMLDB_KEY_PRIMARY, ['id']);
|
||||
|
||||
// Conditionally launch create table for moodlenet_share_progress.
|
||||
if (!$dbman->table_exists($table)) {
|
||||
$dbman->create_table($table);
|
||||
}
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2023090200.01);
|
||||
}
|
||||
|
||||
if ($oldversion < 2023091300.03) {
|
||||
// Delete all the searchanywhere prefs in user_preferences table.
|
||||
$DB->delete_records('user_preferences', ['name' => 'userselector_searchanywhere']);
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2023091300.03);
|
||||
}
|
||||
|
||||
if ($oldversion < 2023100400.01) {
|
||||
// Delete datakey with datavalue -1.
|
||||
$DB->delete_records('messageinbound_datakeys', ['datavalue' => '-1']);
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2023100400.01);
|
||||
}
|
||||
|
||||
if ($oldversion < 2023100400.03) {
|
||||
// Define field id to be added to communication.
|
||||
$table = new xmldb_table('communication');
|
||||
|
||||
// Add the field and allow it to be nullable.
|
||||
// We need to backfill data before setting it to NOT NULL.
|
||||
$field = new xmldb_field(
|
||||
name: 'contextid',
|
||||
type: XMLDB_TYPE_INTEGER,
|
||||
precision: '10',
|
||||
notnull: null,
|
||||
previous: 'id',
|
||||
);
|
||||
|
||||
// Conditionally launch add field id.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Fill the existing data.
|
||||
$sql = <<<EOF
|
||||
SELECT comm.id, c.id AS contextid
|
||||
FROM {communication} comm
|
||||
INNER JOIN {context} c ON c.instanceid = comm.instanceid AND c.contextlevel = :contextcourse
|
||||
WHERE comm.contextid IS NULL
|
||||
AND comm.instancetype = :instancetype
|
||||
EOF;
|
||||
$rs = $DB->get_recordset_sql(
|
||||
sql: $sql,
|
||||
params: [
|
||||
'contextcourse' => CONTEXT_COURSE,
|
||||
'instancetype' => 'coursecommunication',
|
||||
],
|
||||
);
|
||||
foreach ($rs as $comm) {
|
||||
$DB->set_field(
|
||||
table: 'communication',
|
||||
newfield: 'contextid',
|
||||
newvalue: $comm->contextid,
|
||||
conditions: [
|
||||
'id' => $comm->id,
|
||||
],
|
||||
);
|
||||
}
|
||||
$rs->close();
|
||||
|
||||
$systemcontext = \core\context\system::instance();
|
||||
$DB->set_field_select(
|
||||
table: 'communication',
|
||||
newfield: 'contextid',
|
||||
newvalue: $systemcontext->id,
|
||||
select: 'contextid IS NULL',
|
||||
);
|
||||
|
||||
// Now make it NOTNULL.
|
||||
$field = new xmldb_field(
|
||||
name: 'contextid',
|
||||
type: XMLDB_TYPE_INTEGER,
|
||||
precision: '10',
|
||||
notnull: XMLDB_NOTNULL,
|
||||
);
|
||||
$dbman->change_field_notnull($table, $field);
|
||||
|
||||
// Add the contextid constraint.
|
||||
$key = new xmldb_key('contextid', XMLDB_KEY_FOREIGN, ['contextid'], 'context', ['id']);
|
||||
$dbman->add_key($table, $key);
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2023100400.03);
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2023110900.00) {
|
||||
// Reorder the editors to make Tiny the default for all upgrades.
|
||||
$editors = [];
|
||||
array_push($editors, 'tiny');
|
||||
$list = explode(',', $CFG->texteditors);
|
||||
foreach ($list as $editor) {
|
||||
if ($editor != 'tiny') {
|
||||
array_push($editors, $editor);
|
||||
}
|
||||
}
|
||||
set_config('texteditors', implode(',', $editors));
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2023110900.00);
|
||||
}
|
||||
|
||||
if ($oldversion < 2023120100.01) {
|
||||
// The $CFG->linkcoursesections setting has been removed because it's not required anymore.
|
||||
// From now, sections will be always linked because a new page, section.php, has been created to display a single section.
|
||||
unset_config('linkcoursesections');
|
||||
|
||||
upgrade_main_savepoint(true, 2023120100.01);
|
||||
}
|
||||
|
||||
if ($oldversion < 2023121800.02) {
|
||||
// Define field attemptsavailable to be added to task_adhoc.
|
||||
$table = new xmldb_table('task_adhoc');
|
||||
$field = new xmldb_field(
|
||||
name: 'attemptsavailable',
|
||||
type: XMLDB_TYPE_INTEGER,
|
||||
precision: '2',
|
||||
unsigned: null,
|
||||
notnull: null,
|
||||
sequence: null,
|
||||
default: null,
|
||||
previous: 'pid',
|
||||
);
|
||||
|
||||
// Conditionally launch add field attemptsavailable.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Set attemptsavailable to 0 for the tasks that have not been run before.
|
||||
// Set attemptsavailable to 1 for the tasks that have been run and failed before.
|
||||
$DB->execute('
|
||||
UPDATE {task_adhoc}
|
||||
SET attemptsavailable = CASE
|
||||
WHEN faildelay = 0 THEN 1
|
||||
WHEN faildelay > 0 THEN 0
|
||||
END
|
||||
');
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2023121800.02);
|
||||
}
|
||||
|
||||
if ($oldversion < 2023122100.01) {
|
||||
|
||||
// Define field component to be added to course_sections.
|
||||
$table = new xmldb_table('course_sections');
|
||||
$field = new xmldb_field('component', XMLDB_TYPE_CHAR, '100', null, null, null, null, 'availability');
|
||||
|
||||
// Conditionally launch add field component.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Define field itemid to be added to course_sections.
|
||||
$field = new xmldb_field('itemid', XMLDB_TYPE_INTEGER, '10', null, null, null, null, 'component');
|
||||
|
||||
// Conditionally launch add field itemid.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2023122100.01);
|
||||
}
|
||||
|
||||
if ($oldversion < 2023122100.02) {
|
||||
$sqllike = $DB->sql_like('filtercondition', '?');
|
||||
$params[] = '%includesubcategories%';
|
||||
|
||||
$sql = "SELECT qsr.* FROM {question_set_references} qsr WHERE $sqllike";
|
||||
$results = $DB->get_recordset_sql($sql, $params);
|
||||
foreach ($results as $result) {
|
||||
$filtercondition = json_decode($result->filtercondition);
|
||||
if (isset($filtercondition->filter->category->includesubcategories)) {
|
||||
$filtercondition->filter->category->filteroptions =
|
||||
['includesubcategories' => $filtercondition->filter->category->includesubcategories];
|
||||
unset($filtercondition->filter->category->includesubcategories);
|
||||
$result->filtercondition = json_encode($filtercondition);
|
||||
$DB->update_record('question_set_references', $result);
|
||||
}
|
||||
}
|
||||
$results->close();
|
||||
|
||||
upgrade_main_savepoint(true, 2023122100.02);
|
||||
}
|
||||
|
||||
if ($oldversion < 2024010400.01) {
|
||||
|
||||
// Define index timecreated (not unique) to be added to notifications.
|
||||
$table = new xmldb_table('notifications');
|
||||
$createdindex = new xmldb_index('timecreated', XMLDB_INDEX_NOTUNIQUE, ['timecreated']);
|
||||
|
||||
// Conditionally launch add index timecreated.
|
||||
if (!$dbman->index_exists($table, $createdindex)) {
|
||||
$dbman->add_index($table, $createdindex);
|
||||
}
|
||||
|
||||
// Define index timeread (not unique) to be added to notifications.
|
||||
$readindex = new xmldb_index('timeread', XMLDB_INDEX_NOTUNIQUE, ['timeread']);
|
||||
|
||||
// Conditionally launch add index timeread.
|
||||
if (!$dbman->index_exists($table, $readindex)) {
|
||||
$dbman->add_index($table, $readindex);
|
||||
}
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2024010400.01);
|
||||
}
|
||||
|
||||
if ($oldversion < 2024012300.00) {
|
||||
|
||||
// Define field valuetrust to be added to customfield_data.
|
||||
$table = new xmldb_table('customfield_data');
|
||||
$field = new xmldb_field('valuetrust', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, '0', 'valueformat');
|
||||
|
||||
// Conditionally launch add field valuetrust.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2024012300.00);
|
||||
}
|
||||
|
||||
if ($oldversion < 2024020200.01) {
|
||||
// If h5plib_v124 is no longer present, remove it.
|
||||
if (!file_exists($CFG->dirroot . '/h5p/h5plib/v124/version.php')) {
|
||||
// Clean config.
|
||||
uninstall_plugin('h5plib', 'v124');
|
||||
}
|
||||
|
||||
// If h5plib_v126 is present, set it as the default one.
|
||||
if (file_exists($CFG->dirroot . '/h5p/h5plib/v126/version.php')) {
|
||||
set_config('h5plibraryhandler', 'h5plib_v126');
|
||||
}
|
||||
|
||||
upgrade_main_savepoint(true, 2024020200.01);
|
||||
}
|
||||
|
||||
if ($oldversion < 2024021500.01) {
|
||||
// Change default course formats order for sites never changed the default order.
|
||||
if (!get_config('core', 'format_plugins_sortorder')) {
|
||||
set_config('format_plugins_sortorder', 'topics,weeks,singleactivity,social');
|
||||
}
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2024021500.01);
|
||||
}
|
||||
|
||||
if ($oldversion < 2024021500.02) {
|
||||
// A [name => url] map of new OIDC endpoints to be updated/created.
|
||||
$endpointuris = [
|
||||
'authorization_endpoint' => 'https://clever.com/oauth/authorize',
|
||||
'token_endpoint' => 'https://clever.com/oauth/tokens',
|
||||
'userinfo_endpoint' => 'https://api.clever.com/userinfo',
|
||||
'jwks_uri' => 'https://clever.com/oauth/certs',
|
||||
];
|
||||
|
||||
// A [internalfield => externalfield] map of new OIDC-based user field mappings to be updated/created.
|
||||
$userfieldmappings = [
|
||||
'idnumber' => 'sub',
|
||||
'firstname' => 'given_name',
|
||||
'lastname' => 'family_name',
|
||||
'email' => 'email',
|
||||
];
|
||||
|
||||
$admin = get_admin();
|
||||
$adminid = $admin ? $admin->id : '0';
|
||||
|
||||
$cleverservices = $DB->get_records('oauth2_issuer', ['servicetype' => 'clever']);
|
||||
foreach ($cleverservices as $cleverservice) {
|
||||
$time = time();
|
||||
|
||||
// Insert/update the new endpoints.
|
||||
foreach ($endpointuris as $endpointname => $endpointuri) {
|
||||
$endpoint = ['issuerid' => $cleverservice->id, 'name' => $endpointname];
|
||||
$endpointid = $DB->get_field('oauth2_endpoint', 'id', $endpoint);
|
||||
|
||||
if ($endpointid) {
|
||||
$endpoint = array_merge($endpoint, [
|
||||
'id' => $endpointid,
|
||||
'url' => $endpointuri,
|
||||
'timemodified' => $time,
|
||||
'usermodified' => $adminid,
|
||||
]);
|
||||
$DB->update_record('oauth2_endpoint', $endpoint);
|
||||
} else {
|
||||
$endpoint = array_merge($endpoint, [
|
||||
'url' => $endpointuri,
|
||||
'timecreated' => $time,
|
||||
'timemodified' => $time,
|
||||
'usermodified' => $adminid,
|
||||
]);
|
||||
$DB->insert_record('oauth2_endpoint', $endpoint);
|
||||
}
|
||||
}
|
||||
|
||||
// Insert/update new user field mappings.
|
||||
foreach ($userfieldmappings as $internalfieldname => $externalfieldname) {
|
||||
$fieldmap = ['issuerid' => $cleverservice->id, 'internalfield' => $internalfieldname];
|
||||
$fieldmapid = $DB->get_field('oauth2_user_field_mapping', 'id', $fieldmap);
|
||||
|
||||
if ($fieldmapid) {
|
||||
$fieldmap = array_merge($fieldmap, [
|
||||
'id' => $fieldmapid,
|
||||
'externalfield' => $externalfieldname,
|
||||
'timemodified' => $time,
|
||||
'usermodified' => $adminid,
|
||||
]);
|
||||
$DB->update_record('oauth2_user_field_mapping', $fieldmap);
|
||||
} else {
|
||||
$fieldmap = array_merge($fieldmap, [
|
||||
'externalfield' => $externalfieldname,
|
||||
'timecreated' => $time,
|
||||
'timemodified' => $time,
|
||||
'usermodified' => $adminid,
|
||||
]);
|
||||
$DB->insert_record('oauth2_user_field_mapping', $fieldmap);
|
||||
}
|
||||
}
|
||||
|
||||
// Update the baseurl for the issuer.
|
||||
$cleverservice->baseurl = 'https://clever.com';
|
||||
$cleverservice->timemodified = $time;
|
||||
$cleverservice->usermodified = $adminid;
|
||||
$DB->update_record('oauth2_issuer', $cleverservice);
|
||||
}
|
||||
|
||||
upgrade_main_savepoint(true, 2024021500.02);
|
||||
}
|
||||
|
||||
if ($oldversion < 2024022300.02) {
|
||||
// Removed advanced grade item settings.
|
||||
unset_config('grade_item_advanced');
|
||||
|
||||
upgrade_main_savepoint(true, 2024022300.02);
|
||||
}
|
||||
|
||||
if ($oldversion < 2024030500.01) {
|
||||
|
||||
// Define field firststartingtime to be added to task_adhoc.
|
||||
$table = new xmldb_table('task_adhoc');
|
||||
$field = new xmldb_field('firststartingtime', XMLDB_TYPE_INTEGER, '10', null, null, null, null, 'attemptsavailable');
|
||||
|
||||
// Conditionally launch add field firststartingtime.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2024030500.01);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($oldversion < 2024030500.02) {
|
||||
|
||||
// Get all "select" custom field shortnames.
|
||||
$fieldshortnames = $DB->get_fieldset('customfield_field', 'shortname', ['type' => 'select']);
|
||||
|
||||
// Ensure any used in custom reports columns are not using integer type aggregation.
|
||||
foreach ($fieldshortnames as $fieldshortname) {
|
||||
$DB->execute("
|
||||
UPDATE {reportbuilder_column}
|
||||
SET aggregation = NULL
|
||||
WHERE " . $DB->sql_like('uniqueidentifier', ':uniqueidentifier', false) . "
|
||||
AND aggregation IN ('avg', 'max', 'min', 'sum')
|
||||
", [
|
||||
'uniqueidentifier' => '%' . $DB->sql_like_escape(":customfield_{$fieldshortname}"),
|
||||
]);
|
||||
}
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2024030500.02);
|
||||
}
|
||||
|
||||
if ($oldversion < 2024032600.01) {
|
||||
|
||||
// Changing precision of field attemptsavailable on table task_adhoc to (2).
|
||||
$table = new xmldb_table('task_adhoc');
|
||||
$field = new xmldb_field('attemptsavailable', XMLDB_TYPE_INTEGER, '2', null, null, null, null, 'pid');
|
||||
|
||||
// Launch change of precision for field.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->change_field_precision($table, $field);
|
||||
}
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2024032600.01);
|
||||
}
|
||||
|
||||
if ($oldversion < 2024041200.00) {
|
||||
// Define field blocking to be dropped from task_adhoc.
|
||||
$table = new xmldb_table('task_adhoc');
|
||||
$field = new xmldb_field('blocking');
|
||||
|
||||
// Conditionally launch drop field blocking.
|
||||
if ($dbman->field_exists($table, $field)) {
|
||||
$dbman->drop_field($table, $field);
|
||||
}
|
||||
|
||||
// Define field blocking to be dropped from task_scheduled.
|
||||
$table = new xmldb_table('task_scheduled');
|
||||
$field = new xmldb_field('blocking');
|
||||
|
||||
// Conditionally launch drop field blocking.
|
||||
if ($dbman->field_exists($table, $field)) {
|
||||
$dbman->drop_field($table, $field);
|
||||
}
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2024041200.00);
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -48,8 +48,8 @@ function moodle_minimum_php_version_is_met($haltexecution = false) {
|
||||
// PLEASE NOTE THIS FUNCTION MUST BE COMPATIBLE WITH OLD UNSUPPORTED VERSIONS OF PHP.
|
||||
// Do not use modern php features or Moodle convenience functions (e.g. localised strings).
|
||||
|
||||
$minimumversion = '8.2.0';
|
||||
$moodlerequirementchanged = '5.1';
|
||||
$minimumversion = '8.3.0';
|
||||
$moodlerequirementchanged = '5.2';
|
||||
|
||||
if (version_compare(PHP_VERSION, $minimumversion) < 0) {
|
||||
if ($haltexecution) {
|
||||
|
||||
@@ -41,8 +41,8 @@ final class memcached_test extends \advanced_testcase {
|
||||
/** @var memcached|null $memcachedession An instance of the memcached session or null if not initialized. */
|
||||
private ?memcached $memcachedession = null;
|
||||
|
||||
/** @var \Memcached $memcached An instance of the Memcached class used for handling session storage. */
|
||||
private \Memcached $memcached;
|
||||
/** @var ?\Memcached $memcached An instance of the Memcached class used for handling session storage. */
|
||||
private ?\Memcached $memcached = null;
|
||||
|
||||
/** @var mock_handler $mockhandler Dedicated testing handler. */
|
||||
private mock_handler $mockhandler;
|
||||
@@ -87,7 +87,10 @@ final class memcached_test extends \advanced_testcase {
|
||||
|
||||
#[\Override]
|
||||
public function tearDown(): void {
|
||||
$this->memcached->quit();
|
||||
if ($this->memcached !== null) {
|
||||
$this->memcached->quit();
|
||||
$this->memcached = null;
|
||||
}
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
|
||||
@@ -49,12 +49,6 @@
|
||||
* @return bool always true
|
||||
*/
|
||||
function xmldb_media_videojs_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -28,12 +28,6 @@
|
||||
* @param int $oldversion The version that we are upgrading from
|
||||
*/
|
||||
function xmldb_message_email_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -28,12 +28,6 @@
|
||||
* @param int $oldversion The version that we are upgrading from
|
||||
*/
|
||||
function xmldb_message_popup_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -30,36 +30,8 @@
|
||||
function xmldb_assign_upgrade($oldversion) {
|
||||
global $DB;
|
||||
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
$dbman = $DB->get_manager(); // Loads ddl manager and xmldb classes.
|
||||
|
||||
if ($oldversion < 2023103000) {
|
||||
// Define field activity to be added to assign.
|
||||
$table = new xmldb_table('assign');
|
||||
$field = new xmldb_field(
|
||||
'markinganonymous',
|
||||
XMLDB_TYPE_INTEGER,
|
||||
'2',
|
||||
null,
|
||||
XMLDB_NOTNULL,
|
||||
null,
|
||||
'0',
|
||||
'markingallocation'
|
||||
);
|
||||
// Conditionally launch add field activity.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Assign savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2023103000, 'assign');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -28,12 +28,6 @@
|
||||
* @return bool
|
||||
*/
|
||||
function xmldb_assignfeedback_comments_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -28,13 +28,6 @@
|
||||
* @return bool
|
||||
*/
|
||||
function xmldb_assignfeedback_editpdf_upgrade($oldversion) {
|
||||
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -28,12 +28,6 @@
|
||||
* @return bool
|
||||
*/
|
||||
function xmldb_assignfeedback_file_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -28,12 +28,6 @@
|
||||
* @return bool
|
||||
*/
|
||||
function xmldb_assignsubmission_comments_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -28,12 +28,6 @@
|
||||
* @return bool
|
||||
*/
|
||||
function xmldb_assignsubmission_file_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -28,12 +28,6 @@
|
||||
* @return bool
|
||||
*/
|
||||
function xmldb_assignsubmission_onlinetext_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -38,12 +38,6 @@ function xmldb_bigbluebuttonbn_upgrade($oldversion = 0) {
|
||||
global $DB;
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -31,12 +31,6 @@ function xmldb_book_upgrade($oldversion) {
|
||||
global $DB;
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -43,12 +43,6 @@ function xmldb_choice_upgrade($oldversion) {
|
||||
global $DB;
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -43,28 +43,6 @@ function xmldb_data_upgrade($oldversion) {
|
||||
global $DB;
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2023061300) {
|
||||
// Clean orphan data_records.
|
||||
$sql = "SELECT d.id FROM {data} d
|
||||
LEFT JOIN {data_fields} f ON d.id = f.dataid
|
||||
WHERE f.id IS NULL";
|
||||
$emptydatas = $DB->get_records_sql($sql);
|
||||
if (!empty($emptydatas)) {
|
||||
$dataids = array_keys($emptydatas);
|
||||
[$datainsql, $dataparams] = $DB->get_in_or_equal($dataids, SQL_PARAMS_NAMED, 'data');
|
||||
$DB->delete_records_select('data_records', "dataid $datainsql", $dataparams);
|
||||
}
|
||||
|
||||
// Data savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2023061300, 'data');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -43,12 +43,6 @@ function xmldb_feedback_upgrade($oldversion) {
|
||||
global $DB;
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -46,12 +46,6 @@ function xmldb_folder_upgrade($oldversion) {
|
||||
global $DB;
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -44,12 +44,6 @@ function xmldb_forum_upgrade($oldversion) {
|
||||
global $DB;
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -43,12 +43,6 @@ function xmldb_glossary_upgrade($oldversion) {
|
||||
global $DB;
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -48,26 +48,6 @@ function xmldb_h5pactivity_upgrade($oldversion) {
|
||||
global $DB;
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2023042401) {
|
||||
// Remove any orphaned attempt/result records (pointing to non-existing activities).
|
||||
$DB->delete_records_select('h5pactivity_attempts', 'NOT EXISTS (
|
||||
SELECT 1 FROM {h5pactivity} h5p WHERE h5p.id = {h5pactivity_attempts}.h5pactivityid
|
||||
)');
|
||||
|
||||
$DB->delete_records_select('h5pactivity_attempts_results', 'NOT EXISTS (
|
||||
SELECT 1 FROM {h5pactivity_attempts} attempt WHERE attempt.id = {h5pactivity_attempts_results}.attemptid
|
||||
)');
|
||||
|
||||
// H5pactivity savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2023042401, 'h5pactivity');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -30,12 +30,6 @@ function xmldb_imscp_upgrade($oldversion) {
|
||||
global $DB;
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -46,12 +46,6 @@ function xmldb_label_upgrade($oldversion) {
|
||||
global $DB;
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -51,12 +51,6 @@ function xmldb_lesson_upgrade($oldversion) {
|
||||
global $DB;
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -61,61 +61,6 @@ function xmldb_lti_upgrade($oldversion) {
|
||||
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2023070501) {
|
||||
// Define table lti_types_categories to be created.
|
||||
$table = new xmldb_table('lti_types_categories');
|
||||
|
||||
// Adding fields to table lti_types_categories.
|
||||
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
|
||||
$table->add_field('typeid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('categoryid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
|
||||
// Adding keys to table lti_types_categories.
|
||||
$table->add_key('primary', XMLDB_KEY_PRIMARY, ['id']);
|
||||
$table->add_key('typeid', XMLDB_KEY_FOREIGN, ['typeid'], 'lti_types', ['id']);
|
||||
$table->add_key('categoryid', XMLDB_KEY_FOREIGN, ['categoryid'], 'course_categories', ['id']);
|
||||
|
||||
// Conditionally launch create table for lti_types_categories.
|
||||
if (!$dbman->table_exists($table)) {
|
||||
$dbman->create_table($table);
|
||||
}
|
||||
// Lti savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2023070501, 'lti');
|
||||
}
|
||||
|
||||
if ($oldversion < 2023081101) {
|
||||
// Define table to override coursevisible for a tool on course level.
|
||||
$table = new xmldb_table('lti_coursevisible');
|
||||
|
||||
// Adding fields to table lti_coursevisible.
|
||||
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE);
|
||||
$table->add_field('typeid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null, 'id');
|
||||
$table->add_field('courseid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null, 'typeid');
|
||||
$table->add_field('coursevisible', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, null, 'courseid');
|
||||
|
||||
// Add key.
|
||||
$table->add_key('primary', XMLDB_KEY_PRIMARY, ['id']);
|
||||
|
||||
// Define index courseid (not unique) to be added to lti_coursevisible.
|
||||
$table->add_index('courseid', XMLDB_INDEX_NOTUNIQUE, ['courseid']);
|
||||
// Define index typeid (not unique) to be added to lti_coursevisible.
|
||||
$table->add_index('typeid', XMLDB_INDEX_NOTUNIQUE, ['typeid']);
|
||||
|
||||
// Conditionally launch create table for overriding coursevisible.
|
||||
if (!$dbman->table_exists($table)) {
|
||||
$dbman->create_table($table);
|
||||
}
|
||||
|
||||
// Lti savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2023081101, 'lti');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -53,11 +53,6 @@
|
||||
* @return boolean
|
||||
*/
|
||||
function xmldb_ltiservice_gradebookservices_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
@@ -46,12 +46,6 @@ function xmldb_page_upgrade($oldversion) {
|
||||
global $DB;
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -37,12 +37,6 @@ function xmldb_quizaccess_seb_upgrade($oldversion) {
|
||||
global $DB;
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -30,91 +30,6 @@ function xmldb_quiz_upgrade($oldversion) {
|
||||
global $CFG, $DB;
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2023042401) {
|
||||
// Define field reviewmaxmarks to be added to quiz.
|
||||
$table = new xmldb_table('quiz');
|
||||
$field = new xmldb_field('reviewmaxmarks', XMLDB_TYPE_INTEGER, '6', null, XMLDB_NOTNULL, null, '0', 'reviewcorrectness');
|
||||
|
||||
// Conditionally launch add field reviewmaxmarks.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Quiz savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2023042401, 'quiz');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2023112300) {
|
||||
|
||||
// Set the value for all existing rows to match the previous behaviour,
|
||||
// but only where users have not already set another value.
|
||||
$DB->set_field('quiz', 'reviewmaxmarks', 0x11110, ['reviewmaxmarks' => 0]);
|
||||
|
||||
// Quiz savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2023112300, 'quiz');
|
||||
}
|
||||
|
||||
if ($oldversion < 2023112400) {
|
||||
|
||||
// Define table quiz_grade_items to be created.
|
||||
$table = new xmldb_table('quiz_grade_items');
|
||||
|
||||
// Adding fields to table quiz_grade_items.
|
||||
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
|
||||
$table->add_field('quizid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('sortorder', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('name', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null);
|
||||
|
||||
// Adding keys to table quiz_grade_items.
|
||||
$table->add_key('primary', XMLDB_KEY_PRIMARY, ['id']);
|
||||
$table->add_key('quizid', XMLDB_KEY_FOREIGN, ['quizid'], 'quiz', ['id']);
|
||||
|
||||
// Adding indexes to table quiz_grade_items.
|
||||
$table->add_index('quizid-sortorder', XMLDB_INDEX_UNIQUE, ['quizid', 'sortorder']);
|
||||
|
||||
// Conditionally launch create table for quiz_grade_items.
|
||||
if (!$dbman->table_exists($table)) {
|
||||
$dbman->create_table($table);
|
||||
}
|
||||
|
||||
// Quiz savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2023112400, 'quiz');
|
||||
}
|
||||
|
||||
if ($oldversion < 2023112401) {
|
||||
|
||||
// Define field quizgradeitemid to be added to quiz_slots.
|
||||
$table = new xmldb_table('quiz_slots');
|
||||
$field = new xmldb_field('quizgradeitemid', XMLDB_TYPE_INTEGER, '10', null, null, null, null, 'maxmark');
|
||||
|
||||
// Conditionally launch add field quizgradeitemid.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Quiz savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2023112401, 'quiz');
|
||||
}
|
||||
|
||||
if ($oldversion < 2023112402) {
|
||||
|
||||
// Define key quizgradeitemid (foreign) to be added to quiz_slots.
|
||||
$table = new xmldb_table('quiz_slots');
|
||||
$key = new xmldb_key('quizgradeitemid', XMLDB_KEY_FOREIGN, ['quizgradeitemid'], 'quiz_grade_items', ['id']);
|
||||
|
||||
// Launch add key quizgradeitemid.
|
||||
$dbman->add_key($table, $key);
|
||||
|
||||
// Quiz savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2023112402, 'quiz');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -27,12 +27,6 @@
|
||||
* @param number $oldversion
|
||||
*/
|
||||
function xmldb_quiz_overview_upgrade($oldversion) {
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -28,11 +28,6 @@
|
||||
function xmldb_quiz_statistics_upgrade($oldversion) {
|
||||
global $CFG, $DB;
|
||||
$dbman = $DB->get_manager();
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
@@ -46,12 +46,6 @@ function xmldb_resource_upgrade($oldversion) {
|
||||
global $DB;
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -32,161 +32,6 @@ function xmldb_scorm_upgrade($oldversion) {
|
||||
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
// Automatically generated Moodle v4.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// New table structure for scorm_scoes_track.
|
||||
if ($oldversion < 2023042401) {
|
||||
// Define table scorm_attempt to be created.
|
||||
$table = new xmldb_table('scorm_attempt');
|
||||
|
||||
// Adding fields to table scorm_attempt.
|
||||
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
|
||||
$table->add_field('userid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('scormid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('attempt', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '1');
|
||||
|
||||
// Adding keys to table scorm_attempt.
|
||||
$table->add_key('primary', XMLDB_KEY_PRIMARY, ['id']);
|
||||
$table->add_key('user', XMLDB_KEY_FOREIGN, ['userid'], 'user', ['id']);
|
||||
$table->add_key('scorm', XMLDB_KEY_FOREIGN, ['scormid'], 'scorm', ['id']);
|
||||
|
||||
// Conditionally launch create table for scorm_attempt.
|
||||
if (!$dbman->table_exists($table)) {
|
||||
$dbman->create_table($table);
|
||||
}
|
||||
|
||||
// Define table scorm_element to be created.
|
||||
$table = new xmldb_table('scorm_element');
|
||||
|
||||
// Adding fields to table scorm_element.
|
||||
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
|
||||
$table->add_field('element', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null);
|
||||
|
||||
// Adding keys to table scorm_element.
|
||||
$table->add_key('primary', XMLDB_KEY_PRIMARY, ['id']);
|
||||
|
||||
// Adding indexes to table scorm_element.
|
||||
$table->add_index('element', XMLDB_INDEX_UNIQUE, ['element']);
|
||||
|
||||
// Conditionally launch create table for scorm_element.
|
||||
if (!$dbman->table_exists($table)) {
|
||||
$dbman->create_table($table);
|
||||
}
|
||||
|
||||
// Define table scorm_scoes_value to be created.
|
||||
$table = new xmldb_table('scorm_scoes_value');
|
||||
|
||||
// Adding fields to table scorm_scoes_value.
|
||||
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
|
||||
$table->add_field('scoid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('attemptid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('elementid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('value', XMLDB_TYPE_TEXT, null, null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0');
|
||||
|
||||
// Adding keys to table scorm_scoes_value.
|
||||
$table->add_key('primary', XMLDB_KEY_PRIMARY, ['id']);
|
||||
$table->add_key('scoe', XMLDB_KEY_FOREIGN, ['scoid'], 'scorm_scoes', ['id']);
|
||||
$table->add_key('attempt', XMLDB_KEY_FOREIGN, ['attemptid'], 'scorm_attempt', ['id']);
|
||||
$table->add_key('element', XMLDB_KEY_FOREIGN, ['elementid'], 'scorm_element', ['id']);
|
||||
|
||||
// Conditionally launch create table for scorm_scoes_value.
|
||||
if (!$dbman->table_exists($table)) {
|
||||
$dbman->create_table($table);
|
||||
}
|
||||
|
||||
upgrade_mod_savepoint(true, 2023042401, 'scorm');
|
||||
}
|
||||
|
||||
if ($oldversion < 2023042402) {
|
||||
$trans = $DB->start_delegated_transaction();
|
||||
|
||||
// First grab all elements and store those.
|
||||
$sql = "INSERT INTO {scorm_element} (element)
|
||||
SELECT DISTINCT element FROM {scorm_scoes_track}";
|
||||
$DB->execute($sql);
|
||||
|
||||
// Now store all data in the scorm_attempt table.
|
||||
$sql = "INSERT INTO {scorm_attempt} (userid, scormid, attempt)
|
||||
SELECT DISTINCT userid, scormid, attempt FROM {scorm_scoes_track}";
|
||||
$DB->execute($sql);
|
||||
|
||||
$trans->allow_commit();
|
||||
// Scorm savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2023042402, 'scorm');
|
||||
}
|
||||
if ($oldversion < 2023042403) {
|
||||
// Now store all translated data in the scorm_scoes_value table.
|
||||
$total = $DB->count_records('scorm_scoes_track');
|
||||
if ($total > 500000) {
|
||||
// This site has a large number of user track records, lets warn that this next part may take some time.
|
||||
$notification = new \core\output\notification(
|
||||
get_string('largetrackupgrade', 'scorm', format_float($total, 0)),
|
||||
\core\output\notification::NOTIFY_WARNING
|
||||
);
|
||||
$notification->set_show_closebutton(false);
|
||||
echo $OUTPUT->render($notification);
|
||||
}
|
||||
|
||||
// We don't need a progress bar - just run the fastest option possible.
|
||||
$sql = "INSERT INTO {scorm_scoes_value} (attemptid, scoid, elementid, value, timemodified)
|
||||
SELECT a.id as attemptid, t.scoid as scoid, e.id as elementid, t.value as value, t.timemodified
|
||||
FROM {scorm_scoes_track} t
|
||||
JOIN {scorm_element} e ON e.element = t.element
|
||||
JOIN {scorm_attempt} a ON (t.userid = a.userid AND t.scormid = a.scormid AND a.attempt = t.attempt)";
|
||||
$DB->execute($sql);
|
||||
|
||||
// Drop old table scorm_scoes_track.
|
||||
$table = new xmldb_table('scorm_scoes_track');
|
||||
|
||||
// Conditionally launch drop table for scorm_scoes_track.
|
||||
if ($dbman->table_exists($table)) {
|
||||
$dbman->drop_table($table);
|
||||
}
|
||||
|
||||
// Scorm savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2023042403, 'scorm');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v4.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2023100901) {
|
||||
// MDL-79967 - fix up any possible activity completion states since the upgrade to 2023042403.
|
||||
// Get timestamp of when this site updated to version 2023042403.
|
||||
$upgraded = $DB->get_field_sql("SELECT min(timemodified)
|
||||
FROM {upgrade_log}
|
||||
WHERE plugin = 'mod_scorm' AND version = '2023042403'");
|
||||
if (empty($upgraded)) {
|
||||
// The code causing this regression landed upstream 28 Jul 2023, if a site has done a fresh install since then,
|
||||
// the upgrade step won't exist - set it to 20th July so we don't end up dealing with too many attempts.
|
||||
$upgraded = 1689811200; // 20 July 2023 12AM.
|
||||
}
|
||||
// Don't bother triggering this next step if the upgrade completed within the last hour.
|
||||
if (time() - HOURSECS > $upgraded) {
|
||||
// Get all attempts that have occurred since the upgrade.
|
||||
$sql = "SELECT DISTINCT s.id, sa.userid
|
||||
FROM {scorm} s
|
||||
JOIN {scorm_attempt} sa ON sa.scormid = s.id
|
||||
JOIN {scorm_scoes_value} sv on sv.attemptid = sa.id
|
||||
WHERE sv.timemodified > ?";
|
||||
$scorms = $DB->get_recordset_sql($sql, [$upgraded]);
|
||||
foreach ($scorms as $scorm) {
|
||||
// Run an ad-hoc task to update the grades.
|
||||
$task = new \mod_scorm\task\update_grades();
|
||||
$task->set_custom_data([
|
||||
'scormid' => $scorm->id,
|
||||
'userid' => $scorm->userid,
|
||||
]);
|
||||
\core\task\manager::queue_adhoc_task($task, true);
|
||||
}
|
||||
$scorms->close();
|
||||
}
|
||||
|
||||
// Scorm savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2023100901, 'scorm');
|
||||
}
|
||||
// Automatically generated Moodle v4.4.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user