Coding error during restore/import

Coding error during restore/import

by Mateusz Szuter -
Number of replies: 7

Hello,

I'm trying to restore my course template. Only 'structure' - there are only blocks and activities

When I hit restore/import, go through the procedure I got following error (backups weights like 180kb)

Invalid availability structure (unknown ->op)

and my course is not being restored/imported.

Google says nothing about that error, only that it exist. Can someone help me solve that problem, maybe some of my settings are causing this?

Thanks.

Average of ratings: -
In reply to Mateusz Szuter

Re: Coding error during restore/import

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

How was the backup made in the first place?  Are you just using the built in backup restore process?  What version of Moodle was the course backed up and are you trying to restore to?

 Have you turned debugging on - if not, please do that and then post the error.

In reply to Emma Richardson

Odp: Re: Coding error during restore/import

by Mateusz Szuter -

Thanks Emma for your reply.

I'm making a backup in a normal way - by course admin tab. Moodle version is 3.0.3, backup is 3.0.3 too. I restore course either making a new course and then backup > restore, or from the admin panel backup > restore. It's all done within one moodle - I just want to create a course template smile

  • line 152 of /availability/classes/tree.php: coding_exception thrown
  • line 144 of /availability/classes/info.php: call to core_availability\tree->__construct()
  • line 114 of /availability/classes/info.php: call to core_availability\info->decode_availability()
  • line 318 of /availability/classes/info.php: call to core_availability\info->get_availability_tree()
  • line 803 of /backup/moodle2/restore_stepslib.php: call to core_availability\info->update_after_restore()
  • line 34 of /backup/util/plan/restore_execution_step.class.php: call to restore_update_availability->define_execution()
  • line 181 of /backup/util/plan/base_task.class.php: call to restore_execution_step->execute()
  • line 177 of /backup/util/plan/base_plan.class.php: call to base_task->execute()
  • line 167 of /backup/util/plan/restore_plan.class.php: call to base_plan->execute()
  • line 333 of /backup/controller/restore_controller.class.php: call to restore_plan->execute()
  • line 224 of /backup/util/ui/restore_ui.class.php: call to restore_controller->execute_plan()
  • line 111 of /backup/restore.php: call to restore_ui->execute()

That's debugging info.

Also I get user role mapping problem, where I have 3 dropdowns, which in first is preselected Student, and second and third are set to none. May that be the problem?


In reply to Mateusz Szuter

Re: Odp: Re: Coding error during restore/import

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers
The role mapping issue is very strange especially if this is all in one Moodle.  I would guess that either something is corrupted in your install or you have a plugin that is causing issues.  

You might try upgrading to 3.0.4 and see if that resolves it.  



In reply to Emma Richardson

Odp: Re: Odp: Re: Coding error during restore/import

by Mateusz Szuter -

I tried to do the upgrade, but my theme isn't compatible yet. sad 

I've found what is causing problem - when I change the default "topic 1" or the section above news forum (fill it with some description) this errors throws.

So until I change that - I can import course. When I change them, I've got error mentioned above. What's strange that when I remove description and change the topic name back to it's default, the error still happens

In reply to Mateusz Szuter

Re: Odp: Re: Odp: Re: Coding error during restore/import

by Ken Task -
Picture of Particularly helpful Moodlers
Guess ... in reading debug output ...

Debug points to availability issues upon restore ... so in the template course you are using to replicate, does that course have any restrictions/availability settings unique and specific to that course?  IF so, remove those ... ie, don't restrict.   See if the backup runs cleanly.   The restore should be good and then you'd have to go back into availability settings of that item to restrict or whatever.

'spirit of sharing', Ken
In reply to Mateusz Szuter

Re: Coding error during restore/import

by Przemyslaw Stencel -

I am getting the same error on a fresh-installed Moodle 3.1.3+ (Build: 20161125). It is an empty installation and I've been trying to move some courses to it from another site (the source site is Moodle 3.1.1+ Build: 20160825).

When restoring the course to the target site, I am getting:

Coding error detected, it must be fixed by a programmer: Invalid availability structure (unknown ->op)
More information about this error
Debug info: 
Error code: codingerror
Stack trace:
line 152 of /availability/classes/tree.php: coding_exception thrown
line 144 of /availability/classes/info.php: call to core_availability\tree->__construct()
line 114 of /availability/classes/info.php: call to core_availability\info->decode_availability()
line 318 of /availability/classes/info.php: call to core_availability\info->get_availability_tree()
line 907 of /backup/moodle2/restore_stepslib.php: call to core_availability\info->update_after_restore()
line 34 of /backup/util/plan/restore_execution_step.class.php: call to restore_update_availability->define_execution()
line 181 of /backup/util/plan/base_task.class.php: call to restore_execution_step->execute()
line 177 of /backup/util/plan/base_plan.class.php: call to base_task->execute()
line 167 of /backup/util/plan/restore_plan.class.php: call to base_plan->execute()
line 335 of /backup/controller/restore_controller.class.php: call to restore_plan->execute()
line 224 of /backup/util/ui/restore_ui.class.php: call to restore_controller->execute_plan()
line 111 of /backup/restore.php: call to restore_ui->execute()


It doesn't seem to be caused by any "restrictions/availability settings unique and specific to that course", as Ken suggested, because it happens even with a course which doesn't have any restrictions.

I've done some experiments and found the same results Mateusz noticed:

If I create an empty course (with just the news forum) on the 3.1.1 site, backup this course and restore it to the 3.1.3 site, the problem does not occur.

But as soon as I edit the name and summary of the "general" section of the course, the restore process produces the "invalid availability structure" error.

In reply to Przemyslaw Stencel

Re: Coding error during restore/import

by Przemyslaw Stencel -

I have no idea why, but changing the php version from 5.5 to 5.6 helped... mixed

Average of ratings: Useful (2)