Commons:GlobalReplace

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search
Warning GlobalReplace is not currently maintained, and has known bugs, including editing as IP user. For best results, please use another tool, e.g. the script mentioned in the #Replacement section.
GlobalReplace 0.3 in action

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]

  1. Right click (or press & hold the control key while clicking) on the icon for GlobalReplace.jar in Finder.
  2. Select "Get Info", then select "Open with", and from the popup menu select "Other".
  3. 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".
  4. 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
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]

Screenshot of the JustReplace script

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.

See also[edit]