<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Data; use Illuminate\Support\Facades\Storage; use Illuminate\Support\Str; use League\Flysystem\FilesystemInterface; use ModStart\Core\Util\EnvUtil; use ModStart\Core\Util\FileUtil; use ModStart\Core\Util\PathUtil; use ModStart\Data\Repository\DatabaseDataRepository; abstract class AbstractDataStorage { const DATA_TEMP = 'data_temp'; const DATA = 'data'; const DATA_CHUNK = 'data_chunk'; const PATTERN_DATA_TEMP = '/^data_temp\\/([a-z_]+)\\/([a-zA-Z0-9]{32}\\.[a-z0-9]*)$/'; const PATTERN_DATA = '/^data\\/([a-z_]+)\\/(\\d+\\/\\d+\\/\\d+\\/\\d+_[a-zA-Z0-9]{4}_\\d+\\.[a-z0-9]+)$/'; const PATTERN_DATA_STRING = '/data\\/([a-z_]+)\\/(\\d+\\/\\d+\\/\\d+\\/\\d+_[a-zA-Z0-9]{4}_\\d+\\.[a-z0-9]+)/'; protected $localStorage; protected $repository; protected $option = array(); public function __construct($nZw7W) { goto DCAKh; c4SqD: $this->repository = new DatabaseDataRepository(); goto IbHbt; DCAKh: $this->option = $nZw7W; goto l5AXw; l5AXw: config(array('filesystems.disks.data' => array('driver' => 'local', 'root' => base_path('public/')))); goto XD43N; XD43N: $this->localStorage = Storage::disk('data'); goto c4SqD; IbHbt: } public function driverName() { return null; } public abstract function init(); public abstract function has($Jtt5u); public abstract function move($KXoNz, $kn8dk); public abstract function delete($Jtt5u); public function softDelete($Jtt5u) { return $this->move($Jtt5u, self::DATA . '/_trash/' . date('Ymd_H') . '/' . $Jtt5u); } public abstract function put($Jtt5u, $BWI89); public abstract function get($Jtt5u); public abstract function size($Jtt5u); public abstract function multiPartInit($AXgEz); public abstract function multiPartUpload($AXgEz); public function updateDriverDomain($zonFp) { return $zonFp; } public function domain() { return ''; } public function domainInternal() { return ''; } public function getDriverFullPath($nAf_0) { goto LuFUc; P797s: if (Str::startsWith($nAf_0, '//')) { $nAf_0 = 'http:' . $nAf_0; } else { $nAf_0 = ltrim($nAf_0, '/'); } goto jr9hl; LuFUc: if (empty($nAf_0)) { return $nAf_0; } goto P797s; LYbKX: return config('data.baseUrl', '/') . $nAf_0; goto y2dQ0; jr9hl: if (PathUtil::isPublicNetPath($nAf_0)) { return $nAf_0; } goto LYbKX; y2dQ0: } public function getDriverFullPathInternal($nAf_0) { goto qSLqk; eTKUj: if (PathUtil::isPublicNetPath($nAf_0)) { return $nAf_0; } goto fTeCY; qSLqk: if (Str::startsWith($nAf_0, '//')) { $nAf_0 = 'http:' . $nAf_0; } else { $nAf_0 = ltrim($nAf_0, '/'); } goto eTKUj; fTeCY: return config('data.baseUrl', '/') . $nAf_0; goto AqpSM; AqpSM: } public function repository() { return $this->repository; } protected function multiPartInitToken(array $AXgEz) { goto To3HJ; q78MK: $I4NE6 = md5(serialize($Jtt5u) . ':' . serialize($WJICQ)); goto zmqyu; BZ0fA: return $Jtt5u; goto t4vRF; UBk12: $WJICQ['uploadMaxSize'] = EnvUtil::env('uploadMaxSize'); goto q78MK; zmqyu: $GIMON = self::DATA_CHUNK . '/token/' . $I4NE6 . '.php'; goto v1uZn; KCWRH: $WJICQ = array(); goto UBk12; v1uZn: if (file_exists($GIMON)) { $Jtt5u = (include $GIMON); } else { goto XPK37; m05FW: $Jtt5u['hash'] = $I4NE6; goto pAiuV; nUXNM: $Jtt5u['path'] = strtolower(Str::random(32)) . '.' . $o8thz; goto kSYhC; XPK37: $Jtt5u['chunkUploaded'] = 0; goto m05FW; pAiuV: $o8thz = FileUtil::extension($Jtt5u['name']); goto nUXNM; kSYhC: $Jtt5u['fullPath'] = self::DATA_TEMP . '/' . $NU9Ix . '/' . $Jtt5u['path']; goto qOQeQ; qOQeQ: } goto BZ0fA; mgA7m: $Jtt5u = $AXgEz['file']; goto oNjIs; oNjIs: ksort($Jtt5u, SORT_STRING); goto KCWRH; To3HJ: $NU9Ix = $AXgEz['category']; goto mgA7m; t4vRF: } protected function uploadChunkTokenAndDeleteToken($uBuY2) { goto YPuZU; YPuZU: $I4NE6 = $uBuY2['hash']; goto b_IIk; pcqW8: $this->localStorage->delete($GIMON); goto t5xQV; b_IIk: $GIMON = self::DATA_CHUNK . '/token/' . $I4NE6 . '.php'; goto pcqW8; t5xQV: } protected function uploadChunkTokenAndUpdateToken($uBuY2) { goto oxqbY; KGF6Q: $GIMON = self::DATA_CHUNK . '/token/' . $I4NE6 . '.php'; goto stQqS; oxqbY: $I4NE6 = $uBuY2['hash']; goto KGF6Q; stQqS: $this->localStorage->put($GIMON, '<' . '?php return ' . var_export($uBuY2, true) . ';'); goto hzQkv; hzQkv: } }