Moodle

cron should not use globals $PAGE or $USER. function cron_setup_user should go

Details

  • Type: Bug Bug
  • Status: Open Open
  • Priority: Critical Critical
  • Resolution: Unresolved
  • Affects Version/s: 2.0
  • Fix Version/s: DEV backlog
  • Component/s: Administration
  • Labels:
  • Affected Branches:
    MOODLE_20_STABLE

Description

I think that any code that may be used in a cron script should not rely on the globals $PAGE, $USER, etc.

Instead, it should take an explicit $page, $user arguments to any functions. Then we could delete the cron_setup_user function completely.

If that is not possible, perhaps for backwards compatibility, then we should not try to modify the global $PAGE. Instead we should create a new one when necessary.

Activity

Hide
Jay Knight added a comment -

I don't know it if this is really related to this bug, but a fix to this bug would make this go away too, I think:

In lib/sessionlib.php on line 971, $cronsession is created as an array instead of an object which eventually gets assigned to $SESSION. This messes stuff up later when it $SESSION is used as an object.

Show
Jay Knight added a comment - I don't know it if this is really related to this bug, but a fix to this bug would make this go away too, I think: In lib/sessionlib.php on line 971, $cronsession is created as an array instead of an object which eventually gets assigned to $SESSION. This messes stuff up later when it $SESSION is used as an object.
Hide
Petr Škoda (skodak) added a comment -

Thank you for the report, I have committed your fix into CVS.

Petr Skoda

Show
Petr Škoda (skodak) added a comment - Thank you for the report, I have committed your fix into CVS. Petr Skoda

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated: