From e834cb7fbeb81106ce631603ffeb66d599f4032e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luca=20B=C3=B6sch?= Date: Fri, 24 Jan 2025 15:11:40 +0100 Subject: [PATCH] MDL-83985 mod_glossary: change name to 1333 chars --- mod/glossary/db/install.xml | 4 ++-- mod/glossary/db/upgrade.php | 16 ++++++++++++++++ mod/glossary/mod_form.php | 2 +- mod/glossary/version.php | 2 +- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/mod/glossary/db/install.xml b/mod/glossary/db/install.xml index 5f86bcf6bb3..5015624c23b 100644 --- a/mod/glossary/db/install.xml +++ b/mod/glossary/db/install.xml @@ -1,5 +1,5 @@ - @@ -8,7 +8,7 @@ - + diff --git a/mod/glossary/db/upgrade.php b/mod/glossary/db/upgrade.php index bfee9217e1c..0ce46cf4416 100644 --- a/mod/glossary/db/upgrade.php +++ b/mod/glossary/db/upgrade.php @@ -40,6 +40,9 @@ */ function xmldb_glossary_upgrade($oldversion) { + global $DB; + $dbman = $DB->get_manager(); + // Automatically generated Moodle v4.2.0 release upgrade line. // Put any upgrade step following this. @@ -55,5 +58,18 @@ function xmldb_glossary_upgrade($oldversion) { // Automatically generated Moodle v5.0.0 release upgrade line. // Put any upgrade step following this. + if ($oldversion < 2025041401) { + + // Changing precision of field name on table glossary to (1333). + $table = new xmldb_table('glossary'); + $field = new xmldb_field('name', XMLDB_TYPE_CHAR, '1333', null, XMLDB_NOTNULL, null, null, 'course'); + + // Launch change of precision for field name. + $dbman->change_field_precision($table, $field); + + // Glossary savepoint reached. + upgrade_mod_savepoint(true, 2025041401, 'glossary'); + } + return true; } diff --git a/mod/glossary/mod_form.php b/mod/glossary/mod_form.php index e0db550e5e0..38ab5912a11 100644 --- a/mod/glossary/mod_form.php +++ b/mod/glossary/mod_form.php @@ -22,7 +22,7 @@ class mod_glossary_mod_form extends moodleform_mod { $mform->setType('name', PARAM_CLEANHTML); } $mform->addRule('name', null, 'required', null, 'client'); - $mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client'); + $mform->addRule('name', get_string('maximumchars', '', 1333), 'maxlength', 1333, 'client'); $this->standard_intro_elements(); diff --git a/mod/glossary/version.php b/mod/glossary/version.php index 06e2f1d51db..e9fd68742af 100644 --- a/mod/glossary/version.php +++ b/mod/glossary/version.php @@ -24,7 +24,7 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2025041400; // The current module version (Date: YYYYMMDDXX). +$plugin->version = 2025041401; // The current module version (Date: YYYYMMDDXX). $plugin->requires = 2025040800; // Requires this Moodle version. $plugin->component = 'mod_glossary'; // Full name of the plugin (used for diagnostics) $plugin->cron = 0;