$tar->EncryptKey = $NS['dump_encrypt_key']; $tar->ArchiveSizeLimit = IntOption('dump_archive_size_limit'); $tar->gzip = IntOption('dump_use_compression'); $tar->path = DOCUMENT_ROOT_SITE; $tar->ReadBlockCurrent = intval($NS['ReadBlockCurrent']); if (!$tar->openWrite($NS["arc_name"])) RaiseErrorAndDie(GetMessage('DUMP_NO_PERMS')); $Block = $tar->Block; $DirScan = new CDirRealScan; if (!$NS['startPath']) { if (!IntOption('dump_base') && file_exists($f = DOCUMENT_ROOT.BX_ROOT.'/.config.php')) $tar->addFile($f); } else $DirScan->startPath = $NS['startPath']; $r = $DirScan->Scan(DOCUMENT_ROOT_SITE);//.$DIR); $NS["data_size"] += 512 * ($tar->Block - $Block); $tar->close(); if ($r === false) RaiseErrorAndDie(implode('<br>',$DirScan->err)); $NS["ReadBlockCurrent"] = $tar->ReadBlockCurrent; $NS["startPath"] = $DirScan->nextPath; $NS["cnt"] += $DirScan->FileCount;
$rs = $DB->Query('SHOW VARIABLES LIKE "collation_database"'); if (($f = $rs->Fetch()) && array_key_exists('Value', $f)) { file_put_contents($after_file, "ALTER DATABASE `<DATABASE>` COLLATE " . $f['Value'] . ";\n", 8); } } ShowBackupStatus('Archiving database dump'); $tar = new CTar(); $tar->EncryptKey = $arParams['dump_encrypt_key']; $tar->ArchiveSizeLimit = $arParams['dump_archive_size_limit']; $tar->gzip = $arParams['dump_use_compression']; $tar->path = DOCUMENT_ROOT; if (!$tar->openWrite($NS["arc_name"])) { RaiseErrorAndDie(GetMessage('DUMP_NO_PERMS'), $NS['arc_name']); } if (!$tar->ReadBlockCurrent && file_exists($f = DOCUMENT_ROOT . BX_ROOT . '/.config.php')) { $tar->addFile($f); } $Block = $tar->Block; while (($r = $tar->addFile($NS['dump_name'])) && $tar->ReadBlockCurrent > 0) { } $NS["data_size"] += 512 * ($tar->Block - $Block); if ($r === false) { RaiseErrorAndDie(implode('<br>', $tar->err), $NS['arc_name']); } $tar->addFile($after_file); unlink($NS["dump_name"]) && (!file_exists($after_file) || unlink($after_file)); $NS['arc_size'] = 0; $name = $NS["arc_name"]; while (file_exists($name)) { $size = filesize($name); $NS['arc_size'] += $size;
} ShowBackupStatus('Archiving database dump'); $tar = new CTar; $tar->EncryptKey = $NS['dump_encrypt_key']; $tar->ArchiveSizeLimit = $arParams['dump_archive_size_limit']; $tar->gzip = $arParams['dump_use_compression']; $tar->path = DOCUMENT_ROOT; $tar->ReadBlockCurrent = intval($NS['ReadBlockCurrent']); $tar->ReadFileSize = intval($NS['ReadFileSize']); if (!$tar->openWrite($NS["arc_name"])) RaiseErrorAndDie(GetMessage('DUMP_NO_PERMS'), 200, $NS['arc_name']); if (!$tar->ReadBlockCurrent && file_exists($f = DOCUMENT_ROOT.BX_ROOT.'/.config.php')) $tar->addFile($f); $Block = $tar->Block; while(haveTime() && ($r = $tar->addFile($NS['dump_name'])) && $tar->ReadBlockCurrent > 0); $NS["data_size"] += 512 * ($tar->Block - $Block); if ($r === false) RaiseErrorAndDie(implode('<br>',$tar->err), 210, $NS['arc_name']); $NS["ReadBlockCurrent"] = $tar->ReadBlockCurrent; $NS["ReadFileSize"] = $tar->ReadFileSize; if (!haveTime()) { $tar->close(); CheckPoint();
$NS['step'] = 2; clearstatcache(); } ShowBackupStatus('Archiving database dump'); $tar = new CTar(); $tar->EncryptKey = $NS['dump_encrypt_key']; $tar->ArchiveSizeLimit = $arParams['dump_archive_size_limit']; $tar->gzip = $arParams['dump_use_compression']; $tar->path = DOCUMENT_ROOT; $tar->ReadBlockCurrent = intval($NS['ReadBlockCurrent']); $tar->ReadFileSize = intval($NS['ReadFileSize']); if (!$tar->openWrite($NS["arc_name"])) { RaiseErrorAndDie(GetMessage('DUMP_NO_PERMS'), 200, $NS['arc_name']); } if (!$tar->ReadBlockCurrent && file_exists($f = DOCUMENT_ROOT . BX_ROOT . '/.config.php')) { $tar->addFile($f); } $Block = $tar->Block; while (haveTime()) { $r = $tar->addFile($NS['dump_name']); if ($r === false) { RaiseErrorAndDie(implode('<br>', $tar->err), 210, $NS['arc_name']); } if ($tar->ReadBlockCurrent == 0) { unlink($NS["dump_name"]); if (file_exists($next_part = CBackup::getNextName($NS['dump_name']))) { $NS['dump_name'] = $next_part; } else { break; } }