Skip to content

Commit

Permalink
fix default copyleaks plugin settings (off) + bump verison
Browse files Browse the repository at this point in the history
  • Loading branch information
CL-BayanAbuawad committed Jul 21, 2022
1 parent 07df901 commit 0c5705e
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### Date: 2022-July-21
### Release: v2022072100
- Fix default copyleaks plugin settings (off)

### Date: 2022-June-12
### Release: v2022062600
- Add Translations for "es", "fr", "pt", "hi", "zh", "it", "ja", "de", "tr", "ru", "ar",
Expand Down
2 changes: 1 addition & 1 deletion classes/plagiarism_copyleaks_moduleconfig.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public static function set_module_config(
$enablesafesearch,
$enablecheatdetection,
$cmid = PLAGIARISM_COPYLEAKS_DEFAULT_MODULE_CMID,
$enabled = true,
$enabled = false,
$draftssubmit = 0,
$reportgen = 0,
$allowstudentaccess = 0
Expand Down
32 changes: 32 additions & 0 deletions db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,37 @@ function xmldb_plagiarism_copyleaks_upgrade($oldversion) {
upgrade_plugin_savepoint(true, 2021090901, 'plagiarism', 'copyleaks');
}

if ($oldversion < 2022072100) {
// Get saved db settings.
$saveddefaultvalue = $DB->get_records_menu('plagiarism_copyleaks_config', array('cm' => PLAGIARISM_COPYLEAKS_DEFAULT_MODULE_CMID), '', 'name,value');

// Update saved default copyleaks settings.
$fieldname = 'plagiarism_copyleaks_enable';
$savedfield = new stdClass();
$savedfield->cm = PLAGIARISM_COPYLEAKS_DEFAULT_MODULE_CMID;
$savedfield->name = $fieldname;
$savedfield->value = 0;
if (!isset($saveddefaultvalue[$fieldname])) {
$savedfield->config_hash = $savedfield->cm . "_" . $savedfield->name;
if (!$DB->insert_record('plagiarism_copyleaks_config', $savedfield)) {
throw new moodle_exception(get_string('clinserterror', 'plagiarism_copyleaks'));
}
} else {
$savedfield->id = $DB->get_field(
'plagiarism_copyleaks_config',
'id',
(array(
'cm' => PLAGIARISM_COPYLEAKS_DEFAULT_MODULE_CMID,
'name' => $fieldname
))
);
if (!$DB->update_record('plagiarism_copyleaks_config', $savedfield)) {
throw new moodle_exception(get_string('clupdateerror', 'plagiarism_copyleaks'));
}
}

upgrade_plugin_savepoint(true, 2022072100, 'plagiarism', 'copyleaks');
}

return true;
}
2 changes: 1 addition & 1 deletion version.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

defined('MOODLE_INTERNAL') || die();

$plugin->version = 2022061201;
$plugin->version = 2022072100;
$plugin->release = "3.5+";
$plugin->requires = 2018051700;
$plugin->component = 'plagiarism_copyleaks';
Expand Down

0 comments on commit 0c5705e

Please sign in to comment.