-
Bug
-
Resolution: Fixed
-
Major
-
2.6.4, 2.7.1, 2.8
-
Linux Debian 7.2
PHP 5.5.15
-
PostgreSQL
-
MOODLE_26_STABLE, MOODLE_27_STABLE, MOODLE_28_STABLE
-
MOODLE_26_STABLE, MOODLE_27_STABLE
-
MDL-46539-fix-28 -
-
Easy
-
Hi,
Today I upgraded our Moodle instance from latest 2.6 stable to latest 2.7 stable.
I'm using the MOODLE_27_STABLE branch.
I noticed that we get a lot "calendar_event_updated" events on every cron cycle run.
The user with id '2' updated the event 'Progr1 Final Coding Quiz - Group B' with id '690'.
.................
It seems that all update events are from assignments.
How to reproduce:
Add an assignment with "always show description == 0" and set "allow submission from date".
check the query in mod/assign/locallib.php cron(), line 1755
With our "lastcron == 0" we get on every cron() run for all assigments with "always show description == 0" a event log item added to our log.
After digging into the sources, I found one possible solution for my problem.
In "mod/assign/locallib.php" function cron()
locallib.php |
public static function cron() {
|
......
|
$lastcron = $DB->get_field('modules', 'lastcron', array('name'=>'mod_assign'));
|
should be changed to the correct 'name'
|
$lastcron = $DB->get_field('modules', 'lastcron', array('name'=>'assign'));
|
.....
|
}
|
The lastcron field is never set because the cron() function which is called from "assign_cron" in "mod/assign/lib.php" returns "true" but then the return data goes into Nirvana
Normally assign_cron() should return "true/false" to signal the caller to store the last cron call time
Currently assign_cron() in "mod/assign/lib.php" don't return anything.
Moreover this assig_cron() seems to be a special problem because this function also is calling some submodules crons. The question is where to put the "last cron" field setter for the assign cron task.
My proposal would be to add the "lastcron" field setter to:
locallib.php |
public static function cron() {
|
......
|
$DB->set_field('modules', 'lastcron', $timenow, array('name' => 'assign'));
|
return true;
|
}
|
regards
Mario