Commons:File renaming/Global replace

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

Shortcuts: GR • COM:GR

You are likely here because you followed a link in an edit summary. Please be advised: The edit was not done by a bot. It was done by a script that is enabled by default for all users on Wikimedia Commons. If the replacement was done by a file mover or administrator (verify) according to our policies, do not block this user at your project as it will not prevent the file itself from being renamed; blocking will only prevent the user from updating the file link. Unwanted replacement edits under user accounts other than bots may be prevented by using the AbuseFilter. If an individual is misbehaving or replacing usage with a different file you may block them of course. Controversial renames may also be reported and challenged on Commons.

The default “Move” link from the actions dropdown has been replaced by a “Move & Replace” gadget on this site. After a file has been renamed on Wikimedia Commons, the file usage will be replaced on all Wikimedia wikis by a JavaScript gadget running in a user’s browser: All pages where a file is reported to be in use will be searched for the file name, and File:Old name.ext will be replaced with File:New name.ext in its source code. Edits are conducted under the user account of the administrator or file mover who renamed a media file. Since 2013 this extended functionality has been switched on by default for all file movers and administrators. If the replacement is not feasible, for example due to heavy usage, failed edits or slow connections, file usage will be replaced by CommonsDelinker as before.

Why we implemented the JavaScript replacement under individual user accounts

We believe that every file mover and administrator is solely responsible for their own actions; and if they rename a file, they must also justify all edits that are caused by renaming a media file. Additionally, we occasionally encountered technical issues with our replacement bot, CommonsDelinker and not updating file usage is dangerous as, as soon as files are moved twice, there are chances of double redirects which are not resolved by MediaWiki and file usage could break, if not curated like this. Also file renaming should bear some improvements to file names that we would like to share with our users.


Opting out an entire Wiki
If you are an Abuse Filter editor of a Wikimedia Wiki, or you are administrator (a user belonging to the sysop user group), you most likely have necessary permission for creating an Abuse Filter to prevent Commons Global Replace edits submitted by individual user accounts. You might have various reasons for doing so, for example to prevent edits that are not automatically patrolled. In case these edits are prevented, Commons Global Replace system will instruct CommonsDelinker (a global bot) which will then carry out the edit. It would be kind, though, if you would notify Wikimedia Commons about such opt-outs (and the reasons), as this will help us to understand our Media file's users better and we can design our software more efficiently and intelligently.

How to create a new filter

Convenience way

Navigate to Special:AbuseFilter/import on your wiki, insert the following text and press Import data:

{"row":{"af_id":"148","af_pattern":"(action === 'edit')\r\n\u0026 !('autopatrol' in user_rights)\r\n\u0026 (summary rlike '^\\(\\[\\[c\\:GR\\|GR\\]\\]\\)')","af_user":"16603","af_user_text":"Rillke","af_timestamp":"20150201145938","af_enabled":"1","af_comments":"Prevent non-autopatrolled users from replacing files on this wiki.\r\nReference: https://commons.wikimedia.org/wiki/Commons:File_renaming/Global_replace/Abuse_Filter","af_public_comments":"Disallow Commons Global Replace","af_hidden":"0","af_hit_count":"2","af_throttled":"0","af_deleted":"0","af_actions":"disallow","af_global":"0","af_group":"default"},"actions":{"disallow":{"action":"disallow","parameters":[""]}}}
Ex manus

Navigate to Special:AbuseFilter/new on your wiki. Fill-in the following values:

  • Description:
(publicly viewable) Disallow Commons Global Replace
  • Conditions:
    (action === 'edit')
    & !('autopatrol' in user_rights)
    & (summary rlike '^\(\[\[c\:GR\|GR\]\]\)')
    
  • Notes:
    Prevent non-autopatrolled users from replacing files on this wiki.
    Reference: https://commons.wikimedia.org/wiki/Commons:File_renaming/Global_replace/Abuse_Filter
    
  • ☑ Enable this filter
  • ☑ Prevent the user from performing the action in question
Troubleshooting
You are a file mover or administrator and nothing is replaced with your user account? Then, it is likely that your browser or a browser add-on are the cause. A common issue is that cookies from third party sites are disabled (Firefox, Chrome, Internet Explorer).

While this is good for blocking advertising and enhances privacy, it prevents you from getting logged-in on all Wikimedia projects, which in turn is required for Global replace to work correctly. You may work around this by adding exceptions. However, note that the added exceptions may not be persistent in anonymous/private browsing mode and when website preferences are deleted, the list of exceptions is usually deleted as well. Some browsers are configured to delete website preferences as soon as they're closed.

List of domains you should allow cookies from:

https://en.wikipedia.org
https://login.wikimedia.org
https://meta.wikimedia.org
https://en.wiktionary.org
https://en.wikibooks.org
https://en.wikiquote.org
https://en.wikisource.org
https://en.wikinews.org
https://en.wikiversity.org
https://www.mediawiki.org
https://www.wikidata.org
https://species.wikimedia.org
https://incubator.wikimedia.org
https://en.wikivoyage.org

Opting out as a Commons file mover or administrator

window.aqdCORSOptOut = true;
Gadget
Click on “Global replace” in the dropdown menu

If you have filemover right and you want to use the functionality manually, you can use this script with some extra options:

importScript('User:Perhelion/justReplace.js');

You may not use it for possible controversial replacements.

See also: Help:QuickDelete.