Index: trunk/extensions/WikiTrust/sql/create_db.php |
— | — | @@ -73,7 +73,7 @@ |
74 | 74 | // Load all of the MW files. |
75 | 75 | include($mw_root."/maintenance/commandLine.inc"); |
76 | 76 | |
77 | | -global $wgDBserver, $wgDBname, $wgDBuser, $wgDBprefix, $wgCreateRevisionIndex; |
| 77 | +global $wgDBserver, $wgDBname, $wgDBtype, $wgDBuser, $wgDBprefix, $wgCreateRevisionIndex; |
78 | 78 | |
79 | 79 | // Source the update scripts |
80 | 80 | require($mw_root."/extensions/WikiTrust/includes/TrustUpdateScripts.inc"); |
— | — | @@ -103,7 +103,14 @@ |
104 | 104 | } |
105 | 105 | |
106 | 106 | // We need root priveledges to do this. |
107 | | -$db_root = Database::newFromParams($wgDBserver, $dba, $dba_pass, $wgDBname); |
| 107 | +$db_root = DatabaseBase::newFromType( $wgDBtype, |
| 108 | + array( |
| 109 | + 'host' => $wgDBserver, |
| 110 | + 'user' => $dba, |
| 111 | + 'password' => $dba_pass, |
| 112 | + 'dbname' => $wgDBname |
| 113 | + ) |
| 114 | +); |
108 | 115 | |
109 | 116 | if (!$do_remove){ |
110 | 117 | // Now do the actual creating of tables. |
Index: trunk/extensions/Asksql/Asksql_body.php |
— | — | @@ -84,15 +84,24 @@ |
85 | 85 | function doSubmit() { |
86 | 86 | global $wgOut, $wgUser, $wgServer, $wgScript, $wgLang, $wgContLang; |
87 | 87 | global $wgDBserver, $wgDBsqluser, $wgDBsqlpassword, $wgDBname, $wgSqlTimeout; |
| 88 | + global $wgDBtype; |
88 | 89 | |
89 | 90 | # Use a limit, folks! |
90 | 91 | $this->query = trim( $this->query ); |
91 | 92 | if ( preg_match( '/^SELECT/i', $this->query ) |
92 | | - and !preg_match( '/LIMIT/i', $this->query ) ) { |
| 93 | + && !preg_match( '/LIMIT/i', $this->query ) ) { |
93 | 94 | $this->query .= ' LIMIT 100'; |
94 | 95 | } |
95 | | - $conn = Database::newFromParams( $wgDBserver, $wgDBsqluser, $wgDBsqlpassword, $wgDBname ); |
96 | 96 | |
| 97 | + $conn = DatabaseBase::newFromType( $wgDBtype, |
| 98 | + array( |
| 99 | + 'host' => $wgDBserver, |
| 100 | + 'user' => $wgDBsqluser, |
| 101 | + 'password' => $wgDBsqlpassword, |
| 102 | + 'dbname' => $wgDBname |
| 103 | + ) |
| 104 | + ); |
| 105 | + |
97 | 106 | $this->logQuery( $this->query ); |
98 | 107 | |
99 | 108 | # Start timer, will kill the DB thread in $wgSqlTimeout seconds |
— | — | @@ -117,7 +126,7 @@ |
118 | 127 | } |
119 | 128 | |
120 | 129 | $a = array(); |
121 | | - while ( $s = $conn->fetchObject( $res ) ) { |
| 130 | + foreach ( $res as $s ) { |
122 | 131 | array_push( $a, $s ); |
123 | 132 | } |
124 | 133 | $conn->freeResult( $res ); |