From 84462c3e715104ff57bd2e000e53993a7da58dcf Mon Sep 17 00:00:00 2001 From: Jun Pataleta Date: Thu, 20 Apr 2023 23:30:45 +0800 Subject: [PATCH] MDL-77927 core: mod_assignment subplugins environment check --- admin/environment.xml | 3 --- lang/en/admin.php | 4 ++-- lib/upgradelib.php | 9 ++++++++- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/admin/environment.xml b/admin/environment.xml index fe56aa2e253..e2c68ad7808 100644 --- a/admin/environment.xml +++ b/admin/environment.xml @@ -4110,9 +4110,6 @@ - - - diff --git a/lang/en/admin.php b/lang/en/admin.php index bc9ede9e8e2..74736a25da9 100644 --- a/lang/en/admin.php +++ b/lang/en/admin.php @@ -1460,8 +1460,8 @@ $string['xmlrpcmnetenabled'] = 'It has been detected that the Moodle Networking $string['xmlrpcwebserviceenabled'] = 'It has been detected that the XML-RPC Web Service protocol is enabled on your site. This feature relies on the PHP XML-RPC extension which is no longer maintained by PHP.'; $string['yuicomboloading'] = 'YUI combo loading'; $string['ziprequired'] = 'The Zip PHP extension is now required by Moodle, info-ZIP binaries or PclZip library are not used anymore.'; -$string['modassignmentinuse'] = 'It has been detected that your site is still using the Assignment 2.2 plugin. You may resolve this before upgrading by 1) Backing up your Assignment 2.2 activities and restoring them as new Assignment activities; or 2) Deleting the data from the assignment tables in the database.'; - +$string['modassignmentinuse'] = 'Your site is still using the Assignment 2.2 plugin. Before upgrading you must 1) backup any Assignment 2.2 activities that you want to keep and restore them as Assignment activities, and 2) delete all Assignment 2.2 data from the database.'; +$string['modassignmentsubpluginsexist'] = 'Assignment 2.2. subplugins may be present. The mod/assignment folder and all of its subplugins need to be removed before upgrading.'; $string['caching'] = 'Caching'; $string['cachesettings'] = 'Cache settings'; diff --git a/lib/upgradelib.php b/lib/upgradelib.php index e5ccf3ba17e..b68a895b8e8 100644 --- a/lib/upgradelib.php +++ b/lib/upgradelib.php @@ -2774,7 +2774,7 @@ function check_xmlrpc_usage(environment_results $result): ?environment_results { * @return environment_results|null */ function check_mod_assignment(environment_results $result): ?environment_results { - global $DB; + global $DB, $CFG; // Check the number of records. if ($DB->get_manager()->table_exists('assignment') && $DB->count_records('assignment') > 0) { @@ -2783,5 +2783,12 @@ function check_mod_assignment(environment_results $result): ?environment_results return $result; } + // Check for mod_assignment subplugins. + if (is_dir($CFG->dirroot . '/mod/assignment/type')) { + $result->setInfo('Assignment 2.2 subplugins present'); + $result->setFeedbackStr('modassignmentsubpluginsexist'); + return $result; + } + return null; }