From e109b9dd2193f99473c6f9be738f0e83f3628d9a Mon Sep 17 00:00:00 2001 From: Paul Holden Date: Mon, 15 Jul 2024 21:50:10 +0100 Subject: [PATCH] MDL-82483 tag: update the max length constant to match schema. --- lib/moodlelib.php | 12 ++---------- tag/edit_form.php | 11 +---------- 2 files changed, 3 insertions(+), 20 deletions(-) diff --git a/lib/moodlelib.php b/lib/moodlelib.php index c8d1c9ec562..95c76ad296d 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -380,16 +380,8 @@ define ('BLOG_COURSE_LEVEL', 3); define ('BLOG_SITE_LEVEL', 4); define ('BLOG_GLOBAL_LEVEL', 5); - -// Tag constants. -/** - * To prevent problems with multibytes strings,Flag updating in nav not working on the review page. this should not exceed the - * length of "varchar(255) / 3 (bytes / utf-8 character) = 85". - * TODO: this is not correct, varchar(255) are 255 unicode chars ;-) - * - * @todo define(TAG_MAX_LENGTH) this is not correct, varchar(255) are 255 unicode chars ;-) - */ -define('TAG_MAX_LENGTH', 50); +/** The maximum length of a tag */ +define('TAG_MAX_LENGTH', 255); // Password policy constants. define ('PASSWORD_LOWER', 'abcdefghijklmnopqrstuvwxyz'); diff --git a/tag/edit_form.php b/tag/edit_form.php index d381d79dd88..d33cf13d424 100644 --- a/tag/edit_form.php +++ b/tag/edit_form.php @@ -14,14 +14,6 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . - -/** - * @package core_tag - * @category tag - * @copyright 2007 Luiz Cruz - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - if (!defined('MOODLE_INTERNAL')) { die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page } @@ -57,8 +49,7 @@ class tag_edit_form extends moodleform { $systemcontext = context_system::instance(); if (has_capability('moodle/tag:manage', $systemcontext)) { - $mform->addElement('text', 'rawname', get_string('name', 'tag'), - 'maxlength="'.TAG_MAX_LENGTH.'" size="'.TAG_MAX_LENGTH.'"'); + $mform->addElement('text', 'rawname', get_string('name', 'tag'), ['maxlength' => TAG_MAX_LENGTH, 'size' => 50]); $mform->setType('rawname', PARAM_TAG); }