X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Finstaller%2FInstaller.php;h=284d5dd2c1326c1ebd8b41d84fd7fe3fb14d82d2;hb=a771514883e55e67832a75457a5a27e088949e6d;hp=94a5a5a474d6d40b41b6c9989e874ff15df841bb;hpb=2d030f457620bf29d2e26e892fecb07da4dcd977;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/installer/Installer.php b/includes/installer/Installer.php index 94a5a5a474..284d5dd2c1 100644 --- a/includes/installer/Installer.php +++ b/includes/installer/Installer.php @@ -990,6 +990,10 @@ abstract class Installer { return true; } + if ( Shell::isDisabled() ) { + return true; + } + # Get a list of available locales. $result = Shell::command( '/usr/bin/locale', '-a' ) ->execute(); @@ -1133,7 +1137,7 @@ abstract class Installer { /** * This needs to be updated something that the latest libicu * will properly normalize. This normalization was found at - * http://www.unicode.org/versions/Unicode5.2.0/#Character_Additions + * https://www.unicode.org/versions/Unicode5.2.0/#Character_Additions * Note that we use the hex representation to create the code * points in order to avoid any Unicode-destroying during transit. */ @@ -1199,7 +1203,7 @@ abstract class Installer { $scriptTypes = [ 'php' => [ "readExtension( $fullJsonFile ); + if ( $info === false ) { + continue; + } + $exts[$file] += $info; + } } closedir( $dh ); uksort( $exts, 'strnatcasecmp' ); @@ -1319,6 +1338,82 @@ abstract class Installer { return $exts; } + /** + * @param string $fullJsonFile + * @param array $extDeps + * @param array $skinDeps + * + * @return array|bool False if this extension can't be loaded + */ + private function readExtension( $fullJsonFile, $extDeps = [], $skinDeps = [] ) { + $load = [ + $fullJsonFile => 1 + ]; + if ( $extDeps ) { + $extDir = $this->getVar( 'IP' ) . '/extensions'; + foreach ( $extDeps as $dep ) { + $fname = "$extDir/$dep/extension.json"; + if ( !file_exists( $fname ) ) { + return false; + } + $load[$fname] = 1; + } + } + if ( $skinDeps ) { + $skinDir = $this->getVar( 'IP' ) . '/skins'; + foreach ( $skinDeps as $dep ) { + $fname = "$skinDir/$dep/skin.json"; + if ( !file_exists( $fname ) ) { + return false; + } + $load[$fname] = 1; + } + } + $registry = new ExtensionRegistry(); + try { + $info = $registry->readFromQueue( $load ); + } catch ( ExtensionDependencyError $e ) { + if ( $e->incompatibleCore || $e->incompatibleSkins + || $e->incompatibleExtensions + ) { + // If something is incompatible with a dependency, we have no real + // option besides skipping it + return false; + } elseif ( $e->missingExtensions || $e->missingSkins ) { + // There's an extension missing in the dependency tree, + // so add those to the dependency list and try again + return $this->readExtension( + $fullJsonFile, + array_merge( $extDeps, $e->missingExtensions ), + array_merge( $skinDeps, $e->missingSkins ) + ); + } + // Some other kind of dependency error? + return false; + } + $ret = []; + // The order of credits will be the order of $load, + // so the first extension is the one we want to load, + // everything else is a dependency + $i = 0; + foreach ( $info['credits'] as $name => $credit ) { + $i++; + if ( $i == 1 ) { + // Extension we want to load + continue; + } + $type = basename( $credit['path'] ) === 'skin.json' ? 'skins' : 'extensions'; + $ret['requires'][$type][] = $credit['name']; + } + $credits = array_values( $info['credits'] )[0]; + if ( isset( $credits['url'] ) ) { + $ret['url'] = $credits['url']; + } + $ret['type'] = $credits['type']; + + return $ret; + } + /** * Returns a default value to be used for $wgDefaultSkin: normally the one set in DefaultSettings, * but will fall back to another if the default skin is missing and some other one is present