예제 #1
0
function GetStatusLine($kind = "php")
{
    /*AUFBAU der Statuszeile:
    		-- Status:tabellenzahl:datensätze:Multipart:Datenbankname:script:scriptversion:Kommentar:MySQLVersion:Backupflags:SQLBefore:SQLAfter:Charset:CharsetEXTINFO
    		Aufbau Backupflags (1 Zeichen pro Flag, 0 oder 1, 2=unbekannt)
    		(complete inserts)(extended inserts)(ignore inserts)(delayed inserts)(downgrade)(lock tables)(optimize tables)
    	*/
    global $databases, $config, $lang, $dump, $mysql_commentstring;
    $t_array = explode("|", $databases['db_actual_tableselected']);
    $t = 0;
    $r = 0;
    $t_zeile = "{$mysql_commentstring}\n{$mysql_commentstring} TABLE-INFO\r\n";
    MSD_mysql_connect();
    $res = mysqli_query($GLOBALS["___mysqli_ston"], "SHOW TABLE STATUS FROM `" . $databases['Name'][$dump['dbindex']] . "`");
    $numrows = intval(@mysqli_num_rows($res));
    for ($i = 0; $i < $numrows; $i++) {
        $erg = mysqli_fetch_array($res);
        // 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'][$dump['dbindex']] . "`.`" . $erg['Name'] . "`";
        $res2 = @mysqli_query($GLOBALS["___mysqli_ston"], $sql_2);
        if ($res2 === false) {
            // error reading table definition
            $read_create_error = sprintf($lang['L_FATAL_ERROR_DUMP'], $databases['Name'][$dump['dbindex']], $erg['Name']) . ': ' . (is_object($config['dbconnection']) ? mysqli_error($config['dbconnection']) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false));
            Errorlog("DUMP", $databases['Name'][$dump['dbindex']], '', $read_create_error, 0);
            WriteLog($read_create_error);
            if ($config['stop_with_error'] > 0) {
                die($read_create_error);
            }
            $dump['errors']++;
            //$i++; // skip corrupted table
        } else {
            $row2 = mysqli_fetch_array($res2);
            $erg['Rows'] = $row2['count_records'];
            if (($databases['db_actual_tableselected'] == '' || $databases['db_actual_tableselected'] != '' && in_array($erg[0], $t_array)) && substr($erg[0], 0, strlen($databases['praefix'][$dump['dbindex']])) == $databases['praefix'][$dump['dbindex']]) {
                $t++;
                $r += $erg['Rows'];
                if (isset($erg['Type'])) {
                    $erg['Engine'] = $erg['Type'];
                }
                $t_zeile .= "{$mysql_commentstring} TABLE|" . $erg['Name'] . '|' . $erg['Rows'] . '|' . ($erg['Data_length'] + $erg['Index_length']) . '|' . $erg['Update_time'] . '|' . $erg['Engine'] . "\n";
            }
        }
    }
    //$dump['totalrecords']=$r;
    $flags = 1;
    $mp = $config['multi_part'] == 1 ? $mp = "MP_" . ($dump['part'] - $dump['part_offset']) : 'MP_0';
    $statusline = "{$mysql_commentstring} Status:{$t}:{$r}:{$mp}:" . $databases['Name'][$dump['dbindex']] . ":{$kind}:" . MSD_VERSION . ":" . $dump['kommentar'] . ":";
    $statusline .= MSD_MYSQL_VERSION . ":{$flags}:::" . $dump['dump_encoding'] . ":EXTINFO\n" . $t_zeile . "{$mysql_commentstring}" . " EOF TABLE-INFO\n{$mysql_commentstring}";
    return $statusline;
}
예제 #2
0
                         $restore['eintraege_ready'] += $anzsql;
                     }
                 }
             }
             // Bei MySQL-Fehlern sofort abbrechen und Info ausgeben
             $meldung = mysql_error($config['dbconnection']);
             if ($meldung != '') {
                 if (strtolower(substr($meldung, 0, 15)) == 'duplicate entry') {
                     ErrorLog('RESTORE', $databases['db_actual'], $sql_command, $meldung, 1);
                     $restore['notices']++;
                 } else {
                     if ($config['stop_with_error'] == 0) {
                         Errorlog("RESTORE", $databases['db_actual'], $sql_command, $meldung);
                         $restore['errors']++;
                     } else {
                         Errorlog("RESTORE", $databases['db_actual'], $sql_command, 'Restore failed: ' . $meldung, 0);
                         SQLError($sql_command, $meldung);
                         die;
                     }
                 }
             }
         }
         $a++;
         $dauer = time() - $restore['startzeit'];
     }
     $eingetragen = $a - 1;
 }
 $restore['offset'] = $restore['compressed'] ? gztell($restore['filehandle']) : ftell($restore['filehandle']);
 if ($restore['compressed']) {
     gzclose($restore['filehandle']);
 } else {
예제 #3
0
파일: dump.php 프로젝트: thaian2009/php
 $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) . ': ' . mysql_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";