1
0
Fork 0

Convert to mysqli

This commit converts all mysql_* function to the appropriate counterparts
in mysqli.
I used this tool for most of it:
https://github.com/philip/MySQLConverterTool
This makes it possible to continue using MysqlDumper with PHP 7.0
Dieser Commit ist enthalten in:
Hannes Rosenögger 2016-02-01 20:02:15 +01:00
Ursprung dd0e8aede7
Commit 5b995d339d
23 geänderte Dateien mit 210 neuen und 214 gelöschten Zeilen

Datei anzeigen

@ -78,7 +78,7 @@ $pageheader=MSDheader().headline($lang['L_RESTORE']);
$aus1=$page_parameter='';
$RestoreFertig=$eingetragen=$dauer=$filegroesse=0;
MSD_mysql_connect($restore['dump_encoding'],true,$restore['actual_table']);
@mysql_select_db($databases['db_actual']) or die($lang['L_DB_SELECT_ERROR'].$databases['db_actual'].$lang['L_DB_SELECT_ERROR2']);
@((bool)mysqli_query($GLOBALS["___mysqli_ston"], "USE " . $databases['db_actual'])) or die($lang['L_DB_SELECT_ERROR'].$databases['db_actual'].$lang['L_DB_SELECT_ERROR2']);
// open backup file
$restore['filehandle']=($restore['compressed']==1) ? gzopen($config['paths']['backup'].$restore['filename'],'r') : fopen($config['paths']['backup'].$restore['filename'],'r');
@ -118,9 +118,9 @@ if ($restore['filehandle'])
// Disable Keys of actual table to speed up restoring
if (is_array($restore['tables_to_restore'])&&sizeof($restore['tables_to_restore'])>0&&in_array($restore['actual_table'],$restore['tables_to_restore']))
{
@mysql_query('/*!40000 ALTER TABLE `'.$restore['actual_table'].'` DISABLE KEYS */;',$config['dbconnection']);
@mysqli_query($config['dbconnection'], '/*!40000 ALTER TABLE `'.$restore['actual_table'].'` DISABLE KEYS */;');
}
elseif (sizeof($restore['tables_to_restore'])==0&&($restore['actual_table']>''&&$restore['actual_table']!='unbekannt')) @mysql_query('/*!40000 ALTER TABLE `'.$restore['actual_table'].'` DISABLE KEYS */;',$config['dbconnection']);
elseif (sizeof($restore['tables_to_restore'])==0&&($restore['actual_table']>''&&$restore['actual_table']!='unbekannt')) @mysqli_query($config['dbconnection'], '/*!40000 ALTER TABLE `'.$restore['actual_table'].'` DISABLE KEYS */;');
WHILE (($a<$restore['anzahl_zeilen'])&&(!$restore['fileEOF'])&&($dauer<$restore['max_zeit'])&&!$restore['EOB'])
{
@ -128,22 +128,22 @@ if ($restore['filehandle'])
if ($sql_command>'')
{
//WriteLog(htmlspecialchars($sql_command));
$res=mysql_query($sql_command,$config['dbconnection']);
$res=mysqli_query($config['dbconnection'], $sql_command);
if (!$res===false)
{
$anzsql=mysql_affected_rows($config['dbconnection']);
$anzsql=mysqli_affected_rows($config['dbconnection']);
// Anzahl der eingetragenen Datensaetze ermitteln (Indexaktionen nicht zaehlen)
$command=strtoupper(substr($sql_command,0,7));
if ($command=='INSERT ')
{
$anzsql=mysql_affected_rows($config['dbconnection']);
$anzsql=mysqli_affected_rows($config['dbconnection']);
if ($anzsql>0) $restore['eintraege_ready']+=$anzsql;
}
}
else
{
// Bei MySQL-Fehlern sofort abbrechen und Info ausgeben
$meldung=@mysql_error($config['dbconnection']);
$meldung=@((is_object($config['dbconnection'])) ? mysqli_error($config['dbconnection']) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false));
if ($meldung!='')
{
if (strtolower(substr($meldung,0,15))=='duplicate entry')