?> <script> window.setTimeout("if(!stop)AjaxSend('?process=Y&<?php echo bitrix_sessid_get(); ?> ')",<?php echo 1000 * IntOption("dump_max_exec_time_sleep"); ?> ); </script> <?php } else { $title = ($NS['cloud_send'] ? GetMessage("MAIN_DUMP_SUCCESS_SENT") : GetMessage("MAIN_DUMP_FILE_FINISH")) . '<br><br>'; $status_msg = ''; if ($NS["arc_size"]) { $status_msg .= GetMessage("MAIN_DUMP_ARC_NAME") . ": <b>" . basename(CTar::getFirstName($NS["arc_name"])) . "</b><br>"; $status_msg .= GetMessage("MAIN_DUMP_ARC_SIZE") . " <b>" . CFile::FormatSize($NS["arc_size"]) . "</b><br>"; if ($NS['BUCKET_ID'] > 0) { $l = ''; } elseif ($NS['BUCKET_ID'] == -1) { $l = GetMessage('DUMP_MAIN_BITRIX_CLOUD'); } else { $l = GetMessage("MAIN_DUMP_LOCAL"); } if ($l) { $status_msg .= GetMessage("MAIN_DUMP_LOCATION") . ": <b>" . $l . "</b><br>"; } } if ($FinishedTables) { $status_msg .= GetMessage("MAIN_DUMP_TABLE_FINISH") . " <b>" . $FinishedTables . "</b><br>"; }
if ($BUCKET_ID = intval($_REQUEST['BUCKET_ID'])) { // Not realized 'cos no cloud API } else { while(file_exists(DOCUMENT_ROOT.$path.'/'.$ID)) { if (!rename(DOCUMENT_ROOT.$path.'/'.$ID, DOCUMENT_ROOT.$path.'/'.$new_name)) { $lAdmin->AddGroupError(GetMessage("MAIN_DUMP_ERR_FILE_RENAME").htmlspecialcharsbx($ID), $ID); break; } $ID = CTar::getNextName($ID); $new_name = CTar::getNextName($new_name); } } } else $lAdmin->AddGroupError(GetMessage("MAIN_DUMP_ERR_NAME"), $ID); break; } } } InitSorting(); $arDirs = array(); $arFiles = array(); $arTmpFiles = array(); $arFilter = array();
static function Get($strName) { if (!self::Init()) { return false; } $temporary_cache = base64_decode(COption::GetOptionString('main', $strName, '')); $pass = mcrypt_decrypt(MCRYPT_BLOWFISH, self::getEncryptKey(), $temporary_cache, MCRYPT_MODE_ECB, pack("a8", self::getEncryptKey())); if (CTar::substr($pass, 0, 6) == self::SIGN) { return str_replace("", "", CTar::substr($pass, 6)); } return false; }
function readHeader($Long = false) { $header = parent::readHeader($Long); if (is_array($header)) { $dr = str_replace(array('/','\\'),'',$_SERVER['DOCUMENT_ROOT']); $f = str_replace(array('/','\\'),'',$this->path.'/'.$header['filename']); if ($f == $dr.'restore.php') return true; elseif ($f == $dr.'.htaccess') $header['filename'] .= '.restore'; elseif ($f == $dr.'freetrixphp_interfacedbconn.php' && file_exists($_SERVER['DOCUMENT_ROOT'].'/freetrix/php_interface/dbconn.php')) $header['filename'] = str_replace('dbconn.php','dbconn.restore.php',$header['filename']); elseif ($f == $dr.'freetrix.config.php') return file_exists($_SERVER['DOCUMENT_ROOT'].'/freetrix/.config.php') ? true : $this->Error('NOT_SAAS_ENV'); elseif ($this->Block == 1 && file_exists($_SERVER['DOCUMENT_ROOT'].'/freetrix/.config.php')) return $this->Error(getMsg('NOT_SAAS_DISTR')); elseif (preg_match('#[^\x00-\x7f]#', $header['filename'])) // non ASCII character detected { if (false === $this->header['filename'] = $header['filename'] = $this->DecodeFileName($header['filename'])) return false; } } return $header; }
default: break; } $cnt--; $f = $p.'/'.$name; // echo "delete ".$f."\n"; $bDel = false; while(file_exists($f)) { $size = filesize($f); $TotalSize -= $size; if (($bDel = unlink($f)) && $arParams["disk_space"] > 0) CDiskQuota::updateDiskQuota("file", $size , "del"); $f = CTar::getNextName($f); } if (!$bDel) RaiseErrorAndDie('Could not delete file: '.$f, 700, $NS['arc_name']); } } $NS['step'] = 8; } $info = "Finished.\n\nData size: ".round($NS['data_size']/1024/1024, 2)." M\nArchive size: ".round($NS['arc_size']/1024/1024, 2)." M\nTime: ".(time() - START_TIME)." sec\n"; ShowBackupStatus($info); CEventLog::Add(array( "SEVERITY" => "WARNING", "AUDIT_TYPE_ID" => "BACKUP_SUCCESS", "MODULE_ID" => "main",
function readHeader($Long = false) { $header = parent::readHeader($Long); if (is_array($header)) { $dr = str_replace(array('/','\\'),'',$_SERVER['DOCUMENT_ROOT']); $f = str_replace(array('/','\\'),'',$this->path.'/'.$header['filename']); if ($f == $dr.'restore.php') return true; elseif ($f == $dr.'.htaccess') $header['filename'] .= '.restore'; elseif ($f == $dr.'bitrix.config.php') return file_exists($_SERVER['DOCUMENT_ROOT'].'/bitrix/.config.php') ? true : $this->Error('NOT_SAAS_ENV'); elseif ($this->Block == 1 && file_exists($_SERVER['DOCUMENT_ROOT'].'/bitrix/.config.php')) return $this->Error('NOT_SAAS_DISTR'); } return $header; }
function ProcessFile($f) { if (!haveTime()) return 'BREAK'; global $a; if (!$a) return; $k = CTar::substr($f, $this->cut); if (!$a[$k]) { $to = RESTORE_FILE_DIR.'/'.$k; CTar::xmkdir(dirname($to)); rename($f, $to); } return true; }