git.cweiske.de
/
phorkie.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
dd32f37
)
make mime type detection work on php-fpm which has no PATH env variable
author
Christian Weiske
<cweiske@cweiske.de>
Wed, 9 Jul 2014 16:21:42 +0000
(18:21 +0200)
committer
Christian Weiske
<cweiske@cweiske.de>
Wed, 9 Jul 2014 16:21:42 +0000
(18:21 +0200)
src/phorkie/Repository/Post.php
patch
|
blob
|
history
diff --git
a/src/phorkie/Repository/Post.php
b/src/phorkie/Repository/Post.php
index 09cb977e2ac4eed1e7bd6894c5fd44e0bace25dc..a61f2a257e6f78709e49489bce9a1f4dfa063ba5 100644
(file)
--- 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);