Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-19774

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

    Details

    • Type: Bug
    • Status: Reopened
    • Priority: Critical
    • Resolution: Unresolved
    • Affects Version/s: 2.0
    • Fix Version/s: None
    • Component/s: Administration
    • Labels:

      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.

        Gliffy Diagrams

          Activity

          Hide
          jk3us 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
          jk3us 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
          skodak Petr Skoda added a comment -

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

          Petr Skoda

          Show
          skodak Petr Skoda added a comment - Thank you for the report, I have committed your fix into CVS. Petr Skoda
          Hide
          salvetore Michael de Raadt added a comment -

          Thanks for reporting this issue.

          We have detected that this issue has been inactive for over a year. It was reported as affecting versions that are no longer supported.

          If you believe that this issue is still relevant to current versions (2.5 and beyond), please comment on the issue. Issues left inactive for a further month will be closed.

          Michael d.

          TW9vZGxlDQo=

          Show
          salvetore Michael de Raadt added a comment - Thanks for reporting this issue. We have detected that this issue has been inactive for over a year. It was reported as affecting versions that are no longer supported. If you believe that this issue is still relevant to current versions (2.5 and beyond), please comment on the issue. Issues left inactive for a further month will be closed. Michael d. TW9vZGxlDQo=
          Hide
          salvetore Michael de Raadt added a comment -

          I'm closing this issue as it has been inactive for over a year has been recorded as affecting versions that are no longer supported.

          This is being done as part of a bulk annual clean-up of issues.

          If you still believe this is an issue in supported versions, please create a new issue.

          Show
          salvetore Michael de Raadt added a comment - I'm closing this issue as it has been inactive for over a year has been recorded as affecting versions that are no longer supported. This is being done as part of a bulk annual clean-up of issues. If you still believe this is an issue in supported versions, please create a new issue.
          Hide
          marina Marina Glancy added a comment -

          Reopening this issue: there is a TODO in Moodle core linking to this issue number. Issues with existing TODO or @todo in core will be either placed in Epic MDL-47779 or linked to it to prevent accidental closing in the future.

          Show
          marina Marina Glancy added a comment - Reopening this issue: there is a TODO in Moodle core linking to this issue number. Issues with existing TODO or @todo in core will be either placed in Epic MDL-47779 or linked to it to prevent accidental closing in the future.
          Hide
          marina Marina Glancy added a comment -

          This issue has been added to Epic MDL-47779 that collects together issues that have either TODO or @todo in core. This will help us to ensure that such issues will not be closed as inactive or developers accidentally forget to remove the TODO when working on it. If you prefer, you are welcome to remove the issue from Epic but in this case please create a link to MDL-47779 with the type "will help resolve". Thanks in advance

          Show
          marina Marina Glancy added a comment - This issue has been added to Epic MDL-47779 that collects together issues that have either TODO or @todo in core. This will help us to ensure that such issues will not be closed as inactive or developers accidentally forget to remove the TODO when working on it. If you prefer, you are welcome to remove the issue from Epic but in this case please create a link to MDL-47779 with the type "will help resolve". Thanks in advance

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated: