Uploaded image for project: 'Plugins'
  1. Plugins
  2. CONTRIB-5357

Instance store to manage stored instances of Dataform managers

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.6.5, 2.7.2
    • Fix Version/s: 2.7.3, 2.8
    • Component/s: Set: Dataform
    • Labels:
      None
    • Affected Branches:
      MOODLE_26_STABLE, MOODLE_27_STABLE
    • Fixed Branches:
      MOODLE_27_STABLE, MOODLE_28_STABLE

      Description

      The Dataform class and Dataform managers classes (e.g. field manager, view manager etc.) can store active instances during script runtime. In current implementation the instances are stored in a static variable inside a class::instance() method. Conseqently, stored instances cannot be cleaned up from the outside. While this may not have any particular effect in normal operation of the Dataform, it may pose a problem during testing where tests may be run in a group and the static array of instances might not be initialized at the beginning of each test.

      The proposed solution is to extract the instances management to a designated class 'instance_store' which will provide the api for registering, unregistering and retrieving an instance.

      Since all instances belong to a specific dataform, the list can be associative with dataform ids as keys. Manager instances reside in inner lists for each dataform id. This way, on deleting a dataform all stored instances can be cleaned up by unsetting the list entry of the target dataform.

        Attachments

          Activity

            People

            • Assignee:
              itamart Itamar Tzadok
              Reporter:
              itamart Itamar Tzadok
              Tester:
              Itamar Tzadok
              Participants:
              Component watchers:
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                10/Nov/14