return array();
}
+ // extensions -> extension.json, skins -> skin.json
+ $jsonFile = substr( $directory, 0, strlen( $directory ) -1 ) . '.json';
+
$dh = opendir( $extDir );
$exts = array();
while ( ( $file = readdir( $dh ) ) !== false ) {
if ( !is_dir( "$extDir/$file" ) ) {
continue;
}
- if ( file_exists( "$extDir/$file/$file.php" ) ) {
+ if ( file_exists( "$extDir/$file/$jsonFile" ) || file_exists( "$extDir/$file/$file.php" ) ) {
$exts[] = $file;
}
}
protected $groupPermissions = array();
protected $dbSettings = '';
protected $safeMode = false;
+ protected $IP;
/**
* @var Installer
$this->extensions = $installer->getVar( '_Extensions' );
$this->skins = $installer->getVar( '_Skins' );
+ $this->IP = $installer->getVar( 'IP' );
$db = $installer->getDBInstaller( $installer->getVar( 'wgDBtype' ) );
# The following skins were automatically enabled:\n";
foreach ( $this->skins as $skinName ) {
- $localSettings .= $this->generateRequireOnceLine( 'skins', $skinName );
+ $localSettings .= $this->generateExtEnableLine( 'skins', $skinName );
}
$localSettings .= "\n";
# The following extensions were automatically enabled:\n";
foreach ( $this->extensions as $extName ) {
- $localSettings .= $this->generateRequireOnceLine( 'extensions', $extName );
+ $localSettings .= $this->generateExtEnableLine( 'extensions', $extName );
}
$localSettings .= "\n";
}
/**
+ * Generate the appropriate line to enable the given extension or skin
+ *
* @param string $dir Either "extensions" or "skins"
* @param string $name Name of extension/skin
+ * @throws InvalidArgumentException
* @return string
*/
- private function generateRequireOnceLine( $dir, $name ) {
+ private function generateExtEnableLine( $dir, $name ) {
+ if ( $dir === 'extensions' ) {
+ $jsonFile = 'extension.json';
+ $function = 'wfLoadExtension';
+ } elseif ( $dir === 'skins' ) {
+ $jsonFile = 'skin.json';
+ $function = 'wfLoadSkin';
+ } else {
+ throw new InvalidArgumentException( '$dir was not "extensions" or "skins' );
+ }
+
$encName = self::escapePhpString( $name );
- return "require_once \"\$IP/$dir/$encName/$encName.php\";\n";
+
+ if ( file_exists( "{$this->IP}/$dir/$encName/$jsonFile" ) ) {
+ return "$function( '$encName' );\n";
+ } else {
+ return "require_once \"\$IP/$dir/$encName/$encName.php\";\n";
+ }
}
/**