error backing up courses - "setting_invalid_ui_label"

Re: error backing up courses - "setting_invalid_ui_label"

by Drew Smith -
Number of replies: 13

(bump)

In reply to Drew Smith

Re: error backing up courses - "setting_invalid_ui_label"

by Bernat Martinez -

Has this been solved? I couldn't find any clues in a forum search 

We are having the same error/setting_invalid_ui_label problem when trying to perform an automated backup in Moodle 3.3 (PHP 7). 

Strangely enough  the same course backup successfully in Moodle 3.2 

Other courses in the same Moodle 3.3 backup successfully 

this is what we get when we try to backup 


Backing up Mates1ESO (IES Bellaguarda. Altea)...

... used 488 dbqueries

... used 0.5591151714325 seconds

Scheduled task failed: Automated backups (core\task\automated_backup_task),error/setting_invalid_ui_label

Backtrace:

* line 156 of /backup/moodle2/backup_section_task.class.php: call to base_setting_ui->set_label()

* line 153 of /backup/util/plan/base_task.class.php: call to backup_section_task->define_settings()

* line 60 of /backup/util/plan/base_plan.class.php: call to base_task->set_plan()

* line 160 of /backup/moodle2/backup_plan_builder.class.php: call to base_plan->add_task()

* line 187 of /backup/moodle2/backup_plan_builder.class.php: call to backup_plan_builder::build_section_plan()

* line 100 of /backup/moodle2/backup_plan_builder.class.php: call to backup_plan_builder::build_course_plan()

* line 163 of /backup/util/factories/backup_factory.class.php: call to backup_plan_builder::build_plan()

* line 62 of /backup/util/plan/backup_plan.class.php: call to backup_factory::build_plan()

* line 366 of /backup/controller/backup_controller.class.php: call to backup_plan->build()

* line 130 of /backup/controller/backup_controller.class.php: call to backup_controller->load_plan()

* line 374 of /backup/util/helper/backup_cron_helper.class.php: call to backup_controller->__construct()

* line 208 of /backup/util/helper/backup_cron_helper.class.php: call to backup_cron_automated_helper::launch_automated_backup()

* line 50 of /lib/classes/task/automated_backup_task.php: call to backup_cron_automated_helper::run_automated_backup()

* line 141 of /lib/cronlib.php: call to core\task\automated_backup_task->execute()

* line 67 of /lib/cronlib.php: call to cron_run_inner_scheduled_task()

* line 81 of /admin/cron.php: call to cron_run()

In reply to Bernat Martinez

Re: error backing up courses - "setting_invalid_ui_label"

by Yusuf Badran -

In my case this error has been caused by having HTML tags in the topic titles.

Average of ratings: Useful (4)
In reply to Bernat Martinez

Re: error backing up courses - "setting_invalid_ui_label"

by Ken Task -
Picture of Particularly helpful Moodlers

Go to the course and see how the Section Names are done.

In looking at the debug trace - 1st item and the line it references:

$section_included->get_ui()->set_label(get_section_name($course, $section));

As @Yusuf has discovered, the error could be caused by errant HTML in Section Name.   Tags in HTML if not done properly with 'opening tags' and then 'closing tags' could be interpreted as 'redirects' (those are < or >) or as 'escapes' (the '\' character).

'spirit of sharing', Ken



Average of ratings: Useful (3)
In reply to Ken Task

Re: error backing up courses - "setting_invalid_ui_label"

by Ken Task -
Picture of Particularly helpful Moodlers

Follow up after testing with a 3.3 and a 3.2 ...

When editing a section, one has an option to use custom ... which means Moodle won't auto generate 'Topic 1', 'Topic 2', etc.  but, rather, whatever the user inserts.   The box for the Section Title won't accept HTML ... even if one manually inserts it (like <b> some text </b>).   But there is also a 'Summary' one can use under the Section Title that does allow HTML.

One might need to query the database to see what's in both of those objects:

select * from `mdl_course_sections` where `course` like "12"

The 12 in the example above is the ID of the course.

The output of that will show the attributes of all sections in course ID - both the Section Name and the Summary.   The Summary, if used and if teacher/editor used the HTML editor for the Summary, could have errant HTML tags that might be involved.

'spirit of sharing', Ken


Average of ratings: Useful (2)
In reply to Ken Task

Re: error backing up courses - "setting_invalid_ui_label"

by Yusuf Badran -

In my case, I am able to insert HTML into the Section Title, if it is done through the "Edit topic" page, but not with the quick-edit pencil.

It is currently working in version 3.3 and used to display fontawesome icons.

However, backing up and restoring becomes an issue.

I think there should be an option to allow HTML, similar to "formatstringstriptags" or included in the same setting:


Remove HTML tags from all activity names
Uncheck this setting to allow HTML tags in activity and resource names.

Remove HTML tags from all section and activity names
Uncheck this setting to allow HTML tags in section, activity and resource names.

Average of ratings: Useful (2)
In reply to Drew Smith

Re: error backing up courses - "setting_invalid_ui_label"

by Ken Task -
Picture of Particularly helpful Moodlers

@Drew ... Suggest turning on debugging and try to manually backup the course that is failing to backup via automated backups.

Let's see if your debug output matches that of @Bernat's output.

'spirit of sharing', Ken

In reply to Ken Task

Re: error backing up courses - "setting_invalid_ui_label"

by Edward Bethel -

Hi Ken

Having similar problems to the ones described above. I've checked the section titles - no HTML tags used. I've gone through the summaries and while HTML tags used there, they all seem to be in order. We are running Moodle 3.3

Thanks in advance for whatever help you can give me.

Edward

Error output shown below:

error/setting_invalid_ui_label

More information about this error

Debug info: 
Error code: setting_invalid_ui_label
$a contents:

Stack trace:
  • line 152 of /backup/util/ui/backup_ui_setting.class.php: base_setting_ui_exception thrown
  • line 156 of /backup/moodle2/backup_section_task.class.php: call to base_setting_ui->set_label()
  • line 153 of /backup/util/plan/base_task.class.php: call to backup_section_task->define_settings()
  • line 60 of /backup/util/plan/base_plan.class.php: call to base_task->set_plan()
  • line 160 of /backup/moodle2/backup_plan_builder.class.php: call to base_plan->add_task()
  • line 187 of /backup/moodle2/backup_plan_builder.class.php: call to backup_plan_builder::build_section_plan()
  • line 100 of /backup/moodle2/backup_plan_builder.class.php: call to backup_plan_builder::build_course_plan()
  • line 163 of /backup/util/factories/backup_factory.class.php: call to backup_plan_builder::build_plan()
  • line 62 of /backup/util/plan/backup_plan.class.php: call to backup_factory::build_plan()
  • line 366 of /backup/controller/backup_controller.class.php: call to backup_plan->build()
  • line 130 of /backup/controller/backup_controller.class.php: call to backup_controller->load_plan()
  • line 88 of /backup/backup.php: call to backup_controller->__construct()
Output buffer: <script type="text/javascript" src="http://code.jquery.com/jquery.min.js"></script>


In reply to Edward Bethel

Re: error backing up courses - "setting_invalid_ui_label"

by Yusuf Badran -

Hi Edward,


This might not be ideal as it's a change to core code, but I hope this helps. On line 152 of backup_ui_setting.class.php, it looks like Moodle will throw this error if there is any non-text there.

I commented out part of that line as shown below with /* */ and it will now only throw the error if the label is empty.


        if ($label === ''/* || $label !== clean_param($label, PARAM_TEXT)*/) {

            throw new base_setting_ui_exception('setting_invalid_ui_label');

        }

Yusuf

Average of ratings: Useful (1)
In reply to Yusuf Badran

Re: error backing up courses - "setting_invalid_ui_label"

by Jon Miles -

Hi Yusuf,

I've just come across this problem after changing the titles to Images to look "pretty" and this has fixed it for me.

Thank you - I now need to write it into our code changes when we up-version.

Jon


In reply to Jon Miles

Re: error backing up courses - "setting_invalid_ui_label"

by Yusuf Badran -

Glad to hear you got that lipstick on the pig!

In reply to Yusuf Badran

Re: error backing up courses - "setting_invalid_ui_label"

by Teacher Jaque -

Hello Yusuf,

That's a fine explanation. . .

I'm having a problem to backup my Moodle 2.6 course. It's presenting the following error:

error/cannot_finish_ui_if_not_setting_ui

More information about this error (when I click nothing happens and I'm redirected back to my course).

Can you help me? Or do you know anyone who can?


Thank you so much!


Jaqueline Silva (teacher Jaque).


In reply to Ken Task

Re: error backing up courses - "setting_invalid_ui_label"

by Teacher Jaque -

Hello Ken,

I'm having a problem to backup my Moodle 2.6 course. It's presenting the following error:

error/cannot_finish_ui_if_not_setting_ui

More information about this error (when I click on it nothing happens and I'm redirected back to my course).

Can you help me? Or do you know anyone who can?


Thank you so much!


Jaqueline Silva (teacher Jaque).


In reply to Teacher Jaque

Re: error backing up courses - "setting_invalid_ui_label"

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

Please don't just repeat your question - also this is a very old thread.

If you turn debugging on, you should get a better idea of what is going on.  Chances are you have an incompatible plugin.