Commons:GlobalReplace
GlobalReplace is a simple tool designed to quickly find and replace files globally across Wikimedia Projects.
System requirements
[edit]GlobalReplace is written in Java and can run on any operating system (e.g. Windows, Mac, Linux) with Java installed (most modern operating systems include a pre-installed version of Java). A minimum of Java 8 is required to run this tool. Check your Java version and/or download the latest version here.
Download
[edit]Make sure you are running GlobalReplace v0.6.5 or any higher version, as old versions are no longer maintained and may contain bugs. You can download the latest version from the GitHub repository.
Running the program
[edit]Most users need only double-click the program's icon to start it. In case this doesn't work for you, see the #Configuration guide.
To use the tool, simply log-in, and include: the name of a file you want to replace (with or without the "File:" prefix), the name of the new file to replace the old file with, and an optional reason. Click the Start button to begin replacing files.
Configuration guide
[edit]Mac
[edit]- Right click (or press & hold the control key while clicking) on the icon for GlobalReplace.jar in Finder.
- Select "Get Info", then select "Open with", and from the popup menu select "Other".
- In the window that appears, go to the folder /System/Library/CoreServices and select 'Jar Launcher'. Make sure the "Always Open With" checkbox is selected and click "Add".
- Click the "Change all" button so that any jar file will be opened automatically. Close the Info window and double click GlobalReplace.jar
Windows
[edit]Double click the "globalreplace_vX.X.X.exe" file.
Linux
[edit]Start a terminal, change to the directory of the "globalreplace_v0.6.5.jar" file and execute "java -jar globalreplace_vX.X.X.jar".
Disclaimer
[edit]This is a beta version of GlobalReplace, so it might contain bugs. By downloading and running this application, you accept responsibility for any mishap that may occur, whether it be your fault or any fault in the application.
Bugs
[edit]Please report bugs as soon as you discover them. Thanks!
FAQ
[edit]- Q: Why didn't GlobalReplace replace all usages of a file?
- A: There are several possible answers:
- You don't have permission (the page was protected by a local sysop) to edit a page the file is linked on.
- Some MediaWiki error prevented your edit from saving.
- The file is embedded in a Template. Due to the intricacies some template authors introduce into their code, there is no one good way to automatically replace files in Templates. Unfortunately, these replacements must be performed manually.
- The replacements did occur, but you need to first purge the cache of the file you were replacing.
- Try removing the
File:
prefix and running again as some instances where an image is listed (e.g. infobox) does not require the prefix
- A: There are several possible answers:
- Q: Is there an easy way to copy & paste file names into the tool?
- A: Yes! GlobalReplace supports the copy & paste functions. If you're on Mac, use the keyboard shortcut ⌘ Cmd + v to paste text. If you're on Windows, use the keyboard shortcut Ctrl + v to paste text.
- Q: Some way to use this tool with proxy?
- A: No. But you can use it with VPN.
Replacement
[edit]Global replacement can be performed easily using a script.
Just copy
importScript('User:Perhelion/justReplace.js');
into your common.js.
To prevent abuse, justReplace.js is restricted to users with filemover rights.