Release status: stable
|Implementation||Page action, Special page, Ajax, API, User interface|
|Description||Lightweight extension to push content to other wikis|
|Author(s)||Jeroen De Dauw|
|Last version||1.1.3 (2011-10-04)|
|MediaWiki||1.16.0 or higher|
|Download||Stable releases - All releases|
|Check usage and version matrix|
The Push extension is a simple lightweight tool that adds an extra tab to articles which enables users to push the content of the article to one or more other MediaWiki wikis.
Feature overview 
- Pushing page content to other wikis via a tab on the page.
- Bulk push via Special:Push. (as of version 0.2)
- Remote authentication support. (as of version 0.4)
- Automatic transfer of included files. (as of version 0.5)
- Support for ApprovedRevs. If there is an approved revision, it will be pushed, if not, the latest one is pushed.
- AdminLinks integration.
- Usage of the MediaWiki Resource Loader when available with backward support for MW 1.16.x.
You can download the extension directly from the MediaWiki source code repository (browse code). You can get:
- One of the extensions tags
Not all extensions have tags. Some extensions have tags for each release, in which case those tags have the same stability as the release. To download a tag
- Go to the tags list
- Click the name of the tag you want to download
- Click "snapshot"
- The latest version of one of the extensions branches
Each extension has a master branch containing the latest code (might be unstable). Extensions can have further branches as well.
- Go to the branches list
- Click the branch name
- Click "snapshot"
- A snapshot made during the release of a MediaWiki version.
This might be unstable and is not guaranteed to work with the associated MediaWiki version.
After you've got the code, save it into the extensions/Push directory of your wiki.
If you are familiar with git and have shell access to your server, you can obtain the extension, with all its tags and branches, as follows:
cd extensions git clone
Once you have downloaded the code, place the Push directory within your MediaWiki 'extensions' directory. Then add the following code to your LocalSettings.php file:
# Push require_once( "$IP/extensions/Push/Push.php" );
Configuration of push is done by adding simple PHP statements to your LocalSettings.php file. These statements need to be placed AFTER the inclusion of Push. The options are listed below and their default is set in the push settings file. You should NOT modify the settings file, but can have a look at it to get an idea of how to use the settings, in case the below descriptions do not suffice.
Push targets 
You can add push targets (wikis you can push content to) by adding elements to the
$egPushTargets array. The array keys should be the names of your wikis and the values should point to the wiki root, without tailing slash. You can find your wiki root by clicking the history tab on a page, finding the '/index.php' in it, and taking everything that's left of that. Example:
$egPushTargets['English Wikipedia'] = 'http://en.wikipedia.org/w'; $egPushTargets['Local MW 1.16'] = 'http://localhost/mw116'; $egPushTargets['Local MW trunk'] = 'http://localhost/phase3';
By default there are no targets, which will cause the push tab to not be shown anywhere until you add at least one target.
Push adds the following rights to MediaWiki:
- push: Indicates whether you are able to use the push functionality or not.
- bulkpush: Indicates whether you are able to use Special:Push or not. (as of v0.3)
- filepush: Indicates whether you are able to push files or not. (as of v0.5)
By default everyone has 'push', and only registered users have 'bulkpush' and 'filepush'. The later is to prevent anonymous users from easily vandalizing the target wikis.
As of version 0.4, you can specify a username (
$egPushLoginUser) and password (
$egPushLoginPass) to authenticate with on the remote wikis. You can also specify login information per target wiki, which will override the global settings when set. You can do this by adding items to the
$egPushLoginPasswords arrays. The keys need to be the target names set in $egPushTargets. Example:
$egPushLoginUsers['English Wikipedia'] = 'Jeroen De Dauw'; $egPushLoginPasswords['English Wikipedia'] = 'Awesome';
If you are running wikis on localhost, pushing from a MW 1.16 install will not work, due to an issue in Cookie::validateCookieDomain. It can be fixed by replacing this method by it's MW 1.17 equivalent.
Pushing files 
As of version 0.5 of Push, you can choose to also push the files included in the page you are pushing. This is done by checking 'Include files' on the push interface. You can set the default check-state with the
$egPushIncFiles setting. Keep in mind that you need the 'filepush' right to use this functionality, so the checkbox won't show up if your user account doesn't have that right.
To successfully push any file, you need to have sufficient privileges on the target wiki (which probably means you'll have to authenticate), and the target wiki needs to be configured so that it accepts uploads. You need to have
$wgEnableUploads set to true, like this:
$wgEnableUploads = true;
Uploads can be done in 2 ways: either directly or via URL. The one you need depends on your specific setup. You can change which one is used by modifying the value, on the source wiki, of
$egPushDirectFileUploads. This value will default to the reverse of the value of
$wgAllowCopyUploads on the target wiki, which, by default, is false; thus, by default, uploads are done directly.
Direct upload 
Direct file upload is the default option, and the more robust of the two. However, it has two weaknesses: you need to have cURL installed on the source wiki, and the source wiki's version of MediaWiki has to allow for posting files via cURL. Unfortunately, MediaWiki 1.16 and 1.17 do not allow for this; however, you can modify either one to support it by simply replacing the file
includes/HttpFunctions.php with this one.
Upload by URL 
Upload by URL is the simpler of the two options; it was the only option available in versions of Push before 0.8. The limitation of uploading by URL, though, is that the wiki you push from needs to be accessible from the target wiki. So if your source wiki is on a private intranet and the target wiki is not in that same intranet, this won't work.
To upload via URL, just add this to LocalSettings.php on the target wiki:
$wgAllowCopyUploads = true;
The user on the target wiki must also have the upload_by_url permission. Administrators have it by default; regular users don't. If the user on the target wiki is not an administrator, you can solve the problem by granting this right to autoconfirmed users in LocalSettings.php:
$wgGroupPermissions['autoconfirmed']['upload_by_url'] = true;
User manual 
Push enables you to push pages from one wiki (which we'll call the source wiki) to another wiki (the target wiki). This is useful when working with a combination of private and public wikis, or you just want to migrate over some content from one wiki to another. Only the last revision of a page is pushed to the target wiki(s), and added there as the latest revision. This means that anything removed from the page on the source wiki before the push will not show up in the history of the target wiki. It also means that any changes made on the target wiki(s) page will be "hidden" by the new revision, but still accessible via the pages history.
The push extension provides 2 interfaces to push pages. One is geared towards pushing single pages, the other is useful for pushing groups of pages. This manual will introduce you to the two and then list some common problems you might encounter, and how to deal with them.
The tab interface 
The primary interface to push pages from one wiki (the source) to another (the target) can be accessed as a tab, in much the same way as the editing and page history interfaces.
Getting there 
Depending on the configuration and skin of the wiki, this tab can either show up in the action dropdown menu of the page, as shown in the below screenshot, or as an actual tab next to the "View history" one.
By default only registered (and email confirmed) users can push pages, so you will likely need to log in for the tab to show up. It's possible that you need additional privileges on some wikis, for which you should contact your wikis administrators.
The interface 
The interface consists of a table that lists the target wikis you can push to and a list of options underneath it.
Each target wiki has an associated button that allows pushing the page to that wiki. In case there are multiple target wikis, a "Push all" button will also show up at the bottom of the table, which enables you to push the page to all target wikis with one click. After the page is loaded Push will poll the target wikis for useful info on the current state of the page there and display it under a link to the page. This makes it easy to assert if the page already exists there, and if so, who last edited it, and when. You can use the link to the page on the target wiki to further inspect the page if needed, or view the result after doing the push.
You can choose to also push embedded templates by checking the "Include templates" option, if not already done so. This makes sure the used templates exist and are up to date on the target wiki(s).
Similarly you can indicate that embedded files should be transfered during the push. Note that if the files are big, it can take a while before the push completes.
Bulk pushing 
Push enables you to push multiple pages (bulk push) in one go to one or more target wiki(s) via the Special:Push page.
Getting there 
Like with the push tab, you need the correct privileges to use the bulk pushing facilities. This means you will most likely need to login for the links to the page to show up and might need an account in a special user group on some wikis.
One way to get to the bulk push page is via list of special pages, which is usually linked to from the sidebar menu.
In this list, you'll find "push pages" under the "Page tools" section.
The name of the page is
Special:Push, so it can be accessed by replacing the page name by it in the URL of any other page on your wiki. If you are frequently accessing the bulk push page, or any other special page, and are comfortable with it, this approach is faster than going via the list of special pages.
The interface 
The interface is centred around a big text field in which you can specify the pages you want to push, one page name per line. This is similar to how
Special:Export, MediaWikis built-in export facility, works. Directly underneath the text field are the options to include embedded files and templates, which behave identically to the ones found in the push tab interface. At the bottom of the interface is a list of target wikis you can push to. Check or uncheck the checkboxes to indicate which wikis should be pushed to.
Adding pages 
You can specify the pages by typing their names line per line or copying in a list you obtained elsewhere. Like on
Special:Export, you can also choose to add pages based on category or namespace. Simply type the name of the category or select the namespace, and hit the corresponding "Add" button.
Doing the push 
The push process can be started by hitting the "Push pages" button. When doing this, the page will reload and show what pages it's pushing. As the process goes along, a list of pushed pages is build up, keeping track of potential problems per page. If there is such a problem, the line will be colored dark red, if the push is successful, it'll turn grey and state "Title: Push completed".
When all pages have been pushed, this will be indicated by an entry "Push completed".
Dealing with common problems 
Pushing pages between two distinct wikis, that can have different versions and configurations over a network can fail for a number of reasons. This section contains a number of common problems, caused by either misconfiguration, network issues such as timeouts or simple misunderstanding of how the extension works, and their solutions.
The push tab does not show up 
- Make sure you are logged in.
- If it never showed up before, you might still need to get the privileges to push from your wikis administrator.
No targets to push to 
If you get a message equivalent to "There are no targets to push to. Please add some to your LocalSettings.php file.", it means that the Push extension is not configured on the local wiki yet. This can only be done by an administrator.
Authentication failed 
If you get an error stating that authentication failed, it means that either the local configuration for the push user on the target wiki is not correct, or that the remote user simply does not have sufficient privileges to create pages or upload files. Both these problems can only be solved by an administrator. Steps to take:
- Make the
$egPushLoginPasswordsentries for the wiki the pushing fails to are correct. Copy them and try to login into the target wiki.
- Once logged in into the target wiki, try to edit a page, try to create one, and try to upload a file. If one of these fails, give the push user sufficient privileges.
Captcha error 
If you get "Could not push to 'target wiki name' due to captcha.", it means that there is a privilege problem for the push user on the target wiki. This user is getting a captcha when either editing or creating a page, or uploading a file. Give the push user sufficient privileges so it doesn't get a captcha anymore. This can only be done by administrators.
This is a copy of the release notes file on SVN, which might be more up to date then this page.
Version 1.1 
- Added PushAPIAfterPush and PushAPIAfterImagePush hooks to the API modules.
- Added pusher, file pusher and bulk pusher user rights groups.
- Fixed timeout issue occuring when pushing a page with many images from the tab interface.
Version 1.0 
- Fixed compatibility with MediaWiki 1.18.
- Use of FormatJson::encode instead of json_encode for compatibility with PHP5 < 5.2.
- Fixed bug in API modules.
Version 0.8 
- Added ability to directly upload files using cURL.
Version 0.7 
- Fixed issue with non-existing, but embedded, images.
- Added 2 hooks that allows modifying push requests before they are executed.
- Improved error message shown when the target wiki does not allow API uploads via url.
Version 0.6 
- Added listing of embedded images to the tab interface.
- Added notice to the tab interface that shows up when included templates/files already exist on the target wiki.
Version 0.5 
- Added support for file-pushing.
- Improved push status visualization on the tab interface.
Version 0.4 
- Added option to include templates used on the page to the push to the tab interface.
- Added remote authentication support to the push API module.
- Added additional info about target pages to the tab interface.
Version 0.3 
- Fixed push functionality for wikis on remote domains.
- Added 'bulkpush' right.
- Added batch operations to Special:Push.
- Added redlink support to the tab interface.
- Improved error handling.
Version 0.2 
- Added Special:Push for bulk pushing.
- Added AdminLinks hook.
Version 0.1 
- Added push tab that allows pushing the page to one or more other wikis.
- Added ApprovedRevs support.
- Added 'push' right.
Push is fully internationalized. Translation of Push messages is done through translatewiki.net. The translation for this extension can be found here. To add language values or change existing ones, you should create an account on translatewiki.net, then request permission from the administrators to translate a certain language or languages on this page (this is a very simple process). Once you have permission for a given language, you can log in and add or edit whatever messages you want to in that language.