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

WS responses are not compatible on site error or upgrade

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide
      • As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings
      • Create a Token in the mobile app service for user s1
        • Click on Site administration ► Plugins ► Web services ► Manage tokens.
      • Edit the config.php and add a print_error right after the require setup.php line (around line 35-36).

        print_error('upgraderunning');

      • Open the console an execute this new curl request, replacing wstoken with the s1 token and the site url with yours.

        curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=core_block_get_dashboard_blocks&wstoken=630bfa4f38f4993f1514bea8a967e2fb&returncontents=1' | python -m "json.tool"

      • Confirm you receive an exception:

        "errorcode": "upgraderunning",
        "exception": "moodle_exception",
        "message": "Site is being upgraded, please retry later."

         

      Show
      As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings Create a Token in the mobile app service for user s1 Click on Site administration ► Plugins ► Web services ► Manage tokens. Edit the config.php and add a print_error right after the require setup.php line (around line 35-36). print_error('upgraderunning'); Open the console an execute this new curl request, replacing wstoken with the s1 token and the site url with yours. curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=core_block_get_dashboard_blocks&wstoken=630bfa4f38f4993f1514bea8a967e2fb&returncontents=1' | python -m "json.tool" Confirm you receive an exception: "errorcode": "upgraderunning", "exception": "moodle_exception", "message": "Site is being upgraded, please retry later."  
    • Affected Branches:
      MOODLE_29_STABLE, MOODLE_30_STABLE, MOODLE_31_STABLE, MOODLE_37_STABLE
    • Fixed Branches:
      MOODLE_39_STABLE
    • Pull Master Branch:
      MDL-54799-master

      Description

      When calling a WebService, if there's a site error (i.e config) or the site is upgrading it returns a HTML with the same content as web client.

      It should return a WS compatible error message to avoid errors in app and WS clients.

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                11/May/20

                Time Tracking

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 4 hours, 45 minutes
                4h 45m