Where Does Moodle Store Lesson Activity Names? The Ones That Display In the Couse View?

Where Does Moodle Store Lesson Activity Names? The Ones That Display In the Couse View?

by Juan Salazar -
Number of replies: 3

I'm using Moodle version 3.8.1. I know lesson activity names are stored in mdl_lesson, but I've also seen it stored mdl_grade_items, and mdl_grade_items_history. In our Moodle instance, we wrote a script that programmatically updates the name of the lesson in the mdl_lesson table. In the course page (moodle/course/view.php) it displays the incorrect name (the name with which it was first saved as), but in modedit page (moodle/course/modedit.php), it shows it correct in the name field but not in the breadcrumbs at the top.

I'm sorry I'm not providing images. These pages were heavily edited and contains the widgets we wrote, which I believe is NDA material. Otherwise, if there's any other information I can provide please let me know. Thanks!

PS I've already cleared cache several times, although maybe I didn't clear enough of it? Any help or direction will be greatly appreciated.

Average of ratings: -
In reply to Juan Salazar

Re: Where Does Moodle Store Lesson Activity Names? The Ones That Display In the Couse View?

by Renaat Debleu -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers
Even in Moodle version 4.0, the name field remains in the lesson table (https://github.com/moodle/moodle/blob/master/mod/lesson/db/install.xml#L11). So a change in that table should show up in the page view, page edit and breadcrumbs.

If it doesn't, there is something wrong with your course format cache (page view) and/or theme (breadcrumbs) cache. Try to change both to see if your changes finally are shown.

R
Average of ratings: Useful (3)
In reply to Renaat Debleu

Re: Where Does Moodle Store Lesson Activity Names? The Ones That Display In the Couse View?

by Juan Salazar -
That was it!

I went to Site Administration > Development > Purge all Caches and purged Language strings, JavaScript, Text filters, and All file and miscellaneous caches. Do you happen to know which one of these caches would be the course format cache? The breadcrumbs were also fixed purging one of these caches, by the way.

Ok, now I get to write logic that cleans up the needed caches when I save new lesson names, or at least study one of the save buttons on the page and see how they do it.

Thank you very much for your help. I greatly appreciate it!
In reply to Renaat Debleu

Re: Where Does Moodle Store Lesson Activity Names? The Ones That Display In the Couse View?

by Juan Salazar -
Just in case anybody was wondering, if anybody wants to clear cache after updating a course activity or the like, simply:


$courseID = required_param('course', PARAM_INT);
rebuild_course_cache($courseID);


This did the trick for me. Here's the page that explains the rebuild course function: https://github.com/moodle/moodle/blob/master/lib/modinfolib.php.

Again, thank you very much, Renaat!