1 |
efrain |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
/**
|
|
|
4 |
* Cocoon Form Builder integration for Moodle
|
|
|
5 |
*
|
|
|
6 |
* @package cocoon_form_builder
|
|
|
7 |
* @copyright ©2021 Cocoon, XTRA Enterprises Ltd. createdbycocoon.com
|
|
|
8 |
* @author Cocoon
|
|
|
9 |
*/
|
|
|
10 |
|
|
|
11 |
defined('MOODLE_INTERNAL') || die();
|
|
|
12 |
|
|
|
13 |
function xmldb_local_cocoon_form_builder_upgrade($oldversion) {
|
|
|
14 |
global $CFG, $DB;
|
|
|
15 |
$dbman = $DB->get_manager();
|
|
|
16 |
$result = TRUE;
|
|
|
17 |
|
|
|
18 |
if ($oldversion < 2021060823) {
|
|
|
19 |
$table = new xmldb_table('cocoon_form_builder_forms');
|
|
|
20 |
$field = new xmldb_field('url', XMLDB_TYPE_CHAR, '255', null, XMLDB_NULL, null, null, 'data');
|
|
|
21 |
|
|
|
22 |
if (!$dbman->field_exists($table, $field)) {
|
|
|
23 |
$dbman->add_field($table, $field, $continue=true, $feedback=true);
|
|
|
24 |
}
|
|
|
25 |
upgrade_plugin_savepoint(true, 2021060823, 'local', 'cocoon_form_builder');
|
|
|
26 |
}
|
|
|
27 |
|
|
|
28 |
if ($oldversion < 2021060824) {
|
|
|
29 |
$table = new xmldb_table('cocoon_form_builder_forms');
|
|
|
30 |
$field = new xmldb_field('confirm_message', XMLDB_TYPE_CHAR, '255', null, XMLDB_NULL, null, null, 'url');
|
|
|
31 |
$field_2 = new xmldb_field('ajax', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NULL, null, '0', 'status');
|
|
|
32 |
|
|
|
33 |
if (!$dbman->field_exists($table, $field)) {
|
|
|
34 |
$dbman->add_field($table, $field, $continue=true, $feedback=true);
|
|
|
35 |
}
|
|
|
36 |
if (!$dbman->field_exists($table, $field_2)) {
|
|
|
37 |
$dbman->add_field($table, $field_2, $continue=true, $feedback=true);
|
|
|
38 |
}
|
|
|
39 |
upgrade_plugin_savepoint(true, 2021060824, 'local', 'cocoon_form_builder');
|
|
|
40 |
}
|
|
|
41 |
|
|
|
42 |
return $result;
|
|
|
43 |
}
|