function new_file($last_groesse = 0)
{
    global $dump, $databases, $config, $out, $lang, $nl, $mysql_commentstring;
    // Dateiname aus Datum und Uhrzeit bilden
    if ($dump['part'] - $dump['part_offset'] == 1) {
        $dump['filename_stamp'] = date("Y_m_d_H_i", time());
    }
    if ($config['multi_part'] == 1) {
        $dateiname = $databases['Name'][$dump['dbindex']] . '_' . $dump['filename_stamp'] . '_part_' . ($dump['part'] - $dump['part_offset']);
    } else {
        $dateiname = $databases['Name'][$dump['dbindex']] . '_' . date("Y_m_d_H_i", time());
    }
    $structurefilename = $databases['Name'][$dump['dbindex']] . '_structure_file';
    $endung = $config['compression'] ? '.sql.gz' : '.sql';
    $dump['backupdatei'] = $dateiname . $endung;
    $dump['backupdatei_structure'] = $structurefilename . $endung;
    if (file_exists($config['paths']['backup'] . $dump['backupdatei'])) {
        unlink($config['paths']['backup'] . $dump['backupdatei']);
    }
    if ($config['multi_part'] == 0 || $config['multi_part'] == 1 && $dump['part'] - $dump['part_offset'] == 1) {
        if (file_exists($config['paths']['structure'] . $dump['backupdatei_structure'])) {
            unlink($config['paths']['structure'] . $dump['backupdatei_structure']);
        }
    }
    $cur_time = date("Y-m-d H:i");
    $statuszeile = GetStatusLine() . $nl . $mysql_commentstring . ' Dump by MySQLDumper ' . MSD_VERSION . ' (' . $config['homepage'] . ')' . $nl;
    if ($dump['part'] - $dump['part_offset'] == 1) {
        if ($config['multi_part'] == 0) {
            if ($config['multi_dump'] == 1) {
                WriteLog('starting Multidump with ' . count($databases['multi']) . ' Datenbases.');
            }
            WriteLog('Start Dump \'' . $dump['backupdatei'] . '\'');
        } else {
            WriteLog('Start Multipart-Dump \'' . $dateiname . '\'');
        }
        $out .= '<strong>' . $lang['startdump'] . '`' . $databases['Name'][$dump['dbindex']] . '`</strong>' . ($databases['praefix'][$dump['dbindex']] != "" ? ' (' . $lang['withpraefix'] . ' <span style="color:blue">' . $databases['praefix'][$dump['dbindex']] . '</span>)' : '') . '...   ';
        ExecuteCommand('b');
        if ($dump['part'] == 1) {
            $dump['table_offset'] = 0;
            $dump['countdata'] = 0;
        }
        // Seitenerstaufruf -> Backupdatei anlegen
        $dump['data'] = $statuszeile . $mysql_commentstring . ' Dump created at ' . $cur_time . $nl . $nl;
        $dump['structure'] = $mysql_commentstring . ' Status:0:0::' . $databases['Name'][$dump['dbindex']];
        $dump['structure'] .= ":php:" . MSD_VERSION . $nl;
        $dump['structure'] .= $mysql_commentstring . ' Dump by MySQLDumper ' . MSD_VERSION . ' (' . $config['homepage'] . ')' . $nl;
        $dump['structure'] .= $mysql_commentstring . ' Dump created on ' . $cur_time . $nl . $mysql_commentstring . ' This file only contains the structure of the database without data \\n\\n';
    } else {
        if ($config['multi_part'] != 0) {
            WriteLog('Continue Multipart-Dump with File ' . ($dump['part'] - $dump['part_offset']) . ' (last file was ' . $last_groesse . ' Bytes)');
            $dump['data'] = $statuszeile . $mysql_commentstring . ' This is part ' . ($dump['part'] - $dump['part_offset']) . ' of the backup.' . $nl . $nl . $dump['data'];
        }
    }
    WriteToDumpFile();
    $dump['part']++;
}
Exemple #2
0
             $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>';
         }
     } 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>';
     }
     $xtime = time() - $xtime;