MDL-58285 tool_mobile: Web service generates incorrect fileurl on IIS
authorNeill Magill <neill.magill@nottingham.ac.uk>
Thu, 16 Mar 2017 12:08:36 +0000 (12:08 +0000)
committerNeill Magill <neill.magill@nottingham.ac.uk>
Thu, 16 Mar 2017 12:08:36 +0000 (12:08 +0000)
The tool_mobile_get_plugins_supporting_mobile generated an incorrect
fileurl on IIS. The /mobile/filename.zip part was generated as
\mobile\filename.zip, this failed the PARAM_URL check.

This change stops the use of OS specific directory separators and uses
the linux/web separator. PHP file functions recognise this properly.

admin/tool/mobile/classes/api.php

index 5e5836b..aea9aef 100644 (file)
@@ -84,7 +84,7 @@ class api {
                     );
 
                     // All the mobile packages must be under the plugin mobile directory.
-                    $package = $path . DIRECTORY_SEPARATOR . 'mobile' . DIRECTORY_SEPARATOR . $addonname . '.zip';
+                    $package = $path . '/mobile/' . $addonname . '.zip';
                     if (file_exists($package)) {
                         $plugininfo['fileurl'] = $CFG->wwwroot . '' . str_replace($CFG->dirroot, '', $package);
                         $plugininfo['filehash'] = sha1_file($package);