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']++;
}
示例#2
0
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());
    }
    $endung = $config['compression'] ? '.sql.gz' : '.sql';
    $dump['backupdatei'] = $dateiname . $endung;
    if (file_exists($config['paths']['backup'] . $dump['backupdatei'])) {
        unlink($config['paths']['backup'] . $dump['backupdatei']);
    }
    $cur_time = date("Y-m-d H:i");
    $statuszeile = GetStatusLine() . $nl . $mysql_commentstring . ' Dump by MySQLDumper ' . MSD_VERSION . ' (' . $config['homepage'] . ')' . $nl;
    $statuszeile .= '/*!40101 SET NAMES \'' . $dump['dump_encoding'] . '\' */;' . $nl;
    $statuszeile .= 'SET FOREIGN_KEY_CHECKS=0;' . $nl;
    if ($dump['part'] - $dump['part_offset'] == 1) {
        if ($config['multi_part'] == 0) {
            if ($config['multi_dump'] == 1 && $dump['dbindex'] == 0) {
                WriteLog('starting Multidump with ' . count($databases['multi']) . ' Datenbases.');
            }
            WriteLog('Start Dump \'' . $dump['backupdatei'] . '\'');
        } else {
            WriteLog('Start Multipart-Dump \'' . $dateiname . '\'');
        }
        $out .= '<strong>' . $lang['L_STARTDUMP'] . ' `' . $databases['Name'][$dump['dbindex']] . '`</strong>' . ($databases['praefix'][$dump['dbindex']] != "" ? ' (' . $lang['L_WITHPRAEFIX'] . ' <span style="color:blue">' . $databases['praefix'][$dump['dbindex']] . '</span>)' : '') . '...   ';
        if ($dump['part'] == 1) {
            $dump['table_offset'] = 0;
            $dump['countdata'] = 0;
        }
        // Seitenerstaufruf -> Backupdatei anlegen
        $dump['data'] = $statuszeile . $mysql_commentstring . ' Dump created: ' . $cur_time;
    } 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']++;
}