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

Replace add_to_log with an event trigger - tag

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.6
    • Fix Version/s: 2.7
    • Component/s: Tags
    • Labels:
    • Testing Instructions:
      Hide
      Test 1
      1. Run "vendor/bin/phpunit tag/tests/events_test.php" and ensure all passes.
      Test 2
      1. Visit <yoursite>/admin/settings.php?section=managelogging and enable 'Standard log'.
      2. Visit <yoursite>/admin/settings.php?section=optionalsubsystems and check 'Enable tags functionality' and 'Save changes' - if not already enabled.
      3. Visit <yoursite>/admin/settings.php?section=blocksettingtags and check 'Show course tags' and 'Save changes' - if not already enabled.
      4. Open up another tab and go to <yoursite>/report/log/index.php and select the 'Standard log'. View this tab whenever the testing instructions say to view any new events that were added.
      5. Visit a course.
      6. Add the 'Tags' block.
      7. Add a tag to the course (remember the name).
      8. Check the log report and ensure there is a 'Tag created', 'Tag updated' (the reason there is a 'Tag updated' event is because once the tag has been created the type is then set - I don't know why the API was designed this way but it is out of the scope of this issue) and then a 'Item tagged' event.
      9. Add a wiki to the course.
      10. Create the first page and add the same tag you used earlier to the page.
      11. Check that there is an 'Item tagged' event in the log report.
      12. Now completely remove the wiki instance.
      13. Check that there is an 'Item untagged' event in the log report.
      14. Go back to the course page and select "Edit my tags".
      15. Remove the tag.
      16. Check that there is an 'Item untagged' and a 'Tag deleted' event.
      Show
      Test 1 Run "vendor/bin/phpunit tag/tests/events_test.php" and ensure all passes. Test 2 Visit <yoursite>/admin/settings.php?section=managelogging and enable 'Standard log'. Visit <yoursite>/admin/settings.php?section=optionalsubsystems and check 'Enable tags functionality' and 'Save changes' - if not already enabled. Visit <yoursite>/admin/settings.php?section=blocksettingtags and check 'Show course tags' and 'Save changes' - if not already enabled. Open up another tab and go to <yoursite>/report/log/index.php and select the 'Standard log'. View this tab whenever the testing instructions say to view any new events that were added. Visit a course. Add the 'Tags' block. Add a tag to the course (remember the name). Check the log report and ensure there is a 'Tag created', 'Tag updated' (the reason there is a 'Tag updated' event is because once the tag has been created the type is then set - I don't know why the API was designed this way but it is out of the scope of this issue) and then a 'Item tagged' event. Add a wiki to the course. Create the first page and add the same tag you used earlier to the page. Check that there is an 'Item tagged' event in the log report. Now completely remove the wiki instance. Check that there is an 'Item untagged' event in the log report. Go back to the course page and select "Edit my tags". Remove the tag. Check that there is an 'Item untagged' and a 'Tag deleted' event.
    • Affected Branches:
      MOODLE_26_STABLE
    • Fixed Branches:
      MOODLE_27_STABLE
    • Pull Master Branch:
      MDL-40908_master
    • Story Points:
      40
    • Sprint:
      BACKEND Sprint 12

      Description

      Replace the add_to_log calls for the following area, with a call to the get_legacy_logdata function in the event class.

      tag
      /tag/coursetagslib.php:304: add_to_log($courseid, 'coursetags', 'add', $url, 'Course tagged');
      /tag/edit.php:138: add_to_log($COURSE->id, 'tag', 'update', 'index.php?id='. $tag->id, $tag->name . '>'. $tagnew>name);
      /tag/edit.php:141: add_to_log($COURSE->id, 'tag', 'update', 'index.php?id='. $tag->id, $tag->name);
      /tag/user.php:50: add_to_log(SITEID, 'tag', 'flag', 'index.php?id='. $tagid, $tagid, '', $USER->id);

      Suggested additional events
      tag deleted

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              markn Mark Nelson
              Reporter:
              abgreeve Adrian Greeve
              Peer reviewer:
              Marina Glancy
              Integrator:
              Sam Hemelryk
              Tester:
              Adrian Greeve
              Participants:
              Component watchers:
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                12/May/14