Extension:AutoExtensionLoader

From MediaWiki.org

Jump to: navigation, search

           

Manual on MediaWiki Extensions
List of MediaWiki Extensions
Crystal Clear action run.png
AutoExtensionLoader

Release status: beta

Implementation  extension (invalid type)
Description Automatic Extension Loader
Author(s)  Thomas Candrian (ThomascandrianTalk)
Last Version  0.1
License GPL V2
Download see below

1.15 RC1

check usage (experimental)

Contents

[edit] Introduction

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

/extensions/EXTENSIONNAME/EXTENSIONNAME.php

or as

/extensions/EXTENSIONNAME.php

[edit] Requirements

This extension has no requirements.

[edit] Usage

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

[edit] Installation

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'    => 'http://www.mediawiki.org/wiki/Extension:AutoExtensionLoader',
	'author' => 'Thomas Candrian' 
);
 
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 LocalConfig.php:

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