Moodle
  1. Moodle
  2. MDL-31661

Deprecate use of <modname>_get_file_info() and convert

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.2.1
    • Fix Version/s: STABLE backlog
    • Component/s: Files API
    • Labels:
    • Affected Branches:
      MOODLE_22_STABLE
    • Rank:
      38235

      Description

      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) {
      

        Issue Links

          Activity

            People

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

              Dates

              • Created:
                Updated: