Skip to content

Remove upload.php

Fridtjof requested to merge clean-upload.php into master

Closes none

What does this MR do?

While investigating the code base for another clean up, I noticed the file upload.php, sitting at the root of the codebase.

Looking for references to this file/endpoint, I found one in src/Lib/View/Utils.php, in the method v_photo_edit.

This method is used:

  • in FoodsaverControl#picture_box - this one is unused, checked by grepping the entire repository
  • in SettingsView#picture_box - this one is used, through SettingsControl#general => SettingsControl#picture_box. That is the Settings page, where you can upload/edit an image on the right side.

I ended up adding error_log statements to all possible code paths (they all depend on a POST request to /upload.php, otherwise nothing happens). None of them logged to the console while uploading a photo. To verify, I added a log statement right at the start, which got properly executed.

To see if it is still used by e.g. the mobile app, i searched the entire foodsharing-dev organization for "upload.php", which only turned up issue #482 (closed), which I guess this contributes to.

Instead of /upload.php, the profile picture upload seems to use xhr_uploadPhoto nowadays.

Finally, I deleted the file, and the reference to it in the iframe tag involved in uploading a photo. Then I did another test to verify it still works, which it did.

How confident are you it won't break things if deployed?

Very

Links to related issues

How to test

Steps a reviewer can take to verify that this MR does what it says it does e.g.

  1. Checkout branch locally
  2. Login as any user
  3. try uploading a picture in the settings view
  4. verify that the picture is uploaded correctly (nb: cropping seems to be broken irregardless)

Checklist

  • FoodsaverCanEditProfileCept already tests uploading a picture
  • no unrelated changes
  • asked someone for a code review
  • joined #foodsharing-beta channel at https://slackin.yunity.org
  • added an entry to CHANGELOG.md (description, merge request link, username(s))
  • Once your MR has been merged, you are responsible to update the #foodsharing-beta Slack channel about what has been changed here. They will test your work in different browsers, roles or other settings
Edited by Alex

Merge request reports