Last modified: 2014-05-23 20:25:09 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T54587, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 52587 - deleteBatch.php, given a File: redirect, deletes both the redirect and the target's uploaded file
deleteBatch.php, given a File: redirect, deletes both the redirect and the ta...
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
Maintenance scripts (Other open bugs)
1.20.x
All All
: Normal major (vote)
: 1.24.0 release
Assigned To: TeleComNasSprVen
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-08-06 20:33 UTC by Dan Barrett
Modified: 2014-05-23 20:25 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Dan Barrett 2013-08-06 20:33:02 UTC
If you delete a File: redirect using maintenance/deleteBatch.php, the script deletes not only the redirect (correct behavior), but also the uploaded file it points to (arguably incorrect behavior). This destructive act is IMHO a bug because:

* If you perform the same action in the MediaWiki GUI, using the Delete menu item on a File: redirect, the deletion does not touch the uploaded file in the target article.

* In other namespaces, when you delete a redirect with deleteBatch.php, the deletion does not touch the target of that redirect.

Steps to reproduce:

1. Upload an image to File:Example.jpg.
2. Move File:Example.jpg to File:Renamed.jpg. The original File:Example.jpg is now a redirect.
3. Create a file bug.txt containing this single line:

File:Example.jpg

4. Run this command:

php deleteBatch.php bug.txt

5. The redirect File:Example.jpg has been deleted (correct), and the article File:Renamed.jpg still exists (correct), but the actual uploaded file has been deleted (bad). The article File:Renamed.jpg displays, "No file by this name exists, but you can upload it."
Comment 1 Andre Klapper 2013-08-07 04:08:12 UTC
If you really run 1.20.2: Please upgrade to 1.20.6 first and report back.
Comment 2 Dan Barrett 2013-08-07 04:22:35 UTC
Would love to upgrade but it's not going to happen soon.

My "steps to reproduce" take about 60 seconds. Would you be willing to try them on a 1.20.6 (or even newer) system?

1. Create a redirect "File:My_redirect.jpg" to any uploaded file on your wiki (say File:Foo.jpg")
2. Run php deleteBatch.php foo.txt, where foo.txt contains only the line  "File:My_redirect.jpg".
3. Hit File:Foo.jpg and see that the uploaded file is deleted.
Comment 3 Dan Barrett 2013-08-07 16:02:03 UTC
I confirmed that this happens in 1.20.6.
Comment 4 Gerrit Notification Bot 2014-05-09 07:34:46 UTC
Change 132339 had a related patch set uploaded by Withoutaname:
Prevent deleteBatch.php deleting files from redirects

https://gerrit.wikimedia.org/r/132339
Comment 5 Gerrit Notification Bot 2014-05-23 20:19:22 UTC
Change 132339 merged by jenkins-bot:
Prevent deleteBatch.php deleting files from redirects

https://gerrit.wikimedia.org/r/132339

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links