Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php namespace App\File; use Symfony\Component\Finder\Finder; use App\System\CommandExe..

Decoded Output download

<?php 
 namespace App\File; use Symfony\Component\Finder\Finder; use App\System\CommandExecutor; use App\System\Command; use App\System\Command\CopyFileCommand; use App\System\Command\ChownCommand; use App\System\Command\ChmodCommand; use App\System\Command\FindChmodCommand; use App\System\Command\MoveFileCommand; use App\System\Command\CreateDirectoryCommand; use App\System\Command\DeleteFileCommand; use App\System\Command\DeleteDirectoryCommand; use App\System\Command\BsdTarExtractCommand; use App\System\Command\GunzipCommand; class Manager { private const MAX_FILES_TO_COMPRESS = 100000; private const TYPE_FOLDER = "folder"; private string $user; protected CommandExecutor $commandExecutor; private array $fileExtensionMap = ["ai" => "ai", "aut" => "aut", "avi" => "avi", "bin" => "bin", "bmp" => "bmp", "bmp" => "bmp", "cad" => "cad", "cdr" => "cdr", "css" => "css", "csv" => "csv", "db" => "db", "doc" => "doc", "docx" => "docx", "eps" => "eps", "exe" => "exe", "flv" => "flv", "gif" => "gif", "hlp" => "hlp", "htm" => "htm", "ini" => "ini", "iso" => "iso", "java" => "java", "jpg" => "jpg", "jpeg" => "jpg", "js" => "js", "mkv" => "mkv", "mov" => "mov", "mp3" => "mp3", "mp4" => "mp4", "mpg" => "mpg", "mpeg" => "mpeg", "html" => "html", "php" => "php", "phtml" => "php", "pdf" => "pdf", "png" => "png", "ppt" => "ppt", "ps" => "ps", "psd" => "psd", "rar" => "rar", "rss" => "rss", "rtf" => "rtf", "sql" => "sql", "svg" => "svg", "swf" => "swf", "sys" => "sys", "txt" => "txt", "wma" => "wma", "xls" => "xls", "xml" => "xml", "gz" => "gz", "tgz" => "gz", "tar" => "tar", "zip" => "zip"]; private array $fileGroups = ["code" => ["html", "htm", "js", "json", "css", "scss", "sass", "less", "php", "phtml", "sh", "coffee", "txt", "log", "md", "go", "yml", "files"], "document" => ["docx", "doc", "odt", "xls", "xslx", "pdf", "djvu", "djv", "pptx", "ppt"], "archive" => ["rar", "tar", "tgz", "gz", "zip"], "audio" => ["mp3", "ogg", "flac", "wav"], "video" => ["mpg", "mp4", "avi", "mkv", "ogv"], "image" => ["png", "jpg", "jpeg", "webp", "gif", "tiff", "tif", "svg"]]; public function __construct(string $user) { $this->user = $user; $this->commandExecutor = new CommandExecutor(); } public function getFolders(string $directory) : array { goto C78e0; dc475: De419: goto Ceb63; dfdf8: foreach ($finder as $splFileInfo) { goto c7bf2; F6e6d: $filePermissions = substr(sprintf("%o", $splFileInfo->getPerms()), -4); goto a7805; c4ca5: unset($folders[$i]["data"]); goto D8d9f; Dd9d7: $i++; goto A0534; eab2e: if (!(true === empty($folders[$i]["data"]))) { goto c96f0; } goto c4ca5; D8d9f: c96f0: goto Ccc31; Ccc31: usort($folders, function ($a, $b) { return strcasecmp($a["value"], $b["value"]); }); goto Dd9d7; c7bf2: $realPath = array_filter(explode("/", $splFileInfo->getRealPath())); goto A252c; A252c: $id = implode("/", array_slice($realPath, 2, count($realPath))); goto F6e6d; a7805: $folders[$i] = ["value" => $splFileInfo->getFilename(), "id" => sprintf("/%s", $id), "size" => 4096, "date" => $splFileInfo->getMTime(), "permissions" => $filePermissions, "type" => "folder"]; goto eab2e; A0534: d0b5c: goto ad014; ad014: } goto cbbab; Ab5da: $finder = new Finder(); goto c646e; b6a4e: $finder->ignoreDotFiles(false); goto abe11; c646e: $finder->in($directory); goto b6a4e; C78e0: $folders = []; goto Ab5da; eaf35: $finder->depth(0); goto Fe2ec; Fe2ec: $finder->sortByName(true); goto ac442; ac442: if (!(true === $finder->hasResults())) { goto De419; } goto f61e9; abe11: $finder->directories(); goto eaf35; Ceb63: return $folders; goto f55c2; cbbab: Da3cf: goto dc475; f61e9: $i = 0; goto dfdf8; f55c2: } public function getFiles(string $directory) : array { goto d4f9a; d4f9a: $files = []; goto e96df; a4b78: return $files; goto Dee6d; d718c: $finder->ignoreDotFiles(false); goto c5af7; e805d: Dc399: goto a4b78; fb466: $finder->in($directory); goto d718c; bddb8: $finder->sort(function (\SplFileInfo $a, \SplFileInfo $b) { return strnatcasecmp($a->getRealPath(), $b->getRealPath()); }); goto F4cc9; F982c: cecc9: goto ec9fb; eaaa6: $tmpFiles = []; goto d4b98; a7b50: $tmpFolders = []; goto eaaa6; ec9fb: $files = array_merge($tmpFolders, $tmpFiles); goto e805d; e96df: $finder = new Finder(); goto fb466; d4b98: foreach ($finder as $fileInfo) { goto Aafc5; c0a1a: b6044: goto a6292; A8f09: $tmpFiles[] = $file; goto Bb7d6; baf07: $tmpFolders[] = $file; goto d7fc5; Bb7d6: goto c4afd; goto b3992; b3992: Bd430: goto baf07; d7fc5: c4afd: goto c0a1a; C9f2a: if (true === isset($file["type"]) && self::TYPE_FOLDER == $file["type"]) { goto Bd430; } goto A8f09; Aafc5: $file = $this->getFileData($fileInfo); goto C9f2a; a6292: } goto F982c; c5af7: $finder->depth(0); goto bddb8; F4cc9: if (!(true === $finder->hasResults())) { goto Dc399; } goto a7b50; Dee6d: } public function getFileContent(string $file) : string { goto A879f; eec3c: return $fileContent; goto c5650; fbfd3: if (!(true === file_exists($file))) { goto D8606; } goto Ade48; A879f: $fileContent = ''; goto fbfd3; De36c: D8606: goto eec3c; Ade48: $fileContent = file_get_contents($file); goto De36c; c5650: } public function writeFileContent(string $file, string $content) : array { goto A832c; Dc36a: if (!(true === file_exists($file))) { goto fce02; } goto d0d67; D78f6: Afe75: goto Dd6b0; cbcc3: $data = $this->getFileData($fileInfo); goto D78f6; d0d67: if (!file_put_contents($file, $content)) { goto Afe75; } goto F693b; F693b: $fileInfo = new \SplFileInfo($file); goto Ae05a; Dd6b0: fce02: goto E81bc; Ae05a: $this->resetPermissions($fileInfo); goto cbcc3; E81bc: return $data; goto C5e66; A832c: $data = []; goto Dc36a; C5e66: } public function rename(string $from, string $to) : array { goto ebd86; E80c4: if (!(true === file_exists($from))) { goto d40dc; } goto a182e; c71ab: d40dc: goto F89ed; Fe448: $fileData = $this->getFileData($fileInfo); goto C0bb7; a182e: $fileInfo = new \SplFileInfo($from); goto e0664; e0664: $to = sprintf("%s/%s", $fileInfo->getPath(), $to); goto B62b2; F89ed: return $data; goto ebd27; B62b2: @rename($from, $to); goto ba68f; C0bb7: $data = ["invalid" => false, "error" => '', "id" => $fileData["id"]]; goto c71ab; ba68f: $fileInfo = new \SplFileInfo($to); goto E8840; ebd86: $data = []; goto E80c4; E8840: $this->resetPermissions($fileInfo); goto Fe448; ebd27: } public function delete(string $file) : array { goto B40ad; B40ad: $data = []; goto d23c8; cb81d: try { goto C694f; ebbab: goto D2bd5; goto f00c9; F32ab: if (true === $fileInfo->isDir()) { goto ddd10; } goto Ec53c; C694f: $fileInfo = new \SplFileInfo($file); goto F32ab; Cd82f: $data = ["invalid" => false, "error" => '', "id" => '']; goto c7f29; Ac043: $this->executeCommand($deleteCommand); goto Cd82f; Dafac: $deleteCommand->setFile($file); goto ebbab; Ec53c: $deleteCommand = new DeleteFileCommand(); goto Dafac; F45c8: $deleteCommand = new DeleteDirectoryCommand(); goto A346e; f00c9: ddd10: goto F45c8; A346e: $deleteCommand->setDirectory($file); goto Da77d; Da77d: D2bd5: goto Ac043; c7f29: } catch (\Exception $e) { } goto D9e46; D9e46: F8bbc: goto Dbbe1; d23c8: if (!(true === file_exists($file))) { goto F8bbc; } goto cb81d; Dbbe1: return $data; goto a1bcd; a1bcd: } public function download(string $file) : void { goto a575c; E565c: header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); goto c93b2; adff6: readfile($file); goto de13f; e8702: header("Content-Type: " . finfo_file($finfo, $file)); goto Ee7d4; Ee7d4: finfo_close($finfo); goto D9cc4; D9cc4: header("Content-Description: File Transfer"); goto b8cdb; Af413: $fileInfo = new \SplFileInfo($file); goto F678f; e5965: $finfo = finfo_open(FILEINFO_MIME_TYPE); goto e8702; a2194: Fab18: goto bda47; b8cdb: header("Content-Disposition: attachment; filename=" . $filename); goto bea4c; D3d28: header("Content-Length: " . filesize($file)); goto B95e7; a575c: if (!(true === file_exists($file))) { goto Fab18; } goto Af413; ee387: header("Expires: 0"); goto E565c; bea4c: header("Content-Transfer-Encoding: binary"); goto ee387; c93b2: header("Pragma: public"); goto D3d28; de13f: exit; goto a2194; B95e7: ob_clean(); goto a0df2; a0df2: flush(); goto adff6; F678f: $filename = $fileInfo->getFilename(); goto e5965; bda47: } public function upload(string $fileUploadPath, string $directory, string $tmpFile, string $id) : array { goto B1389; A23ad: if (!(false === is_null($fileUploadDirectory))) { goto d589e; } goto Dd797; Ea7b7: $filePathInfo = $fileInfo->getPathInfo(); goto c93d6; a4183: $fileInfo = new \SplFileInfo($file); goto b03c3; a3787: d589e: goto Caad5; bd29a: @move_uploaded_file($tmpFile, $file); goto Dfa16; fa6ac: $file = sprintf("%s/%s", rtrim($directory, "/"), $fileUploadPath); goto eabdf; Caad5: C3f4e: goto e3e76; eabdf: $fileInfo = new \SplFileInfo($file); goto Ea7b7; Dfa16: $fileInfo = new \SplFileInfo($directory); goto F9758; Dd797: @mkdir($fileUploadDirectory, 0777, true); goto bd29a; c93d6: $fileUploadDirectory = $filePathInfo->getPathName(); goto A23ad; e3e76: return $data; goto e52af; F9758: $this->resetPermissions($fileInfo, true); goto a4183; b03c3: $data = $this->getFileData($fileInfo); goto b352a; e1130: if (!(true === is_dir($directory) && true === file_exists($tmpFile))) { goto C3f4e; } goto fa6ac; B1389: $data = []; goto e1130; b352a: $data["uid"] = $id; goto a3787; e52af: } public function copy(string $file, string $directory) : array { goto b2497; F25d0: $copyFileCommand->setDestinationFile($fileToCopy); goto E9f80; F94d4: $data = $this->getFileData($fileInfo); goto fcb64; c5d0c: $copyFileCommand->setSourceFile($file); goto F25d0; C398d: $copyFileCommand = new CopyFileCommand(); goto c5d0c; E9f80: $copyFileCommand->setRecursive(true); goto cc2f3; D759c: $fileExtension = $fileInfo->getExtension(); goto D1459; c175a: E2cf9: goto C398d; E545c: return $data; goto dac9e; Bca89: $filename = $fileInfo->getFilename(); goto eb0c9; eb0c9: if (true === $fileInfo->isDir()) { goto Be631; } goto D759c; b6dee: $copiedFilename = sprintf("%s_copy.%s", $copiedFilename, $fileExtension); goto B5c42; cc2f3: $this->executeCommand($copyFileCommand); goto ffd11; D1459: $copiedFilename = str_replace([sprintf(".%s", $fileExtension)], [''], $filename); goto b6dee; ffd11: $fileInfo = new \SplFileInfo($fileToCopy); goto E3317; b2497: $data = []; goto F920e; fc132: $fileToCopy = sprintf("%s/%s", rtrim($directory, "/)"), $copiedFilename); goto c175a; B5c42: $fileToCopy = sprintf("%s/%s", rtrim($directory, "/)"), $copiedFilename); goto b53bc; e8481: Be631: goto adb52; adb52: $copiedFilename = sprintf("%s_copy", $filename); goto fc132; F920e: if (!(true === file_exists($file) && true === is_dir($directory))) { goto ded1f; } goto F8529; fcb64: ded1f: goto E545c; E3317: $this->resetPermissions($fileInfo, false); goto F94d4; F8529: $fileInfo = new \SplFileInfo($file); goto Bca89; b53bc: goto E2cf9; goto e8481; dac9e: } public function move(string $file, string $directory) : array { goto b5771; b5919: $moveFileCommand->setDestinationFile($fileToMove); goto c73a8; b5771: $data = []; goto f5728; c73a8: $this->executeCommand($moveFileCommand); goto eb461; dfeb9: C0aed: goto A3d16; e8036: $filename = $fileInfo->getFilename(); goto E4a81; Aff1e: $moveFileCommand->setSourceFile($file); goto b5919; A3d16: return $data; goto c143b; Ee6d1: $moveFileCommand = new MoveFileCommand(); goto Aff1e; E4a81: $fileToMove = sprintf("%s/%s", rtrim($directory, "/)"), $filename); goto Ee6d1; f5728: if (!(true === file_exists($file) && true === is_dir($directory))) { goto C0aed; } goto a2ec1; a2ec1: $fileInfo = new \SplFileInfo($file); goto e8036; eb461: $fileInfo = new \SplFileInfo($fileToMove); goto A0489; A0489: $this->resetPermissions($fileInfo, false); goto A6a7e; A6a7e: $data = $this->getFileData($fileInfo); goto dfeb9; c143b: } public function makeFile(string $filename, string $directory) : array { goto Fdfa7; cf34a: $fileInfo = new \SplFileInfo($file); goto ec926; ec926: $this->resetPermissions($fileInfo, false); goto E3290; Ac2ee: @touch($file); goto cf34a; F7a41: Bb4a9: goto e0259; E3290: $data = $this->getFileData($fileInfo); goto F7a41; Cbdbb: $file = sprintf("%s/%s", rtrim($directory, "/"), $filename); goto Ac2ee; B54ec: if (!(true === is_dir($directory))) { goto Bb4a9; } goto Cbdbb; Fdfa7: $data = []; goto B54ec; e0259: return $data; goto Fba8c; Fba8c: } public function makeDirectory(string $directoryName, $directory) : array { goto F9b8c; cd242: if (!(true === is_dir($directory))) { goto cbdca; } goto f82e5; cf4c5: $this->resetPermissions($fileInfo, false); goto c5efb; c5efb: $data = $this->getFileData($fileInfo); goto e531d; f82e5: $newDirectory = sprintf("%s/%s", rtrim($directory, "/"), $directoryName); goto C4481; F9b8c: $data = []; goto cd242; e531d: cbdca: goto B146c; ebae1: $fileInfo = new \SplFileInfo($newDirectory); goto cf4c5; B146c: return $data; goto ba07d; C4481: @mkdir($newDirectory); goto ebae1; ba07d: } private function getFileData(\SplFileInfo $fileInfo) : array { goto F15de; Be16e: return $fileData; goto d2b76; ac966: try { goto d766d; fdaba: $fileType = $this->getFileType($fileInfo); goto df7a0; a3857: $filePermissions = substr(sprintf("%o", $fileInfo->getPerms()), -4); goto c590d; bebe8: $fileGroupInformation = posix_getgrgid($fileInfo->getGroup()); goto b03aa; b03aa: $fileOwner = sprintf("%s:%s", $fileOwnerInformation["name"] ?? '', $fileGroupInformation["name"] ?? ''); goto aa30e; e1620: $realPath = array_filter(explode("/", $fileInfo->getRealPath())); goto c87dd; e948b: $fileSize = $fileInfo->getSize(); goto a3857; eff3d: $fileData["ext"] = $fileExtension; goto B7488; d766d: $filename = $fileInfo->getFilename(); goto e1620; c87dd: $id = implode("/", array_slice($realPath, 2, count($realPath))); goto e948b; c590d: $fileOwnerInformation = posix_getpwuid($fileInfo->getOwner()); goto bebe8; A16ea: $fileExtension = $this->mapFileExtension($fileInfo->getExtension()); goto eff3d; Bcb50: if (!(false === $fileInfo->isDir())) { goto a3bfa; } goto A16ea; aa30e: $fileDate = $fileInfo->getMTime(); goto fdaba; df7a0: $fileData = ["value" => $filename, "id" => sprintf("/%s", $id), "size" => $fileSize, "owner" => $fileOwner, "permissions" => $filePermissions, "date" => $fileDate, "type" => $fileType]; goto Bcb50; B7488: a3bfa: goto e19da; e19da: } catch (\Exception $e) { } goto Be16e; F15de: $fileData = []; goto ac966; d2b76: } private function getFileType(\SplFileInfo $fileInfo) { goto Dbee1; f90bd: Fa2c7: goto Ed3fc; cda83: return $fileType; goto Cf65c; B9460: $fileExtension = $fileInfo->getExtension(); goto b0128; b9d0c: cadd1: goto cda83; b0128: foreach ($this->fileGroups as $type => $extensions) { goto E9452; F5473: goto Fa2c7; goto d6f73; d6884: B43be: goto b8c3b; E9452: if (!(true === in_array($fileExtension, $extensions))) { goto A8416; } goto Ac13b; d6f73: A8416: goto d6884; Ac13b: $fileType = $type; goto F5473; b8c3b: } goto f90bd; Ed3fc: goto cadd1; goto B5154; d92ce: if (true === $fileInfo->isDir()) { goto d6448; } goto B9460; Dbee1: $fileType = "code"; goto d92ce; B5154: d6448: goto faee2; faee2: $fileType = "folder"; goto b9d0c; Cf65c: } public function permissions(string $file, string $permissions) : array { goto F976d; F976d: $data = []; goto fc1a7; d666d: $chownCommand->setUser($this->user); goto Cabd4; dd913: $chownCommand = new ChownCommand(); goto d091a; D5bd6: ea7f5: goto b7399; e770c: $fileInfo = new \SplFileInfo($file); goto dd913; D7229: $chmodCommand->setFile($file); goto c9ee0; c828b: $chmodCommand->setFileChmod($permissions); goto cda25; d091a: $chownCommand->setFile($file); goto e8c0f; Bbc31: $fileData = $this->getFileData($fileInfo); goto B071e; fc1a7: if (!(true === file_exists($file))) { goto ea7f5; } goto e770c; cda25: $this->executeCommand($chownCommand, 600); goto eb61f; A7523: $chmodCommand = new FindChmodCommand(); goto D7229; c9ee0: $chmodCommand->setDirectoryChmod($permissions); goto c828b; e8c0f: $chownCommand->setRecursive(true); goto d666d; eb61f: $this->executeCommand($chmodCommand, 600); goto Bbc31; B071e: $data = ["invalid" => false, "error" => '', "id" => $fileData["id"], "permissions" => $permissions]; goto D5bd6; b7399: return $data; goto F8a0e; Cabd4: $chownCommand->setGroup($this->user); goto A7523; F8a0e: } public function extract(string $file, string $destinationDirectoryName) : array { goto F6fe1; F6fe1: $data = []; goto eaea0; eaea0: try { goto b8671; a7b6f: b7575: goto E88e0; adc67: c6c0d: goto Bf47e; a564b: $fileInfo = new \SplFileInfo($file); goto Dfa86; ebfa3: $createDirectoryCommand->setDirectory($destinationDirectory); goto A0ba8; ac648: $createDirectoryCommand = new CreateDirectoryCommand(); goto a3a85; cbed3: $bsdTarExtractCommand->setSourceFile($file); goto ea3d3; D31a5: $filePathInfo = $fileInfo->getPathInfo(); goto fd72c; c0fba: $path = array_slice($path, 2, count($path)); goto A8054; d7820: $copyFileCommand = new CopyFileCommand(); goto B54f3; b8671: if (!(true === file_exists($file))) { goto Eabbc; } goto a564b; D5d3a: goto c6c0d; goto Ce7ed; fd72c: $path = array_filter(explode("/", $fileInfo->getRealPath())); goto c0fba; a3a85: $createDirectoryCommand->setDirectory($destinationDirectory); goto d7820; dd9e6: $gzipFile = sprintf("%s/%s", rtrim($destinationDirectory, "/"), $filename); goto ac648; F9372: ee8c6: goto D31a5; Fe595: $gunzipCommand->setFile($gzipFile); goto d5372; Add19: $fileExtension = $fileInfo->getExtension(); goto A09a7; Ecac8: if (true === in_array($fileExtension, ["tar", "tgz", "tar.gz", "rar", "zip"])) { goto Ae46e; } goto F83d9; Bf47e: if (!(true === is_dir($destinationDirectory))) { goto dcc4c; } goto Abfc0; e0bf3: dcc4c: goto D8293; ffe36: $data["path"] = $path; goto dec54; E1b0f: $this->executeCommand($createDirectoryCommand); goto C0b63; dd90d: $this->executeCommand($copyFileCommand); goto Cfe0a; A8054: array_pop($path); goto b1c47; b1c47: $path = sprintf("/%s", implode("/", $path)); goto ffe36; B54f3: $copyFileCommand->setSourceFile($file); goto dff8c; ea3d3: $bsdTarExtractCommand->setDestinationFile($destinationDirectory); goto E1b0f; D8293: Eabbc: goto dc7f1; d5372: $this->executeCommand($createDirectoryCommand); goto dd90d; abfa1: $gunzipCommand = new GunzipCommand(); goto Fe595; Cfe0a: $this->executeCommand($gunzipCommand); goto B8cdf; A09a7: goto ee8c6; goto a7b6f; E88e0: $fileExtension = "tar.gz"; goto F9372; Ce7ed: Ae46e: goto f3e4b; dff8c: $copyFileCommand->setDestinationFile($gzipFile); goto abfa1; Dfa86: $filename = $fileInfo->getFilename(); goto F6e2f; f3e4b: $createDirectoryCommand = new CreateDirectoryCommand(); goto ebfa3; C0b63: $this->executeCommand($bsdTarExtractCommand, 3600); goto adc67; F83d9: if (!("gz" == $fileExtension)) { goto Bc90b; } goto dd9e6; F6e2f: if ("tar.gz" == substr($filename, -6)) { goto b7575; } goto Add19; Abfc0: $fileInfo = new \SplFileInfo($destinationDirectory); goto D3bd8; A0ba8: $bsdTarExtractCommand = new BsdTarExtractCommand(); goto cbed3; B8cdf: Bc90b: goto D5d3a; D3bd8: $this->resetPermissions($fileInfo, true); goto e0bf3; dec54: $destinationDirectory = sprintf("%s/%s", rtrim($filePathInfo->getPathName(), "/"), rtrim($destinationDirectoryName, "/")); goto Ecac8; dc7f1: } catch (\Exception $e) { $errorMessage = $e->getMessage(); $data["error"] = $errorMessage; } goto ea2fe; ea2fe: return $data; goto cd9f6; cd9f6: } public function compress(array $files, string $targetDirectory, string $id) : array { goto Bc4bf; Bc4bf: $data = []; goto Fdcaf; Fdcaf: try { goto Dd250; C58b6: $zip = new \ZipArchive(); goto A2e0a; bc955: throw new \Exception(sprintf("Too many files, maximum of "%s" files are allowed.", self::MAX_FILES_TO_COMPRESS)); goto dc9db; d908d: B7eb3: goto D8ec6; D8ec6: $zipArchive = sprintf("%s/archive.zip", rtrim($targetDirectory, "/")); goto C58b6; e0f17: $data = ["path" => $id]; goto Dadb5; D86e4: if ($numberOfFiles < self::MAX_FILES_TO_COMPRESS) { goto B7eb3; } goto bc955; e9c93: $numberOfFiles = $this->countFilesToCompress($files); goto D86e4; a1ef3: Cbafc: goto e9c93; e0e2f: goto a8052; goto a1ef3; D7afd: A5518: goto Eeb3d; Dd250: if (true === is_dir($targetDirectory) && false === empty($files)) { goto Cbafc; } goto C65b3; Da90e: Ea516: goto D1417; D15bf: $zip->close(); goto f6dcf; dc9db: goto A5518; goto d908d; A18e6: A9094: goto D15bf; D1417: foreach ($files as $file) { goto e8d71; fcaac: $directoryIterator = new \RecursiveDirectoryIterator($directory); goto Beb77; f2878: $filepath = $fileInfo->getPathname(); goto A1eb3; B3fd0: Fbce3: goto cd0dd; f6dcd: $fileInfo = new \SplFileInfo($file); goto F1f7f; cd0dd: C1cbe: goto F9b48; F1f7f: if (!(true === $fileInfo->isFile())) { goto C9be6; } goto D23c6; Ac207: C9be6: goto C4404; e8d71: if (!(true === file_exists($file))) { goto C1cbe; } goto f6dcd; F9b48: a0303: goto E18b4; C4404: if (!(true === $fileInfo->isDir())) { goto Fbce3; } goto b5b69; A1eb3: $zip->addFile($filepath, $filename); goto Ac207; a978e: Cdac9: goto B3fd0; D23c6: $filename = $fileInfo->getFilename(); goto f2878; b5b69: $directory = $fileInfo->getPathname(); goto fcaac; Beb77: foreach (new \RecursiveIteratorIterator($directoryIterator) as $fileInfo) { goto a681b; Bc03a: $zip->addEmptyDir($directory); goto ce72d; a681b: if (!(true === $fileInfo->isFile())) { goto B1d65; } goto f4518; Cc3ac: $filepath = $fileInfo->getPathname(); goto d60bb; ebd10: $zip->addFile($filepath, $entryName); goto F3253; d60bb: $entryName = ltrim(str_replace($targetDirectory, '', $fileInfo->getPathname()), "/"); goto F87ed; f4518: $filename = $fileInfo->getFilename(); goto Cc3ac; B03ee: fdc5e: goto ae453; F3253: B1d65: goto B03ee; Ed25d: $directory = implode("/", $entryName); goto Bc03a; ce72d: $entryName = sprintf("%s/%s", rtrim($directory, "/"), $filename); goto ebd10; de901: array_pop($entryName); goto Ed25d; F87ed: $entryName = array_filter(explode("/", $entryName)); goto de901; ae453: } goto a978e; E18b4: } goto A18e6; ba2a0: $fileInfo = new \SplFileInfo($zipArchive); goto cbf8b; f6dcf: if (!(true === file_exists($zipArchive))) { goto e184f; } goto ba2a0; cbf8b: $this->resetPermissions($fileInfo); goto e0f17; A2e0a: if (!(true !== $zip->open($zipArchive, \ZipArchive::CREATE))) { goto Ea516; } goto fadf9; Dadb5: e184f: goto D7afd; fadf9: throw new \Exception(sprintf("Cannot create zip file "%s".", $zipArchive)); goto Da90e; C65b3: throw new \Exception(sprintf("Target directory "%s" does not exist.", $targetDirectory)); goto e0e2f; Eeb3d: a8052: goto Db6ad; Db6ad: } catch (\Exception $e) { $errorMessage = $e->getMessage(); $data["error"] = $errorMessage; } goto F4f5f; F4f5f: return $data; goto f5b8a; f5b8a: } private function countFilesToCompress(array $files) : int { goto B521e; B521e: $numberOfFiles = 0; goto C3647; Aa0d9: return $numberOfFiles; goto F49f9; F85d3: e7e1b: goto Aa0d9; C3647: foreach ($files as $file) { goto D0e18; df747: bd365: goto Bfea8; Fc4eb: $fileInfo = new \SplFileInfo($file); goto B546c; c963c: A7911: goto b8981; B546c: if (!(true === $fileInfo->isFile())) { goto A7911; } goto fe603; D3f22: A5811: goto ae8b3; Ce256: be751: goto D3f22; D0e18: if (!(true === file_exists($file))) { goto be751; } goto Fc4eb; b8981: if (!(true === $fileInfo->isDir())) { goto F9409; } goto f0bae; f0bae: $directory = $fileInfo->getPathname(); goto Ef6c0; Bfea8: F9409: goto Ce256; fe603: ++$numberOfFiles; goto c963c; a7fd6: foreach (new \RecursiveIteratorIterator($directoryIterator) as $fileInfo) { goto A36d1; A36d1: if (!(true === $fileInfo->isFile())) { goto C3098; } goto b501b; b6815: b6c95: goto C395c; d5306: C3098: goto b6815; b501b: ++$numberOfFiles; goto d5306; C395c: } goto df747; Ef6c0: $directoryIterator = new \RecursiveDirectoryIterator($directory); goto a7fd6; ae8b3: } goto F85d3; F49f9: } private function resetPermissions(\SplFileInfo $fileInfo, $recursive = false) { goto F9d4a; de47b: $chmodCommand->setRunInBackground(true); goto F25ee; a22ba: $chmodCommand->setFile($filename); goto B1289; F81f4: $this->executeCommand($chownCommand); goto a0180; C7303: $chmodCommand = new FindChmodCommand(); goto f6c2a; f6c2a: $chmodCommand->setFile($filename); goto b3504; b3504: $chmodCommand->setDirectoryChmod(770); goto ea209; B6690: if (true === $fileInfo->isDir() && true === $recursive) { goto aff52; } goto C8dc2; B89f1: $chownCommand->setRecursive($recursive); goto Dd038; a0180: $this->executeCommand($chmodCommand); goto A8193; E8a8f: $chownCommand->setFile($filename); goto B89f1; ea209: $chmodCommand->setFileChmod(770); goto de47b; C8dc2: $chmodCommand = new ChmodCommand(); goto a22ba; eaf5d: aff52: goto C7303; Dd038: $chownCommand->setUser($this->user); goto Dd829; F25ee: F91d1: goto F81f4; De1e3: goto F91d1; goto eaf5d; Cc855: $chownCommand = new ChownCommand(); goto E8a8f; Dd829: $chownCommand->setGroup($this->user); goto B6690; F9d4a: $filename = $fileInfo->getPathname(); goto Cc855; B1289: $chmodCommand->setChmod(770); goto De1e3; A8193: } private function mapFileExtension(string $fileExtension) : string { goto de019; C94a4: F7b13: goto D9c1f; a82f6: $mappedFileExtension = $this->fileExtensionMap[$fileExtension]; goto C94a4; caff2: if (!(true === isset($this->fileExtensionMap[$fileExtension]))) { goto F7b13; } goto a82f6; de019: $mappedFileExtension = "default"; goto caff2; D9c1f: return $mappedFileExtension; goto C0961; C0961: } private function executeCommand(Command $command, $timeout = 600) { $this->commandExecutor->execute($command, $timeout); } } 
 ?>

Did this file decode correctly?

Original Code

<?php
 namespace App\File; use Symfony\Component\Finder\Finder; use App\System\CommandExecutor; use App\System\Command; use App\System\Command\CopyFileCommand; use App\System\Command\ChownCommand; use App\System\Command\ChmodCommand; use App\System\Command\FindChmodCommand; use App\System\Command\MoveFileCommand; use App\System\Command\CreateDirectoryCommand; use App\System\Command\DeleteFileCommand; use App\System\Command\DeleteDirectoryCommand; use App\System\Command\BsdTarExtractCommand; use App\System\Command\GunzipCommand; class Manager { private const MAX_FILES_TO_COMPRESS = 100000; private const TYPE_FOLDER = "\146\157\x6c\x64\145\x72"; private string $user; protected CommandExecutor $commandExecutor; private array $fileExtensionMap = ["\x61\151" => "\141\x69", "\x61\x75\164" => "\x61\165\164", "\x61\166\x69" => "\x61\x76\x69", "\x62\151\156" => "\142\x69\x6e", "\142\155\x70" => "\x62\x6d\160", "\142\155\x70" => "\142\155\x70", "\143\141\144" => "\143\141\144", "\143\x64\x72" => "\143\x64\162", "\x63\x73\x73" => "\143\163\163", "\x63\x73\x76" => "\x63\163\166", "\x64\x62" => "\x64\x62", "\144\x6f\x63" => "\x64\x6f\x63", "\x64\x6f\143\x78" => "\144\157\143\170", "\145\x70\163" => "\145\x70\x73", "\145\170\145" => "\145\x78\145", "\146\x6c\x76" => "\x66\154\x76", "\x67\x69\146" => "\147\x69\x66", "\150\x6c\160" => "\x68\154\160", "\150\164\x6d" => "\150\x74\155", "\151\156\151" => "\151\156\x69", "\151\163\x6f" => "\x69\163\x6f", "\x6a\x61\166\x61" => "\x6a\x61\166\x61", "\x6a\x70\x67" => "\x6a\x70\147", "\152\160\x65\x67" => "\152\x70\x67", "\152\163" => "\152\163", "\x6d\153\166" => "\x6d\x6b\166", "\155\157\166" => "\x6d\x6f\x76", "\x6d\160\x33" => "\x6d\x70\x33", "\x6d\160\64" => "\x6d\x70\x34", "\155\160\x67" => "\x6d\160\147", "\x6d\x70\x65\x67" => "\155\x70\x65\x67", "\x68\164\x6d\154" => "\150\x74\155\154", "\160\x68\x70" => "\160\150\160", "\x70\x68\164\x6d\x6c" => "\x70\150\160", "\x70\x64\x66" => "\x70\x64\146", "\x70\156\147" => "\160\156\147", "\160\x70\164" => "\x70\x70\x74", "\160\163" => "\160\163", "\x70\163\x64" => "\x70\163\144", "\162\x61\x72" => "\x72\141\x72", "\162\163\163" => "\x72\x73\x73", "\x72\164\146" => "\162\164\x66", "\x73\161\154" => "\x73\x71\154", "\x73\166\x67" => "\163\x76\147", "\x73\167\x66" => "\x73\167\x66", "\163\171\x73" => "\x73\171\163", "\164\x78\164" => "\x74\x78\164", "\x77\155\141" => "\x77\x6d\x61", "\x78\154\x73" => "\170\x6c\163", "\170\x6d\154" => "\170\155\154", "\147\172" => "\x67\x7a", "\164\x67\x7a" => "\147\x7a", "\164\x61\x72" => "\x74\141\162", "\x7a\151\x70" => "\172\151\x70"]; private array $fileGroups = ["\143\x6f\144\x65" => ["\x68\164\155\154", "\150\x74\x6d", "\152\x73", "\152\163\157\156", "\143\x73\x73", "\163\143\x73\x73", "\163\141\163\163", "\154\145\163\x73", "\x70\150\x70", "\160\150\164\x6d\154", "\163\x68", "\143\157\146\146\145\145", "\164\x78\x74", "\x6c\157\x67", "\155\144", "\147\x6f", "\171\x6d\154", "\146\x69\x6c\145\163"], "\x64\x6f\x63\165\x6d\145\x6e\x74" => ["\x64\x6f\143\x78", "\144\x6f\143", "\157\x64\x74", "\x78\154\163", "\x78\x73\154\x78", "\160\144\146", "\144\x6a\x76\x75", "\144\152\x76", "\160\160\x74\170", "\x70\160\164"], "\x61\162\x63\x68\x69\166\x65" => ["\162\141\162", "\x74\x61\x72", "\x74\147\172", "\x67\172", "\x7a\151\160"], "\141\165\144\151\157" => ["\x6d\160\x33", "\157\147\x67", "\x66\154\x61\143", "\x77\141\166"], "\166\x69\x64\145\x6f" => ["\155\160\147", "\x6d\160\64", "\x61\166\x69", "\155\153\x76", "\x6f\x67\x76"], "\151\x6d\x61\147\145" => ["\160\x6e\147", "\152\x70\147", "\152\x70\x65\147", "\167\x65\x62\160", "\147\x69\x66", "\164\151\x66\146", "\x74\151\146", "\x73\166\x67"]]; public function __construct(string $user) { $this->user = $user; $this->commandExecutor = new CommandExecutor(); } public function getFolders(string $directory) : array { goto C78e0; dc475: De419: goto Ceb63; dfdf8: foreach ($finder as $splFileInfo) { goto c7bf2; F6e6d: $filePermissions = substr(sprintf("\x25\157", $splFileInfo->getPerms()), -4); goto a7805; c4ca5: unset($folders[$i]["\144\x61\164\141"]); goto D8d9f; Dd9d7: $i++; goto A0534; eab2e: if (!(true === empty($folders[$i]["\144\x61\164\x61"]))) { goto c96f0; } goto c4ca5; D8d9f: c96f0: goto Ccc31; Ccc31: usort($folders, function ($a, $b) { return strcasecmp($a["\166\x61\154\x75\145"], $b["\x76\x61\x6c\x75\145"]); }); goto Dd9d7; c7bf2: $realPath = array_filter(explode("\x2f", $splFileInfo->getRealPath())); goto A252c; A252c: $id = implode("\x2f", array_slice($realPath, 2, count($realPath))); goto F6e6d; a7805: $folders[$i] = ["\x76\x61\x6c\x75\145" => $splFileInfo->getFilename(), "\151\144" => sprintf("\57\45\163", $id), "\x73\151\172\x65" => 4096, "\144\141\164\145" => $splFileInfo->getMTime(), "\160\x65\x72\x6d\151\163\163\x69\x6f\x6e\x73" => $filePermissions, "\x74\171\x70\145" => "\x66\x6f\x6c\144\145\162"]; goto eab2e; A0534: d0b5c: goto ad014; ad014: } goto cbbab; Ab5da: $finder = new Finder(); goto c646e; b6a4e: $finder->ignoreDotFiles(false); goto abe11; c646e: $finder->in($directory); goto b6a4e; C78e0: $folders = []; goto Ab5da; eaf35: $finder->depth(0); goto Fe2ec; Fe2ec: $finder->sortByName(true); goto ac442; ac442: if (!(true === $finder->hasResults())) { goto De419; } goto f61e9; abe11: $finder->directories(); goto eaf35; Ceb63: return $folders; goto f55c2; cbbab: Da3cf: goto dc475; f61e9: $i = 0; goto dfdf8; f55c2: } public function getFiles(string $directory) : array { goto d4f9a; d4f9a: $files = []; goto e96df; a4b78: return $files; goto Dee6d; d718c: $finder->ignoreDotFiles(false); goto c5af7; e805d: Dc399: goto a4b78; fb466: $finder->in($directory); goto d718c; bddb8: $finder->sort(function (\SplFileInfo $a, \SplFileInfo $b) { return strnatcasecmp($a->getRealPath(), $b->getRealPath()); }); goto F4cc9; F982c: cecc9: goto ec9fb; eaaa6: $tmpFiles = []; goto d4b98; a7b50: $tmpFolders = []; goto eaaa6; ec9fb: $files = array_merge($tmpFolders, $tmpFiles); goto e805d; e96df: $finder = new Finder(); goto fb466; d4b98: foreach ($finder as $fileInfo) { goto Aafc5; c0a1a: b6044: goto a6292; A8f09: $tmpFiles[] = $file; goto Bb7d6; baf07: $tmpFolders[] = $file; goto d7fc5; Bb7d6: goto c4afd; goto b3992; b3992: Bd430: goto baf07; d7fc5: c4afd: goto c0a1a; C9f2a: if (true === isset($file["\164\x79\160\145"]) && self::TYPE_FOLDER == $file["\164\x79\x70\145"]) { goto Bd430; } goto A8f09; Aafc5: $file = $this->getFileData($fileInfo); goto C9f2a; a6292: } goto F982c; c5af7: $finder->depth(0); goto bddb8; F4cc9: if (!(true === $finder->hasResults())) { goto Dc399; } goto a7b50; Dee6d: } public function getFileContent(string $file) : string { goto A879f; eec3c: return $fileContent; goto c5650; fbfd3: if (!(true === file_exists($file))) { goto D8606; } goto Ade48; A879f: $fileContent = ''; goto fbfd3; De36c: D8606: goto eec3c; Ade48: $fileContent = file_get_contents($file); goto De36c; c5650: } public function writeFileContent(string $file, string $content) : array { goto A832c; Dc36a: if (!(true === file_exists($file))) { goto fce02; } goto d0d67; D78f6: Afe75: goto Dd6b0; cbcc3: $data = $this->getFileData($fileInfo); goto D78f6; d0d67: if (!file_put_contents($file, $content)) { goto Afe75; } goto F693b; F693b: $fileInfo = new \SplFileInfo($file); goto Ae05a; Dd6b0: fce02: goto E81bc; Ae05a: $this->resetPermissions($fileInfo); goto cbcc3; E81bc: return $data; goto C5e66; A832c: $data = []; goto Dc36a; C5e66: } public function rename(string $from, string $to) : array { goto ebd86; E80c4: if (!(true === file_exists($from))) { goto d40dc; } goto a182e; c71ab: d40dc: goto F89ed; Fe448: $fileData = $this->getFileData($fileInfo); goto C0bb7; a182e: $fileInfo = new \SplFileInfo($from); goto e0664; e0664: $to = sprintf("\45\163\x2f\x25\163", $fileInfo->getPath(), $to); goto B62b2; F89ed: return $data; goto ebd27; B62b2: @rename($from, $to); goto ba68f; C0bb7: $data = ["\151\156\x76\x61\154\x69\x64" => false, "\145\162\162\x6f\x72" => '', "\x69\x64" => $fileData["\x69\x64"]]; goto c71ab; ba68f: $fileInfo = new \SplFileInfo($to); goto E8840; ebd86: $data = []; goto E80c4; E8840: $this->resetPermissions($fileInfo); goto Fe448; ebd27: } public function delete(string $file) : array { goto B40ad; B40ad: $data = []; goto d23c8; cb81d: try { goto C694f; ebbab: goto D2bd5; goto f00c9; F32ab: if (true === $fileInfo->isDir()) { goto ddd10; } goto Ec53c; C694f: $fileInfo = new \SplFileInfo($file); goto F32ab; Cd82f: $data = ["\151\156\x76\141\154\x69\x64" => false, "\x65\162\x72\157\x72" => '', "\x69\x64" => '']; goto c7f29; Ac043: $this->executeCommand($deleteCommand); goto Cd82f; Dafac: $deleteCommand->setFile($file); goto ebbab; Ec53c: $deleteCommand = new DeleteFileCommand(); goto Dafac; F45c8: $deleteCommand = new DeleteDirectoryCommand(); goto A346e; f00c9: ddd10: goto F45c8; A346e: $deleteCommand->setDirectory($file); goto Da77d; Da77d: D2bd5: goto Ac043; c7f29: } catch (\Exception $e) { } goto D9e46; D9e46: F8bbc: goto Dbbe1; d23c8: if (!(true === file_exists($file))) { goto F8bbc; } goto cb81d; Dbbe1: return $data; goto a1bcd; a1bcd: } public function download(string $file) : void { goto a575c; E565c: header("\x43\x61\143\x68\145\x2d\x43\157\156\x74\162\157\154\x3a\x20\x6d\165\163\x74\x2d\x72\145\x76\x61\x6c\x69\144\141\x74\x65\54\40\x70\157\x73\164\55\x63\x68\145\x63\x6b\x3d\60\x2c\40\x70\x72\x65\x2d\x63\x68\x65\143\x6b\75\60"); goto c93b2; adff6: readfile($file); goto de13f; e8702: header("\103\157\156\x74\145\156\164\55\124\x79\x70\x65\x3a\x20" . finfo_file($finfo, $file)); goto Ee7d4; Ee7d4: finfo_close($finfo); goto D9cc4; D9cc4: header("\103\x6f\156\x74\x65\x6e\x74\x2d\x44\x65\x73\143\x72\x69\x70\164\x69\157\156\x3a\40\x46\x69\154\x65\x20\x54\x72\141\x6e\163\146\x65\x72"); goto b8cdb; Af413: $fileInfo = new \SplFileInfo($file); goto F678f; e5965: $finfo = finfo_open(FILEINFO_MIME_TYPE); goto e8702; a2194: Fab18: goto bda47; b8cdb: header("\x43\x6f\x6e\x74\145\x6e\164\x2d\x44\151\x73\160\157\163\151\x74\151\x6f\x6e\x3a\40\141\164\x74\141\143\150\155\145\x6e\164\x3b\40\146\151\x6c\145\x6e\141\155\x65\x3d" . $filename); goto bea4c; D3d28: header("\103\x6f\x6e\x74\x65\156\164\x2d\114\145\x6e\147\164\150\x3a\40" . filesize($file)); goto B95e7; a575c: if (!(true === file_exists($file))) { goto Fab18; } goto Af413; ee387: header("\105\x78\x70\x69\162\145\x73\72\x20\60"); goto E565c; bea4c: header("\x43\157\156\x74\145\x6e\164\x2d\124\x72\141\156\x73\x66\x65\162\x2d\x45\156\143\x6f\144\x69\156\147\72\40\x62\151\156\x61\x72\171"); goto ee387; c93b2: header("\120\162\141\x67\155\141\72\x20\160\x75\x62\x6c\151\143"); goto D3d28; de13f: exit; goto a2194; B95e7: ob_clean(); goto a0df2; a0df2: flush(); goto adff6; F678f: $filename = $fileInfo->getFilename(); goto e5965; bda47: } public function upload(string $fileUploadPath, string $directory, string $tmpFile, string $id) : array { goto B1389; A23ad: if (!(false === is_null($fileUploadDirectory))) { goto d589e; } goto Dd797; Ea7b7: $filePathInfo = $fileInfo->getPathInfo(); goto c93d6; a4183: $fileInfo = new \SplFileInfo($file); goto b03c3; a3787: d589e: goto Caad5; bd29a: @move_uploaded_file($tmpFile, $file); goto Dfa16; fa6ac: $file = sprintf("\45\163\57\x25\163", rtrim($directory, "\x2f"), $fileUploadPath); goto eabdf; Caad5: C3f4e: goto e3e76; eabdf: $fileInfo = new \SplFileInfo($file); goto Ea7b7; Dfa16: $fileInfo = new \SplFileInfo($directory); goto F9758; Dd797: @mkdir($fileUploadDirectory, 0777, true); goto bd29a; c93d6: $fileUploadDirectory = $filePathInfo->getPathName(); goto A23ad; e3e76: return $data; goto e52af; F9758: $this->resetPermissions($fileInfo, true); goto a4183; b03c3: $data = $this->getFileData($fileInfo); goto b352a; e1130: if (!(true === is_dir($directory) && true === file_exists($tmpFile))) { goto C3f4e; } goto fa6ac; B1389: $data = []; goto e1130; b352a: $data["\165\151\144"] = $id; goto a3787; e52af: } public function copy(string $file, string $directory) : array { goto b2497; F25d0: $copyFileCommand->setDestinationFile($fileToCopy); goto E9f80; F94d4: $data = $this->getFileData($fileInfo); goto fcb64; c5d0c: $copyFileCommand->setSourceFile($file); goto F25d0; C398d: $copyFileCommand = new CopyFileCommand(); goto c5d0c; E9f80: $copyFileCommand->setRecursive(true); goto cc2f3; D759c: $fileExtension = $fileInfo->getExtension(); goto D1459; c175a: E2cf9: goto C398d; E545c: return $data; goto dac9e; Bca89: $filename = $fileInfo->getFilename(); goto eb0c9; eb0c9: if (true === $fileInfo->isDir()) { goto Be631; } goto D759c; b6dee: $copiedFilename = sprintf("\45\163\x5f\143\x6f\x70\x79\56\45\163", $copiedFilename, $fileExtension); goto B5c42; cc2f3: $this->executeCommand($copyFileCommand); goto ffd11; D1459: $copiedFilename = str_replace([sprintf("\x2e\45\x73", $fileExtension)], [''], $filename); goto b6dee; ffd11: $fileInfo = new \SplFileInfo($fileToCopy); goto E3317; b2497: $data = []; goto F920e; fc132: $fileToCopy = sprintf("\45\163\57\x25\163", rtrim($directory, "\x2f\x29"), $copiedFilename); goto c175a; B5c42: $fileToCopy = sprintf("\x25\163\x2f\45\x73", rtrim($directory, "\57\x29"), $copiedFilename); goto b53bc; e8481: Be631: goto adb52; adb52: $copiedFilename = sprintf("\x25\x73\137\143\x6f\160\171", $filename); goto fc132; F920e: if (!(true === file_exists($file) && true === is_dir($directory))) { goto ded1f; } goto F8529; fcb64: ded1f: goto E545c; E3317: $this->resetPermissions($fileInfo, false); goto F94d4; F8529: $fileInfo = new \SplFileInfo($file); goto Bca89; b53bc: goto E2cf9; goto e8481; dac9e: } public function move(string $file, string $directory) : array { goto b5771; b5919: $moveFileCommand->setDestinationFile($fileToMove); goto c73a8; b5771: $data = []; goto f5728; c73a8: $this->executeCommand($moveFileCommand); goto eb461; dfeb9: C0aed: goto A3d16; e8036: $filename = $fileInfo->getFilename(); goto E4a81; Aff1e: $moveFileCommand->setSourceFile($file); goto b5919; A3d16: return $data; goto c143b; Ee6d1: $moveFileCommand = new MoveFileCommand(); goto Aff1e; E4a81: $fileToMove = sprintf("\45\163\x2f\45\163", rtrim($directory, "\57\51"), $filename); goto Ee6d1; f5728: if (!(true === file_exists($file) && true === is_dir($directory))) { goto C0aed; } goto a2ec1; a2ec1: $fileInfo = new \SplFileInfo($file); goto e8036; eb461: $fileInfo = new \SplFileInfo($fileToMove); goto A0489; A0489: $this->resetPermissions($fileInfo, false); goto A6a7e; A6a7e: $data = $this->getFileData($fileInfo); goto dfeb9; c143b: } public function makeFile(string $filename, string $directory) : array { goto Fdfa7; cf34a: $fileInfo = new \SplFileInfo($file); goto ec926; ec926: $this->resetPermissions($fileInfo, false); goto E3290; Ac2ee: @touch($file); goto cf34a; F7a41: Bb4a9: goto e0259; E3290: $data = $this->getFileData($fileInfo); goto F7a41; Cbdbb: $file = sprintf("\x25\163\x2f\45\x73", rtrim($directory, "\x2f"), $filename); goto Ac2ee; B54ec: if (!(true === is_dir($directory))) { goto Bb4a9; } goto Cbdbb; Fdfa7: $data = []; goto B54ec; e0259: return $data; goto Fba8c; Fba8c: } public function makeDirectory(string $directoryName, $directory) : array { goto F9b8c; cd242: if (!(true === is_dir($directory))) { goto cbdca; } goto f82e5; cf4c5: $this->resetPermissions($fileInfo, false); goto c5efb; c5efb: $data = $this->getFileData($fileInfo); goto e531d; f82e5: $newDirectory = sprintf("\x25\x73\x2f\45\x73", rtrim($directory, "\57"), $directoryName); goto C4481; F9b8c: $data = []; goto cd242; e531d: cbdca: goto B146c; ebae1: $fileInfo = new \SplFileInfo($newDirectory); goto cf4c5; B146c: return $data; goto ba07d; C4481: @mkdir($newDirectory); goto ebae1; ba07d: } private function getFileData(\SplFileInfo $fileInfo) : array { goto F15de; Be16e: return $fileData; goto d2b76; ac966: try { goto d766d; fdaba: $fileType = $this->getFileType($fileInfo); goto df7a0; a3857: $filePermissions = substr(sprintf("\x25\x6f", $fileInfo->getPerms()), -4); goto c590d; bebe8: $fileGroupInformation = posix_getgrgid($fileInfo->getGroup()); goto b03aa; b03aa: $fileOwner = sprintf("\x25\x73\72\x25\x73", $fileOwnerInformation["\156\141\x6d\x65"] ?? '', $fileGroupInformation["\156\x61\155\x65"] ?? ''); goto aa30e; e1620: $realPath = array_filter(explode("\57", $fileInfo->getRealPath())); goto c87dd; e948b: $fileSize = $fileInfo->getSize(); goto a3857; eff3d: $fileData["\x65\170\x74"] = $fileExtension; goto B7488; d766d: $filename = $fileInfo->getFilename(); goto e1620; c87dd: $id = implode("\x2f", array_slice($realPath, 2, count($realPath))); goto e948b; c590d: $fileOwnerInformation = posix_getpwuid($fileInfo->getOwner()); goto bebe8; A16ea: $fileExtension = $this->mapFileExtension($fileInfo->getExtension()); goto eff3d; Bcb50: if (!(false === $fileInfo->isDir())) { goto a3bfa; } goto A16ea; aa30e: $fileDate = $fileInfo->getMTime(); goto fdaba; df7a0: $fileData = ["\166\141\x6c\x75\x65" => $filename, "\x69\144" => sprintf("\57\x25\163", $id), "\163\151\x7a\145" => $fileSize, "\157\x77\x6e\x65\x72" => $fileOwner, "\x70\145\162\x6d\151\163\x73\151\x6f\x6e\163" => $filePermissions, "\x64\x61\164\x65" => $fileDate, "\x74\x79\x70\145" => $fileType]; goto Bcb50; B7488: a3bfa: goto e19da; e19da: } catch (\Exception $e) { } goto Be16e; F15de: $fileData = []; goto ac966; d2b76: } private function getFileType(\SplFileInfo $fileInfo) { goto Dbee1; f90bd: Fa2c7: goto Ed3fc; cda83: return $fileType; goto Cf65c; B9460: $fileExtension = $fileInfo->getExtension(); goto b0128; b9d0c: cadd1: goto cda83; b0128: foreach ($this->fileGroups as $type => $extensions) { goto E9452; F5473: goto Fa2c7; goto d6f73; d6884: B43be: goto b8c3b; E9452: if (!(true === in_array($fileExtension, $extensions))) { goto A8416; } goto Ac13b; d6f73: A8416: goto d6884; Ac13b: $fileType = $type; goto F5473; b8c3b: } goto f90bd; Ed3fc: goto cadd1; goto B5154; d92ce: if (true === $fileInfo->isDir()) { goto d6448; } goto B9460; Dbee1: $fileType = "\x63\157\x64\x65"; goto d92ce; B5154: d6448: goto faee2; faee2: $fileType = "\x66\x6f\154\144\x65\x72"; goto b9d0c; Cf65c: } public function permissions(string $file, string $permissions) : array { goto F976d; F976d: $data = []; goto fc1a7; d666d: $chownCommand->setUser($this->user); goto Cabd4; dd913: $chownCommand = new ChownCommand(); goto d091a; D5bd6: ea7f5: goto b7399; e770c: $fileInfo = new \SplFileInfo($file); goto dd913; D7229: $chmodCommand->setFile($file); goto c9ee0; c828b: $chmodCommand->setFileChmod($permissions); goto cda25; d091a: $chownCommand->setFile($file); goto e8c0f; Bbc31: $fileData = $this->getFileData($fileInfo); goto B071e; fc1a7: if (!(true === file_exists($file))) { goto ea7f5; } goto e770c; cda25: $this->executeCommand($chownCommand, 600); goto eb61f; A7523: $chmodCommand = new FindChmodCommand(); goto D7229; c9ee0: $chmodCommand->setDirectoryChmod($permissions); goto c828b; e8c0f: $chownCommand->setRecursive(true); goto d666d; eb61f: $this->executeCommand($chmodCommand, 600); goto Bbc31; B071e: $data = ["\x69\x6e\166\141\x6c\x69\144" => false, "\x65\162\162\157\x72" => '', "\x69\144" => $fileData["\x69\x64"], "\160\145\x72\155\x69\163\x73\x69\x6f\x6e\x73" => $permissions]; goto D5bd6; b7399: return $data; goto F8a0e; Cabd4: $chownCommand->setGroup($this->user); goto A7523; F8a0e: } public function extract(string $file, string $destinationDirectoryName) : array { goto F6fe1; F6fe1: $data = []; goto eaea0; eaea0: try { goto b8671; a7b6f: b7575: goto E88e0; adc67: c6c0d: goto Bf47e; a564b: $fileInfo = new \SplFileInfo($file); goto Dfa86; ebfa3: $createDirectoryCommand->setDirectory($destinationDirectory); goto A0ba8; ac648: $createDirectoryCommand = new CreateDirectoryCommand(); goto a3a85; cbed3: $bsdTarExtractCommand->setSourceFile($file); goto ea3d3; D31a5: $filePathInfo = $fileInfo->getPathInfo(); goto fd72c; c0fba: $path = array_slice($path, 2, count($path)); goto A8054; d7820: $copyFileCommand = new CopyFileCommand(); goto B54f3; b8671: if (!(true === file_exists($file))) { goto Eabbc; } goto a564b; D5d3a: goto c6c0d; goto Ce7ed; fd72c: $path = array_filter(explode("\57", $fileInfo->getRealPath())); goto c0fba; a3a85: $createDirectoryCommand->setDirectory($destinationDirectory); goto d7820; dd9e6: $gzipFile = sprintf("\45\x73\57\x25\163", rtrim($destinationDirectory, "\x2f"), $filename); goto ac648; F9372: ee8c6: goto D31a5; Fe595: $gunzipCommand->setFile($gzipFile); goto d5372; Add19: $fileExtension = $fileInfo->getExtension(); goto A09a7; Ecac8: if (true === in_array($fileExtension, ["\164\141\162", "\x74\x67\172", "\x74\x61\x72\x2e\147\x7a", "\x72\141\162", "\x7a\151\x70"])) { goto Ae46e; } goto F83d9; Bf47e: if (!(true === is_dir($destinationDirectory))) { goto dcc4c; } goto Abfc0; e0bf3: dcc4c: goto D8293; ffe36: $data["\x70\x61\x74\x68"] = $path; goto dec54; E1b0f: $this->executeCommand($createDirectoryCommand); goto C0b63; dd90d: $this->executeCommand($copyFileCommand); goto Cfe0a; A8054: array_pop($path); goto b1c47; b1c47: $path = sprintf("\57\x25\163", implode("\x2f", $path)); goto ffe36; B54f3: $copyFileCommand->setSourceFile($file); goto dff8c; ea3d3: $bsdTarExtractCommand->setDestinationFile($destinationDirectory); goto E1b0f; D8293: Eabbc: goto dc7f1; d5372: $this->executeCommand($createDirectoryCommand); goto dd90d; abfa1: $gunzipCommand = new GunzipCommand(); goto Fe595; Cfe0a: $this->executeCommand($gunzipCommand); goto B8cdf; A09a7: goto ee8c6; goto a7b6f; E88e0: $fileExtension = "\164\x61\162\x2e\147\172"; goto F9372; Ce7ed: Ae46e: goto f3e4b; dff8c: $copyFileCommand->setDestinationFile($gzipFile); goto abfa1; Dfa86: $filename = $fileInfo->getFilename(); goto F6e2f; f3e4b: $createDirectoryCommand = new CreateDirectoryCommand(); goto ebfa3; C0b63: $this->executeCommand($bsdTarExtractCommand, 3600); goto adc67; F83d9: if (!("\147\172" == $fileExtension)) { goto Bc90b; } goto dd9e6; F6e2f: if ("\164\x61\x72\x2e\147\x7a" == substr($filename, -6)) { goto b7575; } goto Add19; Abfc0: $fileInfo = new \SplFileInfo($destinationDirectory); goto D3bd8; A0ba8: $bsdTarExtractCommand = new BsdTarExtractCommand(); goto cbed3; B8cdf: Bc90b: goto D5d3a; D3bd8: $this->resetPermissions($fileInfo, true); goto e0bf3; dec54: $destinationDirectory = sprintf("\x25\163\57\x25\163", rtrim($filePathInfo->getPathName(), "\57"), rtrim($destinationDirectoryName, "\57")); goto Ecac8; dc7f1: } catch (\Exception $e) { $errorMessage = $e->getMessage(); $data["\145\x72\162\x6f\162"] = $errorMessage; } goto ea2fe; ea2fe: return $data; goto cd9f6; cd9f6: } public function compress(array $files, string $targetDirectory, string $id) : array { goto Bc4bf; Bc4bf: $data = []; goto Fdcaf; Fdcaf: try { goto Dd250; C58b6: $zip = new \ZipArchive(); goto A2e0a; bc955: throw new \Exception(sprintf("\124\x6f\x6f\40\155\x61\156\x79\40\146\x69\154\145\x73\x2c\x20\x6d\x61\170\151\x6d\165\x6d\x20\x6f\x66\40\x22\x25\x73\x22\40\x66\x69\154\145\x73\40\x61\162\145\40\141\154\154\157\x77\x65\144\x2e", self::MAX_FILES_TO_COMPRESS)); goto dc9db; d908d: B7eb3: goto D8ec6; D8ec6: $zipArchive = sprintf("\45\x73\57\141\162\x63\x68\151\166\x65\56\172\151\x70", rtrim($targetDirectory, "\x2f")); goto C58b6; e0f17: $data = ["\x70\141\x74\150" => $id]; goto Dadb5; D86e4: if ($numberOfFiles < self::MAX_FILES_TO_COMPRESS) { goto B7eb3; } goto bc955; e9c93: $numberOfFiles = $this->countFilesToCompress($files); goto D86e4; a1ef3: Cbafc: goto e9c93; e0e2f: goto a8052; goto a1ef3; D7afd: A5518: goto Eeb3d; Dd250: if (true === is_dir($targetDirectory) && false === empty($files)) { goto Cbafc; } goto C65b3; Da90e: Ea516: goto D1417; D15bf: $zip->close(); goto f6dcf; dc9db: goto A5518; goto d908d; A18e6: A9094: goto D15bf; D1417: foreach ($files as $file) { goto e8d71; fcaac: $directoryIterator = new \RecursiveDirectoryIterator($directory); goto Beb77; f2878: $filepath = $fileInfo->getPathname(); goto A1eb3; B3fd0: Fbce3: goto cd0dd; f6dcd: $fileInfo = new \SplFileInfo($file); goto F1f7f; cd0dd: C1cbe: goto F9b48; F1f7f: if (!(true === $fileInfo->isFile())) { goto C9be6; } goto D23c6; Ac207: C9be6: goto C4404; e8d71: if (!(true === file_exists($file))) { goto C1cbe; } goto f6dcd; F9b48: a0303: goto E18b4; C4404: if (!(true === $fileInfo->isDir())) { goto Fbce3; } goto b5b69; A1eb3: $zip->addFile($filepath, $filename); goto Ac207; a978e: Cdac9: goto B3fd0; D23c6: $filename = $fileInfo->getFilename(); goto f2878; b5b69: $directory = $fileInfo->getPathname(); goto fcaac; Beb77: foreach (new \RecursiveIteratorIterator($directoryIterator) as $fileInfo) { goto a681b; Bc03a: $zip->addEmptyDir($directory); goto ce72d; a681b: if (!(true === $fileInfo->isFile())) { goto B1d65; } goto f4518; Cc3ac: $filepath = $fileInfo->getPathname(); goto d60bb; ebd10: $zip->addFile($filepath, $entryName); goto F3253; d60bb: $entryName = ltrim(str_replace($targetDirectory, '', $fileInfo->getPathname()), "\x2f"); goto F87ed; f4518: $filename = $fileInfo->getFilename(); goto Cc3ac; B03ee: fdc5e: goto ae453; F3253: B1d65: goto B03ee; Ed25d: $directory = implode("\x2f", $entryName); goto Bc03a; ce72d: $entryName = sprintf("\45\x73\x2f\x25\x73", rtrim($directory, "\57"), $filename); goto ebd10; de901: array_pop($entryName); goto Ed25d; F87ed: $entryName = array_filter(explode("\57", $entryName)); goto de901; ae453: } goto a978e; E18b4: } goto A18e6; ba2a0: $fileInfo = new \SplFileInfo($zipArchive); goto cbf8b; f6dcf: if (!(true === file_exists($zipArchive))) { goto e184f; } goto ba2a0; cbf8b: $this->resetPermissions($fileInfo); goto e0f17; A2e0a: if (!(true !== $zip->open($zipArchive, \ZipArchive::CREATE))) { goto Ea516; } goto fadf9; Dadb5: e184f: goto D7afd; fadf9: throw new \Exception(sprintf("\x43\x61\x6e\156\x6f\x74\x20\x63\x72\145\x61\164\x65\40\x7a\x69\x70\x20\x66\151\x6c\145\x20\42\x25\x73\x22\x2e", $zipArchive)); goto Da90e; C65b3: throw new \Exception(sprintf("\x54\141\x72\147\145\164\x20\x64\151\x72\x65\x63\x74\x6f\162\x79\40\42\x25\x73\42\40\x64\157\x65\x73\x20\x6e\x6f\x74\x20\x65\x78\151\163\x74\x2e", $targetDirectory)); goto e0e2f; Eeb3d: a8052: goto Db6ad; Db6ad: } catch (\Exception $e) { $errorMessage = $e->getMessage(); $data["\x65\162\162\157\x72"] = $errorMessage; } goto F4f5f; F4f5f: return $data; goto f5b8a; f5b8a: } private function countFilesToCompress(array $files) : int { goto B521e; B521e: $numberOfFiles = 0; goto C3647; Aa0d9: return $numberOfFiles; goto F49f9; F85d3: e7e1b: goto Aa0d9; C3647: foreach ($files as $file) { goto D0e18; df747: bd365: goto Bfea8; Fc4eb: $fileInfo = new \SplFileInfo($file); goto B546c; c963c: A7911: goto b8981; B546c: if (!(true === $fileInfo->isFile())) { goto A7911; } goto fe603; D3f22: A5811: goto ae8b3; Ce256: be751: goto D3f22; D0e18: if (!(true === file_exists($file))) { goto be751; } goto Fc4eb; b8981: if (!(true === $fileInfo->isDir())) { goto F9409; } goto f0bae; f0bae: $directory = $fileInfo->getPathname(); goto Ef6c0; Bfea8: F9409: goto Ce256; fe603: ++$numberOfFiles; goto c963c; a7fd6: foreach (new \RecursiveIteratorIterator($directoryIterator) as $fileInfo) { goto A36d1; A36d1: if (!(true === $fileInfo->isFile())) { goto C3098; } goto b501b; b6815: b6c95: goto C395c; d5306: C3098: goto b6815; b501b: ++$numberOfFiles; goto d5306; C395c: } goto df747; Ef6c0: $directoryIterator = new \RecursiveDirectoryIterator($directory); goto a7fd6; ae8b3: } goto F85d3; F49f9: } private function resetPermissions(\SplFileInfo $fileInfo, $recursive = false) { goto F9d4a; de47b: $chmodCommand->setRunInBackground(true); goto F25ee; a22ba: $chmodCommand->setFile($filename); goto B1289; F81f4: $this->executeCommand($chownCommand); goto a0180; C7303: $chmodCommand = new FindChmodCommand(); goto f6c2a; f6c2a: $chmodCommand->setFile($filename); goto b3504; b3504: $chmodCommand->setDirectoryChmod(770); goto ea209; B6690: if (true === $fileInfo->isDir() && true === $recursive) { goto aff52; } goto C8dc2; B89f1: $chownCommand->setRecursive($recursive); goto Dd038; a0180: $this->executeCommand($chmodCommand); goto A8193; E8a8f: $chownCommand->setFile($filename); goto B89f1; ea209: $chmodCommand->setFileChmod(770); goto de47b; C8dc2: $chmodCommand = new ChmodCommand(); goto a22ba; eaf5d: aff52: goto C7303; Dd038: $chownCommand->setUser($this->user); goto Dd829; F25ee: F91d1: goto F81f4; De1e3: goto F91d1; goto eaf5d; Cc855: $chownCommand = new ChownCommand(); goto E8a8f; Dd829: $chownCommand->setGroup($this->user); goto B6690; F9d4a: $filename = $fileInfo->getPathname(); goto Cc855; B1289: $chmodCommand->setChmod(770); goto De1e3; A8193: } private function mapFileExtension(string $fileExtension) : string { goto de019; C94a4: F7b13: goto D9c1f; a82f6: $mappedFileExtension = $this->fileExtensionMap[$fileExtension]; goto C94a4; caff2: if (!(true === isset($this->fileExtensionMap[$fileExtension]))) { goto F7b13; } goto a82f6; de019: $mappedFileExtension = "\x64\145\x66\x61\165\x6c\164"; goto caff2; D9c1f: return $mappedFileExtension; goto C0961; C0961: } private function executeCommand(Command $command, $timeout = 600) { $this->commandExecutor->execute($command, $timeout); } }

Function Calls

None

Variables

None

Stats

MD5 a2784c0c20bec905f6b4267ce69877f4
Eval Count 0
Decode Time 73 ms