From ed23dd1c0f5316f8ae281adb5cb328677b2aadf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sam=20M=C3=B8ller?= Date: Thu, 18 Jan 2024 18:41:36 +0100 Subject: [PATCH] #118: Add feature - async backup/restore Fix upgrade script - MYSQL with danish cannot update character that is out of danish character range --- .../repositories/course_module_repository.php | 4 +--- db/upgrade.php | 17 ----------------- version.php | 2 +- 3 files changed, 2 insertions(+), 21 deletions(-) diff --git a/classes/repositories/course_module_repository.php b/classes/repositories/course_module_repository.php index 0de329c..883eacc 100644 --- a/classes/repositories/course_module_repository.php +++ b/classes/repositories/course_module_repository.php @@ -58,7 +58,7 @@ private function get_label_intro(cm_info $cm): string MUST_EXIST ); if (!empty($record)) { - $intro = format_text( + return format_text( $record->intro, $record->introformat, [ @@ -68,8 +68,6 @@ private function get_label_intro(cm_info $cm): string 'context' => $cm->context ] ); - $intro = str_replace(["\n", "\r", "\t"], ' ', strip_tags($intro)); - return trim(mb_substr($intro, 0, 100, 'UTF-8')); } } catch (\Exception $e) { } diff --git a/db/upgrade.php b/db/upgrade.php index f1c8d8e..3e3499a 100644 --- a/db/upgrade.php +++ b/db/upgrade.php @@ -276,23 +276,6 @@ function xmldb_block_sharing_cart_upgrade($oldversion = 0) { $DB->delete_records_list('block_sharing_cart', 'id', $deleted_sharing_cart_files); } - $sharing_cart_records = $DB->get_recordset_select( - 'block_sharing_cart', - 'LENGTH(modtext) > 100' - ); - - foreach ($sharing_cart_records as $record) { - $intro = trim(strip_tags($record->modtext)); - $record->modtext = substr( - str_replace(["\n", "\r", "\t"], ' ', $intro), - 0, - 100 - ); - $DB->update_record('block_sharing_cart', $record); - } - - $sharing_cart_records->close(); - upgrade_block_savepoint(true, 2024011800, 'sharing_cart'); } diff --git a/version.php b/version.php index f0641c8..9a94c6e 100644 --- a/version.php +++ b/version.php @@ -26,7 +26,7 @@ /** @var object $plugin */ $plugin->component = 'block_sharing_cart'; -$plugin->version = 2024011800; +$plugin->version = 2024011801; $plugin->requires = 2021051704; // Moodle 3.11.4 $plugin->release = '4.4, release 2'; $plugin->maturity = MATURITY_STABLE;