aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Files
diff options
context:
space:
mode:
authorFerdinand Thiessen <opensource@fthiessen.de>2025-05-14 09:55:14 +0200
committerFerdinand Thiessen <opensource@fthiessen.de>2025-05-14 09:55:14 +0200
commit85a6b0d0ebcaf105b914184fdbca9a7c8ee04ab7 (patch)
tree4201fd2240883b4453e37fe5ea987146b9effa98 /lib/private/Files
parenta338772ddd135d5314275fa314ba34be6aec9683 (diff)
downloadnextcloud-server-85a6b0d0ebcaf105b914184fdbca9a7c8ee04ab7.tar.gz
nextcloud-server-85a6b0d0ebcaf105b914184fdbca9a7c8ee04ab7.zip
chore: deprecate \OC_Helper::canExecutechore/oc-helper-can-exec
replace this legacy method with just the IBinaryFinder Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'lib/private/Files')
-rw-r--r--lib/private/Files/Type/Detection.php7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/private/Files/Type/Detection.php b/lib/private/Files/Type/Detection.php
index 42315247dbf..aeaac030413 100644
--- a/lib/private/Files/Type/Detection.php
+++ b/lib/private/Files/Type/Detection.php
@@ -9,6 +9,7 @@ declare(strict_types=1);
namespace OC\Files\Type;
use OCP\Files\IMimeTypeDetector;
+use OCP\IBinaryFinder;
use OCP\ITempManager;
use OCP\IURLGenerator;
use Psr\Log\LoggerInterface;
@@ -225,11 +226,13 @@ class Detection implements IMimeTypeDetector {
}
}
- if (\OC_Helper::canExecute('file')) {
+ $binaryFinder = \OCP\Server::get(IBinaryFinder::class);
+ $program = $binaryFinder->findBinaryPath('file');
+ if ($program !== false) {
// it looks like we have a 'file' command,
// lets see if it does have mime support
$path = escapeshellarg($path);
- $fp = popen("test -f $path && file -b --mime-type $path", 'r');
+ $fp = popen("test -f $path && $program -b --mime-type $path", 'r');
if ($fp !== false) {
$mimeType = fgets($fp);
pclose($fp);