Extension:ExternalArticles

The ExternalArticles extension imports articles from external wikis or text files:
 * 1) When you edit a page, the text of the same page on the external site is preloaded in the edit form.
 * 2) A maintenance script can be used to mass-import text files (and monitor changes in those files).

This can save time when importing pages from an external website, or developing pages in a local wiki with an external editor (such as an IDE).

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 "$eagRules". If you wish to change the default behavior, put the following code in your LocalSettings.php above the  statement for this extension.

Loading external pages when editing
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.

Importing text files
The  maintenance script can be used to import text files into a wiki. It is similar to the but enforces certain conventions and adds other features.

The importTextFiles script is given a single argument of a directory name that contains text files that should be imported. Any files in the top level of this directory will be imported into the main namespace of the wiki. There can be subdirectories in this directory, each corresponding to a different namespace in the wiki, and any files in these will be imported into the matching namespace. All file extensions are retained on import (i.e. most normal wiki pages will need to be in files with no file extensions).

The  option to the importTextFiles script means that the script will remain open and monitor all files for changes. When a file is changed, it will be re-imported immediately. This makes it possible to work on wiki pages in an external editor, and as soon as files are saved they're automatically updated on the wiki.

Known Issues
The default rule does not support languages other than English, as the namespace of a template is assumed to be "Template". 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.