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

deprecation warnings still shown on Moodle 4.1.10+ #857

Open
jpahullo opened this issue May 15, 2024 · 5 comments
Open

deprecation warnings still shown on Moodle 4.1.10+ #857

jpahullo opened this issue May 15, 2024 · 5 comments

Comments

@jpahullo
Copy link

jpahullo commented May 15, 2024

Description

Version

  • Plugin version.php:
$plugin->component = 'logstore_xapi';
$plugin->version = 2022101800;
$plugin->requires = 2020061500;
$plugin->supported = [39, 400];
$plugin->maturity = MATURITY_STABLE;
$plugin->release = '';
  • git commits:
* 544715d (HEAD -> master, origin/master) fix sco_launched transformation (#686)
* 4075847 Test cases ignore plugins that are not installed
* 5ee421e update supported versions via moodle-plugin-ci (#845)
* 58d8ce7 Allow get_string_html_removed transformer to handle null input (#839)
* 416b92c (tag: v4.7.0) Versions supported (#830)
[...]

Steps to reproduce the bug

  1. Enable developer level debug on Moodle.
  2. Uninstall plugin if exists from web administration. Delete files completely. Purge caches. See that no warning appear when going to administration page.
  3. Install plugin from master branch from github.
  4. Go to administration page
  5. See these deprecation warnings:
core\event\content_viewed has been deprecated. Please extend base event or other relevant abstract class.
line 32 of /lib/classes/event/content_viewed.php: call to debugging()
line 137 of /lib/classes/component.php: call to include_once()
line ? of unknownfile: call to core_component::classloader()
line 920 of /lib/classes/component.php: call to class_exists()
line 62 of /report/eventlist/classes/list_generator.php: call to core_component::get_component_classes_in_namespace()
line 101 of /admin/tool/log/store/xapi/src/transformer/get_event_function_map.php: call to report_eventlist_list_generator::get_all_events_list()
line 133 of /admin/tool/log/store/xapi/settings.php: call to src\transformer\get_event_function_map()
line 90 of /admin/tool/log/classes/plugininfo/logstore.php: call to include()
line 46 of /admin/tool/log/settings.php: call to tool_log\plugininfo\logstore->load_settings()
line 81 of /lib/classes/plugininfo/tool.php: call to include()
line 735 of /admin/settings/plugins.php: call to core\plugininfo\tool->load_settings()
line 8878 of /lib/adminlib.php: call to require()
line 8759 of /lib/adminlib.php: call to admin_get_root()
line 28 of /admin/search.php: call to admin_externalpage_setup()
core\event\course_module_instances_list_viewed has been deperecated. Please use core\event\course_module_instance_list_viewed instead
line 31 of /lib/classes/event/course_module_instances_list_viewed.php: call to debugging()
line 137 of /lib/classes/component.php: call to include_once()
line ? of unknownfile: call to core_component::classloader()
line 920 of /lib/classes/component.php: call to class_exists()
line 62 of /report/eventlist/classes/list_generator.php: call to core_component::get_component_classes_in_namespace()
line 101 of /admin/tool/log/store/xapi/src/transformer/get_event_function_map.php: call to report_eventlist_list_generator::get_all_events_list()
line 133 of /admin/tool/log/store/xapi/settings.php: call to src\transformer\get_event_function_map()
line 90 of /admin/tool/log/classes/plugininfo/logstore.php: call to include()
line 46 of /admin/tool/log/settings.php: call to tool_log\plugininfo\logstore->load_settings()
line 81 of /lib/classes/plugininfo/tool.php: call to include()
line 735 of /admin/settings/plugins.php: call to core\plugininfo\tool->load_settings()
line 8878 of /lib/adminlib.php: call to require()
line 8759 of /lib/adminlib.php: call to admin_get_root()
line 28 of /admin/search.php: call to admin_externalpage_setup()
core\event\role_capabilities_updated has been deprecated. Please use core\event\capability_assigned instead
line 31 of /lib/classes/event/role_capabilities_updated.php: call to debugging()
line 137 of /lib/classes/component.php: call to include_once()
line ? of unknownfile: call to core_component::classloader()
line 920 of /lib/classes/component.php: call to class_exists()
line 62 of /report/eventlist/classes/list_generator.php: call to core_component::get_component_classes_in_namespace()
line 101 of /admin/tool/log/store/xapi/src/transformer/get_event_function_map.php: call to report_eventlist_list_generator::get_all_events_list()
line 133 of /admin/tool/log/store/xapi/settings.php: call to src\transformer\get_event_function_map()
line 90 of /admin/tool/log/classes/plugininfo/logstore.php: call to include()
line 46 of /admin/tool/log/settings.php: call to tool_log\plugininfo\logstore->load_settings()
line 81 of /lib/classes/plugininfo/tool.php: call to include()
line 735 of /admin/settings/plugins.php: call to core\plugininfo\tool->load_settings()
line 8878 of /lib/adminlib.php: call to require()
line 8759 of /lib/adminlib.php: call to admin_get_root()
line 28 of /admin/search.php: call to admin_externalpage_setup()
mod_lesson\event\highscore_added has been deprecated. Since the functionality no longer resides in the lesson module.
line 31 of /mod/lesson/classes/event/highscore_added.php: call to debugging()
line 137 of /lib/classes/component.php: call to include_once()
line ? of unknownfile: call to core_component::classloader()
line 920 of /lib/classes/component.php: call to class_exists()
line 62 of /report/eventlist/classes/list_generator.php: call to core_component::get_component_classes_in_namespace()
line 101 of /admin/tool/log/store/xapi/src/transformer/get_event_function_map.php: call to report_eventlist_list_generator::get_all_events_list()
line 133 of /admin/tool/log/store/xapi/settings.php: call to src\transformer\get_event_function_map()
line 90 of /admin/tool/log/classes/plugininfo/logstore.php: call to include()
line 46 of /admin/tool/log/settings.php: call to tool_log\plugininfo\logstore->load_settings()
line 81 of /lib/classes/plugininfo/tool.php: call to include()
line 735 of /admin/settings/plugins.php: call to core\plugininfo\tool->load_settings()
line 8878 of /lib/adminlib.php: call to require()
line 8759 of /lib/adminlib.php: call to admin_get_root()
line 28 of /admin/search.php: call to admin_externalpage_setup()
mod_lesson\event\highscores_viewed has been deprecated. Since the functionality no longer resides in the lesson module.
line 31 of /mod/lesson/classes/event/highscores_viewed.php: call to debugging()
line 137 of /lib/classes/component.php: call to include_once()
line ? of unknownfile: call to core_component::classloader()
line 920 of /lib/classes/component.php: call to class_exists()
line 62 of /report/eventlist/classes/list_generator.php: call to core_component::get_component_classes_in_namespace()
line 101 of /admin/tool/log/store/xapi/src/transformer/get_event_function_map.php: call to report_eventlist_list_generator::get_all_events_list()
line 133 of /admin/tool/log/store/xapi/settings.php: call to src\transformer\get_event_function_map()
line 90 of /admin/tool/log/classes/plugininfo/logstore.php: call to include()
line 46 of /admin/tool/log/settings.php: call to tool_log\plugininfo\logstore->load_settings()
line 81 of /lib/classes/plugininfo/tool.php: call to include()
line 735 of /admin/settings/plugins.php: call to core\plugininfo\tool->load_settings()
line 8878 of /lib/adminlib.php: call to require()
line 8759 of /lib/adminlib.php: call to admin_get_root()
line 28 of /admin/search.php: call to admin_externalpage_setup()

Expected behaviour

  • Do not see any deprecation warning.

Actual behaviour

  • Listed some deprecation warnings.

Server information

  • mysql 8.0.

Client information

  • OS: linux
  • Browser: brave.

Additional information

  • I have just detected that the information from version.php ($plugin->supported = [39, 400];) does not related to that informed on Moodle Plugins: Logstore xAPI 2022101800 (Moodle 3.9, 3.10, 3.11, 4.0, 4.1). Should it include 401 in that range? It is not a problem for installing it on Moodle 4.1.*, though.
@jpahullo
Copy link
Author

I have checked the Moodle path for some of those events, like in:

https://github.com/moodle/moodle/tree/main/lib/classes/event

in particular:

https://github.com/moodle/moodle/blob/MOODLE_401_STABLE/lib/classes/event/content_viewed.php

and yes, there is the deprecation message.

If I understand it correctly, since this plugin collects all possible events in Moodle, we will see these deprecation messages, unfortunately.

So, maybe it is not a problem really. Maybe we just need to know that this deprecation warnings appear if developer level debug is activated on Moodle.

@jpahullo
Copy link
Author

The real problem, maybe, is that these deprecation messages appear everywhere, on every single page from administration menu and also on the Moodle Home page (moodle.url/). These deprecation messages do not appear on the moodle.url/my/ page nor on moodle.url/my/courses.php.

Should these deprecation messages appear only when editing the plugin parameters and while running the scheduled task, if the developer level debug is activated?

It is like the plugin is loaded on every single page.

If we are telling the plugin that the events will be sent through scheduled task, maybe there is no need to load the plugin on every page.

I do no know, just mentioning it.

Thanks,

Jordi

@jpahullo
Copy link
Author

What I detected also is that events from deprecation messages does not appear on the list of candidate events to send into the LRS. So, the list of events eligible to be sent into LRS seems correct.

The only problem is regarding seeing everywhere the deprecation messages.

Without this plugin, it does not happen.

Thanks,

Jordi

@jpahullo
Copy link
Author

jpahullo commented May 23, 2024

I have reached to know why this debugging messages are shown.

In our Moodle we make use of $CFG->debugusers = '...';. In the debugging() function, it is considered as $forceddebug if this variable is set and the current user is in that list of users.

My idea was what it is actually done already on the core:

https://github.com/moodle/moodle/blob/main/report/eventlist/classes/list_generator.php#L47-L52

However, I realize that having the $CFG->debugusers in use, it has no effect.

Would you like to be provided with a patch like this?

diff --git a/admin/tool/log/store/xapi/src/transformer/get_event_function_map.php b/admin/tool/log/store/xapi/src/transformer/get_event_function_map.php
index 4a325584277..1ed74740e03 100644
--- a/admin/tool/log/store/xapi/src/transformer/get_event_function_map.php
+++ b/admin/tool/log/store/xapi/src/transformer/get_event_function_map.php
@@ -97,8 +97,12 @@ function get_event_function_map() {
         '\totara_program\event\program_assigned' => 'totara_program\program_assigned'
     ];
 
+    global $CFG;
+    $debugusers = $CFG->debugusers;
+    $CFG->debugusers = '';
     $environmentevents = class_exists("report_eventlist_list_generator") ?
         array_keys(\report_eventlist_list_generator::get_all_events_list(false)) : array_keys($availableevents);
+    $CFG->debugusers = $debugusers;
 
     return array_filter($availableevents, function($k) use ($environmentevents) {
         return in_array($k, $environmentevents);

With this patch, we do not see any debugging message while navigating through administration options. It is really annoying.

What do you think?

Jordi

@jpahullo
Copy link
Author

Finally, we have added this patch #858 to our Moodle site, so that we would like to contribute it to you and this plugin.

Thanks a lot for your support.

Jordi

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

1 participant