Skip to content

Commit

Permalink
fixes #510
Browse files Browse the repository at this point in the history
  • Loading branch information
ildyria committed Apr 28, 2020
1 parent 5935f48 commit 9cd1a13
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 10 deletions.
32 changes: 22 additions & 10 deletions app/Configs.php
Original file line number Diff line number Diff line change
Expand Up @@ -259,13 +259,19 @@ public static function hasExiftool()

// value not yet set -> let's see if exiftool is available
if ($has_exiftool == 2) {
$path = exec('command -v exiftool');
if ($path == '') {
try {
$path = exec('command -v exiftool');
if ($path == '') {
self::set('has_exiftool', 0);
$has_exiftool = false;
} else {
self::set('has_exiftool', 1);
$has_exiftool = true;
}
} catch (Exception $e) {
self::set('has_exiftool', 0);
$has_exiftool = false;
} else {
self::set('has_exiftool', 1);
$has_exiftool = true;
Logs::warning(__METHOD__, __LINE__, 'exec is disabled, set has_exiftool to 0.');
}
} elseif ($has_exiftool == 1) {
$has_exiftool = true;
Expand All @@ -290,13 +296,19 @@ public static function hasFFmpeg()

// value not yet set -> let's see if ffmpeg is available
if ($has_ffmpeg == 2) {
$path = exec('command -v ffmpeg');
if ($path == '') {
try {
$path = exec('command -v ffmpeg');
if ($path == '') {
self::set('has_ffmpeg', 0);
$has_ffmpeg = false;
} else {
self::set('has_ffmpeg', 1);
$has_ffmpeg = true;
}
} catch (Exception $e) {
self::set('has_ffmpeg', 0);
$has_ffmpeg = false;
} else {
self::set('has_ffmpeg', 1);
$has_ffmpeg = true;
Logs::warning(__METHOD__, __LINE__, 'exec is disabled, set_ffmpeg to 0.');
}
} elseif ($has_ffmpeg == 1) {
$has_ffmpeg = true;
Expand Down
5 changes: 5 additions & 0 deletions app/Http/Controllers/DiagnosticsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,11 @@ public function get_errors()
}
}

if (!function_exists('exec')) {
$errors[]
= 'Warning: exec function has been disabled. You may experience some error 500, please report them to us.';
}

// @codeCoverageIgnoreEnd

return $errors;
Expand Down

0 comments on commit 9cd1a13

Please sign in to comment.