Upgrade from 4.1.1 to 4.2.3 coding error detected

Upgrade from 4.1.1 to 4.2.3 coding error detected

Julien Garrigue -
回帖数:19

Hello,

The upgrade process has been done nicely. However, when I go to site administration > plugin > plugin overview, I'm facing the following error :


Coding error detected, it must be fixed by a programmer: Unknown plugin type: core

More information about this error

Debug info:
Error code: codingerror

Debug info:
Error code: codingerror Stack trace:
  • line 1668 of \lib\classes\plugin_manager.php: coding_exception thrown
  • line 1019 of \lib\classes\plugin_manager.php: call to core_plugin_manager->is_plugintype_writable()
  • line 1663 of \admin\renderer.php: call to core_plugin_manager->is_remote_plugin_installable()
  • line 349 of \admin\renderer.php: call to core_admin_renderer->plugins_overview_panel()
  • line 217 of \admin\plugins.php: call to core_admin_renderer->plugin_management_page()

Also, when I go to Server > scheduled tasks, on top of the list, I have the following lines:

Failed to load task: \mod_customcert\task\email_certificate_task
  • line 376 of /lib/classes/task/manager.php: call to debugging()
  • line 598 of /lib/classes/task/manager.php: call to core\task\manager::scheduled_task_from_record()
  • line 105 of /admin/tool/task/scheduledtasks.php: call to core\task\manager::get_all_scheduled_tasks()
Failed to load task: \mod_hvp\task\look_for_updates
  • line 376 of /lib/classes/task/manager.php: call to debugging()
  • line 598 of /lib/classes/task/manager.php: call to core\task\manager::scheduled_task_from_record()
  • line 105 of /admin/tool/task/scheduledtasks.php: call to core\task\manager::get_all_scheduled_tasks()
Failed to load task: \mod_hvp\task\remove_old_auth_tokens
  • line 376 of /lib/classes/task/manager.php: call to debugging()
  • line 598 of /lib/classes/task/manager.php: call to core\task\manager::scheduled_task_from_record()
  • line 105 of /admin/tool/task/scheduledtasks.php: call to core\task\manager::get_all_scheduled_tasks()
Failed to load task: \mod_hvp\task\remove_old_log_entries
  • line 376 of /lib/classes/task/manager.php: call to debugging()
  • line 598 of /lib/classes/task/manager.php: call to core\task\manager::scheduled_task_from_record()
  • line 105 of /admin/tool/task/scheduledtasks.php: call to core\task\manager::get_all_scheduled_tasks()
Failed to load task: \mod_hvp\task\remove_tmpfiles
  • line 376 of /lib/classes/task/manager.php: call to debugging()
  • line 598 of /lib/classes/task/manager.php: call to core\task\manager::scheduled_task_from_record()
  • line 105 of /admin/tool/task/scheduledtasks.php: call to core\task\manager::get_all_scheduled_tasks()
the only 2 additional plugins are mod_customcert and mod_hvp

Does anyone could help me please?

Thank you
回复Julien Garrigue

Re: Upgrade from 4.1.1 to 4.2.3 coding error detected

Ken Task -
Particularly helpful Moodlers的头像
Qualification for this response: none!  I don't run Windows.

However, you could try this:

hvp
Download available H5P content types from h5p.org
done with a scheduled task:

\core\task\h5p_get_content_types_task

From command line change into code/admin/cli/ and run:

php scheduled_task.php --execute="\core\task\h5p_get_content_types_task"

the php above is php-cli - not the php that runs web services.

When that completes successfully, you should see:

Execute scheduled task: Download available H5P content types from h5p.org (core\task\h5p_get_content_types_task)
... started 17:48:12. Current memory use 4.1 MB.
30 new content types installed
... used 13035 dbqueries
... used 100.55925488472 seconds
Scheduled task complete: Download available H5P content types from h5p.org (core\task\h5p_get_content_types_task)

If you note, takes a long time 100+ seconds.  And since it's downloading and installing new content types, the web service user needs write access to do that!

If you set the path to php-cli in admin interface, there will be a run-now link
under that task when viewing via GUI.

While you are on command line and in code/admin/cli/, also run the cron job:
php cron.php [ENTER]

Don't be surprised if it appears to loop looking for adhoc_task!
Just as long as it finishes! 微笑

Good luck!

'SoS', Ken

回复Ken Task

Re: Upgrade from 4.1.1 to 4.2.3 coding error detected

Julien Garrigue -
Dear Ken,
Thank you for trying to help me.
Our website is hosted at gandi.net with the following address academ.900m.org

Unfortunately, the commands you suggest me to run didn't change anything.
I could run them and I got the expected messages of execution.


Just a detail question : how do I know the path to php-cli ? If you can't answer, it's not that important as now I know how to run cron.php. Thank you for the tricks.

Best regards,

Julien
回复Julien Garrigue

Re: Upgrade from 4.1.1 to 4.2.3 coding error detected

Ken Task -
Particularly helpful Moodlers的头像
path to php-cli
In terminal, issue:

which php [ENTER]

will show a path to a php.
to make sure it is php-cli, then use:
/path/seen/above/php -v

Example:
[root@server ~]# which php
/usr/bin/php

[root@server ~]# /usr/bin/php -v
PHP 7.4.33 (cli) (built: Aug  1 2023 09:00:17) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.33, Copyright (c), by Zend Technologies

See the 'cli'?

Your server is running PHP/8.1.16.

From a curl test to server, however:
?????
x-redirect-by: Moodle /lib/moodlelib.php:2787
via: 1.1 varnish (Varnish/6.3), 1.1 varnish (Varnish/6.3)

Varnish is caching software?   Might check into it's logs.

Uhhh ... if you are asking me about location of php-cli, how could you have done:
"I could run them and I got the expected messages of execution"

in debug line slashes lean to left ...
line 1668 of \lib\classes\plugin_manager.php: coding_exception thrown
which indicates Windows.

But the web errors show:
line 376 of /lib/classes/task/manager.php: call to debugging()
slashes lean to right - like Linux

Could you share one of these 'expected messages of execution' please!

'SoS', Ken



回复Ken Task

Re: Upgrade from 4.1.1 to 4.2.3 coding error detected

Julien Garrigue -
I could have done what you suggest me because your explanations are enough detailed. By the way, thank you for the cli explanation, now I have the "run now" link. In my case, the path is /opt/php-8.1/bin/php

About Varnish, I don't have access to the log
However, I've purged the cache.

I understand why you talk about windows. My own computer is windows but as Moodle is hosted on gandi's web server, I don't think there are fan of windows, there value is more opensource software but I can't guarantee.

I ran again the command line you gave me on your previous message and here is the result :

hosting-user@AcadeM-(Moodle-4:/srv/data/web/vhosts/academ.900m.org/htdocs/admin/cli$ php scheduled_task.php --execute="\core\task\h5p_get_content_types_task"
Execute scheduled task: Télécharger depuis h5p.org les types de contenus H5P disponibles (core\task\h5p_get_content_types_task)
... started 11:42:14. Current memory use 14.3 Mo.
0 new content types installed
... used 158 dbqueries
... used 0.49574303627014 seconds
Scheduled task complete: Télécharger depuis h5p.org les types de contenus H5P disponibles (core\task\h5p_get_content_types_task)
hosting-user@AcadeM-(Moodle-4:/srv/data/web/vhosts/academ.900m.org/htdocs/admin/cli$

However, yesterday, there was 2 new content types installed

Thank you for your help !
回复Julien Garrigue

Re: Upgrade from 4.1.1 to 4.2.3 coding error detected

Ken Task -
Particularly helpful Moodlers的头像
Welcome!  So you are fixed?

'SoS', Ken

回复Ken Task

Re: Upgrade from 4.1.1 to 4.2.3 coding error detected

Julien Garrigue -
Sorry, no, still same messages
回复Julien Garrigue

Re: Upgrade from 4.1.1 to 4.2.3 coding error detected

Ken Task -
Particularly helpful Moodlers的头像
So partially fixed. 伤心

Original "Unknown plugin type: core"

Is there an addon in the wrong place?

Happens when the step involving copying back into updated code the config.php file and addons.  Addons could be a block, a mod, a quiz type, a theme, a ... bunch of stuff depending upon what addons site had to begin with.

Did we copy back an entire code directory as opposed to only addon directories/files?

See if you can go directly to:
/admin/plugins.php
/admin/plugins.php?updatesonly=0&contribonly=1

And, turn on debugging all the way to developer level.   Might get more specific info about which core plugin type.

'SoS', Ken



回复Ken Task

Re: Upgrade from 4.1.1 to 4.2.3 coding error detected

Julien Garrigue -
I don't think there is something on the wrong place. To update Moodle I did :
- backup Database, moodledata folder and renamed htdocs folder in htdocs_old
- upload th new version of moodle in a new htdocs folder
- copy the config.php file from the old htdocs folder
- run the update process

We only have 2 plugins : mod_customcert and mod_hvp
No tweaks.

I've already turn on the debugging mode on developer level.

The direct links you gave me reached me to the same error page I post on my original message.

I have a new line on top of "Coding error detected,..." :
Deprecated: is_dir(): Passing null to parameter #1 ($filename) of type string is deprecated in /srv/data/web/vhosts/academ.900m.org/htdocs/lib/classes/plugin_manager.php on line 1040

Thank you for your help 微笑
回复Julien Garrigue

Re: Upgrade from 4.1.1 to 4.2.3 coding error detected

Ken Task -
Particularly helpful Moodlers的头像
When you:
- copy the config.php file from the old htdocs folder
You should also copy the 2 plugin directories for
mod_customcert and mod_hvp
in mod directory is there a 'customcert' directory?
in mod directory is there a 'hvp' directory?

line 1040 of that file is in this section of code in file given - * is the line in error:

            // Make sure we have write access to all the existing code.
*            if (is_dir($localinfo->rootdir)) {
                if (!$this->is_plugin_folder_removable($component)) {
                    $reason = 'notwritableplugin';
                    return false;
                }
            }
        }
     
        // Looks like it could work.
        return true;
    }

Comment suggest that permissions are an issue?

'SoS', Ken


回复Ken Task

Re: Upgrade from 4.1.1 to 4.2.3 coding error detected

Julien Garrigue -
Here is the solution !!
Indeed, I didn't copy the 2 plugin directories so I did it and now everything is working. I don't have any error anymore anywhere.

Thank you so much Ken!
回复Julien Garrigue

SOLVED Re: Upgrade from 4.1.1 to 4.2.3 coding error detected

Ken Task -
Particularly helpful Moodlers的头像
So it's solved!   Great!   Glad to hear it.

Maybe, in the future, you'll entertain the idea of a better way of updating/upgrading your moodle via git.   It's command line only, but well worth the effort to learn just enough CLI to get the job done.   One (among many) advantage in using git ... less prone to human error ... no 'moving' parts.  Code directory stays where it is and via git, only the changes that need be done are 'pulled in' to your core code.

Your 4.2.3 version is now 4.2.3+ (Build: 20231020) - updated just yesterday.   So your site is now a + update behind! 伤心

Just one last piece of free advice ... now that you have things working, make a full site backup of code, moodledata, and a DB dump. 微笑

'SoS', Ken



回复Ken Task

Re: SOLVED Re: Upgrade from 4.1.1 to 4.2.3 coding error detected

Julien Garrigue -
I would love to be able to update Moodle with git. However I didn't find, yet, a clear and enough detailed process for a beginner like me.
And also because I didn't use git source to install Moodle at the beginning, isn't it a problem now to do update with git?
回复Julien Garrigue

Re: SOLVED Re: Upgrade from 4.1.1 to 4.2.3 coding error detected

Ken Task -
Particularly helpful Moodlers的头像
"However I didn't find, yet, a clear and enough detailed process for a beginner like me"

Where have you looked?
'... clear and enough detailed process ...'  What does that mean?
One of the problems in writing documentation is difference in platforms and hosting.   How good are you at substituting values ... things like a path ... from documentation and applying those to your server environment?

"...isn't it a problem now to do update with git."

A little ... one has to do what Howard calls a 'side load'.  It's a one time thing to get your current code directory under git versioning.
But once done, you'll enjoy the time spent (maybe even some frustration at first).

As has always been recommended, a development instance of a moodle would be very appropriate for this.  For you, perfect time since you are on latest/greatest version of moodle.

I'll send you a PM with a link.   Go try it out and provide some feedback! 微笑

'SoS', Ken


回复Julien Garrigue

Re: SOLVED Re: Upgrade from 4.1.1 to 4.2.3 coding error detected

Visvanath Ratnaweera -
Particularly helpful Moodlers的头像 Translators的头像
回复Visvanath Ratnaweera

Re: SOLVED Re: Upgrade from 4.1.1 to 4.2.3 coding error detected

Ken Task -
Particularly helpful Moodlers的头像
Git for Admins doesn't cover:

"I didn't use git source to install Moodle at the beginning, isn't it a problem now to do update with git?"

Matter of fact, OP's hosting provider also has a doc on using git on providers hosting.

I tend to agree with OP ... not simple enough!

Is there an official Moodle HQ provided course for administration of a Moodle via git and command line?

A beginner using git for the first time would feel more comfortable IF there were specifics to hosting providers.  But I know that's really impossible due to the shear number of hosting providers and panels provided.

On my 'wish list' ... the downloads for moodle code include the hidden .git directory and files.   If they were present, there would be no need for a 'sideload' or an 'upload'. 微笑

'SoS', Ken

回复Ken Task

Re: Upgrade from 4.1.1 to 4.2.3 coding error detected

Adrian Guerra -
I had this same issue. So here is how I resolved it.

After upgrading to 4.3, I experienced a problem with blank pages. First, I remembered my last upgrade having problems with MFA, so I renamed the folder to "old.mfa" thinking Moodle would auto-disable it. Well, no. I read that you could disable it from the command line so I did. Secondly, I hard-coded the default theme in config.php to classic. I found that Boost worked better, so I changed it. Then I could access every page except for the Site Administration area. I cleared all the cache and still did not work. Apparently changing the folder name is not sufficient to keep Moodle from trying to access it. The "core" reference is indeed misleading. I fixed to problem by completely deleting the old.mfa folder. Then i was able to access the Plugin section and complete the upgrade.
回复Adrian Guerra

SOLVED Re: Upgrade from 4.1.1 to 4.2.3 coding error detected

Ken Task -
Particularly helpful Moodlers的头像
Congrats!

@Emma
MFA = multifactor authentication.
To be honest, I didn't know it existed either! :|

@Adrian Guerra
Do you happen to re-call what the former issue with mfa was?

Yes, renaming to 'old.mfa' wouldn't work as apache server can still see it,
thus moodle can also.   IF, however, you had renamed it '.mfa' - see the dot in front of
directory name?   Then apache can't see it thus moodle won't see it.

But your assessment that the 'core' reference is indeed misleading in your case
was right on target ... mfa isn't core.

You were using GUI upgrade ... I wonder if it would have been the same if one were doing the upgrade via command line as they don't use web services ... just php scripts talking to the DB server.

Anyway ... again ... CONGRATS!  I've added 'SOLVED' to the subject line in my response so folks know issue is resolved.
 
'SoS', Ken