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:
Ursprung
dd0e8aede7
Commit
5b995d339d
23 geänderte Dateien mit 210 neuen und 214 gelöschten Zeilen
|
|
@ -14,7 +14,7 @@ for ($i=0; $i<count($databases['Name']); $i++)
|
|||
}
|
||||
if (isset($_POST['kill'.$i]))
|
||||
{
|
||||
$res=mysql_query('DROP DATABASE `'.$databases['Name'][$i].'`') or die(mysql_error());
|
||||
$res=mysqli_query($GLOBALS["___mysqli_ston"], 'DROP DATABASE `'.$databases['Name'][$i].'`') or die(((is_object($GLOBALS["___mysqli_ston"])) ? mysqli_error($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false)));
|
||||
$dba='<p class="green">'.$lang['L_DB'].' '.$databases['Name'][$i].' '.$lang['L_INFO_DELETED'].'</p>';
|
||||
SetDefault();
|
||||
include ($config['files']['parameter']);
|
||||
|
|
@ -23,16 +23,16 @@ for ($i=0; $i<count($databases['Name']); $i++)
|
|||
}
|
||||
if (isset($_POST['optimize'.$i]))
|
||||
{
|
||||
mysql_select_db($databases['Name'][$i], $config['dbconnection']);
|
||||
$res=mysql_query('SHOW TABLES FROM `'.$databases['Name'][$i].'`',$config['dbconnection']);
|
||||
((bool)mysqli_query( $config['dbconnection'], "USE " . $databases['Name'][$i]));
|
||||
$res=mysqli_query($config['dbconnection'], 'SHOW TABLES FROM `'.$databases['Name'][$i].'`');
|
||||
$tabellen='';
|
||||
WHILE ($row=mysql_fetch_row($res))
|
||||
WHILE ($row=mysqli_fetch_row($res))
|
||||
$tabellen.='`'.$row[0].'`,';
|
||||
$tabellen=substr($tabellen,0,(strlen($tabellen)-1));
|
||||
if ($tabellen>"")
|
||||
{
|
||||
$query="OPTIMIZE TABLE ".$tabellen;
|
||||
$res=mysql_query($query) or die(mysql_error()."");
|
||||
$res=mysqli_query($GLOBALS["___mysqli_ston"], $query) or die(((is_object($GLOBALS["___mysqli_ston"])) ? mysqli_error($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false))."");
|
||||
}
|
||||
$_GET['dbid']=$i;
|
||||
$dba='<p class="green">'.$lang['L_DB'].' <b>'.$databases['Name'][$i].'</b> '.$lang['L_INFO_OPTIMIZED'].'.</p>';
|
||||
|
|
@ -63,7 +63,7 @@ for ($i=0; $i<count($databases['Name']); $i++)
|
|||
if ($i==$databases['db_selected_index']) $rowclass="dbrowsel";
|
||||
|
||||
//gibts die Datenbank überhaupt?
|
||||
if (!mysql_select_db($databases['Name'][$i],$config['dbconnection']))
|
||||
if (!((bool)mysqli_query($config['dbconnection'], "USE " . $databases['Name'][$i])))
|
||||
{
|
||||
$tpl->assign_block_vars('DB_NOT_FOUND',array(
|
||||
'ROWCLASS' => $rowclass,
|
||||
|
|
@ -73,9 +73,9 @@ for ($i=0; $i<count($databases['Name']); $i++)
|
|||
}
|
||||
else
|
||||
{
|
||||
mysql_select_db($databases['Name'][$i],$config['dbconnection']);
|
||||
$tabellen=mysql_query('SHOW TABLES FROM `'.$databases['Name'][$i].'`',$config['dbconnection']);
|
||||
$num_tables=mysql_num_rows($tabellen);
|
||||
((bool)mysqli_query($config['dbconnection'], "USE " . $databases['Name'][$i]));
|
||||
$tabellen=mysqli_query($config['dbconnection'], 'SHOW TABLES FROM `'.$databases['Name'][$i].'`');
|
||||
$num_tables=mysqli_num_rows($tabellen);
|
||||
$tpl->assign_block_vars('ROW',array(
|
||||
'ROWCLASS' => $rowclass,
|
||||
'NR' => ($i+1),
|
||||
|
|
@ -101,9 +101,9 @@ if (isset($_GET['dbid']))
|
|||
$dbid=$_GET['dbid'];
|
||||
|
||||
$numrows=0;
|
||||
$res=@mysql_query("SHOW TABLE STATUS FROM `".$databases['Name'][$dbid]."`");
|
||||
mysql_select_db($databases['Name'][$dbid]);
|
||||
if ($res) $numrows=mysql_num_rows($res);
|
||||
$res=@mysqli_query($GLOBALS["___mysqli_ston"], "SHOW TABLE STATUS FROM `".$databases['Name'][$dbid]."`");
|
||||
((bool)mysqli_query($GLOBALS["___mysqli_ston"], "USE " . $databases['Name'][$dbid]));
|
||||
if ($res) $numrows=mysqli_num_rows($res);
|
||||
$tpl->assign_vars(array(
|
||||
'DB_NAME' => $databases['Name'][$dbid],
|
||||
'DB_NAME_URLENCODED' => urlencode($databases['Name'][$dbid]),
|
||||
|
|
@ -120,10 +120,10 @@ if (isset($_GET['dbid']))
|
|||
$sum_records=$sum_data_length='';
|
||||
for ($i=0; $i<$numrows; $i++)
|
||||
{
|
||||
$row=mysql_fetch_array($res,MYSQL_ASSOC);
|
||||
$row=mysqli_fetch_array($res, MYSQLI_ASSOC);
|
||||
// Get nr of records -> need to do it this way because of incorrect returns when using InnoDBs
|
||||
$sql_2="SELECT count(*) as `count_records` FROM `".$databases['Name'][$dbid]."`.`".$row['Name']."`";
|
||||
$res2=@mysql_query($sql_2);
|
||||
$res2=@mysqli_query($GLOBALS["___mysqli_ston"], $sql_2);
|
||||
if ($res2===false)
|
||||
{
|
||||
$row['Rows']=0;
|
||||
|
|
@ -131,7 +131,7 @@ if (isset($_GET['dbid']))
|
|||
}
|
||||
else
|
||||
{
|
||||
$row2=mysql_fetch_array($res2);
|
||||
$row2=mysqli_fetch_array($res2);
|
||||
$row['Rows']=$row2['count_records'];
|
||||
$rowclass=($i%2) ? 'dbrow' : 'dbrow1';
|
||||
}
|
||||
|
|
@ -163,16 +163,16 @@ if (isset($_GET['dbid']))
|
|||
|
||||
if ($checkit==$row['Name']||$repair==1)
|
||||
{
|
||||
$tmp_res=mysql_query("REPAIR TABLE `".$row['Name']."`");
|
||||
$tmp_res=mysqli_query($GLOBALS["___mysqli_ston"], "REPAIR TABLE `".$row['Name']."`");
|
||||
}
|
||||
|
||||
if (($checkit==$row['Name']||$checkit=='ALL'))
|
||||
{
|
||||
// table needs to be checked
|
||||
$tmp_res=mysql_query('CHECK TABLE `'.$row['Name'].'`');
|
||||
$tmp_res=mysqli_query($GLOBALS["___mysqli_ston"], 'CHECK TABLE `'.$row['Name'].'`');
|
||||
if ($tmp_res)
|
||||
{
|
||||
$tmp_row=mysql_fetch_row($tmp_res);
|
||||
$tmp_row=mysqli_fetch_row($tmp_res);
|
||||
if ($tmp_row[3]=='OK') $tpl->assign_block_vars('ROW.CHECK_TABLE_OK',array());
|
||||
else
|
||||
$tpl->assign_block_vars('ROW.CHECK_TABLE_NOT_OK',array());
|
||||
|
|
@ -186,10 +186,10 @@ if (isset($_GET['dbid']))
|
|||
if ($enableKeys==$row['Name'] || $enableKeys=="ALL")
|
||||
{
|
||||
$sSql= "ALTER TABLE `".$databases['Name'][$dbid]."`.`".$row['Name']."` ENABLE KEYS";
|
||||
$tmp_res=mysql_query($sSql);
|
||||
$tmp_res=mysqli_query($GLOBALS["___mysqli_ston"], $sSql);
|
||||
}
|
||||
$res3=mysql_query('SHOW INDEX FROM `'.$databases['Name'][$dbid]."`.`".$row['Name']."`");
|
||||
WHILE ($row3 = mysql_fetch_array($res3, MYSQL_ASSOC))
|
||||
$res3=mysqli_query($GLOBALS["___mysqli_ston"], 'SHOW INDEX FROM `'.$databases['Name'][$dbid]."`.`".$row['Name']."`");
|
||||
WHILE ($row3 = mysqli_fetch_array($res3, MYSQLI_ASSOC))
|
||||
{
|
||||
if ($row3['Comment']=="disabled") {
|
||||
$keys_disabled = true;
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ echo '<p> </p>';
|
|||
switch ($var)
|
||||
{
|
||||
case "variables":
|
||||
$res=@mysql_query("SHOW variables");
|
||||
if ($res) $numrows=mysql_num_rows($res);
|
||||
$res=@mysqli_query($GLOBALS["___mysqli_ston"], "SHOW variables");
|
||||
if ($res) $numrows=mysqli_num_rows($res);
|
||||
if ($numrows==0)
|
||||
{
|
||||
echo $lang['L_INFO_NOVARS'];
|
||||
|
|
@ -25,7 +25,7 @@ switch ($var)
|
|||
echo '<table class="bdr"><tr class="thead"><th><strong>Name</strong></th><th><strong>'.$lang['L_INHALT'].'</strong></th></tr>';
|
||||
for ($i=0; $i<$numrows; $i++)
|
||||
{
|
||||
$row=mysql_fetch_array($res);
|
||||
$row=mysqli_fetch_array($res);
|
||||
$cl=($i%2) ? "dbrow" : "dbrow1";
|
||||
echo '<tr class="'.$cl.'"><td align="left">'.$row[0].'</td><td align="left">'.$row[1].'</td></tr>';
|
||||
}
|
||||
|
|
@ -33,8 +33,8 @@ switch ($var)
|
|||
echo '</table>';
|
||||
break;
|
||||
case "status":
|
||||
$res=@mysql_query("SHOW STATUS");
|
||||
if ($res) $numrows=mysql_num_rows($res);
|
||||
$res=@mysqli_query($GLOBALS["___mysqli_ston"], "SHOW STATUS");
|
||||
if ($res) $numrows=mysqli_num_rows($res);
|
||||
if ($numrows==0)
|
||||
{
|
||||
echo $lang['L_INFO_NOSTATUS'];
|
||||
|
|
@ -45,7 +45,7 @@ switch ($var)
|
|||
for ($i=0; $i<$numrows; $i++)
|
||||
{
|
||||
$cl=($i%2) ? "dbrow" : "dbrow1";
|
||||
$row=mysql_fetch_array($res);
|
||||
$row=mysqli_fetch_array($res);
|
||||
echo '<tr class="'.$cl.'"><td align="left" valign="top">'.$row[0].'</td><td align="left" valign="top">'.$row[1].'</td></tr>';
|
||||
}
|
||||
}
|
||||
|
|
@ -59,7 +59,7 @@ switch ($var)
|
|||
$wait=(isset($_GET['wait'])) ? $_GET['wait'] : 0;
|
||||
if ($wait==0)
|
||||
{
|
||||
$ret=mysql_query("KILL ".$_GET['killid']);
|
||||
$ret=mysqli_query($GLOBALS["___mysqli_ston"], "KILL ".$_GET['killid']);
|
||||
$wait=2;
|
||||
}
|
||||
else
|
||||
|
|
@ -77,8 +77,8 @@ switch ($var)
|
|||
}
|
||||
|
||||
$killid=$wait=0;
|
||||
$res=@mysql_query("SHOW FULL PROCESSLIST ");
|
||||
if ($res) $numrows=mysql_num_rows($res);
|
||||
$res=@mysqli_query($GLOBALS["___mysqli_ston"], "SHOW FULL PROCESSLIST ");
|
||||
if ($res) $numrows=mysqli_num_rows($res);
|
||||
if ($numrows==0)
|
||||
{
|
||||
echo $lang['L_INFO_NOPROCESSES'];
|
||||
|
|
@ -89,7 +89,7 @@ switch ($var)
|
|||
for ($i=0; $i<$numrows; $i++)
|
||||
{
|
||||
$cl=($i%2) ? "dbrow" : "dbrow1";
|
||||
$row=mysql_fetch_array($res);
|
||||
$row=mysqli_fetch_array($res);
|
||||
echo '<tr><td>'.$row[0].'</td><td>'.$row[1].'</td>
|
||||
<td>'.$row[2].'</td><td>'.$row[3].'</td><td>'.$row[4].'</td><td>'.$row[5].'</td>
|
||||
<td>'.$row[6].'</td><td>'.$row[7].'</td>
|
||||
|
|
|
|||
Binäre Datei nicht angezeigt.
|
|
@ -2,18 +2,18 @@
|
|||
if (!defined('MSD_VERSION')) die('No direct access.');
|
||||
$sysaction=(isset($_GET['dosys'])) ? $_GET['dosys'] : 0;
|
||||
$msg="";
|
||||
$res=@mysql_query("SHOW VARIABLES LIKE 'datadir'",$config['dbconnection']);
|
||||
$res=@mysqli_query($config['dbconnection'], "SHOW VARIABLES LIKE 'datadir'");
|
||||
if ($res)
|
||||
{
|
||||
$row=mysql_fetch_array($res);
|
||||
$row=mysqli_fetch_array($res);
|
||||
$data_dir=$row[1];
|
||||
}
|
||||
switch ($sysaction)
|
||||
{
|
||||
case 1: //FLUSH PRIVILEGES
|
||||
$msg="> operating FLUSH PRIVILEGES<br>";
|
||||
$res=@mysql_query("FLUSH PRIVILEGES",$config['dbconnection']);
|
||||
$meldung=mysql_error($config['dbconnection']);
|
||||
$res=@mysqli_query($config['dbconnection'], "FLUSH PRIVILEGES");
|
||||
$meldung=((is_object($config['dbconnection'])) ? mysqli_error($config['dbconnection']) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false));
|
||||
if ($meldung!="")
|
||||
{
|
||||
$msg.='> MySQL-Error: '.$meldung;
|
||||
|
|
@ -25,8 +25,8 @@ switch ($sysaction)
|
|||
break;
|
||||
case 2: //FLUSH STATUS
|
||||
$msg="> operating FLUSH STATUS<br>";
|
||||
$res=@mysql_query("FLUSH STATUS",$config['dbconnection']);
|
||||
$meldung=mysql_error($config['dbconnection']);
|
||||
$res=@mysqli_query($config['dbconnection'], "FLUSH STATUS");
|
||||
$meldung=((is_object($config['dbconnection'])) ? mysqli_error($config['dbconnection']) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false));
|
||||
if ($meldung!="")
|
||||
{
|
||||
$msg.='> MySQL-Error: '.$meldung;
|
||||
|
|
@ -38,8 +38,8 @@ switch ($sysaction)
|
|||
break;
|
||||
case 3: //FLUSH HOSTS
|
||||
$msg="> operating FLUSH HOSTS<br>";
|
||||
$res=@mysql_query("FLUSH HOSTS",$config['dbconnection']);
|
||||
$meldung=mysql_error($config['dbconnection']);
|
||||
$res=@mysqli_query($config['dbconnection'], "FLUSH HOSTS");
|
||||
$meldung=((is_object($config['dbconnection'])) ? mysqli_error($config['dbconnection']) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false));
|
||||
if ($meldung!="")
|
||||
{
|
||||
$msg.='> MySQL-Error: '.$meldung;
|
||||
|
|
@ -52,15 +52,15 @@ switch ($sysaction)
|
|||
break;
|
||||
case 4: //SHOW MASTER LOGS
|
||||
$msg="> operating SHOW MASTER LOGS<br>";
|
||||
$res=@mysql_query("SHOW MASTER LOGS",$config['dbconnection']);
|
||||
$meldung=mysql_error($config['dbconnection']);
|
||||
$res=@mysqli_query($config['dbconnection'], "SHOW MASTER LOGS");
|
||||
$meldung=((is_object($config['dbconnection'])) ? mysqli_error($config['dbconnection']) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false));
|
||||
if ($meldung!="")
|
||||
{
|
||||
$msg.='> MySQL-Error: '.$meldung;
|
||||
}
|
||||
else
|
||||
{
|
||||
$numrows=mysql_num_rows($res);
|
||||
$numrows=mysqli_num_rows($res);
|
||||
if ($numrows==0||$numrows===false)
|
||||
{
|
||||
$msg.='> there are no master log-files';
|
||||
|
|
@ -70,7 +70,7 @@ switch ($sysaction)
|
|||
$msg.='> there are '.$numrows.' logfiles<br>';
|
||||
for ($i=0; $i<$numrows; $i++)
|
||||
{
|
||||
$row=mysql_fetch_row($res);
|
||||
$row=mysqli_fetch_row($res);
|
||||
$msg.='> '.$row[0].' '.(($data_dir) ? byte_output(@filesize($data_dir.$row[0])) : '').'<br>';
|
||||
}
|
||||
}
|
||||
|
|
@ -78,8 +78,8 @@ switch ($sysaction)
|
|||
break;
|
||||
case 5: //RESET MASTER
|
||||
$msg="> operating RESET MASTER<br>";
|
||||
$res=@mysql_query("RESET MASTER",$config['dbconnection']);
|
||||
$meldung=mysql_error($config['dbconnection']);
|
||||
$res=@mysqli_query($config['dbconnection'], "RESET MASTER");
|
||||
$meldung=((is_object($config['dbconnection'])) ? mysqli_error($config['dbconnection']) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false));
|
||||
if ($meldung!="")
|
||||
{
|
||||
$msg.='> MySQL-Error: '.$meldung;
|
||||
|
|
|
|||
Laden …
Tabelle hinzufügen
Einen Link hinzufügen
In neuem Issue referenzieren