Quantcast
Channel: Backup and restore
Viewing all articles
Browse latest Browse all 6815

error cannot_precheck_wrong_status when trying to restore a course via admin/cli/restore_backup.php

$
0
0
by Miguel _.  

Hello,

I must have something wrong configured in my local environment, because I have tried to restore a MBZ on several moodle installations and it is always failing with error/cannot_precheck_wrong_status.

I have tested on a clean moodle installation (3.11.14). With the newly installed moodle, I create a course, enrol a user and add a tag. Then, via CLI, I generate an MBZ of the course and finally I try to restore it (CLI), then it throws the error (cannot_precheck_wrong_status).

My local environment:

  • Moodle 3.11.14+ (Build: 20230504)
  • php 8.0.28 + php-fpm
  • apache 2.4.6
  • postgresql 12.11

The steps I follow:

  • Clean installation moodle 3.11.14
  • Create course, enrol user, create a tag in the course
  • backup: /usr/bin/php admin/cli/backup.php --courseid=2 --destination=/tmp
  • restore: /usr/bin/php admin/cli/restore_backup.php --file=/tmp/backup-moodle2-course-2-testcourse2jun2023-20230602-1512.mbz --categoryid=1 --showdebugging=true

Error:

== Extracting backup file to: /var/www/html/tmpdir/1920/tmpdirmoodleclean/backup/restore_6479f8d0befdd ==
== Preprocessing backup file ==
instantiating restore controller bacdd916b2bdc0295a70c26a95fc52c4
setting controller status to 100
setting controller status to 200
== Cleaning temp data ==
Default exception handler: Exception - error/cannot_precheck_wrong_status Debug: 
Error code: generalexceptionmessage
* line 497 of /lib/setuplib.php: moodle_exception thrown
* line 105 of /admin/cli/restore_backup.php: call to print_error()
!!! Exception - error/cannot_precheck_wrong_status !!!
!! 
Error code: generalexceptionmessage !!
!! Stack trace: * line 497 of /lib/setuplib.php: moodle_exception thrown
* line 105 of /admin/cli/restore_backup.php: call to print_error()
 !!

Finally, in miscellaneous there remains the course that was to be restored, unfinished. If I try to delete this course, the following error occurs and I cannot delete it:

Default exception handler: Exception - max(): Argument #1 ($value) must contain at least one element Debug:
Error code: generalexceptionmessage
* line 287 of /course/format/lib.php: ValueError thrown
* line 287 of /course/format/lib.php: call to max()
* line 465 of /backup/moodle2/backup_stepslib.php: call to format_base->get_last_section_number()
* line 88 of /backup/util/plan/backup_structure_step.class.php: call to backup_course_structure_step->define_structure()
* line 181 of /backup/util/plan/base_task.class.php: call to backup_structure_step->execute()
* line 191 of /backup/util/plan/base_plan.class.php: call to base_task->execute()
* line 145 of /backup/util/plan/backup_plan.class.php: call to base_plan->execute()
* line 419 of /backup/controller/backup_controller.class.php: call to backup_plan->execute()
* line 132 of /admin/tool/recyclebin/classes/category_bin.php: call to backup_controller->execute_plan()
* line 185 of /admin/tool/recyclebin/lib.php: call to tool_recyclebin\category_bin->store_item()
* line 5015 of /lib/moodlelib.php: call to tool_recyclebin_pre_course_delete()
* line 68 of /course/delete.php: call to delete_course()
Potential coding error - existing temptables found when disposing database. Must be dropped!

Does anyone know why this might be happening?

Regards


Viewing all articles
Browse latest Browse all 6815

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>