Index: trunk/extensions/StarterWiki/maintenance/createWikiDBFromStarter.php |
— | — | @@ -26,31 +26,9 @@ |
27 | 27 | |
28 | 28 | $optionsWithArgs = array( 'database' ); |
29 | 29 | $wgUseMasterForMaintenance = true; |
30 | | -require_once( "commandLine.inc" ); |
| 30 | +require_once( dirname( dirname( dirname( dirname( __FILE__ ) ) ) ) . '/maintenance/commandLine.inc' ); |
31 | 31 | $wgTitle = Title::newFromText( "StarterWiki Database Creator" ); |
32 | | -$dbclass = 'Database' . ucfirst( $wgDBtype ); |
33 | 32 | |
34 | | -# Do a pre-emptive check to ensure we've got credentials supplied |
35 | | -# We can't, at this stage, check them, but we can detect their absence, |
36 | | -# which seems to cause most of the problems people whinge about |
37 | | -if ( !isset( $wgDBadminuser ) || !isset( $wgDBadminpassword ) ) { |
38 | | - echo( "No superuser credentials could be found. Please provide the details\n" ); |
39 | | - echo( "of a user with appropriate permissions to update the database. See\n" ); |
40 | | - echo( "AdminSettings.sample for more details.\n\n" ); |
41 | | - exit(); |
42 | | -} |
43 | | - |
44 | | -# Attempt to connect to the database as a privileged user |
45 | | -# This will vomit up an error if there are permissions problems |
46 | | -$wgDatabase = new $dbclass( $wgDBserver, $wgDBadminuser, $wgDBadminpassword, $wgDBname, 1 ); |
47 | | - |
48 | | -if ( !isset( $wgDatabase ) || !$wgDatabase->isOpen() ) { |
49 | | - # Appears to have failed |
50 | | - echo( "A connection to the database could not be established. Check the\n" ); |
51 | | - echo( "values of \$wgDBadminuser and \$wgDBadminpassword.\n" ); |
52 | | - exit(); |
53 | | -} |
54 | | - |
55 | 33 | function usageInfo() { |
56 | 34 | echo <<<TEXT |
57 | 35 | Usage: |
— | — | @@ -207,4 +185,4 @@ |
208 | 186 | return true; |
209 | 187 | } |
210 | 188 | |
211 | | -tryRunCreate( $wgDatabase ); |
| 189 | +tryRunCreate( wfGetDB( DB_MASTER ) ); |