Moodle 3.10 upgrade - add activity issue

Moodle 3.10 upgrade - add activity issue

by Ahmed Al Kahky -
Number of replies: 10

Hello All, 

      After upgrading to Moodle 3.10.2 I was unable to add activity and the following error appears in the javascript of adding activity:

"Coding error detected, it must be fixed by a programmer: Invalid component used in plugin/component_callback():"


Would you please let me know how to solve this issue?

Average of ratings: -
In reply to Ahmed Al Kahky

Re: Moodle 3.10 upgrade - add activity issue

by Leon Stringer -
Picture of Core developers Picture of Particularly helpful Moodlers

Which version did you upgrade from?

Enable debugging, this should show more details with the error:

Debug messages: DEVELOPER, Display debug messages: Yes

Does this happen when adding a specific activity or all activities?

In reply to Leon Stringer

Re: Moodle 3.10 upgrade - add activity issue

by Ahmed Al Kahky -
This happens when enabling course editing and clicking on "Add an activity or resource" nothing happens after that.
and from the javascript console the following error is displayed:

Message: "Coding error detected, it must be fixed by a programmer: Invalid component used in plugin/component_callback():"

Uncaught (in promise) {message: "Coding error detected, it must be fixed by a progr...id component used in plugin/component_callback():", errorcode: "codingerror", link: "https://learningsite/", moreinfourl: "https://docs.moodle.org/310/en/error/debug/codingerror"}errorcode: "codingerror"link: "https://learningsite/"message: "Coding error detected, it must be fixed by a programmer: Invalid component used in plugin/component_callback():"moreinfourl: "https://docs.moodle.org/310/en/error/debug/codingerror"_proto_: Object
m @ first.js:formatted:26191
g @ first.js:formatted:26210
Promise.then (async)
m @ first.js:formatted:26197
f @ first.js:formatted:26207
(anonymous) @ first.js:formatted:26212
(anonymous) @ first.js:formatted:26204
(anonymous) @ first.js:formatted:26333


in addition enabling the debug mode displayed the following errors:
Warning: include(): Failed opening '/var/www/moodle/admin/tool/local/version.php' for inclusion (include_path='/var/www/moodle/lib/pear:.:/usr/share/php') in /var/www/moodle/lib/classes/plugin_manager.php on line 314
Plugin tool_local does not declare valid $plugin->component in its version.php.
line 324 of /lib/classes/plugin_manager.php: call to debugging()
line 344 of /lib/classes/plugin_manager.php: call to core_plugin_manager->load_present_plugins()
line 221 of /lib/classes/plugininfo/base.php: call to core_plugin_manager->get_present_plugins()
line 147 of /lib/classes/plugininfo/base.php: call to core\plugininfo\base->load_disk_version()
line 100 of /lib/classes/plugininfo/base.php: call to core\plugininfo\base::make_plugin_instance()
line 404 of /lib/classes/plugin_manager.php: call to core\plugininfo\base::get_plugins()
line 72 of /admin/settings/messaging.php: call to core_plugin_manager->get_plugins_of_type()
line 8762 of /lib/adminlib.php: call to require()
line 19 of /admin/settings.php: call to admin_get_root()
In reply to Ahmed Al Kahky

Re: Moodle 3.10 upgrade - add activity issue

by Leon Stringer -
Picture of Core developers Picture of Particularly helpful Moodlers

Warning: include(): Failed opening '/var/www/moodle/admin/tool/local/version.php' for inclusion …

It looks like there's a folder in your Moodle source code file: admin/tool/local. This isn't part of Moodle and it's not a plugin from the directory. So either it's there by mistake and needs deleting, or it's an incompatible plugin that needs fixing (or removing).

If there are still problems, please tell us which version you upgraded from and how the upgrade was performed. If there are still JavaScript errors this can be caused by old source code files still present. This reply shows how to do this.

In reply to Leon Stringer

Re: Moodle 3.10 upgrade - add activity issue

by Ahmed Al Kahky -
upgrade was done from 3.7.3 to 3.10.2 using Git as instructed in
https://docs.moodle.org/310/en/Upgrading#Using_Git

So do you think in this case I should backup moodle directory and re-clone the code from git repository?
In reply to Ahmed Al Kahky

Re: Moodle 3.10 upgrade - add activity issue

by Leon Stringer -
Picture of Core developers Picture of Particularly helpful Moodlers

You shouldn't need to re-clone from the repository unless something has gone wrong with Git which is unlikely. Old files being left behind is normally a problem for people who don't use Git.

What does the command git status report?

Are there any files in admin/tool/local?

In reply to Leon Stringer

Re: Moodle 3.10 upgrade - add activity issue

by Ahmed Al Kahky -
git status is displaying the following error:
fatal: not a git repository (or any of the parent directories): .git

as for admin/tool/local, there is a directory called aws
In reply to Ahmed Al Kahky

Re: Moodle 3.10 upgrade - add activity issue

by Leon Stringer -
Picture of Core developers Picture of Particularly helpful Moodlers

Did you run git status from the Moodle source code folder? For example:

$ cd /var/www/moodle
$ git status

Because it's difficult to understand how the site was upgraded using Git if the Moodle source code directory isn't a Git repository. It should show something like the following (I have the Foundation Theme installed):

$ git status
On branch MOODLE_310_STABLE
Your branch is up to date with 'origin/MOODLE_310_STABLE'.

Untracked files:
  (use "git add <file>..." to include in what will be committed)

    theme/foundation/

nothing added to commit but untracked files present (use "git add" to track)

From that directory, admin/tool/local/aws, I assume this is the Catalyst plugin "Amazon's SDK for PHP". It should be in the directory /var/www/moodle/local/aws not /var/www/moodle/admin/tool/local/aws.

In reply to Leon Stringer

Re: Moodle 3.10 upgrade - add activity issue

by Ahmed Al Kahky -
I run the command form /var/www/moodle and I am getting the same error: fatal: not a git repository (or any of the parent directories): .git

As for AWS directory, it is Catalyst plugin.

so what do you recommend in such case?
In reply to Ahmed Al Kahky

Re: Moodle 3.10 upgrade - add activity issue

by Leon Stringer -
Picture of Core developers Picture of Particularly helpful Moodlers

You may want to investigate your previous steps as, from what you've described, Git was used to obtain and upgrade the Moodle source code, but now the source code is no longer managed by Git. I can't explain that.

I think the steps you want now are:

  1. Make a list of any additional plugins/themes installed on the site, from Site administration ▸ Plugins ▸ Plugins overview, Additional plugins.
  2. Back up the current source code, for example: mv /var/www/moodle /var/www/moodle.backup.
  3. Use Git to obtain the Moodle source code, for example git clone git://git.moodle.org/moodle.git --branch MOODLE_310_STABLE /var/www/moodle.
  4. Copy config.php and any plugins/themes from the backup directory. For example for config.php: cp /var/www/moodle.backup/config.php /var/www/moodle.
  5. Move the AWS plugin to the correct location, for example mv /var/www/moodle.backup/admin/tool/local/aws /var/www/moodle/local.
Then log in. You'll probably be prompted to install the AWS plugin.
In reply to Leon Stringer

Re: Moodle 3.10 upgrade - add activity issue

by Ahmed Al Kahky -
Thanks a million Leon, I followed your instruction and it is now working correctly.