Failed Upgrade rollback issue

Failed Upgrade rollback issue

by Bill Searle -
Number of replies: 4

Hi

I know very little of Moodle, I don't use Moodle, I just look after the backend servers.

 I tried upgrading from 3.11 to 4.1 for a client. The upgraded appeared to run ok without issues. However, one of the tutors had an issue trying to access courses.  Since there is no one I can ask for help until the new year, I tried to roll back the upgrade.

I restored all the files in moodle and moodledata folder and restored the backup.sql file, I tried to take the site out of maintenance mode, but came up with the following error and I can't get the original site working now.

The site is running on a Windows Server 2016, with IIS and PHP 7.4.9 and MySQL 5.7.35

I have managed to get this debug information

Error

Can't find data record in database table context.
Debug info: SELECT * FROM {context} WHERE contextlevel = ?
[array (
0 => 10,
)]
Error code: invalidrecord
Stack trace:
  • line 1646 of \lib\dml\moodle_database.php: dml_missing_record_exception thrown
  • line 1622 of \lib\dml\moodle_database.php: call to moodle_database->get_record_select()
  • line 6310 of \lib\accesslib.php: call to moodle_database->get_record()
  • line 758 of \lib\setup.php: call to context_system::instance()
  • line 32 of \config.php: call to require_once()
  • line 3 of \admin\settings.php: call to require_once()
Can anyone help me getting the site back online.
Thanks
Bill

Average of ratings: -
In reply to Bill Searle

Re: Failed Upgrade rollback issue

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Are you absolutely sure it was a valid backup? The best thing is to take the site offline and then back up everything immediately before the upgrade. This looks like a corrupt/incomplete database.

Probably not good news.
In reply to Bill Searle

Re: Failed Upgrade rollback issue

by Bill Searle -
So abandoned rolling back, not sure why the sql file will not restore, there were no errors during the backup or restore.

So I have restored the backup taken after the upgrade so I'm back with the original problem.

A tutor logs in and when they go to there courses they report that there is nothing there, not the tiles and resources that they were expecting to see.

2 images added/uploaded.

Is there anything I'm missing, to get these resources to appear.

Could they be orphaned, under the navigation menu on the right, if I look under the course in question, I can see that Orphaned is in red, usually grey and there are a lot of items under it.  If this is true how can I un-orphan them?

Attachment Screenshot 2022-12-30 182646.png
Attachment Screenshot 2022-12-30 182916.png
In reply to Bill Searle

Re: Failed Upgrade rollback issue

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers
I am guessing that you did not copy over an additional course format and the courses have defaulted to something with not enough sections. If the activities are orphaned, just add a section and move them over (or they might just be appear at that point.)
Average of ratings: Useful (1)