Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show Action failing in Adhoc Task - Moodle 3.11.8 #8

Open
jmerrill86 opened this issue Aug 19, 2022 · 3 comments
Open

Show Action failing in Adhoc Task - Moodle 3.11.8 #8

jmerrill86 opened this issue Aug 19, 2022 · 3 comments
Assignees

Comments

@jmerrill86
Copy link

When using the plugin to create an adhoc task to hide courses everything is working as expected. However, when using the plugin to change courses in a category to a state of "show", the plugin fails with an invalid function call to core_course\management\course_change_visibility() which is odd as this is failing on line 91 where it is calling the method from the helper class in the plugin code.

... started 02:05:06. Current memory use 49.7MB.
... used 3 dbqueries
... used 0.062679052352905 seconds
Adhoc task failed: tool_hidecourses\task\hide_courses_task,Call to undefined function core_course\management\course_change_visibility()
Backtrace:
* line 91 of /admin/tool/hidecourses/classes/task/hide_courses_task.php: call to core_course\management\helper::action_course_show()
* line 341 of /lib/cronlib.php: call to tool_hidecourses\task\hide_courses_task->execute()
* line 198 of /lib/cronlib.php: call to cron_run_inner_adhoc_task()
* line 76 of /lib/cronlib.php: call to cron_run_adhoc_tasks()
* line 178 of /admin/cli/cron.php: call to cron_run()

I've been able to recreate this in multiple Moodle 3.11.8 environments using version 3.6.0 of the plugin where the behavior is the same. Please let me know if you need other information.

@mackensen mackensen self-assigned this Aug 25, 2022
@mackensen
Copy link
Contributor

@inkjet2000 that's a strange error; I have a vague guess as to how it could happen. I've written another test that might give me more insight into what's going on.

@mackensen
Copy link
Contributor

Well, I can reproduce in a development environment although the tests still pass.

@mackensen
Copy link
Contributor

I think this amounts to a core bug; I don't know why it doesn't fail consistently. course_change_visibility() isn't wrapped in a class; it lives in course/lib.php. core_course\management\helper::action_course_show(), which is namespaced, references the function without a backslash. I will follow up with Moodle core. On your environment, try replacing the reference to course_change_visibility in core_course\management\helper::action_course_show() with \course_change_visibility. You'll need to purge your cache after doing so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants