User:Samwilson/ExternalArticles

External Articles is a MediaWiki extension for copying content (articles, templates, files, etc.) from other wikis, and optionally periodically updating that content. Articles are pre-loaded into edit pages where there is a matching page the external wiki. Pages linked to the external one (including categories, templates, files, and redirects) can also be copied at the same time, if desired. It saves time with importing (and re-importing) articles from external wikis.

Pages that have been copied with this extension can have a noticed appended when they are viewed, indicating the source wiki from which they've been copied, and the terms of usage (if available). When editing one of these pages, the copying setup (synchronisation etc.) can be modified.

Definitions

 * Remote wikis : The wikis defined in, from which content can be copied.
 * Local wiki : The wiki running ExternalArticles, to which content can be copied.
 * Sync List : User-specific list of pages from remote wikis that should be kept up-to-date on the local wiki. Sync Lists are stored in  and can be edited directly.

Installation and configuration
The system administrator defines which external wikis are permitted, and sets up the automatic periodical copying.

$wgExternalArticles = array(   'http://en.wikipedia.org/w/api.php',    'http://wiki.openstreetmap.org/w/api.php', );

The syncronisation happens on an ongoing basis by calling Example cron job:

// Synchronise ExternalArticles at 12:38AM every day. 38 0 * * * php /var/www/w/extensions/ExternalArticles/sync.php

Usage
Content is copied locally either when a page is created and already exists on one of the remote wikis, or when it's added to a Sync List.

Any page that has been copied from a remote wiki has a noticed displayed above it. This is defined by the template.

Loading
When a new page is created, each remote wiki is queried for the existance of the page, and each that is found is presented to the user to be selected for copying. If one is selected, it can also be added to the user's Sync List

Synchronisation
Each user has their own Sync List, which track which content from which wikis will be copied to the local wiki. All pages on the Sync Lists will be kept up to date at the frequency set by the system administrator.

Pages can be added to Sync Lists either when they are created and the user elects to add them, or directly by editing.

Configuration
This step is optional. If you do not include the below code, this extension will use the defaults. If you define $eagRules, you must define all the elements of it (likely to change later so you can only override the settings you want).

This extension currently has only one configuration variable " ". If you wish to change the default behavior, put the following code in your LocalSettings.php above the  statement for this extension.

Usage
When a page is edited, its title must match the regular expression in. If it matches, the content of the external article matching the current local page name is fetched and then preloaded into the local edit box. The extension will only preload when creating a new article, and when there is not already a local page being preloaded.

Known Issues
The default rule does not support languages other than English, as the namespace of a template is assumed to be " ". When implementing in other languages the template namespace string is localized, so the rule must be updated to fit the current language.

Feedback
We're looking for feedback on this extension. Security, performance, etc...

Please post feedback to the Extension_talk:ExternalArticles page.

Security
This extension just fetches external wiki-text and inserts it into the edit box. No checking is done to validate or verify the wiki-text, and any edit is attributed to the user running.

Future development
The long term goal of this extension is to allow a wiki to use templates or other articles from external MediaWiki wikis without having to import the articles and all the transcluded articles it depends on manually. When an article is demanded (viewed, created, linked to, transcluded) it will be automatically downloaded from the external wiki and added to the local one.

There is no release schedule for this extension. When we have time and motivation to work on this extension, we will do so and make new releases that implement features when it makes sense to do so.

In May 2013, User:Samwilson adopted this extension, moved it into Gerrit, and is in the process of updating it.