Moodle Upgrade to 3.5 / Undefined Function

Moodle Upgrade to 3.5 / Undefined Function

by Matt David -
Number of replies: 13
I'm in the process of upgrading a Moodle server from 3.1.1 > 3.5 > 3.9 > and lastly 4.1.  I'm helping a non profit out and I'm not familiar with Moodle.  

After the upgrade to v3.5 when a user clicks on a course, it gives the follow error "Exception - Call to undefined function tool_lp_extend_navigation_course()"

I have debugging enabled and it gives the following info:
  • line 4457 of /lib/navigationlib.php: Error thrown
  • line 4018 of /lib/navigationlib.php: call to settings_navigation->load_course_settings()
  • line 759 of /lib/pagelib.php: call to settings_navigation->initialise()
  • line 820 of /lib/pagelib.php: call to moodle_page->magic_get_settingsnav()
  • line 136 of /blocks/settings/block_settings.php: call to moodle_page->__get()
  • line 288 of /blocks/moodleblock.class.php: call to block_settings->get_content()
  • line 230 of /blocks/moodleblock.class.php: call to block_base->formatted_contents()
  • line 1216 of /lib/blocklib.php: call to block_base->get_content_for_output()
  • line 1274 of /lib/blocklib.php: call to block_manager->create_block_contents()
  • line 608 of /lib/outputrenderers.php: call to block_manager->ensure_content_created()
  • line 75 of /theme/essential/classes/output/core_renderer.php: call to core_renderer->standard_head_html()
  • line 39 of /theme/essential/layout/tiles/header.php: call to theme_essential\output\core_renderer->standard_head_html()
  • line 32 of /theme/essential/layout/columns3.php: call to require_once()
  • line 1291 of /lib/outputrenderers.php: call to include()
  • line 1221 of /lib/outputrenderers.php: call to core_renderer->render_page_layout()
  • line 244 of /course/view.php: call to core_renderer->header()

Does anyone have any ideas on what the problem might be? 

I did run into a problem during the upgrade process that I was able to work around and I'm not sure if that's causing this problem.  I'll detail the previous problem below.

I was able to upgrade all dependencies and move the upgrade folder on to the server.  If I moved the old config.php file into the new Moodle folder, it would break and give me an HTTP 500 Error.  If I removed the config.php file from the folder, it would load the initial Moodle installation page.  My workaround was going through the installation page and having it create a new data folder and referencing the existing mysqli database.  When I clicked continue on the page asking for the database information it transitioned into an upgrade page and I completed the upgrade.  Once I got through the installation, I manually went into the newly generated config.php file and changed the data folder location.

Any advice is welcome.


In reply to Matt David

Re: Moodle Upgrade to 3.5 / Undefined Function

by Leon Stringer -
Core developers की तस्वीर Particularly helpful Moodlers की तस्वीर

After the upgrade to v3.5 when a user clicks on a course, it gives the follow error "Exception - Call to undefined function tool_lp_extend_navigation_course()"

I'd suggest purging all caches. It looks like Moodle is trying to call a core plugin callback function, tool_lp_extend_navigation_course(). This function existed in Moodle 3.1 but is not present in Moodle 3.5.

My workaround was going through the installation page and having it create a new data folder and referencing the existing mysqli database.  When I clicked continue on the page asking for the database information it transitioned into an upgrade page and I completed the upgrade.  Once I got through the installation, I manually went into the newly generated config.php file and changed the data folder location.

This shouldn't have needed doing. There may be some unwanted side effects from this approach. This problem may be one of them since the plugin callback cache is by default located in the file data folder (Moodledata) and so should be purged during upgrade. Obviously if the folder's been moved during the upgrade this won't get done.

In reply to Leon Stringer

Re: Moodle Upgrade to 3.5 / Undefined Function

by Matt David -
The cache purged resolved the current issue. Thanks!

See below info on the original problem I worked around in more detail.

The Moodle folder on my server is named moodle_prod. I renamed the moodle_prod folder to moodle_old. When I uploaded the new Moodle 3.5 folder and renamed it to moodle_prod, I received the installation page on load. If I moved the old config.php file into that folder, it would break and give me an HTTP 500 Error.

During the troubleshooting process I removed the config.php file from the new folder and went through the install process. If I referenced the data folder location in the install prompts that generates a new config.php, it would error out. If I had the process create a new data folder it continued as normal.

Is there a way to see what it doesn't like about that data folder? Can you think of any other unwanted side effects to my workaround approach above.

Misc Troubleshooting:
1. If I renamed the new folder from moodle_prod to moodle_hold and renamed moodle_old back to moodle_prod, the old 3.1 site would still load.
2. I matched the new moodle folder to match the permissions and owners that the old one had
3. I increased the permissions to the new moodle folder/subfolders to 777 for troubleshooting, no change
In reply to Matt David

Re: Moodle Upgrade to 3.5 / Undefined Function

by Emma Richardson -
Documentation writers की तस्वीर Particularly helpful Moodlers की तस्वीर Plugin developers की तस्वीर
If you created a new moodle data folder, then you will have all sorts of issues - the moodledata folder is where all your content is stored (files, pictures, etc). You could try redirecting back to it but I am guessing that will give you lots of  trouble as you have already upgraded the database...
In reply to Emma Richardson

Re: Moodle Upgrade to 3.5 / Undefined Function

by Matt David -
That's correct. When I removed the config.php file and went through the install page (it appears to convert into an upgrade process?), I had it create a new data folder location and I used the existing db information. After the install/upgrade process, I opened config.php and referenced the "old" data folder with all the existing content.

I definitely noticed no logos/pictures loaded immediately afterwards, but when I redirected config.php, they load without an issue. My concern is the problems that may arise since I'm not knowledgeable in Moodle.

Hopefully somebody who reads this thread might have an idea why the upgrade was acting up in the first place.

Thank you for the help.
In reply to Matt David

Re: Moodle Upgrade to 3.5 / Undefined Function

by Emma Richardson -
Documentation writers की तस्वीर Particularly helpful Moodlers की तस्वीर Plugin developers की तस्वीर
I wonder if when you moved the config file over originally, the permissions were wrong on it...what was the error when you referenced the existing data folder in the install?  It could almost be that you had two separate things going on - 1. the initial attempt could not read the config file - then when you tried to reference the data folder in the installation wizard, you might have just got the reference wrong...
In reply to Emma Richardson

Re: Moodle Upgrade to 3.5 / Undefined Function

by Matt David -
If I referenced the existing data folder in the "install" process and clicked continue, it would give me an HTTP Error 500. The same as what it gave as if I used the old config.php.

I tried the original config file with 3 sets of permissions... moving it over without doing anything, giving it full permissions, and I also mirrored the permissions of the installed generated config.php

This is on imaged sandbox server on AWS. So I'm free to troubleshoot at will. Thanks!
In reply to Matt David

Re: Moodle Upgrade to 3.5 / Undefined Function

by Ken Task -
Particularly helpful Moodlers की तस्वीर
config.php just needs read access for ugo.

What's more important is the path to moodledata as shown in the config.php file.

With your Amazon setup, is that moodledata directory really a mount point and it resides on another server?  or is it on the same server as the web service?

'SoS', Ken

In reply to Ken Task

Re: Moodle Upgrade to 3.5 / Undefined Function

by Matt David -
It's an EBS volume mounted directly to the Ec2 server. It is not utilized by another server. The mount point is /storage... so the data folder is located at /storage/data/moodledata_prod/. The Moodle folder is located under /storage/www/moodle_prod.

Side note, when I had the install process generate a new data folder, I had it generate at /storage/data.
In reply to Matt David

Re: Moodle Upgrade to 3.5 / Undefined Function

by Ken Task -
Particularly helpful Moodlers की तस्वीर
You could do the entire march via command line.

For code directory, use of git.

For upgrade of code a bash shell script using git.

For actually performing the upgrade, php scripts in code/admin/cli/

Don't have to use the GUI cept when checking site and GUI is probably best for upgrading addons.

'SoS', Ken

In reply to Matt David

Re: Moodle Upgrade to 3.5 / Undefined Function

by Ken Task -
Particularly helpful Moodlers की तस्वीर
Think your original issue is related to the theme the site is using.
Essential theme is massive ... over 600+ settings or more
in the DB.  Even the original author of theme recommended switching theme to boost first, upgrade, then switch back. उदास

In the debug you see references to /theme/essential/

https://moodle.org/plugins/theme_essential/versions
shows it's compatible up to 3.6 ... but there are no other higher
versions available.  Your goal of 4.1 is not attainable with that theme.  May as well get rid of it now rather than wait!

First, edit config.php and add a line to force the theme to boost
$CFG->theme='boost';

Boost comes with all the versions you will march through.
Leave the added line there until later you finish your march.

Once you are able to log back into the site as an admin level user, delete the essential theme.

Now the above won't fix whatever the heck is going on with moodledata and other issues in a mis-guided upgrade attempt.
But it sure will make the site more managable through the march.

Your DB has been touched ... db is now a 3.5 ... no un-do ... no roll back.   You **might** have to start over .... and the only way to recover is to restore the backup of the original code directory and a restore of the backup (sql dump) of the DB made just prior to upgrade attempt to a new DB.   Hopefully, you made a site backup!

'SoS', Ken

In reply to Ken Task

Re: Moodle Upgrade to 3.5 / Undefined Function

by Ken Task -
Particularly helpful Moodlers की तस्वीर
There's prelim info one needs to gather before a march of a moodle.   One of those items ... additional plugins.
They need to be checked in https://moodle.org/plugins/ to see if there is a compatible version for destination version ... as well as versions you will have to march through.   Already mentioned theme - essential.  More than likely there are other plugins.

The step of copying config.php from old to new should also include copying any 3rd party plugin installed in old to same location in new.   Not only themes, but blocks, mods, course formats, quiz question types, etc.   What ever is 3rd party ... not part of core.

The other is a biggy ...
Please see chart:
Along your march you will need to upgrade not only your PHP but your DB (MySQL/MariaDB) as well.
See version row and Min/Max's.

Piece of advice ... after every successful hop, do a site backup ... which consist of code + DB dump.   Proir to first hop include backup of minimally moodledata/filedir/

IF ... IF ... there is a big hickup on next hop and you can't solve it soon, you don't want to loose ground gained and have to start all over again.   Just restore your last site backup. मुस्कान

'SoS', Ken



In reply to Ken Task

Re: Moodle Upgrade to 3.5 / Undefined Function

by Matt David -
Ken, thank you for the write up.

The original issue was fixed by running a cache purge that Leon mentioned above.

Since it was mentioned my original issue that I worked around could cause unforeseen issues, I figured I might want to dig into it a little bit.

I did move over all 3rd party plugins and themes to their appropriate subfolders in the new moodle folder.  At this point, I just needed to upgrade PHP from 5.5 to 7.0.  I know the DB needs an upgrade for 3.9.

This is on a sandbox server on AWS. So I'm free to troubleshoot and teardown/bring up a fresh instance at will.  I do plan on taking snapshots between each upgrade for sure.
In reply to Matt David

Re: Moodle Upgrade to 3.5 / Undefined Function

by Ken Task -
Particularly helpful Moodlers की तस्वीर
Since this is on Amazon ... might be a good time to consider using git versioning for moodle core code.


IF one uses old method, that's a lot of moving parts.  If using git, code directory and settings stay in place (where they are) and using git literally 'pulls in' new code ... but only the changes needed.

Fewer moving parts means less prone to human error and it's faster and smaller.

+ one does the upgrade with existing php scripts in code/admin/cli/  Takes the web service out of the loop and it's just php talking to your DB server.

'SoS', Ken