binext: catch missing exiftool error (fix #601)
Signed-off-by: Varun Patil <radialapps@gmail.com>pull/653/head
parent
e5a958916e
commit
13341ebbd3
|
@ -122,7 +122,7 @@ class OtherController extends GenericApiController
|
|||
// Check exiftool version
|
||||
$exiftoolNoLocal = Util::getSystemConfig('memories.exiftool_no_local');
|
||||
$status['exiftool'] = $this->getExecutableStatus(
|
||||
BinExt::getExiftoolPBin(),
|
||||
fn () => BinExt::getExiftoolPBin(),
|
||||
fn ($p) => BinExt::testExiftool(),
|
||||
!$exiftoolNoLocal,
|
||||
!$exiftoolNoLocal,
|
||||
|
@ -253,10 +253,10 @@ class OtherController extends GenericApiController
|
|||
/**
|
||||
* Get the status of an executable.
|
||||
*
|
||||
* @param string $path Path to the executable
|
||||
* @param ?\Closure $testFunction Function to test the executable
|
||||
* @param bool $testIfFile Test if the path is a file
|
||||
* @param bool $testIfExecutable Test if the path is executable
|
||||
* @param \Closure|string $path Path to the executable
|
||||
* @param ?\Closure $testFunction Function to test the executable
|
||||
* @param bool $testIfFile Test if the path is a file
|
||||
* @param bool $testIfExecutable Test if the path is executable
|
||||
*/
|
||||
private function getExecutableStatus(
|
||||
$path,
|
||||
|
@ -264,6 +264,14 @@ class OtherController extends GenericApiController
|
|||
bool $testIfFile = true,
|
||||
bool $testIfExecutable = true
|
||||
): string {
|
||||
if ($path instanceof \Closure) {
|
||||
try {
|
||||
$path = $path();
|
||||
} catch (\Exception $e) {
|
||||
return 'test_fail:'.$e->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
if (!\is_string($path)) {
|
||||
return 'not_found';
|
||||
}
|
||||
|
|
|
@ -32,6 +32,10 @@ class BinExt
|
|||
}
|
||||
|
||||
if ($copy) {
|
||||
if (empty($path)) {
|
||||
throw new \Exception('binary path is empty (run occ maintenance:repair)');
|
||||
}
|
||||
|
||||
if (!copy($path, $target)) {
|
||||
throw new \Exception("failed to copy {$name} binary from {$path} to {$target}");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue