summaryrefslogtreecommitdiffstats
path: root/lib/filestorage.php
diff options
context:
space:
mode:
authorRobin Appelman <icewind1991@gmail.com>2011-07-28 20:10:58 +0200
committerRobin Appelman <icewind1991@gmail.com>2011-07-28 20:10:58 +0200
commit0d408fe6f540161b9367d7b6abb93965139898a4 (patch)
tree2550d5d819b5b19224bb1ba5031a181de5c10d39 /lib/filestorage.php
parent7505720350369943d4b1a8be5f3840ada424221b (diff)
downloadnextcloud-server-0d408fe6f540161b9367d7b6abb93965139898a4.tar.gz
nextcloud-server-0d408fe6f540161b9367d7b6abb93965139898a4.zip
make use of the command line tools id3info and mp3info for scanning music if they are available
Diffstat (limited to 'lib/filestorage.php')
-rw-r--r--lib/filestorage.php58
1 files changed, 1 insertions, 57 deletions
diff --git a/lib/filestorage.php b/lib/filestorage.php
index 95e8c31eff2..601cf6f37fe 100644
--- a/lib/filestorage.php
+++ b/lib/filestorage.php
@@ -200,7 +200,7 @@ class OC_FILESTORAGE_LOCAL extends OC_FILESTORAGE{
} else if (function_exists("mime_content_type")) {
// use mime magic extension if available
$mime_type = mime_content_type($this->datadir.$fspath);
- } else if (self::canExecute("file")) {
+ } else if (OC_HELPER::canExecute("file")) {
// it looks like we have a 'file' command,
// lets see it it does have mime support
$fp = popen("file -i -b '{$this->datadir}$fspath' 2>/dev/null", "r");
@@ -223,62 +223,6 @@ class OC_FILESTORAGE_LOCAL extends OC_FILESTORAGE{
}
}
- /**
- * detect if a given program is found in the search PATH
- *
- * helper function used by _mimetype() to detect if the
- * external 'file' utility is available
- *
- * @param string program name
- * @param string optional search path, defaults to $PATH
- * @return bool true if executable program found in path
- */
- private function canExecute($name, $path = false)
- {
- // path defaults to PATH from environment if not set
- if ($path === false) {
- $path = getenv("PATH");
- }
-
- // check method depends on operating system
- if (!strncmp(PHP_OS, "WIN", 3)) {
- // on Windows an appropriate COM or EXE file needs to exist
- $exts = array(".exe", ".com");
- $check_fn = "file_exists";
- } else {
- // anywhere else we look for an executable file of that name
- $exts = array("");
- $check_fn = "is_executable";
- }
-
- // Default check will be done with $path directories :
- $dirs = explode(PATH_SEPARATOR, $path);
-
- // WARNING : We have to check if open_basedir is enabled :
- $obd = ini_get('open_basedir');
-
- if($obd != "none")
- $obd_values = explode(PATH_SEPARATOR, $obd);
-
- if(count($obd_values) > 0)
- {
- // open_basedir is in effect !
- // We need to check if the program is in one of these dirs :
- $dirs = $obd_values;
- }
-
- foreach($dirs as $dir)
- {
- foreach($exts as $ext)
- {
- if($check_fn("$dir/$name".$ext))
- return true;
- }
- }
-
- return false;
- }
-
public function toTmpFile($path){
$tmpFolder=sys_get_temp_dir();
$filename=tempnam($tmpFolder,'OC_TEMP_FILE_'.substr($path,strrpos($path,'.')));