Error when attempting backup of course: error/setting_invalid_ui_label

Error when attempting backup of course: error/setting_invalid_ui_label

by Ken Task -
Number of replies: 3
Picture of Particularly helpful Moodlers

Moodle version 3.5.highest
MySQL 5.7
no issues with character set nor collation - no tables in need of repair.  Nor anything I can test.

Attempting backup from command line of courses whose content
uses a language other than en (fr,spanish) this error thrown and stops
the backup.

== Performing backup... ==
!!! error/setting_invalid_ui_label !!!

Course title: Español 4 - Cultura y Comunicación

Error reported some time ago and supposedly fixed.
https://tracker.moodle.org/browse/MDL-23559
not a bug: https://tracker.moodle.org/browse/MDL-30933
https://tracker.moodle.org/browse/MDL-51099

On most of these troubled courses, discovered that each
had lost course title!!!???

When viewing category of language courses those without a course title didn't appear in the listing of courses.

Have corrected that.

Finally able to enter course in an edit mode and I see that some
resources (various - link, file, etc.) in the course have no 'label'.
I edit and put something in so that icon has linked text next to them.

Thinking I've fixed the course, I once again attempt backup ... command line and GUI ... same error.

== Performing backup... ==
!!! error/setting_invalid_ui_label !!!

Since I supposedly have fixed code, am needing to find and edit tables.
mdl_courses known but what other tables would be involved?

Thanks, in advance, for any hints/clues!

'SoS', Ken

Average of ratings: -
In reply to Ken Task

Re: Error when attempting backup of course: error/setting_invalid_ui_label

by Leon Stringer -
Picture of Core developers Picture of Particularly helpful Moodlers

Reading the code this error means that the value passed to backup/util/ui/backup_ui_setting.class.php:base_setting_ui->set_label() is either blank or doesn't match the results of clean_param().

It looks like these labels are the course contents – topics, activities, etc. – rather than the course title.

Enabling debugging in the GUI should cause admin/cli/backup.php to show the stack trace from which we can hopefully determine the course content type set_label() doesn't like. Then hopefully we can trace this to a specific item (or items) in the database.

Alternatively (or additionally) you could insert an echo to backup/util/ui/backup_ui_setting.class.php to report the value passed when the error happens, something like:

149     public function set_label($label) {
150         $label = (string)$label;
151         echo "DEBUG: \$label == \"$label\"" . PHP_EOL;
152         if (true || $label === '' || $label !== clean_param($label, PARAM_TEXT)) {
153             throw new base_setting_ui_exception('setting_invalid_ui_label');
154         }
155         $this->label = $label;
156     }
Average of ratings: Useful (1)
In reply to Leon Stringer

Re: Error when attempting backup of course: error/setting_invalid_ui_label

by Ken Task -
Picture of Particularly helpful Moodlers

Thanks, Leon.   Have gone the echo route.   Edited one of troubled courses via the GUI and all resources do have an icon and text beside that icon.

Ran the command line backup with course ID and am getting this:

== Performing backup... ==
DEBUG: $label == "General"
DEBUG: $label == "User data"
DEBUG: $label == "-"
DEBUG: $label == "General Classroom Information"
DEBUG: $label == "User data"
DEBUG: $label == "-"
DEBUG: $label == "-"
DEBUG: $label == "-"
DEBUG: $label == "-"
DEBUG: $label == "-"
DEBUG: $label == "-"
DEBUG: $label == "-"
DEBUG: $label == "-"
DEBUG: $label == "-"
DEBUG: $label == "-"
DEBUG: $label == "-"
DEBUG: $label == "-"
DEBUG: $label == "Calendarios"
DEBUG: $label == "User data"
DEBUG: $label == "-"
DEBUG: $label == "Reference Sheets"
DEBUG: $label == "User data"
DEBUG: $label == "-"
DEBUG: $label == "-"
DEBUG: $label == ""
!!! error/setting_invalid_ui_label !!!

All appear to be Section headings .. custom ... when editing no label but there are descriptons.

Working on it! :|

'SoS', Ken


In reply to Leon Stringer

Re: Error when attempting backup of course: error/setting_invalid_ui_label

by Ken Task -
Picture of Particularly helpful Moodlers

Went the echo route ...

Discovered that each section title set to custom but had no text in the title!

Added text to each of them ... some 50+ ... oh, how boring is that!

Anyhoo ... ran the backup from command line again.

Success!

DEBUG: $label == "-"
DEBUG: $label == "-"
Writing /home/clibackups/backup-moodle2-course-97-sp_3-20200709-1304-nu.mbz
Backup completed.

Thanks, a ton Leon!   Don't think I'll spend any time trying to figure out how that happened! :|   Know the fix now and have about 10 such courses to fix for teachers. :|

'SoS', Ken