From d0ff1e57ff7fb7bf2d5b6b9a70e867c90cda6aa4 Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Thu, 23 Jul 2009 00:31:37 +0000 Subject: [PATCH] * (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 --- AdminSettings.sample | 32 -------------------------------- RELEASE-NOTES | 6 ++++-- UPGRADE | 19 +++++++++---------- config/index.php | 22 +++++++++++++++++----- docs/scripts.txt | 7 +++---- maintenance/README | 6 +++--- maintenance/commandLine.inc | 4 ++-- maintenance/fuzz-tester.php | 2 +- profileinfo.php | 1 - t/Search.inc | 3 +-- 10 files changed, 40 insertions(+), 62 deletions(-) delete mode 100644 AdminSettings.sample diff --git a/AdminSettings.sample b/AdminSettings.sample deleted file mode 100644 index 8b6fe99351..0000000000 --- a/AdminSettings.sample +++ /dev/null @@ -1,32 +0,0 @@ -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 "
  • Invalid database superuser, please supply a valid superuser account.
  • "; echo "
  • ERR: ".print_r(oci_error(), true)."
  • "; @@ -1173,7 +1174,7 @@ if( $conf->posted && ( 0 == count( $errs ) ) ) { print " If the next step fails, see http://dev.mysql.com/doc/mysql/en/old-client.html for help."; } print "\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 "
  • 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( "
  • " . htmlspecialchars( "Granting user permissions to $wgDBuser on $wgDBname..." ) ); - dbsource( "../maintenance/users.sql", $wgDatabase ); + $wgDatabase->sourceFile( "../maintenance/users.sql" ); echo( "success.
  • \n" ); } } @@ -1547,6 +1548,8 @@ if( count( $errs ) ) { checked="checked" />   + populateadmin ) { ?>checked="checked" /> +  
    @@ -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; diff --git a/docs/scripts.txt b/docs/scripts.txt index f8228a463a..2027d176e7 100644 --- a/docs/scripts.txt +++ b/docs/scripts.txt @@ -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 diff --git a/maintenance/README b/maintenance/README index e2215c1dd9..d6e7691705 100644 --- a/maintenance/README +++ b/maintenance/README @@ -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 diff --git a/maintenance/commandLine.inc b/maintenance/commandLine.inc index a221e6457e..b4fcbe4b7c 100644 --- a/maintenance/commandLine.inc +++ b/maintenance/commandLine.inc @@ -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; diff --git a/maintenance/fuzz-tester.php b/maintenance/fuzz-tester.php index 124857020b..da1680b214 100644 --- a/maintenance/fuzz-tester.php +++ b/maintenance/fuzz-tester.php @@ -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 diff --git a/profileinfo.php b/profileinfo.php index fcce6d71c6..afc05eb5c0 100644 --- a/profileinfo.php +++ b/profileinfo.php @@ -4,7 +4,6 @@ ini_set( 'zlib.output_compression', 'off' ); $wgEnableProfileInfo = $wgProfileToDatabase = false; require_once( './includes/WebStart.php' ); -@include_once( './AdminSettings.php' ); ?>