installer: Don't allow setting $wgDBmysql5
[lhc/web/wiklou.git] / includes / installer / CliInstaller.php
index 55ec8df..90ba3c4 100644 (file)
@@ -30,7 +30,7 @@
 class CliInstaller extends Installer {
        private $specifiedScriptPath = false;
 
-       private $optionMap = array(
+       private $optionMap = [
                'dbtype' => 'wgDBtype',
                'dbserver' => 'wgDBserver',
                'dbname' => 'wgDBname',
@@ -38,22 +38,19 @@ class CliInstaller extends Installer {
                'dbpass' => 'wgDBpassword',
                'dbprefix' => 'wgDBprefix',
                'dbtableoptions' => 'wgDBTableOptions',
-               'dbmysql5' => 'wgDBmysql5',
                'dbport' => 'wgDBport',
                'dbschema' => 'wgDBmwschema',
                'dbpath' => 'wgSQLiteDataDir',
                'server' => 'wgServer',
                'scriptpath' => 'wgScriptPath',
-       );
+       ];
 
        /**
-        * Constructor.
-        *
         * @param string $siteName
         * @param string $admin
         * @param array $option
         */
-       function __construct( $siteName, $admin = null, array $option = array() ) {
+       function __construct( $siteName, $admin = null, array $option = [] ) {
                global $wgContLang;
 
                parent::__construct();
@@ -109,8 +106,13 @@ class CliInstaller extends Installer {
                        $this->setVar( '_AdminPassword', $option['pass'] );
                }
 
+               // Detect and inject any extension found
+               if ( isset( $option['with-extensions'] ) ) {
+                       $this->setVar( '_Extensions', array_keys( $this->findExtensions() ) );
+               }
+
                // Set up the default skins
-               $skins = $this->findExtensions( 'skins' );
+               $skins = array_keys( $this->findExtensions( 'skins' ) );
                $this->setVar( '_Skins', $skins );
 
                if ( $skins ) {
@@ -131,8 +133,8 @@ class CliInstaller extends Installer {
                }
 
                $this->performInstallation(
-                       array( $this, 'startStage' ),
-                       array( $this, 'endStage' )
+                       [ $this, 'startStage' ],
+                       [ $this, 'endStage' ]
                );
        }
 
@@ -180,7 +182,7 @@ class CliInstaller extends Installer {
 
                $text = preg_replace( '/<a href="(.*?)".*?>(.*?)<\/a>/', '$2 &lt;$1&gt;', $text );
 
-               return html_entity_decode( strip_tags( $text ), ENT_QUOTES );
+               return Sanitizer::stripAllTags( $text );
        }
 
        /**
@@ -195,11 +197,11 @@ class CliInstaller extends Installer {
 
                if ( count( $warnings ) !== 0 ) {
                        foreach ( $warnings as $w ) {
-                               call_user_func_array( array( $this, 'showMessage' ), $w );
+                               call_user_func_array( [ $this, 'showMessage' ], $w );
                        }
                }
 
-               if ( !$status->isOk() ) {
+               if ( !$status->isOK() ) {
                        echo "\n";
                        exit( 1 );
                }