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

Deprecate use of <modname>_get_file_info() and convert

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: Minor Minor
    • None
    • 2.2.1, 2.9
    • Files API
    • MOODLE_22_STABLE, MOODLE_29_STABLE

      As I noted in MDL-30709, it appears that file_info_context_module::get_file_info() has moved to use a new format for getting file info from modules:

      ...
              $functionname     = 'mod_'.$this->modname.'_get_file_info';
              $functionname_old = $this->modname.'_get_file_info';
       
              if (function_exists($functionname)) {
                  return $functionname($this->browser, $this->areas, $this->course, $this->cm, $this->context, $filearea, $itemid, $filepath, $filename);
              } else if (function_exists($functionname_old)) {
                  return $functionname_old($this->browser, $this->areas, $this->course, $this->cm, $this->context, $filearea, $itemid, $filepath, $filename);
              }

      There are no comments to this affect but it would make sense to choose one function name or the other and stick to it. The following files need to change if converting from MODNAME_get_file_info() to mod_MODNAME_get_file_info:

      mod/folder/lib.php:function folder_get_file_info($browser, $areas, $course, $cm, $context, $filearea, $itemid, $filepath, $filename) {
      mod/forum/lib.php:function forum_get_file_info($browser, $areas, $course, $cm, $context, $filearea, $itemid, $filepath, $filename) {
      mod/imscp/lib.php:function imscp_get_file_info($browser, $areas, $course, $cm, $context, $filearea, $itemid, $filepath, $filename) {
      mod/lesson/lib.php:function lesson_get_file_info($browser, $areas, $course, $cm, $context, $filearea, $itemid, $filepath, $filename) {
      mod/page/lib.php:function page_get_file_info($browser, $areas, $course, $cm, $context, $filearea, $itemid, $filepath, $filename) {
      mod/resource/lib.php:function resource_get_file_info($browser, $areas, $course, $cm, $context, $filearea, $itemid, $filepath, $filename) {
      mod/scorm/lib.php:function scorm_get_file_info($browser, $areas, $course, $cm, $context, $filearea, $itemid, $filepath, $filename) {
      mod/workshop/lib.php:function workshop_get_file_info($browser, $areas, $course, $cm, $context, $filearea, $itemid, $filepath, $filename) {

            Unassigned Unassigned
            dobedobedoh Andrew Lyons
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

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