Status wydania: stabilne
|Realizacja||Akcja strony, Strona specjalna, Ajax, API, Interfejs użytkownika|
|Opis||Lightweight extension to push content to other wikis|
|Autor(zy)||Jeroen De Dauwdyskusja|
|Ostatnia wersja||1.4.0 alpha (2020-11-09)|
|Zmiany w bazie danych||Nie|
|Licencja||GNU General Public License 3.0 or later|
|Quarterly downloads||5 (Ranked 166th)|
|Przetłumacz rozszerzenie Push jeżeli jest dostępne na translatewiki.net|
|Problemy||Otwarte zadania · Zgłoś błąd|
The Push extension is a simple lightweight tool that adds an extra tab to articles that users can use to push the article content to one or more other MediaWiki wikis.
- 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 is pushed, if not, the latest one is pushed.
- Admin Links integration
- Use of the MediaWiki Resource Loader when available with backward support for MW 1.16.x
- Pobierz i umieść plik(i) w katalogu o nazwie
- Dodaj poniższy kod na dole twojego pliku
wfLoadExtension( 'Push' );
- Configure as required.
- Zrobione – Przejdź do Special:Version na twojej wiki, aby sprawdzić czy rozszerzenie zostało pomyślnie zainstalowane.
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.
You can add push targets (wikis you can push content to) by adding elements to the
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';
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.
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.
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 its MW 1.17 equivalent.
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
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
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 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.
Przesyłania przez 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;
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.
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 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.
Push enables you to push multiple pages (bulk push) in one go to one or more target wiki(s) via the Special:Push page.
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 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.
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.
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.
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 occurring 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 red-link 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.
Push has been written by Jeroen De Dauw as WikiWorks consultant for Texas Instruments.
The push tab interface for a page titled 'Main Page'
The page selection interface of Special:Push
Special:Push in action
- Push hooks that let you build on its functionality
- Push on OpenHub
- Authors blog posts about Push
- Extension:PushAll - A completely rewritten fork of this extension
- Page import - overview of all page import tools
|To rozszerzenie jest dołączone do następujących pakietów lub farm wiki:|