<?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($c3D3W) { goto rnMKY; T76RC: $this->localStorage = Storage::disk('data'); goto SP0QS; rnMKY: $this->option = $c3D3W; goto vop3H; SP0QS: $this->repository = new DatabaseDataRepository(); goto AxSZO; vop3H: config(array('filesystems.disks.data' => array('driver' => 'local', 'root' => base_path('public/')))); goto T76RC; AxSZO: } public function driverName() { return null; } public abstract function init(); public abstract function has($fWBvH); public abstract function move($wZ0QM, $hKkPV); public abstract function delete($fWBvH); public function softDelete($fWBvH) { return $this->move($fWBvH, self::DATA . '/_trash/' . date('Ymd_H') . '/' . $fWBvH); } public abstract function put($fWBvH, $ohNZt); public abstract function get($fWBvH); public abstract function size($fWBvH); public abstract function multiPartInit($pmJAc); public abstract function multiPartUpload($pmJAc); public function updateDriverDomain($IaeCl) { return $IaeCl; } public function domain() { return ''; } public function domainInternal() { return ''; } public function getDriverFullPath($aurrr) { goto Be_cj; Nrrsw: if (Str::startsWith($aurrr, '//')) { $aurrr = 'http:' . $aurrr; } else { $aurrr = ltrim($aurrr, '/'); } goto ld321; Be_cj: if (empty($aurrr)) { return $aurrr; } goto Nrrsw; DSWIx: return config('data.baseUrl', '/') . $aurrr; goto uoJQd; ld321: if (PathUtil::isPublicNetPath($aurrr)) { return $aurrr; } goto DSWIx; uoJQd: } public function getDriverFullPathInternal($aurrr) { goto LI9so; Ttn7I: if (PathUtil::isPublicNetPath($aurrr)) { return $aurrr; } goto kJJ37; kJJ37: return config('data.baseUrl', '/') . $aurrr; goto YtC43; LI9so: if (Str::startsWith($aurrr, '//')) { $aurrr = 'http:' . $aurrr; } else { $aurrr = ltrim($aurrr, '/'); } goto Ttn7I; YtC43: } public function repository() { return $this->repository; } protected function multiPartInitToken(array $pmJAc) { goto hV1EU; zU6cz: $JxaDU['uploadMaxSize'] = EnvUtil::env('uploadMaxSize'); goto Xs0D4; Jinbr: return $fWBvH; goto fRttB; Xs0D4: $Ooi_1 = md5(serialize($fWBvH) . ':' . serialize($JxaDU)); goto LDS1a; V0JXn: $JxaDU = array(); goto zU6cz; yAtVi: if (file_exists($w7Kaa)) { $fWBvH = (include $w7Kaa); } else { goto Db0HP; il_o7: $SrMwX = FileUtil::extension($fWBvH['name']); goto HnAFV; n8fSS: $fWBvH['fullPath'] = self::DATA_TEMP . '/' . $IaATa . '/' . $fWBvH['path']; goto f2DX_; HnAFV: $fWBvH['path'] = strtolower(Str::random(32)) . '.' . $SrMwX; goto n8fSS; Db0HP: $fWBvH['chunkUploaded'] = 0; goto wQd66; wQd66: $fWBvH['hash'] = $Ooi_1; goto il_o7; f2DX_: } goto Jinbr; PxxCt: $fWBvH = $pmJAc['file']; goto NXrFe; NXrFe: ksort($fWBvH, SORT_STRING); goto V0JXn; LDS1a: $w7Kaa = self::DATA_CHUNK . '/token/' . $Ooi_1 . '.php'; goto yAtVi; hV1EU: $IaATa = $pmJAc['category']; goto PxxCt; fRttB: } protected function uploadChunkTokenAndDeleteToken($I82X8) { goto qW7Ff; qW7Ff: $Ooi_1 = $I82X8['hash']; goto glzeD; T2UhH: $this->localStorage->delete($w7Kaa); goto tkjMC; glzeD: $w7Kaa = self::DATA_CHUNK . '/token/' . $Ooi_1 . '.php'; goto T2UhH; tkjMC: } protected function uploadChunkTokenAndUpdateToken($I82X8) { goto NckS9; cW7Kl: $w7Kaa = self::DATA_CHUNK . '/token/' . $Ooi_1 . '.php'; goto LWpJM; NckS9: $Ooi_1 = $I82X8['hash']; goto cW7Kl; LWpJM: $this->localStorage->put($w7Kaa, '<' . '?php return ' . var_export($I82X8, true) . ';'); goto q5nN9; q5nN9: } }