Exception - Call to undefined method quiz_statistics\task\recalculate::set_last_run_time()

Exception - Call to undefined method quiz_statistics\task\recalculate::set_last_run_time()

- Ricardo Caiado の投稿
返信数: 21
画像 Particularly helpful Moodlers
Hi,

After upgrading from 4.1.5+ to 4.1.6, I got this error message when accessing "/admin/tool/task/scheduledtasks.php":

Exception - Call to undefined method quiz_statistics\task\recalculate::set_last_run_time()

More information about this error
Debug info:
Error code: generalexceptionmessage
Stack trace:

line 385 of /lib/classes/task/manager.php: Error thrown
line 530 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()

Ricardo


Ricardo Caiado への返信

Re: Exception - Call to undefined method quiz_statistics\task\recalculate::set_last_run_time()

- i an の投稿
C:\inetpub\wwwroot\admin\cli>php scheduled_task.php --execute="\quiz_statistics\task\recalculate" --force
!!! Exception - Call to undefined method quiz_statistics\task\recalculate::set_last_run_time() !!!
!!
Error code: generalexceptionmessage !!
!! Stack trace: * line 388 of \lib\classes\task\manager.php: Error thrown
* line 473 of \lib\classes\task\manager.php: call to core\task\manager::scheduled_task_from_record()
* line 123 of \admin\cli\scheduled_task.php: call to core\task\manager::get_scheduled_task()
!!

C:\inetpub\wwwroot\admin\cli>php scheduled_task.php --execute="\quiz_statistics\task\recalculate" --showsql
--------------------------------
SELECT * FROM mdl_task_scheduled WHERE classname = ?
[array (
0 => '\\quiz_statistics\\task\\recalculate',
)]
--------------------------------
Query took: 0.0030179023742676 seconds.
--------------------------------
!!! Exception - Call to undefined method quiz_statistics\task\recalculate::set_last_run_time() !!!
!!
Error code: generalexceptionmessage !!
!! Stack trace: * line 388 of \lib\classes\task\manager.php: Error thrown
* line 473 of \lib\classes\task\manager.php: call to core\task\manager::scheduled_task_from_record()
* line 123 of \admin\cli\scheduled_task.php: call to core\task\manager::get_scheduled_task()
!!

C:\inetpub\wwwroot\admin\cli>php scheduled_task.php --execute="\quiz_statistics\task\recalculate" --showdebugging
!!! Exception - Call to undefined method quiz_statistics\task\recalculate::set_last_run_time() !!!
!!
Error code: generalexceptionmessage !!
!! Stack trace: * line 388 of \lib\classes\task\manager.php: Error thrown
* line 473 of \lib\classes\task\manager.php: call to core\task\manager::scheduled_task_from_record()
* line 123 of \admin\cli\scheduled_task.php: call to core\task\manager::get_scheduled_task()
i an への返信

Re: Exception - Call to undefined method quiz_statistics\task\recalculate::set_last_run_time()

- Leon Stringer の投稿
画像 Core developers 画像 Particularly helpful Moodlers

It looks like the upgrade didn't complete successfully. In Moodle 4.2.3 and 4.1.6 there is no longer a quiz_statistics\task\recalculate scheduled task (MDL-79254) so Moodle shouldn't be attempting to run this. During the upgrade the mdl_task_scheduled record for this task should have been deleted.

Another possible explanation is the Moodle source code folder doesn't have the correct contents. Is the file mod/quiz/report/statistics/db/tasks.php present? It was present in 4.2.2 and 4.1.5 but should not be for 4.2.3 and 4.1.6.

You can probably fix this specific error by removing the record from the database (DELETE FROM mdl_task_scheduled WHERE classname = '\\quiz_statistics\\task\\recalculate'). But you may want to see if you can identify the cause of this because if one item was not upgraded correctly there may be others.

Leon Stringer への返信

Re: Exception - Call to undefined method quiz_statistics\task\recalculate::set_last_run_time()

- i an の投稿
Thanks both, I can see where the upgrade disabled this task, which it had done, but not where it deletes it, can you confirm where this is in the upgrade files so I can check? Removing the entry did resolve that error. I'm now left with the manage plugins screen (original error on other thread). It's almost certainly not a permissions issue and likely plugins, Although the errors aren't giving any hint of which plugin. (I also dislike working in Windows, this ins't my server).

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()

i an への返信

Re: Exception - Call to undefined method quiz_statistics\task\recalculate::set_last_run_time()

- Leon Stringer の投稿
画像 Core developers 画像 Particularly helpful Moodlers

I can see where the upgrade disabled this task, which it had done, but not where it deletes it, can you confirm where this is in the upgrade files so I can check?

On upgrade Moodle checks the db/tasks.php for every plugin – including core plugins such as quiz_statistics here – and compares the listed tasks to those in mdl_task_scheduled. It adds records for new tasks, and removes the records if they no longer appear in tasks.php. So if mod/quiz/report/statistics/db/tasks.php was somehow still present when upgrading to 4.2.3 then the record won't have been deleted and the error you reported will occur.

I'm not sure about the Unknown plugin type: core but Francesco reports he resolved this.

i an への返信

Re: Exception - Call to undefined method quiz_statistics\task\recalculate::set_last_run_time()

- Ken Task の投稿
画像 Particularly helpful Moodlers
@Ion ... we have posted in 2 different threads so it's getting confusing. 悲しい

In one of my responses I asked if you would redirect the listing of all scheduled task to a text file and then view the text file.

Reason: would show the column for 'last run'.
which it seems to be pointing to:
set_last_run_time()

You are on windows so does just plain ole php in front of that scheduled task command work?   Is that finding php-cli?

When you switched versions of code did you also change the DB that version was pointed to?

May as well go all in on checking:
in admin/cli/
php -v
php -i
php checks.php
php check_database_schema.php

and in your DB client - assuming mysql here as we've not said:
using the DB for the moodle

mysql> show tables like '%task%';
mysql> explain mdl_task_scheduled;
mysql> select lastruntime,nextruntime from mdl_task_scheduled;

There haven't been a bunch of 'me too's' in forums so .... guess we keep digging.

Oh, BTW, am not a Windows person. 笑顔

'SoS', Ken

Ken Task への返信

Re: Exception - Call to undefined method quiz_statistics\task\recalculate::set_last_run_time()

- i an の投稿
Nothing odd there, although this seems worrying (I think these were left behind by hotpot)

C:\inetpub\wwwroot\admin\cli>php uninstall_plugins.php  --show-missing
        hp
        html
        qedoc
        hp
        html
        qedoc
        analysis
        clicktrail
        overview
        responses
        scores

C:\inetpub\wwwroot\admin\cli>php uninstall_plugins.php  --purge-missing --run
Can not be uninstalled:         hp
Can not be uninstalled:         html
Can not be uninstalled:         qedoc
Can not be uninstalled:         hp
Can not be uninstalled:         html
Can not be uninstalled:         qedoc
Can not be uninstalled:         analysis
Can not be uninstalled:         clicktrail
Can not be uninstalled:         overview
Can not be uninstalled:         responses
Can not be uninstalled:         scores
i an への返信

Re: Exception - Call to undefined method quiz_statistics\task\recalculate::set_last_run_time()

- Ken Task の投稿
画像 Particularly helpful Moodlers
@ian
That's one messed up site! 悲しい

Plugins site for hotpot shows combat up to 4.0 but not for higher
https://moodle.org/plugins/mod_hotpot/versions

query:
select plugin from mdl_config_plugins where plugin like 'hotpot%';

Not sure about the 'like' in above ... am guessing that is what it would register.

Then you'd have to find all related tables in DB and remove those.

in /mod/hotpot/db there should be an install.xml file as well as an uninstall.php script.
Taking a peak at those might provide more info on how to eradicate.

Wishing you good luck!
'SoS', Ken

Ken Task への返信

Re: Exception - Call to undefined method quiz_statistics\task\recalculate::set_last_run_time()

- i an の投稿
Thanks Ken, Hotpot was actually removed prior to updating to Moodle 4 and it did run through it's uninstall process and removed the main components, looks like it left a few things behind though, I have now downloaded hotpot (not to the site) to review the uninstall file and am removing all instances manually. Looks like the error is now gone and the plugins page is loading, select plugin from mdl_config_plugins where plugin like 'hotpot%'; also now returns no results as does the Moodle CLI script, hopefully this has resolved the issue!

For anyone else who sees that error it's almost certainly a result of plugins not being removed properly, these have always been present though so it's only the latest update that seems to be particulary fussy about those being there.

Looks like the fix for most instances of this would be to review the output of the uninstall_plugins.php  --show-missing in the cli folder and then resolve any issues there, likely missing plugins OR previously removed plugins which have left a trail behind.

Many thanks for your help.
Ricardo Caiado への返信

Re: Exception - Call to undefined method quiz_statistics\task\recalculate::set_last_run_time()

- Ricardo Caiado の投稿
画像 Particularly helpful Moodlers
Vote for this "Update to 4.1.6 breaks on quiz statistics" (https://tracker.moodle.org/browse/MDL-79627)
Ricardo Caiado への返信

Re: Exception - Call to undefined method quiz_statistics\task\recalculate::set_last_run_time()

- Leon Stringer の投稿
画像 Core developers 画像 Particularly helpful Moodlers

MDL-79627 is not a bug in Moodle. The upgrade was performed incorrectly with one of the previous version's source files still present resulting in the Call to undefined method quiz_statistics\task\recalculate::set_minute() error. As the docs say:

Do NOT copy new files over the old files.

Leon Stringer への返信

Re: Exception - Call to undefined method quiz_statistics\task\recalculate::set_last_run_time()

- i an の投稿
Resolved, thanks or the help, it's not part of our standard procedure to replace all files during update for a 0.0.1 version update as it's never caused any issues before, I have now modified that procedure here. The main reason being plugins like course format plugins tend to reset course layouts if not present during update.

Whilst I 100% agree you are correct I suspect we will see quite a few instances of this particular bug and I can confirm removing the entry from the DB manually has worked.

I don't believe there are any other issues with the site and I've done an extensive amount of testing now. (if you are aware of anything to check regarding the latest updates that would be great)
i an への返信

Re: Exception - Call to undefined method quiz_statistics\task\recalculate::set_last_run_time()

- Ken Task の投稿
画像 Particularly helpful Moodlers
"it's not part of our standard procedure to replace all files during update for a 0.0.1 version update as it's never caused any issues before"

Huh?  Sounds like you need to explore the use of git to update/upgrade core moodle code!

'SoS', Ken

Leon Stringer への返信

Re: Exception - Call to undefined method quiz_statistics\task\recalculate::set_last_run_time()

- Séverin TERRIER の投稿
画像 Documentation writers 画像 Particularly helpful Moodlers 画像 Testers 画像 Translators
Just wanted to confirm here also that i had the same problem, after making the update (4.1.5 to 4.1.6), overwriting old files (and letting one that was deleted).

After deleting the file mod/quiz/report/statistics/db/tasks.php, and the line in mdl_task_scheduled table ( WHERE component='quiz_statistics'), as explained, everything was OK, as explained in my comments in MDL-79627.

Hope this helps other people having made the update the same way as me.

Séverin
Séverin TERRIER への返信

Re: Exception - Call to undefined method quiz_statistics\task\recalculate::set_last_run_time()

- Didier CABY の投稿
Bonjour Séverin,
Même problème après mise à jour en 4.2.3 +
J'ai suivi à la lettre la procédure décrite, et cela a effectivement résolu le problème. 
Merci pour ces explications
Didier
Ricardo Caiado への返信

Re: Exception - Call to undefined method quiz_statistics\task\recalculate::set_last_run_time()

- Robert Wagenhoffer の投稿
Same problem, have four instances first one updated no problem, have the same error on the second, afraid to try the others.

My client no longer wants to use Moodle, says you get what you pay for. Prior to this upgrade my sites were paralyzed because of a bug that impacted Articulate Storyline courses. Tired of spending hours debugging these types of problems.

Past few updates have been nothing but problems.
Robert Wagenhoffer への返信

Re: Exception - Call to undefined method quiz_statistics\task\recalculate::set_last_run_time()

- Ken Task の投稿
画像 Particularly helpful Moodlers
@Robert
If I recall correctly your issues with SCORM had to do with a ';' in a filename contained in a SCORM.   In that thread a user did post a fix for removing the ';' character from all files.

There are characters that should not be used in filenames.

So what was at fault .... moodle or the creator of the SCORM?

And, if I recall correctly you use Softaculous to upgrade .. is that correct?

Attempting to help those that use Softac, I came to the conclusion that Softac did fine on initial installs, but had issues with upgrading.  Am also of the opinion that hyperjumps ... upgrading past higher versions of Moodle have hidden/non-documented hickups ... case in point 3.11.highest hyperjump to 4.1.  In 4.0 there was a column added to a core table.
The hyperjump missed that minor change and thus when OP discovered the issue, had to resort to use mysql client to add the column.

Am not saying moodle is perfect and never to blame for issues.   SCORM's have had problems for many versions of Moodle.   Matter of fact, a large/influenical entity in Tx where I live had issues with SCORM's that could have been resolved by making the SCORM's without the quiz stuff at end of the SCORM, but entity didn't want to do that.

Result ... entity left Moodle and went with Canvas ... took many schools that used Moodle with them.

True ... you get what you pay for ... and that's something that every entity must decide for themselves.  Taking on a DIY moodle does mean OP has to know more about what's under the hood and have some expertise to fix.

It's always been advised to have a development site ... not really for customers use, but OP's use in testing/troubleshooting issues.  In your case, you could make no user backups of courses from other sites and restore/install them in the dev site for tinkering.

And, despite what the docs/pages, etc. says about admin'ing a moodle, I have come to the conclusion that having CLI access to the site is necessary - and knowing just enough to work with moodle from CLI - don't have to be a 'rocket sci' person either!

Arrived at that conclusion when noticing how many cli directories there were in moodle code.   Those exist for a reason ... to easily fix some issues for which the GUI just can't ... for whatever reason.

When it comes to initial install ... updating ... as well as upgrading ... research necessary for versions of PHP + php extensions, MySQL/MariaDB and plugins.   When comes to an existing site, Environment check very valuable.   Plugins ... a different story ... for that, however, moosh (a Swiss Army knife CLI utility for Moodle) can do.  As well as the use of git ... command line only ... for initial install, updates, and upgrades.  That takes the potential for human error semi out of the loop.

But, I'll be 100% honest since I don't work for a Moodle Partner ... if your sites use 100% SCORM, then maybe it's best for you to seek hosting that focuses on SCORM.  Can't recommend any for ya ... but they exist.   Me, I must continue to use Moodle cause it fits my retired teacher budget ... besides .... gives me something to play with when I am tired of  watching re-runs on TV - or get angry when watching the 'news' on TV! 笑顔

My 10 cents!
'SoS', Ken


  


Ken Task への返信

Re: Exception - Call to undefined method quiz_statistics\task\recalculate::set_last_run_time()

- Robert Wagenhoffer の投稿
Hi Ken,


Looks like the upgrade fixed the “{“ issue.  I was able to correct the other issue by using:

DELETE FROM mdl_task_scheduled WHERE classname = '\\quiz_statistics\\task\\recalculate'

I have not updated my two large production sites yet  I am away and doing this on a phone  Next week I will try and see what happens  

I am also taking your advise and not updating Moodle for some time after this   Turns out to be nothing but headaches every time  

Thank you for all the help  

Bob



Robert Wagenhoffer への返信

Re: Exception - Call to undefined method quiz_statistics\task\recalculate::set_last_run_time()

- Ken Task の投稿
画像 Particularly helpful Moodlers
Good to hear about fixing issues then.

"I am also taking your advise and not updating Moodle for some time after this"

Not sure I am following  the above ... I am of the camp of users that prefers long term support versions for a long time.   I also use command line git which allows me to do that as LTS versions do release code frequently ... containing either fixes to bugs or security updates.   That has served me well - but that's me!

But, have had clients that just had to have latest/greatest even if they did not know why or what new thing they thought would be mission critical.   Due to differences, those clients now have other technical support ... and I never hear from them nor do I check up on them.   Their choice ... and mine ... we part friendly. 笑顔

We all must choose our paths and methods of madness! 笑顔

'Spirit of Sharing', Ken

Ken Task への返信

Re: Exception - Call to undefined method quiz_statistics\task\recalculate::set_last_run_time()

- Visvanath Ratnaweera の投稿
画像 Particularly helpful Moodlers 画像 Translators
Ha, ha, ha! Now you are getting philosophical!

On "all must choose our paths and methods", tell me the one which is closer to heaven?
Visvanath Ratnaweera への返信

Re: Exception - Call to undefined method quiz_statistics\task\recalculate::set_last_run_time()

- Ken Task の投稿
画像 Particularly helpful Moodlers
'closer to heaven' ... is the path that's 'upwards' ... as opposed to 'downwards' ... or in context - H-LL! (if you are of that 'religion', that is! Boy!  Hard to be politically correct these days! :|

'SoS', Ken