diff options
author | Jakob Sack <kde@jakobsack.de> | 2011-07-29 20:42:24 +0200 |
---|---|---|
committer | Jakob Sack <kde@jakobsack.de> | 2011-07-29 20:42:24 +0200 |
commit | 2bfad189e7e9c8ea78e4b5f78c9e779074dd991c (patch) | |
tree | 697204517c95647e382a4723545ade3950420913 /lib/filestorage | |
parent | e69079f9354464d21f31ae8b6d9e47988ba22fb4 (diff) | |
parent | d12d08e2f3553b06df6371535f971c9f193bd388 (diff) | |
download | nextcloud-server-2bfad189e7e9c8ea78e4b5f78c9e779074dd991c.tar.gz nextcloud-server-2bfad189e7e9c8ea78e4b5f78c9e779074dd991c.zip |
Merge branch 'master' of git://anongit.kde.org/owncloud into autoload
Conflicts:
lib/base.php
lib/filestorage.php
Diffstat (limited to 'lib/filestorage')
-rw-r--r-- | lib/filestorage/local.php | 59 |
1 files changed, 1 insertions, 58 deletions
diff --git a/lib/filestorage/local.php b/lib/filestorage/local.php index 81a00dd8f4d..fd3f043de3b 100644 --- a/lib/filestorage/local.php +++ b/lib/filestorage/local.php @@ -138,7 +138,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"); @@ -161,62 +161,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,'.'))); @@ -411,4 +355,3 @@ class OC_FILESTORAGE_LOCAL extends OC_FILESTORAGE{ } } } - |