# the correct table.
$dbDetails = array_reverse( explode( '.', $name, 2 ) );
if ( isset( $dbDetails[1] ) ) {
- @list( $table, $database ) = $dbDetails;
+ list( $table, $database ) = $dbDetails;
} else {
- @list( $table ) = $dbDetails;
+ list( $table ) = $dbDetails;
}
$prefix = $this->mTablePrefix; # Default prefix
* @param $error String A simple error message to be used for debugging
*/
function __construct( DatabaseBase &$db, $error ) {
- $this->db =& $db;
+ $this->db = $db;
parent::__construct( $error );
}
* @return string
*/
function searchForm() {
- global $wgSitename, $wgServer;
+ global $wgSitename, $wgServer, $wgRequest;
$usegoogle = htmlspecialchars( $this->msg( 'dberr-usegoogle', 'You can try searching via Google in the meantime.' ) );
$outofdate = htmlspecialchars( $this->msg( 'dberr-outofdate', 'Note that their indexes of our content may be out of date.' ) );
$googlesearch = htmlspecialchars( $this->msg( 'searchbutton', 'Search' ) );
- $search = htmlspecialchars( @$_REQUEST['search'] );
+ $search = htmlspecialchars( $wgRequest->getVal( 'search' ) );
$server = htmlspecialchars( $wgServer );
$sitename = htmlspecialchars( $wgSitename );
* Opens a cataloged database connection, sets mConn
*/
protected function openCataloged( $dbName, $user, $password ) {
- @$this->mConn = db2_pconnect( $dbName, $user, $password );
+ wfSuppressWarnings();
+ $this->mConn = db2_pconnect( $dbName, $user, $password );
+ wfRestoreWarnings();
}
/**
protected function openUncataloged( $dbName, $user, $password, $server, $port )
{
$dsn = "DRIVER={IBM DB2 ODBC DRIVER};DATABASE=$dbName;CHARSET=UTF-8;HOSTNAME=$server;PORT=$port;PROTOCOL=TCPIP;UID=$user;PWD=$password;";
- @$this->mConn = db2_pconnect($dsn, "", "", array());
+ wfSuppressWarnings();
+ $this->mConn = db2_pconnect($dsn, "", "", array());
+ wfRestoreWarnings();
}
/**
}
// If the table exists, there should be one of it
- @$row = $this->fetchRow( $res );
+ $row = $this->fetchRow( $res );
$count = $row[0];
if ( $count == '1' || $count == 1 ) {
return true;
if ( $res instanceof ResultWrapper ) {
$res = $res->result;
}
- @$row = db2_fetch_object( $res );
+ wfSuppressWarnings();
+ $row = db2_fetch_object( $res );
+ wfRestoreWarnings();
if( $this->lastErrno() ) {
throw new DBUnexpectedError( $this, 'Error in fetchObject(): '
. htmlspecialchars( $this->lastError() ) );
$res = $res->result;
}
if ( db2_num_rows( $res ) > 0) {
- @$row = db2_fetch_array( $res );
+ wfSuppressWarnings();
+ $row = db2_fetch_array( $res );
+ wfRestoreWarnings();
if ( $this->lastErrno() ) {
throw new DBUnexpectedError( $this, 'Error in fetchRow(): '
. htmlspecialchars( $this->lastError() ) );
if ( $res instanceof ResultWrapper ) {
$res = $res->result;
}
- if ( !@db2_free_result( $res ) ) {
+ wfSuppressWarnings();
+ $ok = db2_free_result( $res );
+ wfRestoreWarnings();
+ if ( !$ok ) {
throw new DBUnexpectedError( $this, "Unable to free DB2 result\n" );
}
}
wfProfileOut("dbconnect-$server");
if ( $dbName != '' && $this->mConn !== false ) {
- $success = @/**/mysql_select_db( $dbName, $this->mConn );
+ wfSuppressWarnings();
+ $success = mysql_select_db( $dbName, $this->mConn );
+ wfRestoreWarnings();
if ( !$success ) {
$error = "Error selecting database $dbName on server {$this->mServer} " .
"from client host " . wfHostname() . "\n";
if ( $res instanceof ResultWrapper ) {
$res = $res->result;
}
- if ( !@/**/mysql_free_result( $res ) ) {
+ wfSuppressWarnings();
+ $ok = mysql_free_result( $res );
+ wfRestoreWarnings();
+ if ( !$ok ) {
throw new DBUnexpectedError( $this, "Unable to free MySQL result" );
}
}
if ( $res instanceof ResultWrapper ) {
$res = $res->result;
}
- @/**/$row = mysql_fetch_object( $res );
+ wfSuppressWarnings();
+ $row = mysql_fetch_object( $res );
+ wfRestoreWarnings();
if( $this->lastErrno() ) {
throw new DBUnexpectedError( $this, 'Error in fetchObject(): ' . htmlspecialchars( $this->lastError() ) );
}
if ( $res instanceof ResultWrapper ) {
$res = $res->result;
}
- @/**/$row = mysql_fetch_array( $res );
+ wfSuppressWarnings();
+ $row = mysql_fetch_array( $res );
+ wfRestoreWarnings();
if ( $this->lastErrno() ) {
throw new DBUnexpectedError( $this, 'Error in fetchRow(): ' . htmlspecialchars( $this->lastError() ) );
}
if ( $res instanceof ResultWrapper ) {
$res = $res->result;
}
- @/**/$n = mysql_num_rows( $res );
+ wfSuppressWarnings();
+ $n = mysql_num_rows( $res );
+ wfRestoreWarnings();
if( $this->lastErrno() ) {
throw new DBUnexpectedError( $this, 'Error in numRows(): ' . htmlspecialchars( $this->lastError() ) );
}
if ( $res instanceof ResultWrapper ) {
$res = $res->result;
}
- if ( !@pg_free_result( $res ) ) {
+ wfSuppressWarnings();
+ $ok = pg_free_result( $res );
+ wfRestoreWarnings();
+ if ( !$ok ) {
throw new DBUnexpectedError( $this, "Unable to free Postgres result\n" );
}
}
if ( $res instanceof ResultWrapper ) {
$res = $res->result;
}
- @$row = pg_fetch_object( $res );
+ wfSuppressWarnings();
+ $row = pg_fetch_object( $res );
+ wfRestoreWarnings();
# @todo FIXME: HACK HACK HACK HACK debug
# @todo hashar: not sure if the following test really trigger if the object
if ( $res instanceof ResultWrapper ) {
$res = $res->result;
}
- @$row = pg_fetch_array( $res );
+ wfSuppressWarnings();
+ $row = pg_fetch_array( $res );
+ wfRestoreWarnings();
if( pg_last_error( $this->mConn ) ) {
throw new DBUnexpectedError( $this, 'SQL error: ' . htmlspecialchars( pg_last_error( $this->mConn ) ) );
}
if ( $res instanceof ResultWrapper ) {
$res = $res->result;
}
- @$n = pg_num_rows( $res );
+ wfSuppressWarnings();
+ $n = pg_num_rows( $res );
+ wfRestoreWarnings();
if( pg_last_error( $this->mConn ) ) {
throw new DBUnexpectedError( $this, 'SQL error: ' . htmlspecialchars( pg_last_error( $this->mConn ) ) );
}