diff options
| author | Christian Weiske <cweiske@cweiske.de> | 2014-07-09 18:21:42 +0200 |
|---|---|---|
| committer | Christian Weiske <cweiske@cweiske.de> | 2014-07-09 18:21:42 +0200 |
| commit | 9a21a1cba3aa4d263d8e541382cb4ba0103fc19a (patch) | |
| tree | 27511d2627db19ab3b57f16c11e19449d9e5ee28 /src/phorkie/Repository/Post.php | |
| parent | dd32f373a6ce0ce9782ecd4f8bf6abf59246113a (diff) | |
| download | phorkie-9a21a1cba3aa4d263d8e541382cb4ba0103fc19a.tar.gz phorkie-9a21a1cba3aa4d263d8e541382cb4ba0103fc19a.zip | |
make mime type detection work on php-fpm which has no PATH env variable
Diffstat (limited to 'src/phorkie/Repository/Post.php')
| -rw-r--r-- | src/phorkie/Repository/Post.php | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/phorkie/Repository/Post.php b/src/phorkie/Repository/Post.php index 09cb977..a61f2a2 100644 --- a/src/phorkie/Repository/Post.php +++ b/src/phorkie/Repository/Post.php @@ -234,6 +234,12 @@ class Repository_Post public function getType($content, $returnError = false) { + if (getenv('PATH') == '') { + //php-fpm does not fill $PATH by default + // we have to work around that since System::which() uses it + putenv('PATH=/usr/local/bin:/usr/bin:/bin'); + } + $tmp = tempnam(sys_get_temp_dir(), 'phorkie-autodetect-'); file_put_contents($tmp, $content); $type = Tool_MIME_Type_PlainDetect::autoDetect($tmp); |
