gjbarnard / moodle-format_grid

Grid course format contributed by Gareth J Barnard originally created by Paul Krix
GNU General Public License v3.0
21 stars 55 forks source link

Exception when using course import function #144

Closed anieminen closed 2 years ago

anieminen commented 3 years ago

Hi,

We are getting an error "_Exception - Class 'formatgrid' not found" when importing from a Grid course to another course that is not using Grid format. I wasn't able to reproduce the error myself, but I found a couple of these in the web server logs.

That exception is thrown when course_restored event observer is triggered, so this doesn't affect the actual course import/restore process. Here is the full error message: Default exception handler: Exception - Class 'format_grid' not found Debug: \nError code: generalexceptionmessage\n* line 70 of /course/format/grid/classes/observer.php: Error thrown\n* line 63 of /course/format/grid/classes/observer.php: call to format_grid_observer::delete_images_and_summary()\n* line ? of unknownfile: call to format_grid_observer::course_restored()\n* line 155 of /lib/classes/event/manager.php: call to call_user_func()\n* line 75 of /lib/classes/event/manager.php: call to core\\event\\manager::process_buffers()\n* line 834 of /lib/classes/event/base.php: call to core\\event\\manager::dispatch()\n* line 195 of /backup/util/plan/restore_plan.class.php: call to core\\event\\base->trigger()\n* line 385 of /backup/controller/restore_controller.class.php: call to restore_plan->execute()\n* line 193 of /backup/import.php: call to restore_controller->execute_plan()\n, referer: https://<moodle-url>/backup/import.php

gjb2048 commented 3 years ago

@anieminen Thanks for the info, what version of Grid are you using please?

anieminen commented 3 years ago

Grid version is: 3.9.1.3 (2020070704) Moodle version: 3.9.7

gjb2048 commented 3 years ago

@anieminen Thanks.

gjb2048 commented 3 years ago

@anieminen I was not able to reproduce the error when I imported a Grid course into another non Grid course, ran cron, looked in the logs etc. But the code looked iffy, so please could you patch your version with https://github.com/gjb2048/moodle-format_grid/commit/c59e788b6c32a52eeb5eaab2078801e4f8fc8408 and let me know.

anieminen commented 3 years ago

@gjb2048 Thanks for the quick fix. I am also still not able to reproduce the problem, but I will try to get some more details.

gjb2048 commented 3 years ago

Released: https://moodle.org/mod/forum/discuss.php?d=424140.