-<?
-include_once( "FulltextStoplist.php" );
-include_once( "CacheManager.php" );
-
-define( "DB_READ", -1 );
-define( "DB_WRITE", -2 );
-define( "DB_LAST", -3 );
-
-$wgLastDatabaseQuery = "";
-
-/* private */ $wgBufferSQLResults = true;
-
-function wfGetDB( $altuser = "", $altpassword = "", $altserver = "", $altdb = "" )
-{
- global $wgDBserver, $wgDBuser, $wgDBpassword;
- global $wgDBname, $wgDBconnection, $wgEmergencyContact;
-
- $noconn = wfMsgNoDB( "noconnect", $wgDBserver );
- $nodb = wfMsgNoDB( "nodb", $wgDBname );
-
- $helpme = "\n<p>If this error persists after reloading and clearing " .
- "your browser cache, please notify the <a href=\"mailto:" .
- $wgEmergencyContact . "\">Wikipedia developers</a>.</p>";
-
- if ( $altuser != "" ) {
- $serve = ($altserver ? $altserver : $wgDBserver );
- $db = ($altdb ? $altdb : $wgDBname );
- $wgDBconnection = mysql_connect( $serve, $altuser, $altpassword )
- or die( "bad sql user" );
- mysql_select_db( $db, $wgDBconnection ) or die(
- htmlspecialchars(mysql_error()) );
+<?php
+/**
+ * Backwards compatibility wrapper for Database.php
+ *
+ * Note: $wgDatabase has ceased to exist. Destroy all references.
+ *
+ * @package MediaWiki
+ */
+
+/**
+ * Usually aborts on failure
+ * If errors are explicitly ignored, returns success
+ * @param string $sql SQL query
+ * @param mixed $db database handler
+ * @param string $fname name of the php function calling
+ */
+function wfQuery( $sql, $db, $fname = '' ) {
+ global $wgOut;
+ if ( !is_numeric( $db ) ) {
+ # Someone has tried to call this the old way
+ $wgOut->fatalError( wfMsgNoDB( 'wrong_wfQuery_params', $db, $sql ) );