User:Alexis Jazz/LuckyRename

LuckyRename is a user script to ease requesting file moves and for file movers to streamline moving files, including automatic replacement of existing usage. With LuckyRename, even a complete idiot can move files properly. You don't even have to ponder appropriate filenames anymore: just press the Feelin' lucky button and see what happens!

The four-leaf clover is Unicode U+1F340. See the history of the test version for a changelog of sorts.

How to use
After installation you will get an additional tool link (somewhere near Twinkle if you have enabled that as well) and a little four-leaf clover next to the file info on file pages, for example: "(250 × 375 pixels, file size: 110 KB, MIME type: image/png) 🍀". Click either the tool link or the four-leaf cover and LuckyRename will open. There is no tool link on the mobile site, only the four-leaf cover is available there.

Request a move or move a file
When using Feelin' lucky, if the file is used on more than one article you can press Feelin' lucky again to cycle through the filename suggestions for each article. If the background of the filename field is green, the entered name is valid. If it's red, it isn't and the reason will be visible within the field on the right side. If it's yellow it's identical to the current name.
 * 1) Enter the desired target filename or press Feelin' lucky and adjust as needed.
 * 2) (optional) Select a reason for moving the file from the drop down menu and/or enter a custom reason.
 * 3) Press either Request move to request the move or (file movers only) Move file to actually move the file and replace existing usage.

Decline a move request

 * 1) (optional) Enter a reason for declining the move request.
 * 2) Press "Decline".

If you're not a file mover you'll have to press "Override" first. If you're not a file mover, please only decline clearly bogus requests and vandalism.

Illegal characters
The following characters will be flagged as illegal by LuckyRename: If LuckyRename flags the filename that is entered as unacceptable you can use the "Override" button to request/move the file anyway. You will be appropriately warned.
 * ,,  ,  ,  ,  ,  ,  ,  ,  ,   and non-ascii characters /[\\x00-\\x1f\\x7f]/ are disallowed by MediaWiki. LuckyRename tests for /[^\x00-\xFF]/ instead of /[\\x00-\\x1f\\x7f]/.
 * ,,  ,  ,  ,  ,  ,     are disallowed in Windows filenames ( ,   and   are allowed by MediaWiki)
 * is disallowed in filenames when using FAT
 * as the first character indicates a hidden file on various operating systems (but not on Windows), periods are allowed when they are not the first character
 * has special meaning in C shell which might cause problems for someone who downloads the files and tries to process them with a script. It's rarely appropriate anyway.

Override
The "Override" button disables various sanity checks and relabels the "Move file" button to "YOLO!". It will also unlock the "Decline" button if you're not a file mover. Override at your own risk. Acceptable uses of override:
 * A sanity check in LuckyRename is bugged. Please report the bug so it can be fixed.
 * You absolutely must use,  ,  ,  ,   in the filename or have a   as the first character and your hands are tied. Please try to find an alternative if you can.
 * You are not a file mover but have identified a rename request as clearly bogus/vandalism and want to decline it.
 * Generate a Feelin' lucky suggestion from an article the file isn't used on. (you can enter the article title to use when you override)
 * You need to resolve redirects for a manually moved file, updating articles and other pages to link to the current name instead of the redirect. To do this: press override, then press "Resolve redirects". The edit summary will be adjusted accordingly.

Everyone

 * Integrated list of WP:FNC criteria. Never copy-paste again!
 * Automatically checks if the chosen filename is in use either locally or on Commons
 * Automatically checks if the chosen filename contains illegal characters
 * Doesn't change watchlist settings for any edited page
 * Feelin' lucky: too drunk to come up with a better filename? Just hit the button!

File movers

 * Automatically replaces existing usage (including file links, links to the associated talk page and updating redirects)
 * Automatically removes Rename media and ShadowsCommons from the file page
 * Automatically unchecks leaving a redirect when selecting WP:FNC (shadows a Commons file or redirect)
 * Automatically tag the redirect for speedy deletion if you don't have the  right which is only available to page movers and admins. Tags Db-r4 if it shadows Commons, Db-g6 with reference to WP:PMRC otherwise provided the file is linked from less than 20 pages.
 * Fully Bots compliant for usage replacement (can be useful for lists of files in user space), will not edit pages where "luckyrename" or "userscript" is denied
 * Automatically generated compliant, no links or usage on automatically generated pages with that template will be replaced.
 * Automatic workaround for T235589

Examples
Sometimes the generated filename isn't ideal though:
 * File:Fox Sports Racing.jpg.png → File:Fox Sports Racing (television channel) logo.png
 * File:800px-DKSH logo.svg.png → File:DKSH (business) logo.png
 * File:CC2 REISSUE COVER.gif.png → File:Cryptic Collection Vol. 2 (2001 compilation album).png
 * File:Paadhamudrafilm.jpg.JPG → File:Padamudra (1988 film).jpg
 * File:TheSexFactor.jpg.png → File:The Sex Factor (reality show).png
 * File:Thunderbg.jpg.gif → File:Thunder Boogie (2002 album).gif
 * File:Don Keefer.jpg.png → File:Don Keefer (actor, television actor, born 1916).png
 * File:Nikolay Prishchepa.jpg.png → File:Nikolay Prishchepa (military personnel, born 1900).png, better to say "major general" instead of "military personnel".
 * File:Prince logo.svg → File:Prince (film actor, singer, film director, singer-songwriter, screenwriter, record producer, film score composer, film producer, multi-instrumentalist, musician, dancer, guitarist, composer, actor, acting, born 1958) logo.svg, it's not wrong really.

How Feelin' lucky works

 * Checks the title of the first article in mainspace the file is used on. If the image isn't in use in mainspace, Feelin' lucky won't work. If the first article it's used on is only loosely related to the file (e.g. a list article) the suggestion will be useless. You can activate the lucky button again to try the next article the image is used on.
 * Obtains various statements from the associated Wikidata item for the article
 * Checks the file page for certain templates (logo, screenshot, etc)
 * Profit!
 * Profit!

Known issues and missing features
See this subpage for resolved issues.