Merge branch 'MDL-87708-500' of https://github.com/HuongNV13/moodle into MOODLE_500_STABLE
This commit is contained in:
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace tool_moodlenet\task;
|
||||
|
||||
/**
|
||||
* Ad-hoc task to perform post install tasks.
|
||||
* We use this to set the active activity chooser footer plugin to tool_moodlenet.
|
||||
* We couldn't do this directly in install.php, because there is an admin_apply_default_settings() call after all plugins are
|
||||
* installed and that would reset whatever value we had set earlier to 'hidden'.
|
||||
*
|
||||
* @package tool_moodlenet
|
||||
* @copyright 2022 Shamim Rezaie <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class post_install extends \core\task\adhoc_task {
|
||||
public function execute() {
|
||||
set_config('activitychooseractivefooter', 'tool_moodlenet');
|
||||
}
|
||||
}
|
||||
@@ -28,12 +28,5 @@ declare(strict_types=1);
|
||||
* Perform the post-install procedures.
|
||||
*/
|
||||
function xmldb_tool_moodlenet_install() {
|
||||
// Use an ad-hoc task to set the active activity chooser footer plugin to tool_moodlenet.
|
||||
// We couldn't do this in admin/settings/courses.php for 2 reasons:
|
||||
// - First, because it would be a breach of component communications principles to do so there.
|
||||
// - Second, because we can't call get_plugins_with_function() during install and upgrade (or it will return []).
|
||||
// We couldn't do this directly here either, because there is an admin_apply_default_settings() call after all plugins are
|
||||
// installed and that would reset whatever value we set here to 'hidden'.
|
||||
$postinstall = new tool_moodlenet\task\post_install();
|
||||
core\task\manager::queue_adhoc_task($postinstall);
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -966,7 +966,7 @@ $string['maxtimelimit'] = 'Maximum time limit';
|
||||
$string['maxtimelimit_desc'] = 'To restrict the maximum PHP execution time that Moodle will allow without any output being displayed, enter a value in seconds here. 0 means that Moodle default restrictions are used. If you have a front-end server with its own time limit, set this value lower to receive PHP errors in logs. Does not apply to CLI scripts.';
|
||||
$string['moodlebrandedapp'] = 'Branded Moodle app';
|
||||
$string['moodlebrandedappreference'] = 'Alternatively, get a <a href="https://moodle.com/branded-app/">Branded Moodle app</a> with your own custom branding.';
|
||||
$string['moodlenetremovalwarning'] = 'The MoodleNet service will be shut down on 20 April 2026. If you wish to continue using MoodleNet on your site, install the MoodleNet plugin from the <a href="https://moodle.org/plugins" target="_blank">Moodle plugins directory <i class="fa fa-external-link" role="img" aria-label="Opens in new window" title="Opens in new window"></i></a> and connect it to a self-hosted MoodleNet instance. Following this, the MoodleNet profile ID field will be removed; please migrate that data if you are using it for other purposes.';
|
||||
$string['moodlenetremovalwarning'] = 'The MoodleNet service will be shut down on 20 April 2026. If you wish to continue using MoodleNet on your site, install the MoodleNet plugin from the <a href="https://github.com/moodlehq/moodle-tool_moodlenet" target="_blank">Moodle HQ GitHub repository <i class="fa fa-external-link" role="img" aria-label="Opens in new window" title="Opens in new window"></i></a> and connect it to a self-hosted MoodleNet instance. Following this, the MoodleNet profile ID field will be removed; please migrate that data if you are using it for other purposes.';
|
||||
$string['noreplyaddress'] = 'No-reply address';
|
||||
$string['noreplydomain'] = 'No-reply and domain';
|
||||
$string['noreplydomaindetail'] = 'Settings for No-reply and configured domains';
|
||||
|
||||
@@ -2017,5 +2017,53 @@ function xmldb_main_upgrade($oldversion) {
|
||||
upgrade_main_savepoint(true, 2025041406.05);
|
||||
}
|
||||
|
||||
if ($oldversion < 2025041406.07) {
|
||||
// Clean up tool_moodlenet configurations unless pointing to a custom installation.
|
||||
$moodleneturl = get_config('tool_moodlenet', 'defaultmoodlenet');
|
||||
|
||||
$shouldcleanup = true;
|
||||
|
||||
// Check if pointing to a custom MoodleNet installation.
|
||||
if (!empty($moodleneturl)) {
|
||||
$parsed = parse_url(strtolower(trim($moodleneturl)));
|
||||
$host = $parsed['host'] ?? '';
|
||||
|
||||
// Don't cleanup if it's a custom installation (not moodle.net).
|
||||
if ($host !== 'moodle.net' && $host !== 'www.moodle.net') {
|
||||
$shouldcleanup = false;
|
||||
}
|
||||
}
|
||||
|
||||
if ($shouldcleanup) {
|
||||
// Reset configs to defaults.
|
||||
set_config('defaultmoodlenet', '', 'tool_moodlenet');
|
||||
set_config('enablemoodlenet', 0, 'tool_moodlenet');
|
||||
|
||||
// Hide activity chooser footer if set to MoodleNet.
|
||||
$footer = get_config('core', 'activitychooseractivefooter');
|
||||
if ($footer === 'tool_moodlenet') {
|
||||
set_config('activitychooseractivefooter', 'hidden');
|
||||
}
|
||||
|
||||
// Remove the enablesharingtomoodlenet config setting.
|
||||
unset_config('enablesharingtomoodlenet');
|
||||
|
||||
// Remove MoodleNet outbound OAuth2 configuration.
|
||||
unset_config('oauthservice', 'moodlenet');
|
||||
$issuerids = $DB->get_fieldset_select('oauth2_issuer', 'id', "servicetype = ?", ['moodlenet']);
|
||||
if (!empty($issuerids)) {
|
||||
$DB->delete_records_list('oauth2_endpoint', 'issuerid', $issuerids);
|
||||
$DB->delete_records_list('oauth2_access_token', 'issuerid', $issuerids);
|
||||
$DB->delete_records_list('oauth2_refresh_token', 'issuerid', $issuerids);
|
||||
$DB->delete_records_list('oauth2_system_account', 'issuerid', $issuerids);
|
||||
$DB->delete_records_list('oauth2_user_field_mapping', 'issuerid', $issuerids);
|
||||
$DB->delete_records_list('oauth2_issuer', 'id', $issuerids);
|
||||
}
|
||||
}
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2025041406.07);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$version = 2025041406.06; // 20250414 = branching date YYYYMMDD - do not modify!
|
||||
$version = 2025041406.07; // 20250414 = branching date YYYYMMDD - do not modify!
|
||||
// RR = release increments - 00 in DEV branches.
|
||||
// .XX = incremental changes.
|
||||
$release = '5.0.6+ (Build: 20260306)'; // Human-friendly version name
|
||||
|
||||
Reference in New Issue
Block a user