Add new columns for table. Upgrade version to v3.6.2

This commit is contained in:
Jane Adelmann 2021-07-28 19:02:50 +03:00
parent 600676c990
commit 8a8f3a2763
No known key found for this signature in database
GPG Key ID: 4CCF39DF30B8AF72
2 changed files with 61 additions and 2 deletions

59
db/upgrade.php Normal file
View File

@ -0,0 +1,59 @@
<?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/>.
/**
* @package plagiarism_pchkorg
* @category plagiarism
* @copyright PlagiarismCheck.org, https://plagiarismcheck.org/
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
function xmldb_plagiarism_pchkorg_upgrade($oldversion) {
global $DB;
$dbman = $DB->get_manager();
if ($oldversion < 2021072801) {
$table = new xmldb_table('plagiarism_pchkorg_files');
$field1 = new xmldb_field('signature', XMLDB_TYPE_CHAR, '40', null, null, null, null, null);
$field1->setComment('Signature');
$field2 = new xmldb_field('attempt', XMLDB_TYPE_INTEGER, '5', null, null, null, 0, null);
$field2->setComment('Sending attempts');
$field3 = new xmldb_field('itemid', XMLDB_TYPE_INTEGER, '10', null, null, null, null, null);
$field3->setComment('ID of file');
if (!$dbman->field_exists($table, $field1)) {
$dbman->add_field($table, $field1);
}
if (!$dbman->field_exists($table, $field2)) {
$dbman->add_field($table, $field2);
}
if (!$dbman->field_exists($table, $field3)) {
$dbman->add_field($table, $field3);
}
upgrade_plugin_savepoint(true, 2021072801, 'plagiarism', 'pchkorg');
}
}

View File

@ -26,9 +26,9 @@ defined('MOODLE_INTERNAL') || die();
if (!isset($plugin)) {
$plugin = new stdClass();
}
$plugin->version = 2019052701;
$plugin->version = 2021072801;
$plugin->requires = 2017051500; // Requires Moodle 3.3 .
$plugin->release = 'v3.6.1';
$plugin->release = 'v3.6.2';
$plugin->maturity = MATURITY_STABLE;
$plugin->component = 'plagiarism_pchkorg';
$plugin->dependencies = array(