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

Return more file database fields in core_files_get_files

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide
      1. In you private file areas create some directories and upload some files
      2. Enable "Mobile services": Plugins ► Web Services ► External services
      3. Create a Token for the user you used to upload the files:
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      4. Click add, select user and service (Mobile Service)
      5. Next, you can do a CURL REST call simulating a WS client:
        • You need to replace the instanceid with the user id you created the token for .
        • You also need to replace the wstoken and the URL of your moodle instance

          curl 'http://localhost/moodlebugs/webservice/rest/server.php?moodlewsrestformat=json' -H 'Pragma: no-cache' -H 'Origin: file://' -H 'Accept-Encoding: gzip,deflate,sdch' -H 'Accept-Language: es,en;q=0.8,de-DE;q=0.6,de;q=0.4' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1798.0 Safari/537.36' -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' -H 'Accept: application/json, text/javascript, */*; q=0.01' -H 'Cache-Control: no-cache' -H 'Cookie: MoodleSession=f40pv08phpbc79boa0oh8h2r94' -H 'Connection: keep-alive' --data 'contextid=-1&component=user&filearea=private&itemid=0&filepath=&filename=&contextlevel=user&instanceid=3&wsfunction=core_files_get_files&wstoken=493d2e785f81515296cf09e05f1f8179' --compressed
          

      6. Confirm that:
        • You receive a list of directories and files uploaded to the root of your private file area, both file and directories has the values filesize, author, timecreated and license populated (directories should have 0 for filesize and null for author and license)
      Show
      In you private file areas create some directories and upload some files Enable "Mobile services": Plugins ► Web Services ► External services Create a Token for the user you used to upload the files: Click on Site administration ► Plugins ► Web services ► Manage tokens Click add, select user and service (Mobile Service) Next, you can do a CURL REST call simulating a WS client: You need to replace the instanceid with the user id you created the token for . You also need to replace the wstoken and the URL of your moodle instance curl 'http://localhost/moodlebugs/webservice/rest/server.php?moodlewsrestformat=json' -H 'Pragma: no-cache' -H 'Origin: file://' -H 'Accept-Encoding: gzip,deflate,sdch' -H 'Accept-Language: es,en;q=0.8,de-DE;q=0.6,de;q=0.4' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1798.0 Safari/537.36' -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' -H 'Accept: application/json, text/javascript, */*; q=0.01' -H 'Cache-Control: no-cache' -H 'Cookie: MoodleSession=f40pv08phpbc79boa0oh8h2r94' -H 'Connection: keep-alive' --data 'contextid=-1&component=user&filearea=private&itemid=0&filepath=&filename=&contextlevel=user&instanceid=3&wsfunction=core_files_get_files&wstoken=493d2e785f81515296cf09e05f1f8179' --compressed Confirm that: You receive a list of directories and files uploaded to the root of your private file area, both file and directories has the values filesize, author, timecreated and license populated (directories should have 0 for filesize and null for author and license)
    • Affected Branches:
      MOODLE_28_STABLE
    • Fixed Branches:
      MOODLE_29_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-30239-master

      Description

      Some fields in the files table are not returned in the current function core_files_get_files ;

      timecreated
      timemodified
      hash
      userid
      mimetype
      filesize
      ...

      It seems that only the ones required by the mobile client are returned

      Since in 2.3 it's going to be some improvements in the File handling (mew tables and fields for the current tables) I think it's a good time for adding this new returned values

        Attachments

          Activity

            People

            Assignee:
            jleyva Juan Leyva
            Reporter:
            jleyva Juan Leyva
            Peer reviewer:
            Ankit Agarwal
            Integrator:
            Dan Poltawski
            Tester:
            Adrian Greeve
            Participants:
            Component watchers:
            Matteo Scaramuccia, Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Juan Leyva, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona)
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              11/May/15