Skip to content

Commit

Permalink
MDL-77927 core: mod_assignment subplugins environment check
Browse files Browse the repository at this point in the history
  • Loading branch information
junpataleta authored and stevandoMoodle committed Apr 21, 2023
1 parent 8eaed7a commit 5f8d85f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
3 changes: 0 additions & 3 deletions admin/environment.xml
Expand Up @@ -4110,9 +4110,6 @@
<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">
<FEEDBACK>
<ON_ERROR message="modassignmentinuse" />
</FEEDBACK>
</CUSTOM_CHECK>
</CUSTOM_CHECKS>
</MOODLE>
Expand Down
4 changes: 2 additions & 2 deletions lang/en/admin.php
Expand Up @@ -1513,8 +1513,8 @@
$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';
Expand Down
9 changes: 8 additions & 1 deletion lib/upgradelib.php
Expand Up @@ -2786,7 +2786,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) {
Expand All @@ -2795,5 +2795,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;
}

0 comments on commit 5f8d85f

Please sign in to comment.