Extension:AutoExtensionLoader

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manualManual:Extensions
Crystal Clear action run.png
AutoExtensionLoader

Release status:Extension status beta

ImplementationTemplate:Extension#type MyWiki
DescriptionTemplate:Extension#description Automatic Extension Loader
Author(s)Template:Extension#username Thomas Candrian (Thomascandriantalk)
Latest versionTemplate:Extension#version 0.1 (2009-06-09)
MediaWikiTemplate:Extension#mediawiki 1.15+
Database changesTemplate:Extension#needs-updatephp No
LicenseTemplate:Extension#license GNU General Public License 2.0 or later
Download see below
Added rightsTemplate:Extension#rights

GPL v2

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

Check usage and version matrix.

Introduction[edit]

This extension loads all extensions in extension folder, which are stored either as

/extensions/EXTENSIONNAME/EXTENSIONNAME.php

or as

/extensions/EXTENSIONNAME.php

Requirements[edit]

This extension has no requirements.

Usage[edit]

It simplifies installation of extensions: From now on it's enough to put them into the extension folder. AutoExtensionLoader will then load it!

Installation[edit]

1. Store the file below in your extensions/AutoExtensionLoader/

<?php

/**
 * Extension which loads all Extensions in extension folder
 *
 * @addtogroup Extensions
 * @author Thomas Candrian, dm-informatik.com
 * @copyright © 2009 Thomas Candrian
 * @license GNU General Public Licence 2.0 or later
 */

if (!defined('MEDIAWIKI')) {
	echo ("This file is an extension to the MediaWiki software and cannot be used standalone.\n");
	die(1);
}

$wgExtensionCredits['other'][] = array( 
	'name'   => 'AutoExtensionLoader',
	'version'=> '0.1',
	'url'    => 'https://www.mediawiki.org/wiki/Extension:AutoExtensionLoader',
	'author' => 'Thomas Candrian',
	'description' => 'Loads all extensions in the extension folder automatically'
);

if ($handle = opendir("$IP/extensions/")) {
	while (false !== ($file = readdir($handle))) {
		if ($file != "AutoExtensionLoader" and $file != "AutoExtensionLoader.php" and $file != "." and $file != "..") {
			if (is_file("$IP/extensions/" . $file . "/" . $file . ".php")) {
				include_once ("$IP/extensions/" . $file . "/" . $file . ".php");
			}
			if (is_file("$IP/extensions/" . $file . ".php")) {
				include_once ("$IP/extensions/" . $file . ".php");
			}
		}
	}
	closedir($handle);
}

2. Add a call to it at the end of LocalSettings.php:

require_once("$IP/extensions/AutoExtensionLoader/AutoExtensionLoader.php");