* (bug 14201) Set $wgDBadminuser/$wgDBadminpassword during setup
authorChad Horohoe <demon@users.mediawiki.org>
Thu, 23 Jul 2009 00:31:37 +0000 (00:31 +0000)
committerChad Horohoe <demon@users.mediawiki.org>
Thu, 23 Jul 2009 00:31:37 +0000 (00:31 +0000)
* (bug 18768) Remove AdminSettings requirements. Maintenance environment will still load it if it exists, but it's not required for anything

AdminSettings.sample [deleted file]
RELEASE-NOTES
UPGRADE
config/index.php
docs/scripts.txt
maintenance/README
maintenance/commandLine.inc
maintenance/fuzz-tester.php
profileinfo.php
t/Search.inc

diff --git a/AdminSettings.sample b/AdminSettings.sample
deleted file mode 100644 (file)
index 8b6fe99..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-<?php
-/**
- * This file should be copied to AdminSettings.php, and modified
- * to reflect local settings. It is required for the maintenance
- * scripts which run on the command line, as an extra security
- * measure to allow using a separate user account with higher
- * privileges to do maintenance work.
- *
- * Developers: Do not check AdminSettings.php into Subversion
- */
-
-/*
- * This data is used by all database maintenance scripts
- * (see directory maintenance/). The SQL user MUST BE
- * MANUALLY CREATED or set to an existing user with
- * necessary permissions.
- *
- * This is not to be confused with sysop accounts for the
- * wiki.
- *
- * NOTE: for PostgreSQL this should be set to the same user and 
- * password as the web user, that is, the same as $wgDBuser and
- * $wgDBpassword in LocalSettings.php. This is necessary to 
- * ensure that the owner for new tables is set correctly.
- */
-$wgDBadminuser      = 'wikiadmin';
-$wgDBadminpassword  = 'adminpass';
-
-/*
- * Whether to enable the profileinfo.php script.
- */
-$wgEnableProfileInfo = false;
index dc4b407..ae2d6b9 100644 (file)
@@ -37,7 +37,6 @@ loader. By default we only grab classes in $wgJSAutoloadClasses
 this. Was used when mwEmbed was going to be an extension.   
 * $wgDebugJavaScript if we want to enable fresh debug javascript 
 * $wgPhpCliPath Path to php-cli for spinning up background php processes
-
 * (bug 18222) $wgMinimalPasswordLength default is now 1
 * $wgSessionHandler can be used to configure session.save_handler
 * $wgLocalFileRepo/$wgForeignFileRepos now have a 'fileMode' parameter to
@@ -151,7 +150,10 @@ this. Was used when mwEmbed was going to be an extension.
   thumbnails to be stored in a separate location to the source images.
 * If config/ directory is not executable, the command to make it executable 
   now asks the user to cd to the correct directory
-* Add experimental new external authentication framework, ExternalAuth.
+* Add experimental new external authentication framework, ExternalAuth
+* (bug 14201) Set $wgDBadminuser/$wgDBadminpassword during setup
+* (bug 18768) Remove AdminSettings requirements. Maintenance environment
+  will still load it if it exists, but it's not required for anything
 
 === Bug fixes in 1.16 ===
 
diff --git a/UPGRADE b/UPGRADE
index 9d0e052..f55364f 100644 (file)
--- a/UPGRADE
+++ b/UPGRADE
@@ -42,8 +42,7 @@ You can also obtain the new files directly from our Subversion source code
 repository, via a checkout or export operation.
 
 Replace the existing MediaWiki files with the new. You should preserve the
-LocalSettings.php file, AdminSettings.php file (if present), and the
-"extensions" and "images" directories.
+LocalSettings.php file and the "extensions" and "images" directories.
 
 Depending upon your configuration, you may also need to preserve additional
 directories, including a custom upload directory ($wgUploadDirectory),
@@ -51,8 +50,8 @@ deleted file archives, and any custom skins.
 
 === Perform the database upgrade ===
 
-You will need an AdminSettings.php file set up in the correct format; see
-AdminSettings.sample in the wiki root for more information and examples.
+You will need to have $wgDBadminuser and $wgDBadminpass set in your
+LocalSettings.php, see there for more info.
 
 From the command line, browse to the "maintenance" directory and run the 
 update.php script to check and update the schema. This will insert missing
@@ -172,10 +171,10 @@ should be replaced with:
 === Web installer ===
 
 You can use the web-based installer wizard if you first remove the
-LocalSettings.php (and AdminSettings.php, if any) files; be sure to
-give the installer the same information as you did on the original
-install (language/encoding, database name, password, etc). This will
-also generate a fresh LocalSettings.php, which you may need to customize.
+LocalSettings.php file; be sure to give the installer the same 
+information as you did on the original install (language/encoding, 
+database name, password, etc). This will also generate a fresh 
+LocalSettings.php, which you may need to customize.
 
 You may change some settings during the install, but be very careful!
 Changing the encoding in particular will generally leave you with a
@@ -185,8 +184,8 @@ lot of corrupt pages, particularly if your wiki is not in English.
 
 Additionally, as of 1.4.0 you can run an in-place upgrade script from
 the command line, keeping your existing LocalSettings.php. This requires
-that you create an AdminSettings.php giving an appropriate database user
-and password with privileges to modify the database structure.
+that you set $wgDBadminuser and $wgDBadminpassword with  an appropriate 
+database user and password with privileges to modify the database structure.
 
 Once the new files are in place, go into the maintenance subdirectory and
 run the script:
index d48f56a..0bce9e6 100644 (file)
@@ -633,6 +633,7 @@ print "<li style='font-weight:bold;color:green;font-size:110%'>Environment check
        $conf->RootUser = importPost( "RootUser", "root" );
        $conf->RootPW = importPost( "RootPW", "" );
        $useRoot = importCheck( 'useroot', false );
+       $conf->populateadmin = importCheck( 'populateadmin', false );
        $conf->LanguageCode = importPost( "LanguageCode", "en" );
        ## MySQL specific:
        $conf->DBprefix     = importPost( "DBprefix" );
@@ -1000,7 +1001,7 @@ if( $conf->posted && ( 0 == count( $errs ) ) ) {
                                                if ($wgDatabase->isOpen()) {
                                                        $wgDBOracleDefTS = $conf->DBdefTS_ora;
                                                        $wgDBOracleTempTS = $conf->DBtempTS_ora;
-                                                       dbsource( "../maintenance/ora/user.sql", $wgDatabase );
+                                                       $wgDatabase->sourceFile( "../maintenance/ora/user.sql"  );
                                                } else {
                                                        echo "<li>Invalid database superuser, please supply a valid superuser account.</li>";
                                                        echo "<li>ERR: ".print_r(oci_error(), true)."</li>";
@@ -1173,7 +1174,7 @@ if( $conf->posted && ( 0 == count( $errs ) ) ) {
                                                        print " <b class='error'>If the next step fails, see <a href='http://dev.mysql.com/doc/mysql/en/old-client.html'>http://dev.mysql.com/doc/mysql/en/old-client.html</a> for help.</b>";
                                                }
                                                print "</li>\n";
-                                               dbsource( "../maintenance/users.sql", $wgDatabase );
+                                               $wgDatabase->sourceFile( "../maintenance/users.sql" );
                                        }
                                }
                        }
@@ -1207,8 +1208,8 @@ if( $conf->posted && ( 0 == count( $errs ) ) ) {
                        # FIXME: Check for errors
                        print "<li>Creating tables...";
                        if ($conf->DBtype == 'mysql') {
-                               dbsource( "../maintenance/tables.sql", $wgDatabase );
-                               dbsource( "../maintenance/interwiki.sql", $wgDatabase );
+                               $wgDatabase->sourceFile( "../maintenance/tables.sql" );
+                               $wgDatabase->sourceFile( "../maintenance/interwiki.sql" );
                        } elseif (is_callable(array($wgDatabase, 'setup_database'))) {
                                $wgDatabase->setup_database();
                        }
@@ -1241,7 +1242,7 @@ if( $conf->posted && ( 0 == count( $errs ) ) ) {
                                } else {
                                        # Yes, so run the grants
                                        echo( "<li>" . htmlspecialchars( "Granting user permissions to $wgDBuser on $wgDBname..." ) );
-                                       dbsource( "../maintenance/users.sql", $wgDatabase );
+                                       $wgDatabase->sourceFile( "../maintenance/users.sql" );
                                        echo( "success.</li>\n" );
                                }
                        }
@@ -1547,6 +1548,8 @@ if( count( $errs ) ) {
                <label class="column">Superuser account:</label>
                <input type="checkbox" name="useroot" id="useroot" <?php if( $useRoot ) { ?>checked="checked" <?php } ?> />
                &nbsp;<label for="useroot">Use superuser account</label>
+               <input type="checkbox" name="populateadmin" id="populateadmin" <?php if( $conf->populateadmin ) { ?>checked="checked" <?php } ?> />
+               &nbsp;<label for="populateadmin">Set as admin user for maintenance</label>
        </div>
        <div class="config-input"><?php aField( $conf, "RootUser", "Superuser name:", "text" ); ?></div>
        <div class="config-input"><?php aField( $conf, "RootPW", "Superuser password:", "password" ); ?></div>
@@ -1812,6 +1815,11 @@ function writeLocalSettings( $conf ) {
                # Needs literal string interpolation for the current style path
                $slconf['RightsIcon'] = $conf->RightsIcon;
        }
+       
+       if( $conf->populateadmin ) {
+               $slconf['DBadminuser'] = $conf->RootUser;
+               $slconf['DBadminpassword'] = $conf->RootPW;
+       }
 
        if( $conf->DBtype == 'mysql' ) {
                $dbsettings =
@@ -1919,6 +1927,10 @@ if ( \$wgCommandLineMode ) {
 
 {$dbsettings}
 
+## Database admin settings, used for maintenance scripts
+\$wgDBadminuser     = \"{$slconf['DBadminuser']}\";
+\$wgDBadminpassword = \"{$slconf['DBadminpassword']}\";
+
 ## Shared memory settings
 \$wgMainCacheType = $cacheType;
 \$wgMemCachedServers = $mcservers;
index f8228a4..2027d17 100644 (file)
@@ -35,10 +35,9 @@ Primary scripts:
     to force the profiler to save the informations in the database and apply the
     maintenance/archives/patch-profiling.sql patch to the database.
 
-    To enable the profileinfo.php itself, you'll need to create the
-    AdminSettings.php file (see AdminSettings.sample for more information) and
-    set $wgEnableProfileInfo to true in that file. See also
-    http://www.mediawiki.org/wiki/How_to_debug#Profiling.
+    To enable the profileinfo.php itself, you'll need to set $wgDBadminuser
+    and $wgDBadminpassword in your LocalSettings.php, as well as $wgEnableProfileInfo 
+    See also http://www.mediawiki.org/wiki/How_to_debug#Profiling.
 
   redirect.php
     Script that only redirect to the article passed in the wpDropdown parameter
index e2215c1..d6e7691 100644 (file)
@@ -10,8 +10,8 @@ proper installation.
 
 Certain scripts will require elevated access to the database. In order to
 provide this, first create a MySQL user with "all" permissions on the wiki
-database, and then place their username and password in an AdminSettings.php
-file in the directory above. See AdminSettings.sample for specifics on this.
+database, and then set $wgDBadminuser and $wgDBadminpassword in your
+LocalSettings.php
 
 === Brief explanation of files ===
 
@@ -94,7 +94,7 @@ installations.
        Immediately complete all jobs in the job queue
 
        stats.php
-       Show all statistics stored in memcached
+       Show all statistics stored in the cache
 
        undelete.php
        Undelete all revisions of a page
index a221e64..b4fcbe4 100644 (file)
@@ -171,8 +171,8 @@ if ( file_exists( dirname(__FILE__).'/wikimedia-mode' ) ) {
        #require_once( $IP.'/includes/ProfilerStub.php' );
        require( $IP.'/includes/Defines.php' );
        require( $IP.'/CommonSettings.php' );
-       if ( !$wgUseNormalUser ) {
-               require( $IP.'/AdminSettings.php' );
+       if ( !$wgUseNormalUser && is_readable( "$IP/AdminSettings.php" ) ) {
+               require( "$IP/AdminSettings.php" );
        }
 } else {
        $wgWikiFarm = false;
index 1248570..da1680b 100644 (file)
@@ -138,7 +138,7 @@ Wiki configuration for testing:
   }
   // --------- End ---------
 
-  Also add/change this in AdminSettings.php:
+  Also add/change this in LocalSettings.php:
   // --------- Start ---------
   $wgEnableProfileInfo = true;
   $wgDBserver = "localhost"; // replace with DB server hostname
index fcce6d7..afc05eb 100644 (file)
@@ -4,7 +4,6 @@ ini_set( 'zlib.output_compression', 'off' );
 $wgEnableProfileInfo = $wgProfileToDatabase = false;
 
 require_once( './includes/WebStart.php' );
-@include_once( './AdminSettings.php' );
 
 ?>
 <!--
index 2522930..a76acfd 100644 (file)
@@ -7,11 +7,10 @@ require 't/Test.php';
 require 'includes/Defines.php';
 require 'includes/ProfilerStub.php';
 require 'LocalSettings.php';
-require 'AdminSettings.php';
 require 'includes/Setup.php';
 
 function buildTestDatabase( $tables ) {
-       global $wgDBprefix, $wgDBserver, $wgDBadminuser, $wgDBadminpassword, $wgDBname, $wgDBtype;
+       global $wgDBprefix, $wgDBserver, $wgDBname, $wgDBtype;
        $oldPrefix = $wgDBprefix;
        $wgDBprefix = 'parsertest';