0) ? $config['minspeed']:50); $dump['dump_encoding']=(isset($_POST['dump_encoding'])) ? urldecode($_POST['dump_encoding']):''; 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; } $mp2=array( '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'])); } // 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]]; } //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'); // 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).'
'; $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'].' '.$databases['praefix'][$dump['dbindex']].')':''))); if (isset($aus_error)&&count($aus_error)>0) $aus_header=array_merge($aus_header,$aus_error); if ($num_tables==0) { //keine Tabellen gefunden $aus[]='

'.$lang['L_ERROR'].': '.sprintf($lang['L_DUMP_NOTABLES'],$databases['Name'][$dump['dbindex']]).'

'; if (!$config['multi_dump']==1) { echo $pageheader; echo get_page_parameter($dump); echo implode("\n",$aus); echo ''; exit(); } } 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'].'
'; $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'].' '.$mpdatei.' ('.$sz.') '.$lang['L_DUMP_SUCCESSFUL'].'
'; } } else { clearstatcache(); $out.=$lang['L_FINISHED'].'
'.$dump['backupdatei'].' ('.byte_output(filesize($config['paths']['backup'].$dump['backupdatei'])).')
'; } 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.='

'; ExecuteCommand('b'); new_file(); } $aktuelle_tabelle=$dump['table_offset']; if ($dump['zeilen_offset']==0) { if ($config['minspeed']>0) { $dump['anzahl_zeilen']=$config['minspeed']; $dump['restzeilen']=$config['minspeed']; } $create_statement=''; $create_statement=get_def($adbname,$table); 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).': '.((is_object($config['dbconnection'])) ? mysqli_error($config['dbconnection']) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false)); 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(); } } ///////////////////////////////// // 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.=''.$databases['multi'][$i].'   '; else $mudbs.=''.$databases['multi'][$i].'   '; } } if ($config['multi_part']==1) $aus[]='
Multipart-Backup: '.$config['multipartgroesse1'].' '.$mp2[$config['multipartgroesse2']].'
'; $aus[]='

'.$lang['L_DUMP_HEADLINE'].'

'; if ($dump['kommentar']>'') $aus[]=$lang['L_COMMENT'].': '.$dump['kommentar'].'
'; $aus[]=($config['multi_dump']==1) ? $lang['L_DB'].': '.$mudbs:$lang['L_DB'].': '.$databases['Name'][$dump['dbindex']].''; $aus[]=(($databases['praefix'][$dump['dbindex']]!='') ? ' ('.$lang['L_WITHPRAEFIX'].' '.$databases['praefix'][$dump['dbindex']].')':'').'
'; if (isset($tbl_sel)) $aus[]=$msgTbl.'

'; if ($config['multi_part']==1) { $aus[]='Multipart-Backup File '.($dump['part']-$dump['part_offset']-1).'
'; $aus2=', '.($dump['part']-1).' files'; } $aus[]=$lang['L_DUMP_FILENAME'].''.$dump['backupdatei'].'
'.$lang['L_CHARSET'].': '.$dump['dump_encoding'].''. '
'.$lang['L_FILESIZE'].': '.byte_output($dump['filesize']).'

'.$lang['L_GZIP_COMPRESSION'].' '; $aus[]=($config['compression']==1) ? $lang['L_ACTIVATED']:$lang['L_NOT_ACTIVATED']; $aus[]='.
'; if ($out>'') $aus[]='
'.$out.''; 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']],'|')); // 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['zeilen_total']>0) $fortschritt=intval((100*$dump['zeilen_offset'])/$dump['zeilen_total']); else $fortschritt=100; $aus[]=$lang['L_SAVING_TABLE'].''.($dump['table_offset']+1).' '.$lang['L_OF'].' '.sizeof($dump['tables']).'
'.$lang['L_ACTUAL_TABLE'].': '.$table.'

'.$lang['L_PROGRESS_TABLE'].':
'; $aus[]=''.''.''.''; 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; } $aus[]=''.'
 '.($fortschritt).'%
'.$lang['L_ENTRY'].' '.number_format($eintrag,0,',','.').' '.$lang['L_UPTO'].' '.number_format(($zeilen_gesamt),0,',','.').' '.$lang['L_OF'].' '.number_format($dump['zeilen_total'],0,',','.').'
'; $dump['tabellen_gesamt']=(isset($dump['tables'])) ? count($dump['tables']):0; $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[]="\n".'
'.$lang['L_PROGRESS_OVER_ALL'].':'."\n".''.''.''.'
'.(100-$prozent).'%
'; //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[]='
'.'
'.'Speed
'.$dump['anzahl_zeilen'].'
'.''.'
'.''.'
'.''.''.'
'.$config['minspeed'].''.$config['maxspeed'].'
'."\n".'
'. //Status-Text '

'.zeit_format(time()-$xtime).', '.$dump['aufruf'].' '.$lang['L_PAGE_REFRESHS'].$aus2; $aus[]=($dump['errors']>0) ? ', '.$dump['errors'].' errors':''; $aus[]='

'; } else $dump['table_offset']++; // Ende Anzeige WriteToDumpFile(); if (!isset($summe_eintraege)) $summe_eintraege=0; if ($dump['table_offset']<=$dump['tabellen_gesamt']) { $dauer=time()-($xtime+$dump['verbraucht']); $dump['verbraucht']+=$dauer; $summe_eintraege+=$dump['anzahl_zeilen']; //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".'
'; $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'].' '.$mpdatei.' ('.$sz.') '.$lang['L_DUMP_SUCCESSFUL'].'
'; } } else $out.="\n".'
'.$lang['L_FILE'].' '.$dump['backupdatei'].' ('.byte_output(filesize($config['paths']['backup'].$dump['backupdatei'])).')'.''.$lang['L_DUMP_SUCCESSFUL'].'
'; $xtime=time()-$xtime; $aus=Array(); $aus[]='
'."\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).'.'); if ($config['send_mail']==1) DoEmail(); for($i=0;$i<3;$i++) { if ($config['ftp_transfer'][$i]==1) DoFTP($i); } $aus[]=''.$lang['L_DONE'].'
'; if ($config['multi_dump']==1) { $aus[]=sprintf($lang['L_MULTIDUMP'],count($databases['multi'])).': '; $aus[]=''.implode(', ',$databases['multi']).''; $aus2=''; $out=''; } else { $aus[]='
'.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[]='
'.$out.'
'.'

'.zeit_format($xtime).', '.$dump['aufruf'].' '.$lang['L_PAGE_REFRESHS'].$aus2.'

'."\n"; $aus[]="\n".'
'; $aus[]='   '; $aus[]='   

'; $aus[]='
'; $DumpFertig=1; } } //===================================================================== //================= Anzeige =========================================== //===================================================================== //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=''; $selbstaufruf=$page_parameter.'
'; } else { $dump=array(); $_SESSION['dump']=$dump; $pagefooter=MSDFooter('',1); $selbstaufruf=''; } $complete_page=$pageheader.implode("\n",$aus)."\n".$selbstaufruf."\n".$pagefooter; echo $complete_page; ob_end_flush();