Extension:Push

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 Approved Revs. If there is an approved revision, it will be pushed, if not, the latest one is pushed.
 * Admin Links integration.
 * Usage of the MediaWiki Resource Loader when available with backward support for MW 1.16.x.

Installation
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:

Configuration
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 http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/Push/Push_Settings.php?view=markup 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  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:

You cannot have two targets with the same host URL using different credentials, if you do the last set of credentials defined with be used for all targets with that host name

By default there are no targets, which will cause the push tab to not be shown anywhere until you add at least one target.

Rights
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 latter is to prevent anonymous users from easily vandalizing the target wikis.

Authentication
As of version 0.4, you can specify a username and password  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  and   arrays. The keys need to be the target names set in $egPushTargets. Example:

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 its 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  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  set to true, like this:

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. This value will default to the reverse of the value of  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  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:

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:

Version
This is a copy of the release notes file on SVN, which might be more up to date then this page.

Version 1.1
2011-08-04


 * Added PushAPIAfterPush and PushAPIAfterImagePush hooks to the API modules.
 * Added pusher, file pusher and bulk pusher user rights groups.
 * Fixed timeout issue occurring when pushing a page with many images from the tab interface.

Version 1.0
2011-05-26


 * Fixed compatibility with MediaWiki 1.18.
 * Use of FormatJson::encode instead of json_encode for compatibility with PHP5 < 5.2.
 * Fixed some JavaScript issues causing problems for IE users.
 * Fixed bug in API modules.

Version 0.8
2011-02-27


 * Added ability to directly upload files using cURL.

Version 0.7
2011-01-14


 * 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
2010-12-19


 * 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
2010-12-14


 * Added support for file-pushing.
 * Improved push status visualization on the tab interface.

Version 0.4
2010-12-12


 * 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
2010-12-10


 * Fixed push functionality for wikis on remote domains.
 * Added 'bulkpush' right.
 * Added batch operations to Special:Push.
 * Added red-link support to the tab interface.
 * Improved error handling.

Version 0.2
2010-12-08


 * Added Special:Push for bulk pushing.
 * Added AdminLinks hook.

Version 0.1
2010-12-08

Initial release.


 * Added push tab that allows pushing the page to one or more other wikis.
 * Added ApprovedRevs support.
 * Added 'push' right.

Internationalization
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.

Authors
Push has been written by Jeroen De Dauw as WikiWorks consultant for Texas Instruments.