Файловый менеджер - Редактировать - /home/infrafs/INFRABIKEIT/wp-content/plugins/daws.zip
Назад
PK V�4\A;m\ \ class.daws.constants.phpnu �[��� <?php defined('ABSPATH') || defined('DUPXABSPATH') || exit; /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ class DAWSConstants { public static $DAWS_ROOT; public static $DUPARCHIVE_DIR; public static $DUPARCHIVE_CLASSES_DIR; public static $DUPARCHIVE_STATES_DIR; public static $DUPARCHIVE_UTIL_DIR; public static $DEFAULT_WORKER_TIME = 18; public static $LIB_DIR; public static $PROCESS_LOCK_FILEPATH; public static $PROCESS_CANCEL_FILEPATH; public static $LOG_FILEPATH; public static function init() { self::$DAWS_ROOT = dirname(__FILE__); self::$DUPARCHIVE_DIR = self::$DAWS_ROOT.'/..'; self::$DUPARCHIVE_CLASSES_DIR = self::$DUPARCHIVE_DIR.'/classes'; self::$DUPARCHIVE_STATES_DIR = self::$DUPARCHIVE_CLASSES_DIR.'/states'; self::$DUPARCHIVE_UTIL_DIR = self::$DUPARCHIVE_CLASSES_DIR.'/util'; self::$LIB_DIR = self::$DAWS_ROOT.'/../..'; self::$PROCESS_LOCK_FILEPATH = self::$DAWS_ROOT.'/dawslock.bin'; self::$PROCESS_CANCEL_FILEPATH = self::$DAWS_ROOT.'/dawscancel.bin'; self::$LOG_FILEPATH = dirname(__FILE__).'/daws.log'; } } DAWSConstants::init();PK V�4\�/V: index.phpnu �[��� <?php //silentPK V�4\ dawslock.binnu �[��� PK V�4\|ܘ\� � class.daws.state.expand.phpnu �[��� <?php defined('ABSPATH') || defined('DUPXABSPATH') || exit; /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ require_once(DAWSConstants::$DUPARCHIVE_STATES_DIR.'/class.duparchive.state.expand.php'); class DAWSExpandState extends DupArchiveExpandState { public static $instance = null; const StateFilename = 'expandstate.json'; public static function purgeStatefile() { $stateFilepath = dirname(__FILE__).'/'.self::StateFilename; DupLiteSnapLibIOU::rm($stateFilepath, false); } public static function getInstance($reset = false) { if ((self::$instance == null) && (!$reset)) { $stateFilepath = dirname(__FILE__).'/'.self::StateFilename; self::$instance = new DAWSExpandState(); if (file_exists($stateFilepath)) { $stateHandle = DupLiteSnapLibIOU::fopen($stateFilepath, 'rb'); // RSR we shouldn't need read locks and it seems to screw up on some boxes anyway.. DupLiteSnapLibIOU::flock($stateHandle, LOCK_EX); $stateString = fread($stateHandle, filesize($stateFilepath)); $data = json_decode($stateString); self::$instance->setFromData($data); self::$instance->fileRenames = (array)(self::$instance->fileRenames); // DupLiteSnapLibIOU::flock($stateHandle, LOCK_UN); DupLiteSnapLibIOU::fclose($stateHandle); } else { $reset = true; } } if ($reset) { self::$instance = new DAWSExpandState(); self::$instance->reset(); } return self::$instance; } private function setFromData($data) { $this->currentFileHeader = $data->currentFileHeader; $this->archiveHeader = $data->archiveHeader; $this->archiveOffset = $data->archiveOffset; $this->archivePath = $data->archivePath; $this->basePath = $data->basePath; $this->currentFileOffset = $data->currentFileOffset; $this->failures = $data->failures; $this->isCompressed = $data->isCompressed; $this->startTimestamp = $data->startTimestamp; $this->timeSliceInSecs = $data->timeSliceInSecs; $this->validateOnly = $data->validateOnly; $this->fileWriteCount = $data->fileWriteCount; $this->directoryWriteCount = $data->directoryWriteCount; $this->working = $data->working; $this->filteredDirectories = $data->filteredDirectories; $this->filteredFiles = $data->filteredFiles; $this->fileRenames = $data->fileRenames; $this->directoryModeOverride = $data->directoryModeOverride; $this->fileModeOverride = $data->fileModeOverride; $this->lastHeaderOffset = $data->lastHeaderOffset; $this->throttleDelayInUs = $data->throttleDelayInUs; $this->timerEnabled = $data->timerEnabled; } public function reset() { $stateFilepath = dirname(__FILE__).'/'.self::StateFilename; $stateHandle = DupLiteSnapLibIOU::fopen($stateFilepath, 'w'); DupLiteSnapLibIOU::flock($stateHandle, LOCK_EX); $this->initMembers(); DupLiteSnapLibIOU::fwrite($stateHandle, DupLiteSnapJsonU::wp_json_encode($this)); DupLiteSnapLibIOU::flock($stateHandle, LOCK_UN); DupLiteSnapLibIOU::fclose($stateHandle); } public function save() { $stateFilepath = dirname(__FILE__).'/'.self::StateFilename; $stateHandle = DupLiteSnapLibIOU::fopen($stateFilepath, 'w'); DupLiteSnapLibIOU::flock($stateHandle, LOCK_EX); DupArchiveUtil::tlog("saving state"); DupLiteSnapLibIOU::fwrite($stateHandle, DupLiteSnapJsonU::wp_json_encode($this)); DupLiteSnapLibIOU::flock($stateHandle, LOCK_UN); DupLiteSnapLibIOU::fclose($stateHandle); } private function initMembers() { $this->currentFileHeader = null; $this->archiveOffset = 0; $this->archiveHeader = 0; $this->archivePath = null; $this->basePath = null; $this->currentFileOffset = 0; $this->failures = array(); $this->isCompressed = false; $this->startTimestamp = time(); $this->timeSliceInSecs = -1; $this->working = false; $this->validateOnly = false; $this->filteredDirectories = array(); $this->filteredFiles = array(); $this->fileRenames = array(); $this->directoryModeOverride = -1; $this->fileModeOverride = -1; $this->lastHeaderOffset = -1; $this->throttleDelayInUs = 0; $this->timerEnabled = true; } } PK V�4\\��+ �+ daws.phpnu �[��� <?php /** * * * Standard: PSR-2 * @link http://www.php-fig.org/psr/psr-2 Full Documentation * * @package daws * */ defined('ABSPATH') || defined('DUPXABSPATH') || exit; if (DupLiteSnapLibUtil::wp_is_ini_value_changeable('display_errors')) { @ini_set('display_errors', 1); } error_reporting(E_ALL); set_error_handler("terminate_missing_variables"); require_once(dirname(__FILE__) . '/class.daws.constants.php'); require_once(DAWSConstants::$LIB_DIR . '/snaplib/snaplib.all.php'); require_once(DAWSConstants::$DUPARCHIVE_CLASSES_DIR . '/class.duparchive.loggerbase.php'); require_once(DAWSConstants::$DUPARCHIVE_CLASSES_DIR . '/class.duparchive.engine.php'); require_once(DAWSConstants::$DUPARCHIVE_CLASSES_DIR . '/class.duparchive.mini.expander.php'); require_once(DAWSConstants::$DUPARCHIVE_STATES_DIR . '/class.duparchive.state.simplecreate.php'); require_once(DAWSConstants::$DAWS_ROOT . '/class.daws.state.expand.php'); DupArchiveUtil::$TRACE_ON = false; class DAWS_Logger extends DupArchiveLoggerBase { public function log($s, $flush = false, $callingFunctionOverride = null) { DupLiteSnapLibLogger::log($s, $flush, $callingFunctionOverride); } } class DAWS { private $lock_handle = null; function __construct() { date_default_timezone_set('UTC'); // Some machines don’t have this set so just do it here. DupLiteSnapLibLogger::init(DAWSConstants::$LOG_FILEPATH); DupArchiveEngine::init(new DAWS_Logger()); } public function processRequest($params) { try { DupLiteSnapLibLogger::log('process request'); $retVal = new StdClass(); $retVal->pass = false; DupLiteSnapLibLogger::logObject('params', $params); DupLiteSnapLibLogger::logObject('keys', array_keys($params)); $action = $params['action']; $initializeState = false; $isClientDriven = DupLiteSnapLibUtil::getArrayValue($params, 'client_driven', false); if ($action == 'start_expand') { $initializeState = true; DAWSExpandState::purgeStatefile(); DupLiteSnapLibLogger::clearLog(); DupLiteSnapLibIOU::rm(DAWSConstants::$PROCESS_CANCEL_FILEPATH); $archiveFilepath = DupLiteSnapLibUtil::getArrayValue($params, 'archive_filepath'); $restoreDirectory = DupLiteSnapLibUtil::getArrayValue($params, 'restore_directory'); $workerTime = DupLiteSnapLibUtil::getArrayValue($params, 'worker_time', false, DAWSConstants::$DEFAULT_WORKER_TIME); $filteredDirectories = DupLiteSnapLibUtil::getArrayValue($params, 'filtered_directories', false, array()); $filteredFiles = DupLiteSnapLibUtil::getArrayValue($params, 'filtered_files', false, array()); $fileRenames = DupLiteSnapLibUtil::getArrayValue($params, 'file_renames', false, array()); $action = 'expand'; DupLiteSnapLibLogger::log('startexpand->expand'); } else if($action == 'start_create') { $archiveFilepath = DupLiteSnapLibUtil::getArrayValue($params, 'archive_filepath'); $workerTime = DupLiteSnapLibUtil::getArrayValue($params, 'worker_time', false, DAWSConstants::$DEFAULT_WORKER_TIME); $createState->basePath = $dataDirectory; $createState->isCompressed = $isCompressed; $sourceDirectory = DupLiteSnapLibUtil::getArrayValue($params, 'source_directory'); $isCompressed = DupLiteSnapLibUtil::getArrayValue($params, 'is_compressed') === 'true' ? true : false; } $throttleDelayInMs = DupLiteSnapLibUtil::getArrayValue($params, 'throttle_delay', false, 0); if ($action == 'expand') { DupLiteSnapLibLogger::log('expand action'); /* @var $expandState DAWSExpandState */ $expandState = DAWSExpandState::getInstance($initializeState); $this->lock_handle = DupLiteSnapLibIOU::fopen(DAWSConstants::$PROCESS_LOCK_FILEPATH, 'c+'); DupLiteSnapLibIOU::flock($this->lock_handle, LOCK_EX); if($initializeState || $expandState->working) { if ($initializeState) { DupLiteSnapLibLogger::logObject('file renames', $fileRenames); $expandState->archivePath = $archiveFilepath; $expandState->working = true; $expandState->timeSliceInSecs = $workerTime; $expandState->basePath = $restoreDirectory; $expandState->working = true; $expandState->filteredDirectories = $filteredDirectories; $expandState->filteredFiles = $filteredFiles; $expandState->fileRenames = $fileRenames; $expandState->fileModeOverride = 0644; $expandState->directoryModeOverride = 'u+rwx'; $expandState->save(); } $expandState->throttleDelayInUs = 1000 * $throttleDelayInMs; DupLiteSnapLibLogger::logObject('Expand State In', $expandState); DupArchiveEngine::expandArchive($expandState); } if (!$expandState->working) { $deltaTime = time() - $expandState->startTimestamp; DupLiteSnapLibLogger::log("###### Processing ended. Seconds taken:$deltaTime"); if (count($expandState->failures) > 0) { DupLiteSnapLibLogger::log('Errors detected'); foreach ($expandState->failures as $failure) { DupLiteSnapLibLogger::log("{$failure->subject}:{$failure->description}"); } } else { DupLiteSnapLibLogger::log('Expansion done, archive checks out!'); } } else { DupLiteSnapLibLogger::log("Processing will continue"); } DupLiteSnapLibIOU::flock($this->lock_handle, LOCK_UN); $retVal->pass = true; $retVal->status = $this->getStatus($expandState); } else if ($action == 'create') { DupLiteSnapLibLogger::log('create action'); /* @var $expandState DAWSExpandState */ $createState = DAWSCreateState::getInstance($initializeState); $this->lock_handle = DupLiteSnapLibIOU::fopen(DAWSConstants::$PROCESS_LOCK_FILEPATH, 'c+'); DupLiteSnapLibIOU::flock($this->lock_handle, LOCK_EX); if($initializeState || $createState->working) { DupArchiveEngine::createArchive($archiveFilepath, $isCompressed); $createState->archivePath = $archiveFilepath; $createState->archiveOffset = DupLiteSnapLibIOU::filesize($archiveFilepath); $createState->working = true; $createState->timeSliceInSecs = $workerTime; $createState->basePath = $dataDirectory; $createState->isCompressed = $isCompressed; $createState->throttleDelayInUs = $throttleDelayInUs; // $daTesterCreateState->globSize = self::GLOB_SIZE; $createState->save(); $scan = DupArchiveScanUtil::createScan($this->paths->scanFilepath, $this->paths->dataDirectory); } $createState->throttleDelayInUs = 1000 * $throttleDelayInMs; if (!$createState->working) { $deltaTime = time() - $createState->startTimestamp; DupLiteSnapLibLogger::log("###### Processing ended. Seconds taken:$deltaTime"); if (count($createState->failures) > 0) { DupLiteSnapLibLogger::log('Errors detected'); foreach ($createState->failures as $failure) { DupLiteSnapLibLogger::log("{$failure->subject}:{$failure->description}"); } } else { DupLiteSnapLibLogger::log('Creation done, archive checks out!'); } } else { DupLiteSnapLibLogger::log("Processing will continue"); } DupLiteSnapLibIOU::flock($this->lock_handle, LOCK_UN); $retVal->pass = true; $retVal->status = $this->getStatus($createState); } else if ($action == 'get_status') { /* @var $expandState DAWSExpandState */ $expandState = DAWSExpandState::getInstance($initializeState); $retVal->pass = true; $retVal->status = $this->getStatus($expandState); } else if ($action == 'cancel') { if (!DupLiteSnapLibIOU::touch(DAWSConstants::$PROCESS_CANCEL_FILEPATH)) { throw new Exception("Couldn't update time on ".DAWSConstants::$PROCESS_CANCEL_FILEPATH); } $retVal->pass = true; } else { throw new Exception('Unknown command.'); } session_write_close(); } catch (Exception $ex) { $error_message = "Error Encountered:" . $ex->getMessage() . '<br/>' . $ex->getTraceAsString(); DupLiteSnapLibLogger::log($error_message); $retVal->pass = false; $retVal->error = $error_message; } DupLiteSnapLibLogger::logObject("before json encode retval", $retVal); $jsonRetVal = DupLiteSnapJsonU::wp_json_encode($retVal); DupLiteSnapLibLogger::logObject("json encoded retval", $jsonRetVal); echo $jsonRetVal; } private function getStatus($state) { /* @var $state DupArchiveStateBase */ $ret_val = new stdClass(); $ret_val->archive_offset = $state->archiveOffset; $ret_val->archive_size = @filesize($state->archivePath); $ret_val->failures = $state->failures; $ret_val->file_index = $state->fileWriteCount; $ret_val->is_done = !$state->working; $ret_val->timestamp = time(); return $ret_val; } } function generateCallTrace() { $e = new Exception(); $trace = explode("\n", $e->getTraceAsString()); // reverse array to make steps line up chronologically $trace = array_reverse($trace); array_shift($trace); // remove {main} array_pop($trace); // remove call to this method $length = count($trace); $result = array(); for ($i = 0; $i < $length; $i++) { $result[] = ($i + 1) . ')' . substr($trace[$i], strpos($trace[$i], ' ')); // replace '#someNum' with '$i)', set the right ordering } return "\t" . implode("\n\t", $result); } function terminate_missing_variables($errno, $errstr, $errfile, $errline) { DupLiteSnapLibLogger::log("ERROR $errno, $errstr, {$errfile}:{$errline}"); DupLiteSnapLibLogger::log(generateCallTrace()); // DaTesterLogging::clearLog(); /** * INTERCEPT ON processRequest AND RETURN JSON STATUS */ throw new Exception("ERROR:{$errfile}:{$errline} | ".$errstr , $errno); } PK V�4\A;m\ \ class.daws.constants.phpnu �[��� PK V�4\�/V: � index.phpnu �[��� PK V�4\ � dawslock.binnu �[��� PK V�4\|ܘ\� � ( class.daws.state.expand.phpnu �[��� PK V�4\\��+ �+ daws.phpnu �[��� PK � "G
| ver. 1.4 |
Github
|
.
| PHP 8.2.29 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка