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

Module updated/created event is called too early

    Details

    • Testing Instructions:
      Hide

      Create an activity module. Check no errors or warnings are generated.

      Edit an activity module's settings. Check no errors or warnings are generated.

      Moodle core doesn't actually consume the events it generates so the event generation cannot really be tested without writing additional code (http://docs.moodle.org/dev/Events_API).

      Show
      Create an activity module. Check no errors or warnings are generated. Edit an activity module's settings. Check no errors or warnings are generated. Moodle core doesn't actually consume the events it generates so the event generation cannot really be tested without writing additional code ( http://docs.moodle.org/dev/Events_API ).
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_21_STABLE, MOODLE_22_STABLE, MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_21_STABLE, MOODLE_22_STABLE
    • Pull Master Branch:
      MDL-29097_mod_update_create

      Description

      The event is basically called before some grade stuff and before the course cache has been rebuilt. To avoid having to do some trickery or rebuilding the course cache twice, just move the event triggers lower in the code. At the very least, this is now less code

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            salvetore Michael de Raadt added a comment -

            Thanks for providing a solution to that.

            Show
            salvetore Michael de Raadt added a comment - Thanks for providing a solution to that.
            Hide
            andyjdavis Andrew Davis added a comment -

            Thanks for that Mark. I've created a branch containing a slightly modified version of your patch.

            Show
            andyjdavis Andrew Davis added a comment - Thanks for that Mark. I've created a branch containing a slightly modified version of your patch.
            Hide
            andyjdavis Andrew Davis added a comment -

            Added testing instructions.

            Show
            andyjdavis Andrew Davis added a comment - Added testing instructions.
            Hide
            samhemelryk Sam Hemelryk added a comment -

            Looks good thanks Andrew, backport and up for integration.

            Only thing I noted is that you don't need to initialise $eventname as an empty string. I don't think we will ever add another if...else to that branch though so not an essential to remove it.

            Cheers
            Sam

            Show
            samhemelryk Sam Hemelryk added a comment - Looks good thanks Andrew, backport and up for integration. Only thing I noted is that you don't need to initialise $eventname as an empty string. I don't think we will ever add another if...else to that branch though so not an essential to remove it. Cheers Sam
            Hide
            andyjdavis Andrew Davis added a comment -

            Created the various branches.

            Initializing variables outside of if else structures is a habit from C+. In C+ a variable defined within an if goes out of scope when you leave the if. Variables defined inside an if and used outside of it still look wrong to me.

            Show
            andyjdavis Andrew Davis added a comment - Created the various branches. Initializing variables outside of if else structures is a habit from C+ . In C + a variable defined within an if goes out of scope when you leave the if. Variables defined inside an if and used outside of it still look wrong to me.
            Hide
            stronk7 Eloy Lafuente (stronk7) added a comment -

            The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week.

            TIA and ciao

            Show
            stronk7 Eloy Lafuente (stronk7) added a comment - The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week. TIA and ciao
            Hide
            nebgor Aparup Banerjee added a comment -

            ok, changes look good, this is in integration now.

            Show
            nebgor Aparup Banerjee added a comment - ok, changes look good, this is in integration now.
            Hide
            phalacee Jason Fowler added a comment -

            All good

            Show
            phalacee Jason Fowler added a comment - All good
            Hide
            stronk7 Eloy Lafuente (stronk7) added a comment -

            Many thanks for your collaboration, this code has been integrated upstream and it's available in all the repositories.

            Closing, ciao

            Show
            stronk7 Eloy Lafuente (stronk7) added a comment - Many thanks for your collaboration, this code has been integrated upstream and it's available in all the repositories. Closing, ciao

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  12/Mar/12