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

Move old PHP classes in core_question into the classes folder

      Some bits of the core_question code was written before automatic class loading was a thing. Becuase of db/renamedclasses.php, we should be able to fix this in a backwards-compatible way.

      I audited full search results for ^(abstract )?class in question. I ignored code within sub-plugins, and the backup folder.

      Some priciples I am following here:

      • classes which are designed to be used by calling code (e.g. question_bank, question_engine, question_display_options) are not renamed when being moved to a namespace. This allows any deprecation errors to be fixed just by adding a use statement.
      • This restriction does not apply to classes which are designed to be use by overriding them. For example base classes for types of plugins, since the class name should only really be referenced in the extends statement, so easy to update.

      I suggest the following class moves and renames:

      Old class New name old file comment
      qformat_default - format.php Hard to move because of mod_lesson horror. Leave for now.
      qformat_based_on_xml \core_question\local\format\xml_format_base format.php  
      core_question_bank_renderer \core_question\output\renderer renderer.php  
      question_behaviour \core_question\local\behaviour\behaviour_base behaviour/behaviourbase.php  
      question_behaviour_with_save \core_question\local\behaviour\behaviour_with_save behaviour/behaviourbase.php  

      Work in progress ...

            Unassigned Unassigned
            timhunt Tim Hunt
            Tim Hunt Tim Hunt
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 5 minutes
                5m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.