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

Add filesize as a new field returned in all the Web Services returning file information

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      The best way to check that everything is working after the refactor is via the Mobile app, in the Moodle site:

      • Create a forum post with attachments
      • Create a glossary entry with attachments
      • Create an assignment including attachments in the description (attached files, not in the description editor)

      Connect with the app to the site and check that you can see the glossary, forum and assignment attachments correctly.

      To check that now you can view the attached files size:

      1. As admin, enable "Mobile services": Plugins ► Web Services ► Mobile
      2. Create a Token for one user in the course where the forum with attachments is:
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      3. Next, you can do a CURL REST call simulating a WS client with the user.
        • You need to replace the wstoken, discussionid (the discussion id of the post with attachments) and the URL of your moodle instance

          curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'discussionid=X&wsfunction=mod_forum_get_forum_discussion_posts&wstoken=ffbe3a3002f235bf9d01fd9369e10b66&moodlewssettingfilter=true'| python -m "json.tool"

      4. Now check that you can see the attachments including the file size
      Show
      The best way to check that everything is working after the refactor is via the Mobile app, in the Moodle site: Create a forum post with attachments Create a glossary entry with attachments Create an assignment including attachments in the description (attached files, not in the description editor) Connect with the app to the site and check that you can see the glossary, forum and assignment attachments correctly. To check that now you can view the attached files size: As admin, enable "Mobile services": Plugins ► Web Services ► Mobile Create a Token for one user in the course where the forum with attachments is: Click on Site administration ► Plugins ► Web services ► Manage tokens Next, you can do a CURL REST call simulating a WS client with the user. You need to replace the wstoken, discussionid (the discussion id of the post with attachments) and the URL of your moodle instance curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'discussionid=X&wsfunction=mod_forum_get_forum_discussion_posts&wstoken=ffbe3a3002f235bf9d01fd9369e10b66&moodlewssettingfilter=true'| python -m "json.tool" Now check that you can see the attachments including the file size
    • Affected Branches:
      MOODLE_31_STABLE, MOODLE_32_STABLE
    • Fixed Branches:
      MOODLE_32_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-54941-master

      Description

      We need this field to calculate the size of all the information to be downloaded via the Mobile app. Reason is that we want to implement a pre-fetch (download) of all the activities data so the user can do the activity offline.

        Attachments

        1. app view.PNG
          app view.PNG
          27 kB
        2. web view.PNG
          web view.PNG
          60 kB

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  5/Dec/16