Extension:ExternalArticles

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manual
Crystal Clear action run.png
External Articles

Release status: experimental

Implementation Page action
Description Loads article text from external wikis.
Author(s) Nathan Perry, Sam Wilson
Latest version 0.1.4 (2013-05-31)
MediaWiki 1.17+
Database changes No
License GNU General Public License
Download
README
CHANGES
Parameters

$eagRules

Hooks used
EditFormPreloadText

Translate the ExternalArticles extension if it is available at translatewiki.net

Check usage and version matrix; code metrics

The ExternalArticles extension imports articles from external wikis. When you edit a page, the text of the same page on the external site is preloaded in the edit form.

This can save time when importing pages from an external website.

Installation[edit | edit source]

  • Download and extract the tarball in your extensions/ folder. It should generate a new folder called ExternalArticles directly inside your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php:
require_once "$IP/extensions/ExternalArticles/ExternalArticles.php";
  • Done! Navigate to "Special:Version" on your wiki to verify that the extension is successfully installed.

Configuration[edit | edit source]

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 require_once statement for this extension.

// External Articles Configuration
$eagRules = array();
// Specifies if text will be preloaded on edit
$eagRules['onpreload'] = true;
// Specifies the URL of the external wiki.  Must point to the index.php?title= and not the short link
$eagRules['url']       = 'http://en.wikipedia.org/w/index.php?title=';
// Specifies the regular expression used to determine if an article will be preloaded.
// See http://us3.php.net/manual/en/function.preg-match.php for more information.
#$eagRules['rule']      = '/.*/';           // All articles
$eagRules['rule']      = '/^Template:.*$/'; // Templates only (in English MediaWiki, default)
#$eagRules['rule']      = '/^.*talk:.*$/';  // Talk pages only (and any page that contains "talk:")

Usage[edit | edit source]

When a page is edited, its title must match the regular expression in $eagRules['rule']. 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[edit | edit source]

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[edit | edit source]

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

Please post feedback to the Extension_talk:ExternalArticles page.

Security[edit | edit source]

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[edit | edit source]

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.