* re r69332, r64217: complete removal of WikiSysop for CLI installer
authorMark A. Hershberger <mah@users.mediawiki.org>
Sun, 18 Jul 2010 18:52:05 +0000 (18:52 +0000)
committerMark A. Hershberger <mah@users.mediawiki.org>
Sun, 18 Jul 2010 18:52:05 +0000 (18:52 +0000)
* Incorporate new Installer::performInstallation() function
* Update SQLite schema tables to insert data to updatelog correctly

includes/installer/CliInstaller.php
includes/installer/Installer.php
maintenance/sqlite/archives/initial-indexes.sql
maintenance/sqlite/archives/patch-tc-timestamp.sql
maintenance/sqlite/archives/searchindex-fts3.sql

index 51ffeb6..3f0c958 100644 (file)
@@ -47,9 +47,6 @@ class CliInstaller extends Installer {
                $this->setVar( 'wgSitename', $siteName );
                if ( $admin ) {
                        $this->setVar( '_AdminName', $admin );
-               } else {
-                       $this->setVar( '_AdminName',
-                               wfMsgForContent( 'config-admin-default-username' ) );
                }
 
                if ( !isset( $option['installdbuser'] ) ) {
@@ -67,26 +64,31 @@ class CliInstaller extends Installer {
        /**
         * Main entry point.
         */
-       function execute( ) {
-               foreach( $this->getInstallSteps() as $stepObj ) {
-                       $step = is_array( $stepObj ) ? $stepObj['name'] : $stepObj;
-                       $this->showMessage( wfMsg( "config-install-$step") .
-                                       wfMsg( 'ellipsis' ) . wfMsg( 'word-separator' ) );
-                       $func = 'install' . ucfirst( $step );
-                       $status = $this->{$func}();
-                       $warnings = $status->getWarningsArray();
-                       if ( !$status->isOk() ) {
-                               $this->showStatusMessage( $status );
-                               echo "\n";
-                               exit;
-                       } elseif ( count($warnings) !== 0 ) {
-                               foreach ( $status->getWikiTextArray( $warnings ) as $w ) {
-                                       $this->showMessage( $w . wfMsg( 'ellipsis') .
-                                               wfMsg( 'word-separator' ) );
-                               }
+       public function execute( ) {
+               $this->performInstallation(
+                       array( $this, 'startStage'),
+                       array( $this, 'endStage' )
+               );
+       }
+
+       public function startStage( $step ) {
+               $this->showMessage( wfMsg( "config-install-$step") .
+                       wfMsg( 'ellipsis' ) . wfMsg( 'word-separator' ) );
+       }
+
+       public function endStage( $step, $status ) {
+               $warnings = $status->getWarningsArray();
+               if ( !$status->isOk() ) {
+                       $this->showStatusMessage( $status );
+                       echo "\n";
+                       exit;
+               } elseif ( count($warnings) !== 0 ) {
+                       foreach ( $status->getWikiTextArray( $warnings ) as $w ) {
+                               $this->showMessage( $w . wfMsg( 'ellipsis') .
+                                       wfMsg( 'word-separator' ) );
                        }
-                       $this->showMessage( wfMsg( 'config-install-step-done' ) ."\n");
                }
+               $this->showMessage( wfMsg( 'config-install-step-done' ) ."\n");
        }
 
        function showMessage( $msg /*, ... */ ) {
index 8ef9e7a..37c4923 100644 (file)
@@ -8,14 +8,14 @@ abstract class Installer {
        var $settings, $output;
 
        /**
-        * MediaWiki configuration globals that will eventually be passed through 
-        * to LocalSettings.php. The names only are given here, the defaults 
+        * MediaWiki configuration globals that will eventually be passed through
+        * to LocalSettings.php. The names only are given here, the defaults
         * typically come from DefaultSettings.php.
         */
        protected $defaultVarNames = array(
                'wgSitename',
                'wgPasswordSender',
-               'wgLanguageCode', 
+               'wgLanguageCode',
                'wgRightsIcon',
                'wgRightsText',
                'wgRightsUrl',
@@ -41,8 +41,8 @@ abstract class Installer {
        );
 
        /**
-        * Variables that are stored alongside globals, and are used for any 
-        * configuration of the installation process aside from the MediaWiki 
+        * Variables that are stored alongside globals, and are used for any
+        * configuration of the installation process aside from the MediaWiki
         * configuration. Map of names to defaults.
         */
        protected $internalDefaults = array(
@@ -77,7 +77,7 @@ abstract class Installer {
         * Known database types. These correspond to the class names <type>Installer,
         * and are also MediaWiki database types valid for $wgDBtype.
         *
-        * To add a new type, create a <type>Installer class and a Database<type> 
+        * To add a new type, create a <type>Installer class and a Database<type>
         * class, and add a config-type-<type> message to MessagesEn.php.
         */
        private $dbTypes = array(
@@ -98,8 +98,8 @@ abstract class Installer {
        private $dbInstallers = array();
 
        /**
-        * A list of environment check methods called by doEnvironmentChecks(). 
-        * These may output warnings using showMessage(), and/or abort the 
+        * A list of environment check methods called by doEnvironmentChecks().
+        * These may output warnings using showMessage(), and/or abort the
         * installation process by returning false.
         */
        protected $envChecks = array(
@@ -154,7 +154,7 @@ abstract class Installer {
                        '*' => array( 'edit' => false )
                ),
                'fishbowl' => array(
-                       '*' => array( 
+                       '*' => array(
                                'createaccount' => false,
                                'edit' => false,
                        ),
@@ -199,7 +199,7 @@ abstract class Installer {
                ),
                'cc-choose' => array(
                        // details will be filled in by the selector
-                       'url' => '', 
+                       'url' => '',
                        'icon' => '',
                        'text' => '',
                ),
@@ -257,7 +257,7 @@ abstract class Installer {
        /**
         * UI interface for displaying a short message
         * The parameters are like parameters to wfMsg().
-        * The messages will be in wikitext format, which will be converted to an 
+        * The messages will be in wikitext format, which will be converted to an
         * output format such as HTML or text before being sent to the user.
         */
        abstract function showMessage( $msg /*, ... */ );
@@ -289,14 +289,14 @@ abstract class Installer {
        }
 
        /**
-        * Do initial checks of the PHP environment. Set variables according to 
+        * Do initial checks of the PHP environment. Set variables according to
         * the observed environment.
         *
         * It's possible that this may be called under the CLI SAPI, not the SAPI
         * that the wiki will primarily run under. In that case, the subclass should
         * initialise variables such as wgScriptPath, before calling this function.
         *
-        * Under the web subclass, it can already be assumed that PHP 5+ is in use 
+        * Under the web subclass, it can already be assumed that PHP 5+ is in use
         * and that sessions are working.
         */
        function doEnvironmentChecks() {
@@ -359,7 +359,7 @@ abstract class Installer {
        }
 
        /**
-        * Set a variable which stores a password, except if the new value is a 
+        * Set a variable which stores a password, except if the new value is a
         * fake password in which case leave it as it is.
         */
        function setPassword( $name, $value ) {
@@ -367,7 +367,7 @@ abstract class Installer {
                        $this->setVar( $name, $value );
                }
        }
-       
+
        /** Check if we're installing the latest version */
        function envLatestVersion() {
                global $wgVersion;
@@ -391,7 +391,7 @@ abstract class Installer {
                }
                if( version_compare( $wgVersion, $currentVersion, '<' ) ) {
                        $this->showMessage( 'config-env-latest-old' );
-                       $this->showHelpBox( 'config-env-latest-help', $wgVersion, $currentVersion ); 
+                       $this->showHelpBox( 'config-env-latest-help', $wgVersion, $currentVersion );
                } elseif( version_compare( $wgVersion, $currentVersion, '>' ) ) {
                        $this->showMessage( 'config-env-latest-new' );
                }
@@ -557,17 +557,17 @@ abstract class Installer {
        }
 
        /**
-        * Search a path for any of the given executable names. Returns the 
-        * executable name if found. Also checks the version string returned 
+        * Search a path for any of the given executable names. Returns the
+        * executable name if found. Also checks the version string returned
         * by each executable
         *
         * @param $path String: path to search
         * @param $names Array of executable names
         * @param $versionInfo Boolean false or array with two members:
-        *       0 => Command to run for version check, with $1 for the path
-        *       1 => String to compare the output with
+        *               0 => Command to run for version check, with $1 for the path
+        *               1 => String to compare the output with
         *
-        * If $versionInfo is not false, only executables with a version 
+        * If $versionInfo is not false, only executables with a version
         * matching $versionInfo[1] will be returned.
         */
        function locateExecutable( $path, $names, $versionInfo = false ) {
@@ -582,7 +582,7 @@ abstract class Installer {
 
                                $file = str_replace( '$1', $command, $versionInfo[0] );
                                # Should maybe be wfShellExec( $file), but runs into a ulimit, see
-                               # http://www.mediawiki.org/w/index.php?title=New-installer_issues&diff=prev&oldid=335456 
+                               # http://www.mediawiki.org/w/index.php?title=New-installer_issues&diff=prev&oldid=335456
                                if ( strstr( `$file`, $versionInfo[1]) !== false )
                                        return $command;
                        }
@@ -732,7 +732,7 @@ abstract class Installer {
                # Give up
                return true;
        }
-       
+
        function envCheckUploadsDirectory() {
                global $IP, $wgServer;
                $dir = $IP . '/images/';
@@ -780,12 +780,12 @@ abstract class Installer {
         * Convert wikitext $text to HTML.
         *
         * This is potentially error prone since many parser features require a complete
-        * installed MW database. The solution is to just not use those features when you 
+        * installed MW database. The solution is to just not use those features when you
         * write your messages. This appears to work well enough. Basic formatting and
         * external links work just fine.
         *
-        * But in case a translator decides to throw in a #ifexist or internal link or 
-        * whatever, this function is guarded to catch attempted DB access and to present 
+        * But in case a translator decides to throw in a #ifexist or internal link or
+        * whatever, this function is guarded to catch attempted DB access and to present
         * some fallback text.
         *
         * @param $text String
@@ -819,8 +819,8 @@ abstract class Installer {
         */
        function docLink( $linkText, $attribs, $parser ) {
                $url = $this->getDocUrl( $attribs['href'] );
-               return '<a href="' . htmlspecialchars( $url ) . '">' . 
-                       htmlspecialchars( $linkText ) . 
+               return '<a href="' . htmlspecialchars( $url ) . '">' .
+                       htmlspecialchars( $linkText ) .
                        '</a>';
        }
 
@@ -987,7 +987,7 @@ abstract class Installer {
                wfSuppressWarnings();
                $ls = file_exists( "$IP/LocalSettings.php" );
                wfRestoreWarnings();
-               
+
                if( $ls ) {
                        if( $this->getDBInstaller()->needsUpgrade() ) {
                                $status->warning( 'config-localsettings-upgrade' );
@@ -1044,7 +1044,7 @@ abstract class Installer {
        }
 
        /**
-        * Add an installation step following the given step. 
+        * Add an installation step following the given step.
         * @param $findStep String the step to find.  Use NULL to put the step at the beginning.
         * @param $callback array
         */
index f085116..2573ca1 100644 (file)
@@ -413,4 +413,4 @@ CREATE INDEX /*i*/qcc_type ON /*_*/querycachetwo (qcc_type,qcc_value);
 CREATE INDEX /*i*/qcc_title ON /*_*/querycachetwo (qcc_type,qcc_namespace,qcc_title);
 CREATE INDEX /*i*/qcc_titletwo ON /*_*/querycachetwo (qcc_type,qcc_namespacetwo,qcc_titletwo);
 
-INSERT INTO /*_*/updatelog VALUES ('initial_indexes');
+INSERT INTO /*_*/updatelog (ul_key) VALUES ('initial_indexes');
index 551a5f1..5c09bf3 100644 (file)
@@ -1,3 +1,3 @@
 UPDATE /*_*/transcache SET tc_time = strftime('%Y%m%d%H%M%S', datetime(tc_time, 'unixepoch'));
 
-INSERT INTO /*_*/updatelog VALUES ('convert transcache field');
+INSERT INTO /*_*/updatelog (ul_key) VALUES ('convert transcache field');
index c3a8689..28554c0 100644 (file)
@@ -15,4 +15,4 @@ CREATE VIRTUAL TABLE /*_*/searchindex USING FTS3(
   si_text
 );
 
-INSERT INTO /*_*/updatelog VALUES ('fts3');
\ No newline at end of file
+INSERT INTO /*_*/updatelog (ul_key) VALUES ('fts3');
\ No newline at end of file