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 FileOpsState(); self::$instance->reset(); } return self::$instance; } private function setFromData($data) { // $this->currentFileHeader = $data->currentFileHeader; } public function reset() { $stateFilepath = dirname(__FILE__).'/'.self::StateFilename; $stateHandle = DupLiteSnapLibIOU::fopen($stateFilepath, 'w'); DupLiteSnapLibIOU::flock($stateHandle, LOCK_EX); $this->initMembers(); DupLiteSnapLibIOU::fwrite($stateHandle, json_encode($this)); 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, json_encode($this)); DupLiteSnapLibIOU::fclose($stateHandle); } private function initMembers() { // $this->currentFileHeader = null; } }