feat: photo
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Support\Facades\Process;
|
||||
use RuntimeException;
|
||||
|
||||
@@ -80,18 +81,21 @@ class CorunaArchive
|
||||
|
||||
$archive = $destDir.'/capture.7z';
|
||||
file_put_contents($archive, $repaired);
|
||||
file_put_contents($destDir.'/wire.bin', $wireData);
|
||||
$password = $this->crypto->archivePassword($batchBase);
|
||||
$membersDir = $destDir.'/members';
|
||||
@mkdir($membersDir, 0755, true);
|
||||
|
||||
$bin = $this->resolveSevenZipBinary();
|
||||
$result = Process::timeout(120)->run([
|
||||
$bin, 'x', '-y',
|
||||
'-p'.$password,
|
||||
'-o'.$membersDir,
|
||||
$archive,
|
||||
]);
|
||||
try {
|
||||
$result = Process::timeout(120)->run([
|
||||
$bin, 'x', '-y',
|
||||
'-p'.$password,
|
||||
'-o'.$membersDir,
|
||||
$archive,
|
||||
]);
|
||||
} finally {
|
||||
@unlink($archive);
|
||||
}
|
||||
|
||||
$files = [];
|
||||
if (is_dir($membersDir)) {
|
||||
@@ -114,6 +118,18 @@ class CorunaArchive
|
||||
];
|
||||
}
|
||||
|
||||
public static function forgetWorkDir(string $dir): void
|
||||
{
|
||||
if ($dir === '' || ! is_dir($dir)) {
|
||||
return;
|
||||
}
|
||||
File::deleteDirectory($dir);
|
||||
$parent = dirname($dir);
|
||||
if (is_dir($parent) && File::isEmptyDirectory($parent)) {
|
||||
@rmdir($parent);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve 7z path without probing outside open_basedir.
|
||||
* is_executable('/usr/bin/7z') fatals under typical panel open_basedir.
|
||||
|
||||
Reference in New Issue
Block a user