Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
<?php
2
// This file is part of Moodle - http://moodle.org/
3
//
4
// Moodle is free software: you can redistribute it and/or modify
5
// it under the terms of the GNU General Public License as published by
6
// the Free Software Foundation, either version 3 of the License, or
7
// (at your option) any later version.
8
//
9
// Moodle is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
// GNU General Public License for more details.
13
//
14
// You should have received a copy of the GNU General Public License
15
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
16
 
17
/**
18
 * Custommailing module upgrade code.
19
 *
20
 * @package    mod_custommailing
21
 * @author     jeanfrancois@cblue.be
22
 * @copyright  2021 CBlue SPRL
23
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
24
 */
25
 
26
defined('MOODLE_INTERNAL') || die;
27
 
28
/**
29
 * @param int $oldversion the version we are upgrading from
30
 * @return bool
31
 * @throws ddl_exception
32
 * @throws ddl_field_missing_exception
33
 * @throws ddl_table_missing_exception
34
 * @throws dml_exception
35
 * @throws downgrade_exception
36
 * @throws upgrade_exception
37
 */
38
function xmldb_custommailing_upgrade($oldversion) {
39
    global $DB;
40
 
41
    $dbman = $DB->get_manager();
42
 
43
    if ($oldversion < 2021033100) {
44
 
45
        $table = new xmldb_table('custommailing_mailing');
46
        $field = new xmldb_field('retroactive', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, '1', 'mailingstatus');
47
 
48
        if (!$dbman->field_exists($table, $field)) {
49
            $dbman->add_field($table, $field);
50
        }
51
 
52
        // Savepoint reached.
53
        upgrade_mod_savepoint(true, 2021033100, 'custommailing');
54
    }
55
 
56
    return true;
57
}