Moodle
  1. Moodle
  2. MDL-33061

META : Remove deprecated api function get_context_instance() and replace calls with context_XXX::instance()

    Details

    • Type: Task Task
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.3
    • Fix Version/s: None
    • Component/s: Libraries
    • Affected Branches:
      MOODLE_23_STABLE
    • Rank:
      40241

      Description

      The get_context_instance() function was marked as deprecated in 2.1.

      We need to change any call to get_context_instance() to context_xxxx::instance() and then remove the get_context_instance() itself.

      There are other library functions that utilise this call. They should be changed over as well.

        Issue Links

        Progress
        Resolved Sub-Tasks

        Sub-Tasks

        1.
        Replace get_context_instance with context_XXXX::instance() in set location (group 1) Sub-task Closed Frédéric Massart
         
        2.
        Replace get_context_instance with context_XXXX::instance() in set location (group 2) Sub-task Closed Frédéric Massart
         
        3.
        Replace get_context_instance with context_XXXX::instance() in set location (group 3) Sub-task Closed Adrian Greeve
         
        4.
        Replace get_context_instance with context_XXXX::instance() in set location (group 4) Sub-task Closed Ankit Agarwal
         
        5.
        Replace get_context_instance with context_XXXX::instance() in set location (group 5) Sub-task Closed Frédéric Massart
         
        6.
        Replace get_context_instance with context_XXXX::instance() in set location (group 6) Sub-task Closed Frédéric Massart
         
        7.
        Replace get_context_instance with context_XXXX::instance() in set location (group 7) Sub-task Closed Adrian Greeve
         
        8.
        Replace get_context_instance with context_XXXX::instance() in set location (group 8) Sub-task Closed Adrian Greeve
         
        9.
        Replace get_context_instance with context_XXXX::instance() in set location (group 9) Sub-task Closed Frédéric Massart
         
        10.
        Replace get_context_instance with context_XXXX::instance() in set location (group 10) Sub-task Closed Frédéric Massart
         
        11.
        Replace get_context_instance with context_XXXX::instance() in set location (group 11) Sub-task Closed David Monllaó
         
        12.
        Replace get_context_instance with context_XXXX::instance() in set location (group 12) Sub-task Closed David Monllaó
         
        13.
        Replace get_context_instance with context_XXXX::instance() in set location (group 13) Sub-task Closed Ankit Agarwal
         
        14.
        Replace get_context_instance with context_XXXX::instance() in set location (group 14) Sub-task Closed Ankit Agarwal
         
        15.
        Replace get_context_instance with context_XXXX::instance() in set location (group 15) Sub-task Closed Adrian Greeve
         
        16.
        Replace get_context_instance with context_XXXX::instance() in set location (group 16) Sub-task Closed Ankit Agarwal
         
        17.
        Replace get_context_instance with context_XXXX::instance() in set location (Cleanup issue) Sub-task Closed Ankit Agarwal
         

          Activity

          Hide
          Ankit Agarwal added a comment -

          My -1 for removing the function in 2.4
          IMO we shouldn't remove the function get_context_instance() itself in 2.4, as it is one of the most commonly and widely used function.

          Although the function was marked deprecated in 2.1, but it doesn't generate any warning. So there is no way for external developers to know about it.

          I would suggest we change all instances of this to respective class and introduce a deprecated warning in 2.4 and later remove the function in 2.6

          Thanks

          Show
          Ankit Agarwal added a comment - My -1 for removing the function in 2.4 IMO we shouldn't remove the function get_context_instance() itself in 2.4, as it is one of the most commonly and widely used function. Although the function was marked deprecated in 2.1, but it doesn't generate any warning. So there is no way for external developers to know about it. I would suggest we change all instances of this to respective class and introduce a deprecated warning in 2.4 and later remove the function in 2.6 Thanks
          Hide
          Martin Dougiamas added a comment - - edited

          Agreed. In fact the old function shouldn't be removed for a very long time. This whole issue is just about replacing calls to the function in core code.

          Show
          Martin Dougiamas added a comment - - edited Agreed. In fact the old function shouldn't be removed for a very long time. This whole issue is just about replacing calls to the function in core code.
          Show
          Ankit Agarwal added a comment - Related docs have been updated:- http://docs.moodle.org/dev/Access_API#Context_fetching http://docs.moodle.org/dev/Roles_and_modules#Context Post in the forum:- http://moodle.org/mod/forum/discuss.php?d=208283 Thanks
          Hide
          Michael de Raadt added a comment -

          Carrying over to the next sprint.

          Show
          Michael de Raadt added a comment - Carrying over to the next sprint.
          Hide
          Adrian Greeve added a comment -

          All subtasks completed. Issue closed.

          Show
          Adrian Greeve added a comment - All subtasks completed. Issue closed.

            People

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

              Dates

              • Created:
                Updated:
                Resolved: