Merge pull request #528 from nextcloud/fix/migration

Fix substring utf8
This commit is contained in:
Jonas 2020-07-29 18:21:56 +02:00 committed by GitHub
commit bc05d0307f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -259,7 +259,7 @@ class Version010200Date20200323141300 extends SimpleMigrationStep {
//In case the old Question would have been longer than current possible length, create a warning and shorten text to avoid Error on upgrade.
if (strlen($question['form_question_text']) > 2048) {
$output->warning("Question-text is too long for new Database: '" . $question['form_question_text'] . "'");
$question['form_question_text'] = substr($question['form_question_text'], 0, 2048);
$question['form_question_text'] = mb_substr($question['form_question_text'], 0, 2048);
}
$qb_restore->insert('forms_v2_questions')
@ -285,7 +285,7 @@ class Version010200Date20200323141300 extends SimpleMigrationStep {
//In case the old Answer would have been longer than current possible length, create a warning and shorten text to avoid Error on upgrade.
if (strlen($answer['text']) > 1024) {
$output->warning("Option-text is too long for new Database: '" . $answer['text'] . "'");
$answer['text'] = substr($answer['text'], 0, 1024);
$answer['text'] = mb_substr($answer['text'], 0, 1024);
}
$qb_restore->insert('forms_v2_options')
@ -352,7 +352,7 @@ class Version010200Date20200323141300 extends SimpleMigrationStep {
//In case the old Answer would have been longer than current possible length, create a warning and shorten text to avoid Error on upgrade.
if (strlen($vote['vote_answer']) > 2048) {
$output->warning("Answer-text is too long for new Database: '" . $vote['vote_answer'] . "'");
$vote['vote_answer'] = substr($vote['vote_answer'], 0, 2048);
$vote['vote_answer'] = mb_substr($vote['vote_answer'], 0, 2048);
}
/* Due to the unconventional storing fo vote_option_ids, the vote_option_id needs to get mapped onto old question-id and from there to new question-id.