ftp_ansicht repariert und neues msd
This commit is contained in:
799
msd/dump.php
799
msd/dump.php
@ -4,7 +4,7 @@
|
||||
MyOOS [Dumper]
|
||||
http://www.oos-shop.de/
|
||||
|
||||
Copyright (c) 2016 by the MyOOS Development Team.
|
||||
Copyright (c) 2013 - 2022 by the MyOOS Development Team.
|
||||
----------------------------------------------------------------------
|
||||
Based on:
|
||||
|
||||
@ -18,454 +18,461 @@
|
||||
|
||||
define('OOS_VALID_MOD', true);
|
||||
|
||||
if (!@ob_start("ob_gzhandler")) @ob_start();
|
||||
if (!@ob_start('ob_gzhandler')) {
|
||||
@ob_start();
|
||||
}
|
||||
|
||||
session_name('MyOOSDumperID');
|
||||
session_start();
|
||||
$aus2=$page_parameter=$a=$out='';
|
||||
include_once ('./inc/functions_dump.php');
|
||||
$aus2 = $page_parameter = $a = $out = '';
|
||||
include_once './inc/functions_dump.php';
|
||||
|
||||
// beim Erstaufruf Konfigurationsdatei auslesen und in Session speichern
|
||||
if (isset($_GET['config']))
|
||||
{
|
||||
// Session loeschen, damit keine alten Werte des letzten Laufs uebernommen werden
|
||||
if (isset($_SESSION['dump'])) unset($_SESSION['dump']);
|
||||
$search=array(
|
||||
|
||||
'/','\\',':','@');
|
||||
$replace=array(
|
||||
|
||||
'','','','');
|
||||
$config_file=str_replace($search,$replace,$_GET['config']);
|
||||
if (is_readable($config['paths']['config'].$config_file.'.php'))
|
||||
{
|
||||
$config['files']['parameter']=$config['paths']['config'].$config_file.'.php';
|
||||
$_SESSION['config_file']=$config_file;
|
||||
read_config($config['paths']['config'].$config['files']['parameter']);
|
||||
$_SESSION['config']=$config;
|
||||
}
|
||||
else
|
||||
die("Hacking attempt or configuration not found!");
|
||||
// read configuration file on first call and save it in session
|
||||
if (isset($_GET['config'])) {
|
||||
// Session loeschen, damit keine alten Werte des letzten Laufs uebernommen werden
|
||||
if (isset($_SESSION['dump'])) {
|
||||
unset($_SESSION['dump']);
|
||||
}
|
||||
$search = [
|
||||
'/', '\\', ':', '@', ];
|
||||
$replace = [
|
||||
'', '', '', '', ];
|
||||
$config_file = str_replace($search, $replace, $_GET['config']);
|
||||
if (is_readable($config['paths']['config'].$config_file.'.php')) {
|
||||
$config['files']['parameter'] = $config['paths']['config'].$config_file.'.php';
|
||||
$_SESSION['config_file'] = $config_file;
|
||||
read_config($config['paths']['config'].$config['files']['parameter']);
|
||||
$_SESSION['config'] = $config;
|
||||
} else {
|
||||
exit('Hacking attempt or configuration not found!');
|
||||
}
|
||||
}
|
||||
$config=$_SESSION['config'];
|
||||
include ('./'.$config['files']['parameter']);
|
||||
$config['files']['iconpath']='./css/'.$config['theme'].'/icons/';
|
||||
include ('./inc/mysql.php');
|
||||
include ('./language/'.$config['language'].'/lang.php');
|
||||
include ('./language/'.$config['language'].'/lang_dump.php');
|
||||
$config = $_SESSION['config'];
|
||||
|
||||
$pageheader=MSDHeader();
|
||||
$DumpFertig=0;
|
||||
$relativ_path='./';
|
||||
$flipped=array_flip($databases['Name']);
|
||||
include './'.$config['files']['parameter'];
|
||||
$config['files']['iconpath'] = './css/'.$config['theme'].'/icons/';
|
||||
include './inc/mysqli.php';
|
||||
include './language/'.$config['language'].'/lang.php';
|
||||
include './language/'.$config['language'].'/lang_dump.php';
|
||||
|
||||
if (isset($_SESSION['dump'])&&!isset($_GET['config']))
|
||||
{
|
||||
$dump=$_SESSION['dump'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$dump['tables']=Array();
|
||||
$dump['records']=Array();
|
||||
$dump['skip_data']=Array();
|
||||
$dump['totalrecords']=0;
|
||||
$dump['dbindex']=0;
|
||||
//$_POST-Parameter lesen
|
||||
$dump['kommentar']=(isset($_GET['comment'])) ? urldecode($_GET['comment']):'';
|
||||
if (isset($_POST['kommentar'])) $dump['kommentar']=urldecode($_POST['kommentar']);
|
||||
if (get_magic_quotes_gpc()) $dump['kommentar']=stripslashes($dump['kommentar']);
|
||||
$pageheader = MODHeader();
|
||||
$DumpFertig = 0;
|
||||
$relativ_path = './';
|
||||
$flipped = array_flip($databases['Name']);
|
||||
|
||||
$dump['backupdatei']=(isset($_POST['backupdatei'])) ? $_POST['backupdatei']:'';
|
||||
$dump['part']=(isset($_POST['part'])) ? $_POST['part']:1;
|
||||
$dump['part_offset']=(isset($_POST['part_offset'])) ? $_POST['part_offset']:0;
|
||||
$dump['verbraucht']=(isset($_POST['verbraucht'])) ? $_POST['verbraucht']:0;
|
||||
$dump['errors']=(isset($_POST['errors'])) ? $_POST['errors']:0;
|
||||
$dump['table_offset']=(isset($_POST['table_offset'])) ? $_POST['table_offset']:-1;
|
||||
$dump['zeilen_offset']=(isset($_POST['zeilen_offset'])) ? $_POST['zeilen_offset']:0;
|
||||
$dump['filename_stamp']=(isset($_POST['filename_stamp'])) ? $_POST['filename_stamp']:'';
|
||||
$dump['anzahl_zeilen']=(isset($_POST['anzahl_zeilen'])) ? $_POST['anzahl_zeilen']:(($config['minspeed']>0) ? $config['minspeed']:50);
|
||||
$dump['dump_encoding']=(isset($_POST['dump_encoding'])) ? urldecode($_POST['dump_encoding']):'';
|
||||
if (isset($_SESSION['dump']) && !isset($_GET['config'])) {
|
||||
$dump = $_SESSION['dump'];
|
||||
} else {
|
||||
$dump['tables'] = [];
|
||||
$dump['records'] = [];
|
||||
$dump['skip_data'] = [];
|
||||
$dump['totalrecords'] = 0;
|
||||
$dump['dbindex'] = 0;
|
||||
// Read $_POST parameter
|
||||
$dump['kommentar'] = (isset($_GET['comment'])) ? urldecode($_GET['comment']) : '';
|
||||
if (isset($_POST['kommentar'])) {
|
||||
$dump['kommentar'] = urldecode($_POST['kommentar']);
|
||||
}
|
||||
|
||||
if (isset($_GET['sel_dump_encoding']))
|
||||
{
|
||||
// Erstaufruf -> encoding auswerten
|
||||
include_once ('./inc/functions_sql.php');
|
||||
get_sql_encodings();
|
||||
$encodingline=$config['mysql_possible_character_sets'][$_GET['sel_dump_encoding']];
|
||||
$encoding=explode(' ',$encodingline);
|
||||
$dump['dump_encoding']=isset($encoding[0]) ? $encoding[0]:$encodingline;
|
||||
}
|
||||
include ('./inc/define_icons.php');
|
||||
$dump['tabellen_gesamt']=0;
|
||||
$dump['backupdatei'] = (isset($_POST['backupdatei'])) ? $_POST['backupdatei'] : '';
|
||||
$dump['part'] = (isset($_POST['part'])) ? $_POST['part'] : 1;
|
||||
$dump['part_offset'] = (isset($_POST['part_offset'])) ? $_POST['part_offset'] : 0;
|
||||
$dump['verbraucht'] = (isset($_POST['verbraucht'])) ? $_POST['verbraucht'] : 0;
|
||||
$dump['errors'] = (isset($_POST['errors'])) ? $_POST['errors'] : 0;
|
||||
$dump['table_offset'] = (isset($_POST['table_offset'])) ? $_POST['table_offset'] : -1;
|
||||
$dump['zeilen_offset'] = (isset($_POST['zeilen_offset'])) ? $_POST['zeilen_offset'] : 0;
|
||||
$dump['filename_stamp'] = (isset($_POST['filename_stamp'])) ? $_POST['filename_stamp'] : '';
|
||||
$dump['anzahl_zeilen'] = (isset($_POST['anzahl_zeilen'])) ? $_POST['anzahl_zeilen'] : (((isset($config['minspeed']) && $config['minspeed'] > 0)) ? $config['minspeed'] : 50);
|
||||
$dump['dump_encoding'] = (isset($_POST['dump_encoding'])) ? urldecode($_POST['dump_encoding']) : '';
|
||||
|
||||
if (isset($_GET['sel_dump_encoding'])) {
|
||||
// First call -> evaluate encoding
|
||||
include_once './inc/functions_sql.php';
|
||||
get_sql_encodings();
|
||||
$encodingline = $config['mysql_possible_character_sets'][$_GET['sel_dump_encoding']];
|
||||
$encoding = explode(' ', $encodingline);
|
||||
$dump['dump_encoding'] = isset($encoding[0]) ? $encoding[0] : $encodingline;
|
||||
}
|
||||
include './inc/define_icons.php';
|
||||
$dump['tabellen_gesamt'] = 0;
|
||||
}
|
||||
|
||||
$mp2=array(
|
||||
$mp2 = [
|
||||
'Bytes', 'Kilobytes', 'Megabytes', 'Gigabytes', ];
|
||||
|
||||
'Bytes','Kilobytes','Megabytes','Gigabytes');
|
||||
|
||||
FillMultiDBArrays();
|
||||
if ($databases['db_actual_tableselected']!=''&&$config['multi_dump']==0)
|
||||
{
|
||||
$dump['tblArray']=explode('|',$databases['db_actual_tableselected']);
|
||||
$tbl_sel=true;
|
||||
$msgTbl=sprintf($lang['L_NR_TABLES_SELECTED'],count($dump['tblArray']));
|
||||
FillMultiDBarrays();
|
||||
if ('' != $databases['db_actual_tableselected'] && 0 == $config['multi_dump']) {
|
||||
$dump['tblArray'] = explode('|', $databases['db_actual_tableselected']);
|
||||
$tbl_sel = true;
|
||||
$msgTbl = sprintf($lang['L_NR_TABLES_SELECTED'], count($dump['tblArray']));
|
||||
}
|
||||
// Korrektur -> Multi-DB-Array ist gefuellt (damit die Infos in der Konfig nicht verloren gehen), aber Multidump ist nicht aktiviert)
|
||||
if ($config['multi_dump']==0)
|
||||
{
|
||||
unset($databases['multi']);
|
||||
$databases['multi']=array();
|
||||
$databases['multi'][0]=$databases['db_actual'];
|
||||
}
|
||||
else
|
||||
{
|
||||
// wenn Multidump aktiviert ist, aber keine DB gewaehlt wurde -> aktuelle DB uebernehmen
|
||||
if (!isset($databases['multi'][0])) $databases['multi'][0]=$databases['db_actual'];
|
||||
// find correct dbindex -> take dbname from $databases['multi'] and get the correct index
|
||||
// from $databases['Name'] -> needed to set $dump['dbindex'] for first run of command_before_dump
|
||||
$dump['dbindex']=$flipped[$databases['multi'][0]];
|
||||
// Correction -> Multi-DB-array is filled (so that the info is not lost in the config), but multidump is not activated)
|
||||
if (isset($config['multi_dump']) && (0 == $config['multi_dump'])) {
|
||||
unset($databases['multi']);
|
||||
$databases['multi'] = [];
|
||||
$databases['multi'][0] = $databases['db_actual'];
|
||||
} else {
|
||||
// if multidump is activated, but no DB is selected -> take over current DB
|
||||
if (!isset($databases['multi'][0])) {
|
||||
$databases['multi'][0] = $databases['db_actual'];
|
||||
}
|
||||
// find correct dbindex -> take dbname from $databases['multi'] and get the correct index
|
||||
// from $databases['Name'] -> needed to set $dump['dbindex'] for first run of command_before_dump
|
||||
$dump['dbindex'] = $flipped[$databases['multi'][0]];
|
||||
}
|
||||
|
||||
//Zeitzähler aktivieren
|
||||
$dump['max_zeit']=intval($config['max_execution_time']*$config['time_buffer']);
|
||||
$dump['startzeit']=time();
|
||||
$xtime=(isset($_POST['xtime'])) ? $_POST['xtime']:time();
|
||||
$dump['countdata']=(!empty($_POST['countdata'])) ? $_POST['countdata']:0;
|
||||
$dump['aufruf']=(!empty($_POST['aufruf'])) ? $_POST['aufruf']:0;
|
||||
MSD_mysql_connect($dump['dump_encoding']);
|
||||
if ($dump['table_offset']==-1) ExecuteCommand('b');
|
||||
// Activate time counter
|
||||
$dump['max_zeit'] = intval($config['max_execution_time'] * $config['time_buffer']);
|
||||
$dump['startzeit'] = time();
|
||||
$xtime = (isset($_POST['xtime'])) ? $_POST['xtime'] : time();
|
||||
$dump['countdata'] = (!empty($_POST['countdata'])) ? $_POST['countdata'] : 0;
|
||||
$dump['aufruf'] = (!empty($_POST['aufruf'])) ? $_POST['aufruf'] : 0;
|
||||
mod_mysqli_connect($dump['dump_encoding']);
|
||||
|
||||
if (-1 == $dump['table_offset']) {
|
||||
ExecuteCommand('b');
|
||||
}
|
||||
|
||||
// only read tableinfos the first time and save it to session to speed up backing up process
|
||||
if (!isset($_SESSION['dump'])) getDBInfos();
|
||||
|
||||
$num_tables=count($dump['tables']);
|
||||
|
||||
if ($config['optimize_tables_beforedump']==1&&$dump['table_offset']==-1) $out.=sprintf($lang['L_NR_TABLES_OPTIMIZED'],$num_tables).'<br>';
|
||||
$dump['data']='';
|
||||
$dump['dbindex']=(isset($_POST['dbindex'])) ? $_POST['dbindex']:$flipped[$databases['multi'][0]];
|
||||
|
||||
//Ausgaben-Header bauen
|
||||
$aus_header[]=headline('Backup: '.(($config['multi_dump']==1) ? 'Multidump ('.count($databases['multi']).' '.$lang['L_DBS'].')':$lang['L_DB'].': '.$databases['Name'][$dump['dbindex']].(($databases['praefix'][$dump['dbindex']]!='') ? ' ('.$lang['L_WITHPRAEFIX'].' <span>'.$databases['praefix'][$dump['dbindex']].'</span>)':'')));
|
||||
if (isset($aus_error)&&count($aus_error)>0) $aus_header=array_merge($aus_header,$aus_error);
|
||||
|
||||
if ($num_tables==0)
|
||||
{
|
||||
//keine Tabellen gefunden
|
||||
$aus[]='<br><br><p class="error">'.$lang['L_ERROR'].': '.sprintf($lang['L_DUMP_NOTABLES'],$databases['Name'][$dump['dbindex']]).'</p>';
|
||||
if (!$config['multi_dump']==1)
|
||||
{
|
||||
echo $pageheader;
|
||||
echo get_page_parameter($dump);
|
||||
echo implode("\n",$aus);
|
||||
echo '</body></html>';
|
||||
exit();
|
||||
}
|
||||
if (!isset($_SESSION['dump'])) {
|
||||
getDBInfos();
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($dump['table_offset']==-1)
|
||||
{
|
||||
// File anlegen, da Erstaufruf
|
||||
new_file();
|
||||
$dump['table_offset']=0; // jetzt kanns losgehen
|
||||
flush();
|
||||
}
|
||||
else
|
||||
{
|
||||
// SQL-Befehle ermitteln
|
||||
$dump['restzeilen']=$dump['anzahl_zeilen'];
|
||||
while (($dump['table_offset']<$num_tables)&&($dump['restzeilen']>0))
|
||||
{
|
||||
$table=substr($dump['tables'][$dump['table_offset']],strpos($dump['tables'][$dump['table_offset']],'|')+1);
|
||||
$adbname=substr($dump['tables'][$dump['table_offset']],0,strpos($dump['tables'][$dump['table_offset']],'|'));
|
||||
if ($databases['Name'][$dump['dbindex']]!=$adbname)
|
||||
{
|
||||
//neue Datenbank
|
||||
$dump['data'].="\nSET FOREIGN_KEY_CHECKS=1;";
|
||||
$dump['data'].="\n".$mysql_commentstring.' EOB'."\n\n";
|
||||
WriteToDumpFile();
|
||||
WriteLog('Dump \''.$dump['backupdatei'].'\' finished.');
|
||||
ExecuteCommand('a');
|
||||
if ($config['multi_part']==1)
|
||||
{
|
||||
$out.=$lang['L_FINISHED'].'<br><div class="backupmsg">';
|
||||
$dateistamm=substr($dump['backupdatei'],0,strrpos($dump['backupdatei'],'part_')).'part_';
|
||||
$dateiendung=($config['compression']==1) ? '.sql.gz':'.sql';
|
||||
for($i=1;$i<($dump['part']-$dump['part_offset']);$i++)
|
||||
{
|
||||
$mpdatei=$dateistamm.$i.$dateiendung;
|
||||
clearstatcache();
|
||||
$sz=byte_output(@filesize($config['paths']['backup'].$mpdatei));
|
||||
$out.=$lang['L_FILE'].' <a href="'.$config['paths']['backup'].$mpdatei.'" class="smallblack">'.$mpdatei.' ('.$sz.')</a> '.$lang['L_DUMP_SUCCESSFUL'].'<br>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
clearstatcache();
|
||||
$out.=$lang['L_FINISHED'].'<br><div class="backupmsg"><a href="'.$config['paths']['backup'].$dump['backupdatei'].'" class="smallblack">'.$dump['backupdatei'].' ('.byte_output(filesize($config['paths']['backup'].$dump['backupdatei'])).')</a><br>';
|
||||
}
|
||||
if ($config['send_mail']==1) DoEmail();
|
||||
|
||||
for($i=0;$i<3;$i++)
|
||||
{
|
||||
if ($config['ftp_transfer'][$i]==1) DoFTP($i);
|
||||
}
|
||||
if (isset($flipped[$adbname])) $dump['dbindex']=$flipped[$adbname];
|
||||
$dump['part_offset']=$dump['part']-1;
|
||||
$out.='</div><br>';
|
||||
ExecuteCommand('b');
|
||||
new_file();
|
||||
}
|
||||
$num_tables = count($dump['tables']);
|
||||
|
||||
$aktuelle_tabelle=$dump['table_offset'];
|
||||
if ($dump['zeilen_offset']==0)
|
||||
{
|
||||
if ($config['minspeed']>0)
|
||||
{
|
||||
$dump['anzahl_zeilen']=$config['minspeed'];
|
||||
$dump['restzeilen']=$config['minspeed'];
|
||||
}
|
||||
if ((isset($config['optimize_tables_beforedump']) && (1 == $config['optimize_tables_beforedump'])) && -1 == $dump['table_offset']) {
|
||||
$out .= sprintf($lang['L_NR_TABLES_OPTIMIZED'], $num_tables).'<br>';
|
||||
}
|
||||
$dump['data'] = '';
|
||||
$dump['dbindex'] = (isset($_POST['dbindex'])) ? $_POST['dbindex'] : $flipped[$databases['multi'][0]];
|
||||
|
||||
$create_statement='';
|
||||
$create_statement=get_def($adbname,$table);
|
||||
// Build output header
|
||||
$aus_header[] = headline('Backup: '.((isset($config['multi_dump']) && (1 == $config['multi_dump'])) ? 'Multidump ('.count($databases['multi']).' '.$lang['L_DBS'].')' : $lang['L_DB'].': '.$databases['Name'][$dump['dbindex']].(('' != $databases['praefix'][$dump['dbindex']]) ? ' ('.$lang['L_WITHPRAEFIX'].' <span>'.$databases['praefix'][$dump['dbindex']].'</span>)' : '')));
|
||||
if (isset($aus_error) && count($aus_error) > 0) {
|
||||
$aus_header = array_merge($aus_header, $aus_error);
|
||||
}
|
||||
|
||||
if (!($create_statement===false))
|
||||
{
|
||||
$dump['data'].=$create_statement;
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteToDumpFile(); // save data we have up to now
|
||||
// error reading table definition
|
||||
$read_create_error=sprintf($lang['L_FATAL_ERROR_DUMP'],$table,$adbname).': '.mysqli_error($config['dbconnection']);
|
||||
Errorlog("DUMP",$databases['db_actual'],'',$read_create_error,0);
|
||||
WriteLog($read_create_error);
|
||||
if ($config['stop_with_error']>0)
|
||||
{
|
||||
die($read_create_error);
|
||||
}
|
||||
$dump['errors']++;
|
||||
}
|
||||
}
|
||||
WriteToDumpFile();
|
||||
if (!in_array($adbname.'|'.$table,$dump['skip_data'])&&$dump['table_types'][getDBIndex($adbname,$table)]!='VIEW')
|
||||
{
|
||||
get_content($adbname,$table);
|
||||
$dump['restzeilen']--;
|
||||
}
|
||||
else
|
||||
{
|
||||
// skip data
|
||||
if ($dump['table_types'][getDBIndex($adbname,$table)]!='VIEW') $dump['data'].='/*!40000 ALTER TABLE `'.$table.'` ENABLE KEYS */;'."\n";
|
||||
WriteToDumpFile();
|
||||
$dump['table_offset']++;
|
||||
}
|
||||
if ($config['memory_limit']>0&&strlen($dump['data'])>$config['memory_limit']) WriteToDumpFile();
|
||||
}
|
||||
}
|
||||
if (0 == $num_tables) {
|
||||
// no tables found
|
||||
$aus[] = '<br><br><p class="error">'.$lang['L_ERROR'].': '.sprintf($lang['L_DUMP_NOTABLES'], $databases['Name'][$dump['dbindex']]).'</p>';
|
||||
if (1 == !$config['multi_dump']) {
|
||||
echo $pageheader;
|
||||
echo get_page_parameter($dump);
|
||||
echo implode("\n", $aus);
|
||||
echo '</body></html>';
|
||||
exit();
|
||||
}
|
||||
} else {
|
||||
if (-1 == $dump['table_offset']) {
|
||||
// Create file, since first call
|
||||
new_file();
|
||||
$dump['table_offset'] = 0; // now it can start
|
||||
flush();
|
||||
} else {
|
||||
// Determine SQL commands
|
||||
$dump['restzeilen'] = $dump['anzahl_zeilen'];
|
||||
while (($dump['table_offset'] < $num_tables) && ($dump['restzeilen'] > 0)) {
|
||||
$table = substr($dump['tables'][$dump['table_offset']], strpos($dump['tables'][$dump['table_offset']], '|') + 1);
|
||||
$adbname = substr($dump['tables'][$dump['table_offset']], 0, strpos($dump['tables'][$dump['table_offset']], '|'));
|
||||
if ($databases['Name'][$dump['dbindex']] != $adbname) {
|
||||
//neue Datenbank
|
||||
$dump['data'] .= "\nSET FOREIGN_KEY_CHECKS=1;";
|
||||
$dump['data'] .= "\n".$mysql_commentstring.' EOB'."\n\n";
|
||||
WriteToDumpFile();
|
||||
WriteLog('Dump \''.$dump['backupdatei'].'\' finished.');
|
||||
ExecuteCommand('a');
|
||||
if (1 == $config['multi_part']) {
|
||||
$out .= $lang['L_FINISHED'].'<br><div class="backupmsg">';
|
||||
$dateistamm = substr($dump['backupdatei'], 0, strrpos($dump['backupdatei'], 'part_')).'part_';
|
||||
$dateiendung = (1 == $config['compression']) ? '.sql.gz' : '.sql';
|
||||
for ($i = 1; $i < ($dump['part'] - $dump['part_offset']); ++$i) {
|
||||
$mpdatei = $dateistamm.$i.$dateiendung;
|
||||
clearstatcache();
|
||||
$sz = byte_output(@filesize($config['paths']['backup'].$mpdatei));
|
||||
$out .= $lang['L_FILE'].' <a href="'.$config['paths']['backup'].$mpdatei.'" class="smallblack">'.$mpdatei.' ('.$sz.')</a> '.$lang['L_DUMP_SUCCESSFUL'].'<br>';
|
||||
}
|
||||
} else {
|
||||
clearstatcache();
|
||||
$out .= $lang['L_FINISHED'].'<br><div class="backupmsg"><a href="'.$config['paths']['backup'].$dump['backupdatei'].'" class="smallblack">'.$dump['backupdatei'].' ('.byte_output(filesize($config['paths']['backup'].$dump['backupdatei'])).')</a><br>';
|
||||
}
|
||||
if (1 == $config['send_mail']) {
|
||||
DoEmail();
|
||||
}
|
||||
|
||||
/////////////////////////////////
|
||||
// Anzeige - Fortschritt
|
||||
/////////////////////////////////
|
||||
if ($config['multi_dump']==1)
|
||||
{
|
||||
$mudbs='';
|
||||
$count_dbs=count($databases['multi']);
|
||||
for($i=0;$i<$count_dbs;$i++)
|
||||
{
|
||||
if ($databases['Name'][$dump['dbindex']]==$databases['multi'][$i]) $mudbs.='<span class="active_db">'.$databases['multi'][$i].' </span> ';
|
||||
else
|
||||
$mudbs.='<span class="success">'.$databases['multi'][$i].' </span> ';
|
||||
}
|
||||
}
|
||||
if ($config['multi_part']==1) $aus[]='<h5>Multipart-Backup: '.$config['multipartgroesse1'].' '.$mp2[$config['multipartgroesse2']].'</h5>';
|
||||
for ($i = 0; $i < 3; ++$i) {
|
||||
if (isset($config['ftp_transfer'][$i]) && (1 == $config['ftp_transfer'][$i])) {
|
||||
DoFTP($i);
|
||||
}
|
||||
if (isset($config['sftp_transfer'][$i]) && (1 == $config['sftp_transfer'][$i])) {
|
||||
DoSFTP($i);
|
||||
}
|
||||
}
|
||||
if (isset($flipped[$adbname])) {
|
||||
$dump['dbindex'] = $flipped[$adbname];
|
||||
}
|
||||
$dump['part_offset'] = $dump['part'] - 1;
|
||||
$out .= '</div><br>';
|
||||
ExecuteCommand('b');
|
||||
new_file();
|
||||
}
|
||||
|
||||
$aus[]='<h4>'.$lang['L_DUMP_HEADLINE'].'</h4>';
|
||||
$aktuelle_tabelle = $dump['table_offset'];
|
||||
if (0 == $dump['zeilen_offset']) {
|
||||
if (isset($config['minspeed']) && ($config['minspeed'] > 0)) {
|
||||
$dump['anzahl_zeilen'] = $config['minspeed'];
|
||||
$dump['restzeilen'] = $config['minspeed'];
|
||||
}
|
||||
|
||||
if ($dump['kommentar']>'') $aus[]=$lang['L_COMMENT'].': <span><em>'.$dump['kommentar'].'</em></span><br>';
|
||||
$aus[]=($config['multi_dump']==1) ? $lang['L_DB'].': '.$mudbs:$lang['L_DB'].': <strong>'.$databases['Name'][$dump['dbindex']].'</strong>';
|
||||
$aus[]=(($databases['praefix'][$dump['dbindex']]!='') ? ' ('.$lang['L_WITHPRAEFIX'].' <span>'.$databases['praefix'][$dump['dbindex']].'</span>)':'').'<br>';
|
||||
if (isset($tbl_sel)) $aus[]=$msgTbl.'<br><br>';
|
||||
$create_statement = '';
|
||||
$create_statement = get_def($adbname, $table);
|
||||
|
||||
if ($config['multi_part']==1)
|
||||
{
|
||||
$aus[]='<span>Multipart-Backup File <strong>'.($dump['part']-$dump['part_offset']-1).'</strong></span><br>';
|
||||
$aus2=', '.($dump['part']-1).' files';
|
||||
}
|
||||
$aus[]=$lang['L_DUMP_FILENAME'].'<b>'.$dump['backupdatei'].'</b><br>'.$lang['L_CHARSET'].': <strong>'.$dump['dump_encoding'].'</strong>'.
|
||||
if (!(false === $create_statement)) {
|
||||
$dump['data'] .= $create_statement;
|
||||
} else {
|
||||
WriteToDumpFile(); // save data we have up to now
|
||||
// error reading table definition
|
||||
$read_create_error = sprintf($lang['L_FATAL_ERROR_DUMP'], $table, $adbname).': '.mysqli_error($config['dbconnection']);
|
||||
Errorlog('DUMP', $databases['db_actual'], '', $read_create_error, 0);
|
||||
WriteLog($read_create_error);
|
||||
if ($config['stop_with_error'] > 0) {
|
||||
exit($read_create_error);
|
||||
}
|
||||
++$dump['errors'];
|
||||
}
|
||||
}
|
||||
WriteToDumpFile();
|
||||
if (!in_array($adbname.'|'.$table, $dump['skip_data']) && 'VIEW' != $dump['table_types'][getDBIndex($adbname, $table)]) {
|
||||
get_content($adbname, $table);
|
||||
--$dump['restzeilen'];
|
||||
} else {
|
||||
// skip data
|
||||
if ('VIEW' != $dump['table_types'][getDBIndex($adbname, $table)]) {
|
||||
$dump['data'] .= '/*!40000 ALTER TABLE `'.$table.'` ENABLE KEYS */;'."\n";
|
||||
}
|
||||
WriteToDumpFile();
|
||||
++$dump['table_offset'];
|
||||
}
|
||||
if ((isset($config['memory_limit']) && $config['memory_limit'] > 0) && strlen($dump['data']) > $config['memory_limit']) {
|
||||
WriteToDumpFile();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
'<br>'.$lang['L_FILESIZE'].': <b>'.byte_output($dump['filesize']).'</b><br><br>'.$lang['L_GZIP_COMPRESSION'].' <b>';
|
||||
$aus[]=($config['compression']==1) ? $lang['L_ACTIVATED']:$lang['L_NOT_ACTIVATED'];
|
||||
$aus[]='</b>.<br>';
|
||||
if ($out>'') $aus[]='<br><span class="smallgrey">'.$out.'</span>';
|
||||
/*
|
||||
* Display - Progress
|
||||
*/
|
||||
if (isset($config['multi_dump']) && (1 == $config['multi_dump'])) {
|
||||
$mudbs = '';
|
||||
$count_dbs = count($databases['multi']);
|
||||
for ($i = 0; $i < $count_dbs; ++$i) {
|
||||
if ($databases['Name'][$dump['dbindex']] == $databases['multi'][$i]) {
|
||||
$mudbs .= '<span class="active_db">'.$databases['multi'][$i].' </span> ';
|
||||
} else {
|
||||
$mudbs .= '<span class="success">'.$databases['multi'][$i].' </span> ';
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isset($config['multi_part']) && (1 == $config['multi_part'])) {
|
||||
$aus[] = '<h5>Multipart-Backup: '.$config['multipartgroesse1'].' '.$mp2[$config['multipartgroesse2']].'</h5>';
|
||||
}
|
||||
|
||||
if (isset($dump['tables'][$dump['table_offset']]))
|
||||
{
|
||||
$table=substr($dump['tables'][$dump['table_offset']],strpos($dump['tables'][$dump['table_offset']],'|')+1);
|
||||
$adbname=substr($dump['tables'][$dump['table_offset']],0,strpos($dump['tables'][$dump['table_offset']],'|'));
|
||||
$aus[] = '<h4>'.$lang['L_DUMP_HEADLINE'].'</h4>';
|
||||
|
||||
// get nr of recorsd from dump-array
|
||||
$record_string=$dump['records'][$dump['table_offset']];
|
||||
$record_string=explode('|',$record_string);
|
||||
$dump['zeilen_total']=$record_string[1];
|
||||
if ($dump['kommentar'] > '') {
|
||||
$aus[] = $lang['L_COMMENT'].': <span><em>'.$dump['kommentar'].'</em></span><br>';
|
||||
}
|
||||
$aus[] = ((isset($config['multi_dump']) && 1 == $config['multi_dump'])) ? $lang['L_DB'].': '.$mudbs : $lang['L_DB'].': <strong>'.$databases['Name'][$dump['dbindex']].'</strong>';
|
||||
$aus[] = (('' != $databases['praefix'][$dump['dbindex']]) ? ' ('.$lang['L_WITHPRAEFIX'].' <span>'.$databases['praefix'][$dump['dbindex']].'</span>)' : '').'<br>';
|
||||
if (isset($tbl_sel)) {
|
||||
$aus[] = $msgTbl.'<br><br>';
|
||||
}
|
||||
|
||||
if ($dump['zeilen_total']>0) $fortschritt=intval((100*$dump['zeilen_offset'])/$dump['zeilen_total']);
|
||||
else
|
||||
$fortschritt=100;
|
||||
if (isset($config['multi_part']) && (1 == $config['multi_part'])) {
|
||||
$aus[] = '<span>Multipart-Backup File <strong>'.($dump['part'] - $dump['part_offset'] - 1).'</strong></span><br>';
|
||||
$aus2 = ', '.($dump['part'] - 1).' files';
|
||||
}
|
||||
$aus[] = $lang['L_DUMP_FILENAME'].'<b>'.$dump['backupdatei'].'</b><br>'.$lang['L_CHARSET'].': <strong>'.$dump['dump_encoding'].'</strong>'.
|
||||
|
||||
$aus[]=$lang['L_SAVING_TABLE'].'<b>'.($dump['table_offset']+1).'</b> '.$lang['L_OF'].'<b> '.sizeof($dump['tables']).'</b><br>'.$lang['L_ACTUAL_TABLE'].': <b>'.$table.'</b><br><br>'.$lang['L_PROGRESS_TABLE'].':<br>';
|
||||
'<br>'.$lang['L_FILESIZE'].': <b>'.byte_output($dump['filesize']).'</b><br><br>'.$lang['L_GZIP_COMPRESSION'].' <b>';
|
||||
$aus[] = (isset($config['compression']) && (1 == $config['compression'])) ? $lang['L_ACTIVATED'] : $lang['L_NOT_ACTIVATED'];
|
||||
$aus[] = '</b>.<br>';
|
||||
if ($out > '') {
|
||||
$aus[] = '<br><span class="smallgrey">'.$out.'</span>';
|
||||
}
|
||||
|
||||
$aus[]='<table border="0" width="380"><tr>'.'<td width="'.($fortschritt*3).'"><img src="'.$config['files']['iconpath'].'progressbar_dump.gif" alt="" width="'.($fortschritt*3).'" height="16" border="0"></td>'.'<td width="'.((100-$fortschritt)*3).'"> </td>'.'<td width="80" align="right">'.($fortschritt).'%</td>';
|
||||
if (isset($dump['tables'][$dump['table_offset']])) {
|
||||
$table = substr($dump['tables'][$dump['table_offset']], strpos($dump['tables'][$dump['table_offset']], '|') + 1);
|
||||
$adbname = substr($dump['tables'][$dump['table_offset']], 0, strpos($dump['tables'][$dump['table_offset']], '|'));
|
||||
|
||||
if ($dump['anzahl_zeilen']+$dump['zeilen_offset']>=$dump['zeilen_total'])
|
||||
{
|
||||
$eintrag=$dump['zeilen_offset']+1;
|
||||
$zeilen_gesamt=$dump['zeilen_total'];
|
||||
if ($zeilen_gesamt==0) $eintrag=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
$zeilen_gesamt=$dump['zeilen_offset']+$dump['anzahl_zeilen'];
|
||||
$eintrag=$dump['zeilen_offset']+1;
|
||||
}
|
||||
// get nr of recorsd from dump-array
|
||||
$record_string = $dump['records'][$dump['table_offset']];
|
||||
$record_string = explode('|', $record_string);
|
||||
$dump['zeilen_total'] = $record_string[1];
|
||||
|
||||
$aus[]='</tr><tr>'.'<td colspan="3">'.$lang['L_ENTRY'].' <b>'.number_format($eintrag,0,',','.').'</b> '.$lang['L_UPTO'].' <b>'.number_format(($zeilen_gesamt),0,',','.').'</b> '.$lang['L_OF'].' <b>'.number_format($dump['zeilen_total'],0,',','.').'</b></td></tr></table>';
|
||||
if ($dump['zeilen_total'] > 0) {
|
||||
$fortschritt = intval((100 * $dump['zeilen_offset']) / $dump['zeilen_total']);
|
||||
} else {
|
||||
$fortschritt = 100;
|
||||
}
|
||||
|
||||
$dump['tabellen_gesamt']=(isset($dump['tables'])) ? count($dump['tables']):0;
|
||||
$aus[] = $lang['L_SAVING_TABLE'].'<b>'.($dump['table_offset'] + 1).'</b> '.$lang['L_OF'].'<b> '.sizeof($dump['tables']).'</b><br>'.$lang['L_ACTUAL_TABLE'].': <b>'.$table.'</b><br><br>'.$lang['L_PROGRESS_TABLE'].':<br>';
|
||||
|
||||
$noch_zu_speichern=$dump['totalrecords']-$dump['countdata'];
|
||||
$prozent=($dump['totalrecords']>0) ? round(((100*$noch_zu_speichern)/$dump['totalrecords']),0):100;
|
||||
if ($noch_zu_speichern==0||$prozent>100) $prozent=100;
|
||||
$aus[] = '<table border="0" width="380"><tr>'.'<td width="'.($fortschritt * 3).'"><img src="'.$config['files']['iconpath'].'progressbar_dump.gif" alt="" width="'.($fortschritt * 3).'" height="16" border="0"></td>'.'<td width="'.((100 - $fortschritt) * 3).'"> </td>'.'<td width="80" align="right">'.($fortschritt).'%</td>';
|
||||
|
||||
$aus[]="\n".'<br>'.$lang['L_PROGRESS_OVER_ALL'].':'."\n".'<table border="0" width="550" cellpadding="0" cellspacing="0"><tr>'.'<td width="'.(5*(100-$prozent)).'"><img src="'.$config['files']['iconpath'].'progressbar_dump.gif" alt="" width="'.(5*(100-$prozent)).'" height="16" border="0"></td>'.'<td width="'.($prozent*5).'" align="center"></td>'.'<td width="50">'.(100-$prozent).'%</td></tr></table>';
|
||||
if ($dump['anzahl_zeilen'] + $dump['zeilen_offset'] >= $dump['zeilen_total']) {
|
||||
$eintrag = $dump['zeilen_offset'] + 1;
|
||||
$zeilen_gesamt = $dump['zeilen_total'];
|
||||
if (0 == $zeilen_gesamt) {
|
||||
$eintrag = 0;
|
||||
}
|
||||
} else {
|
||||
$zeilen_gesamt = $dump['zeilen_offset'] + $dump['anzahl_zeilen'];
|
||||
$eintrag = $dump['zeilen_offset'] + 1;
|
||||
}
|
||||
|
||||
//Speed-Anzeige
|
||||
$fw=($config['maxspeed']==$config['minspeed']) ? 300:round(($dump['anzahl_zeilen']-$config['minspeed'])/($config['maxspeed']-$config['minspeed'])*300,0);
|
||||
if ($fw>300) $fw=300;
|
||||
$aus[]='<br><table border="0" cellpadding="0" cellspacing="0"><tr>'.'<td class="nomargin" width="60" valign="top" align="center" style="font-size:10px;" >'.'<strong>Speed</strong><br>'.$dump['anzahl_zeilen'].'</td><td class="nomargin" width="300">'.'<table border="0" width="100%" cellpadding="0" cellspacing="0"><tr>'.'<td class="nomargin small" align="left" width="300" nowrap="nowrap">'.'<img src="'.$config['files']['iconpath'].'progressbar_speed.gif" alt="" width="'.$fw.'" height="14" border="0" vspace="0" hspace="0">'.'</td></tr></table><table border="0" width="100%" cellpadding="0" cellspacing="0"><tr>'.'<td class="nomargin" align="left" nowrap="nowrap" style="font-size:10px;" >'.$config['minspeed'].'</td>'.'<td class="nomargin" nowrap="nowrap" style="font-size:10px;text-align:right;" >'.$config['maxspeed'].'</td>'.'</tr></table>'."\n".'</td></tr></table>'.
|
||||
$aus[] = '</tr><tr>'.'<td colspan="3">'.$lang['L_ENTRY'].' <b>'.number_format($eintrag, 0, ',', '.').'</b> '.$lang['L_UPTO'].' <b>'.number_format(($zeilen_gesamt), 0, ',', '.').'</b> '.$lang['L_OF'].' <b>'.number_format($dump['zeilen_total'], 0, ',', '.').'</b></td></tr></table>';
|
||||
|
||||
//Status-Text
|
||||
'<p class="small">'.zeit_format(time()-$xtime).', '.$dump['aufruf'].' '.$lang['L_PAGE_REFRESHS'].$aus2;
|
||||
$aus[]=($dump['errors']>0) ? ', <span style="color:red;">'.$dump['errors'].' errors</span>':'';
|
||||
$aus[]='</p>';
|
||||
}
|
||||
else
|
||||
$dump['table_offset']++;
|
||||
// Ende Anzeige
|
||||
WriteToDumpFile();
|
||||
if (!isset($summe_eintraege)) $summe_eintraege=0;
|
||||
$dump['tabellen_gesamt'] = (isset($dump['tables'])) ? count($dump['tables']) : 0;
|
||||
|
||||
if ($dump['table_offset']<=$dump['tabellen_gesamt'])
|
||||
{
|
||||
$dauer=time()-($xtime+$dump['verbraucht']);
|
||||
$dump['verbraucht']+=$dauer;
|
||||
$summe_eintraege+=$dump['anzahl_zeilen'];
|
||||
$noch_zu_speichern = $dump['totalrecords'] - $dump['countdata'];
|
||||
$prozent = ($dump['totalrecords'] > 0) ? round(((100 * $noch_zu_speichern) / $dump['totalrecords']), 0) : 100;
|
||||
if (0 == $noch_zu_speichern || $prozent > 100) {
|
||||
$prozent = 100;
|
||||
}
|
||||
|
||||
//Zeitanpassung
|
||||
if ($dauer<$dump['max_zeit'])
|
||||
{
|
||||
$dump['anzahl_zeilen']=$dump['anzahl_zeilen']*$config['tuning_add'];
|
||||
if ($dauer<$dump['max_zeit']/2) $dump['anzahl_zeilen']*=1.8;
|
||||
if ($dump['anzahl_zeilen']>$config['maxspeed']) $dump['anzahl_zeilen']=$config['maxspeed'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$dump['anzahl_zeilen']=$dump['anzahl_zeilen']*$config['tuning_sub'];
|
||||
if ($dump['anzahl_zeilen']<$config['minspeed']) $dump['anzahl_zeilen']=$config['minspeed'];
|
||||
}
|
||||
$dump['anzahl_zeilen']=intval($dump['anzahl_zeilen']);
|
||||
$dump['aufruf']++;
|
||||
}
|
||||
else
|
||||
{
|
||||
//Backup fertig
|
||||
$dump['data']="\nSET FOREIGN_KEY_CHECKS=1;";
|
||||
$dump['data'].="\n".$mysql_commentstring.' EOB'."\n\n";
|
||||
WriteToDumpFile();
|
||||
ExecuteCommand('a');
|
||||
chmod($config['paths']['backup'].$dump['backupdatei'],0777);
|
||||
if ($config['multi_part']==1)
|
||||
{
|
||||
$out.="\n".'<br><div class="backupmsg">';
|
||||
$dateistamm=substr($dump['backupdatei'],0,strrpos($dump['backupdatei'],'part_')).'part_';
|
||||
$dateiendung=($config['compression']==1) ? '.sql.gz':'.sql';
|
||||
clearstatcache();
|
||||
for($i=1;$i<($dump['part']-$dump['part_offset']);$i++)
|
||||
{
|
||||
$mpdatei=$dateistamm.$i.$dateiendung;
|
||||
$sz=byte_output(@filesize($config['paths']['backup'].$mpdatei));
|
||||
$out.="\n".$lang['L_FILE'].' <a href="'.$config['paths']['backup'].$mpdatei.'" class="smallblack">'.$mpdatei.' ('.$sz.')</a> '.$lang['L_DUMP_SUCCESSFUL'].'<br>';
|
||||
}
|
||||
$aus[] = "\n".'<br>'.$lang['L_PROGRESS_OVER_ALL'].':'."\n".'<table border="0" width="550" cellpadding="0" cellspacing="0"><tr>'.'<td width="'.(5 * (100 - $prozent)).'"><img src="'.$config['files']['iconpath'].'progressbar_dump.gif" alt="" width="'.(5 * (100 - $prozent)).'" height="16" border="0"></td>'.'<td width="'.($prozent * 5).'" align="center"></td>'.'<td width="50">'.(100 - $prozent).'%</td></tr></table>';
|
||||
|
||||
}
|
||||
else
|
||||
$out.="\n".'<div class="backupmsg">'.$lang['L_FILE'].' <a href="'.$config['paths']['backup'].$dump['backupdatei'].'" class="smallblack">'.$dump['backupdatei'].' ('.byte_output(filesize($config['paths']['backup'].$dump['backupdatei'])).')'.'</a>'.$lang['L_DUMP_SUCCESSFUL'].'<br>';
|
||||
//Speed-Anzeige
|
||||
$config['maxspeed'] = isset($config['maxspeed']) ? $config['maxspeed'] : '1';
|
||||
$config['minspeed'] = isset($config['minspeed']) ? $config['minspeed'] : '1';
|
||||
$fw = ($config['maxspeed'] == $config['minspeed']) ? 300 : round(($dump['anzahl_zeilen'] - $config['minspeed']) / ($config['maxspeed'] - $config['minspeed']) * 300, 0);
|
||||
if ($fw > 300) {
|
||||
$fw = 300;
|
||||
}
|
||||
$aus[] = '<br><table border="0" cellpadding="0" cellspacing="0"><tr>'.'<td class="nomargin" width="60" valign="top" align="center" style="font-size:10px;" >'.'<strong>Speed</strong><br>'.$dump['anzahl_zeilen'].'</td><td class="nomargin" width="300">'.'<table border="0" width="100%" cellpadding="0" cellspacing="0"><tr>'.'<td class="nomargin small" align="left" width="300" nowrap="nowrap">'.'<img src="'.$config['files']['iconpath'].'progressbar_speed.gif" alt="" width="'.$fw.'" height="14" border="0" vspace="0" hspace="0">'.'</td></tr></table><table border="0" width="100%" cellpadding="0" cellspacing="0"><tr>'.'<td class="nomargin" align="left" nowrap="nowrap" style="font-size:10px;" >'.$config['minspeed'].'</td>'.'<td class="nomargin" nowrap="nowrap" style="font-size:10px;text-align:right;" >'.$config['maxspeed'].'</td>'.'</tr></table>'."\n".'</td></tr></table>'.
|
||||
|
||||
$xtime=time()-$xtime;
|
||||
$aus=Array();
|
||||
$aus[]='<br>'."\n";
|
||||
if ($config['multi_dump']==1)
|
||||
{
|
||||
WriteLog('Dump \''.$dump['backupdatei'].'\' finished.');
|
||||
WriteLog('Multidump: '.count($databases['multi']).' Databases in '.zeit_format($xtime).'.');
|
||||
}
|
||||
else
|
||||
WriteLog('Dump \''.$dump['backupdatei'].'\' finished in '.zeit_format($xtime).'.');
|
||||
//Status-Text
|
||||
'<p class="small">'.zeit_format(time() - $xtime).', '.$dump['aufruf'].' '.$lang['L_PAGE_REFRESHS'].$aus2;
|
||||
$aus[] = ($dump['errors'] > 0) ? ', <span style="color:red;">'.$dump['errors'].' errors</span>' : '';
|
||||
$aus[] = '</p>';
|
||||
} else {
|
||||
++$dump['table_offset'];
|
||||
}
|
||||
// End display
|
||||
WriteToDumpFile();
|
||||
if (!isset($summe_eintraege)) {
|
||||
$summe_eintraege = 0;
|
||||
}
|
||||
|
||||
if ($config['send_mail']==1) DoEmail();
|
||||
for($i=0;$i<3;$i++)
|
||||
{
|
||||
if ($config['ftp_transfer'][$i]==1) DoFTP($i);
|
||||
}
|
||||
if ($dump['table_offset'] <= $dump['tabellen_gesamt']) {
|
||||
$dauer = time() - ($xtime + $dump['verbraucht']);
|
||||
$dump['verbraucht'] += $dauer;
|
||||
$summe_eintraege += $dump['anzahl_zeilen'];
|
||||
|
||||
$aus[]='<strong>'.$lang['L_DONE'].'</strong><br>';
|
||||
// Time adjustment
|
||||
if ($dauer < $dump['max_zeit']) {
|
||||
$dump['anzahl_zeilen'] = $dump['anzahl_zeilen'] * $config['tuning_add'];
|
||||
if ($dauer < $dump['max_zeit'] / 2) {
|
||||
$dump['anzahl_zeilen'] *= 1.8;
|
||||
}
|
||||
if ($dump['anzahl_zeilen'] > $config['maxspeed']) {
|
||||
$dump['anzahl_zeilen'] = $config['maxspeed'];
|
||||
}
|
||||
} else {
|
||||
$dump['anzahl_zeilen'] = $dump['anzahl_zeilen'] * $config['tuning_sub'];
|
||||
if ($dump['anzahl_zeilen'] < $config['minspeed']) {
|
||||
$dump['anzahl_zeilen'] = $config['minspeed'];
|
||||
}
|
||||
}
|
||||
$dump['anzahl_zeilen'] = intval($dump['anzahl_zeilen']);
|
||||
++$dump['aufruf'];
|
||||
} else {
|
||||
// Backup ready
|
||||
$dump['data'] = "\nSET FOREIGN_KEY_CHECKS=1;";
|
||||
$dump['data'] .= "\n".$mysql_commentstring.' EOB'."\n\n";
|
||||
WriteToDumpFile();
|
||||
ExecuteCommand('a');
|
||||
chmod($config['paths']['backup'].$dump['backupdatei'], 0777);
|
||||
if (isset($config['multi_part']) && (1 == $config['multi_part'])) {
|
||||
$out .= "\n".'<br><div class="backupmsg">';
|
||||
$dateistamm = substr($dump['backupdatei'], 0, strrpos($dump['backupdatei'], 'part_')).'part_';
|
||||
$dateiendung = (1 == $config['compression']) ? '.sql.gz' : '.sql';
|
||||
clearstatcache();
|
||||
for ($i = 1; $i < ($dump['part'] - $dump['part_offset']); ++$i) {
|
||||
$mpdatei = $dateistamm.$i.$dateiendung;
|
||||
$sz = byte_output(@filesize($config['paths']['backup'].$mpdatei));
|
||||
$out .= "\n".$lang['L_FILE'].' <a href="'.$config['paths']['backup'].$mpdatei.'" class="smallblack">'.$mpdatei.' ('.$sz.')</a> '.$lang['L_DUMP_SUCCESSFUL'].'<br>';
|
||||
}
|
||||
} else {
|
||||
$out .= "\n".'<div class="backupmsg">'.$lang['L_FILE'].' <a href="'.$config['paths']['backup'].$dump['backupdatei'].'" class="smallblack">'.$dump['backupdatei'].' ('.byte_output(filesize($config['paths']['backup'].$dump['backupdatei'])).')'.'</a>'.$lang['L_DUMP_SUCCESSFUL'].'<br>';
|
||||
}
|
||||
|
||||
if ($config['multi_dump']==1)
|
||||
{
|
||||
$aus[]=sprintf($lang['L_MULTIDUMP'],count($databases['multi'])).': ';
|
||||
$aus[]='<strong>'.implode(', ',$databases['multi']).'</strong>';
|
||||
$aus2='';
|
||||
$out='';
|
||||
}
|
||||
else
|
||||
{
|
||||
$aus[]='<br>'.sprintf($lang['L_DUMP_ENDERGEBNIS'],$num_tables,number_format($dump['countdata'],0,',','.'));
|
||||
}
|
||||
if ($dump['errors']>0) $aus[]=sprintf($lang['L_DUMP_ERRORS'],$dump['errors']);
|
||||
$xtime = time() - $xtime;
|
||||
$aus = [];
|
||||
$aus[] = '<br>'."\n";
|
||||
if (isset($config['multi_dump']) && (1 == $config['multi_dump'])) {
|
||||
WriteLog('Dump \''.$dump['backupdatei'].'\' finished.');
|
||||
WriteLog('Multidump: '.count($databases['multi']).' Databases in '.zeit_format($xtime).'.');
|
||||
} else {
|
||||
WriteLog('Dump \''.$dump['backupdatei'].'\' finished in '.zeit_format($xtime).'.');
|
||||
}
|
||||
|
||||
$aus[]='<form action="dump.php?MySQLDumper='.session_id().'" method="POST">'.$out.'<br>'.'<p class="small">'.zeit_format($xtime).', '.$dump['aufruf'].' '.$lang['L_PAGE_REFRESHS'].$aus2.'</p>'."\n";
|
||||
$aus[]="\n".'<br><input class="Formbutton" type="button" value="'.$lang['L_BACK_TO_CONTROL'].'" onclick="self.location.href=\''.$relativ_path.'filemanagement.php\'">';
|
||||
$aus[]=' <input class="Formbutton" type="button" value="'.$lang['L_BACK_TO_MINISQL'].'" onclick="self.location.href=\''.$relativ_path.'sql.php\'">';
|
||||
$aus[]=' <input class="Formbutton" type="button" value="'.$lang['L_BACK_TO_OVERVIEW'].'" onclick="self.location.href=\''.$relativ_path.'main.php?action=db&dbid='.$dump['dbindex'].'#dbid\'"><br><br>';
|
||||
$aus[]='</div></form>';
|
||||
if (isset($config['send_mail']) && (1 == $config['send_mail'])) {
|
||||
DoEmail();
|
||||
}
|
||||
for ($i = 0; $i < 3; ++$i) {
|
||||
if (isset($config['ftp_transfer'][$i]) && (1 == $config['ftp_transfer'][$i])) {
|
||||
DoFTP($i);
|
||||
}
|
||||
if (isset($config['sftp_transfer'][$i]) && (1 == $config['sftp_transfer'][$i])) {
|
||||
DoSFTP($i);
|
||||
}
|
||||
}
|
||||
|
||||
$DumpFertig=1;
|
||||
}
|
||||
$aus[] = '<strong>'.$lang['L_DONE'].'</strong><br>';
|
||||
|
||||
if (isset($config['multi_dump']) && (1 == $config['multi_dump'])) {
|
||||
$aus[] = sprintf($lang['L_MULTIDUMP'], count($databases['multi'])).': ';
|
||||
$aus[] = '<strong>'.implode(', ', $databases['multi']).'</strong>';
|
||||
$aus2 = '';
|
||||
$out = '';
|
||||
} else {
|
||||
$aus[] = '<br>'.sprintf($lang['L_DUMP_ENDERGEBNIS'], $num_tables, number_format($dump['countdata'], 0, ',', '.'));
|
||||
}
|
||||
if ($dump['errors'] > 0) {
|
||||
$aus[] = sprintf($lang['L_DUMP_ERRORS'], $dump['errors']);
|
||||
}
|
||||
|
||||
$aus[] = '<form action="dump.php?MyOOSDumperID='.session_id().'" method="POST">'.$out.'<br>'.'<p class="small">'.zeit_format($xtime).', '.$dump['aufruf'].' '.$lang['L_PAGE_REFRESHS'].$aus2.'</p>'."\n";
|
||||
$aus[] = "\n".'<br><input class="Formbutton" type="button" value="'.$lang['L_BACK_TO_CONTROL'].'" onclick="self.location.href=\''.$relativ_path.'filemanagement.php\'">';
|
||||
$aus[] = ' <input class="Formbutton" type="button" value="'.$lang['L_BACK_TO_MINISQL'].'" onclick="self.location.href=\''.$relativ_path.'sql.php\'">';
|
||||
$aus[] = ' <input class="Formbutton" type="button" value="'.$lang['L_BACK_TO_OVERVIEW'].'" onclick="self.location.href=\''.$relativ_path.'main.php?action=db&dbid='.$dump['dbindex'].'#dbid\'"><br><br>';
|
||||
$aus[] = '</div></form>';
|
||||
|
||||
$DumpFertig = 1;
|
||||
}
|
||||
}
|
||||
|
||||
//=====================================================================
|
||||
//================= Anzeige ===========================================
|
||||
//================= Display ===========================================
|
||||
//=====================================================================
|
||||
|
||||
// Craft page
|
||||
$aus = array_merge($aus_header, $aus);
|
||||
|
||||
//Seite basteln
|
||||
$aus=array_merge($aus_header,$aus);
|
||||
|
||||
$dump['xtime']=$xtime;
|
||||
if ($DumpFertig!=1)
|
||||
{
|
||||
// save actual values to session
|
||||
$_SESSION['dump']=$dump;
|
||||
$page_parameter=get_page_parameter($dump);
|
||||
$pagefooter='</body></html>';
|
||||
$selbstaufruf=$page_parameter.'<script language="javascript" type="text/javascript">setTimeout("document.dump.submit()", 10);</script></div>';
|
||||
$dump['xtime'] = $xtime;
|
||||
if (1 != $DumpFertig) {
|
||||
// save actual values to session
|
||||
$_SESSION['dump'] = $dump;
|
||||
$page_parameter = get_page_parameter($dump);
|
||||
$pagefooter = '</body></html>';
|
||||
$selbstaufruf = $page_parameter.'<script>setTimeout("document.dump.submit()", 10);</script></div>';
|
||||
} else {
|
||||
$dump = [];
|
||||
$_SESSION['dump'] = $dump;
|
||||
$pagefooter = MODFooter('', 1);
|
||||
$selbstaufruf = '';
|
||||
}
|
||||
else
|
||||
{
|
||||
$dump=array();
|
||||
$_SESSION['dump']=$dump;
|
||||
$pagefooter=MSDFooter('',1);
|
||||
$selbstaufruf='';
|
||||
}
|
||||
$complete_page=$pageheader.implode("\n",$aus)."\n".$selbstaufruf."\n".$pagefooter;
|
||||
$complete_page = $pageheader.implode("\n", $aus)."\n".$selbstaufruf."\n".$pagefooter;
|
||||
echo $complete_page;
|
||||
ob_end_flush();
|
||||
|
Reference in New Issue
Block a user