From 0c18745424588407c37bc09b140fd993aeeaf3f7 Mon Sep 17 00:00:00 2001 From: Mathew May Date: Tue, 23 Jul 2019 12:14:53 +0800 Subject: [PATCH] MDL-57342 admin: confightml will check if returned data is empty --- lib/adminlib.php | 13 +++++++++++++ lib/db/upgrade.php | 11 +++++++++++ version.php | 2 +- 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/lib/adminlib.php b/lib/adminlib.php index 45b99183084..e8b3649bfd7 100644 --- a/lib/adminlib.php +++ b/lib/adminlib.php @@ -2583,6 +2583,19 @@ class admin_setting_confightmleditor extends admin_setting_configtextarea { $editor->use_editor($this->get_id(), array('noclean'=>true)); return parent::output_html($data, $query); } + + /** + * Checks if data has empty html. + * + * @param string $data + * @return string Empty when no errors. + */ + public function write_setting($data) { + if (trim(html_to_text($data)) === '') { + $data = ''; + } + return parent::write_setting($data); + } } diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php index 048ae58cb56..5728213e0b3 100644 --- a/lib/db/upgrade.php +++ b/lib/db/upgrade.php @@ -3416,5 +3416,16 @@ function xmldb_main_upgrade($oldversion) { upgrade_main_savepoint(true, 2019070400.01); } + if ($oldversion < 2019071800.01) { + // Update the empty tag instructions to null. + $instructions = get_config('core', 'auth_instructions'); + + if (trim(html_to_text($instructions)) === '') { + set_config('auth_instructions', ''); + } + + // Main savepoint reached. + upgrade_main_savepoint(true, 2019071800.01); + } return true; } diff --git a/version.php b/version.php index 572c371c5b2..a3edfce2474 100644 --- a/version.php +++ b/version.php @@ -29,7 +29,7 @@ defined('MOODLE_INTERNAL') || die(); -$version = 2019071800.00; // YYYYMMDD = weekly release date of this DEV branch. +$version = 2019071800.01; // YYYYMMDD = weekly release date of this DEV branch. // RR = release increments - 00 in DEV branches. // .XX = incremental changes.