cvs: php4 /ext/mime_magic config.m4 mime_magic.c
| From: | Ilia Alshanetsky | Date: | Thu, 22 Aug 2002 12:21:25 +0000 |
| Subject: | cvs: php4 /ext/mime_magic config.m4 mime_magic.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-13562@lists.php.net to get a copy of this message | ||
iliaa Thu Aug 22 08:21:25 2002 EDT
Modified files:
/php4/ext/mime_magic config.m4 mime_magic.c
Log:
Instead of hardcoding the path of magic.mime file, try to find the file
inside common paths for the file.
Index: php4/ext/mime_magic/config.m4
diff -u php4/ext/mime_magic/config.m4:1.2 php4/ext/mime_magic/config.m4:1.3
--- php4/ext/mime_magic/config.m4:1.2 Wed Mar 27 08:54:09 2002
+++ php4/ext/mime_magic/config.m4 Thu Aug 22 08:21:25 2002
@@ -1,4 +1,4 @@
-dnl $Id: config.m4,v 1.2 2002/03/27 13:54:09 hholzgra Exp $
+dnl $Id: config.m4,v 1.3 2002/08/22 12:21:25 iliaa Exp $
dnl config.m4 for extension mime_magic
PHP_ARG_ENABLE(mime_magic, whether to enable mime_magic support,
@@ -8,4 +8,21 @@
dnl PHP_SUBST(MIME_MAGIC_SHARED_LIBADD)
PHP_NEW_EXTENSION(mime_magic, mime_magic.c, $ext_shared)
+
+ # Try to see if we can find the path of the magic file in its
+ # default locations.
+ if test-f /usr/share/magic.mime ; then
+ PHP_MIME_MAGIC_FILE_PATH=/usr/share/magic.mime
+ elif test -f /usr/share/magic ; then
+ PHP_MIME_MAGIC_FILE_PATH=/usr/share/magic
+ elif test -f /usr/share/misc/magic.mime ; then
+ PHP_MIME_MAGIC_FILE_PATH=/usr/share/misc/magic.mime
+ elif test -f /etc/magic ; then
+ PHP_MIME_MAGIC_FILE_PATH=/etc/magic
+ else
+ PHP_MIME_MAGIC_FILE_PATH=""
+ fi
+
+ AC_DEFINE_UNQUOTED(PHP_MIME_MAGIC_FILE_PATH,"$PHP_MIME_MAGIC_FILE_PATH",[magic file
path])
+
fi
Index: php4/ext/mime_magic/mime_magic.c
diff -u php4/ext/mime_magic/mime_magic.c:1.8 php4/ext/mime_magic/mime_magic.c:1.9
--- php4/ext/mime_magic/mime_magic.c:1.8 Wed Jun 26 14:49:08 2002
+++ php4/ext/mime_magic/mime_magic.c Thu Aug 22 08:21:25 2002
@@ -15,7 +15,7 @@
| Author: Hartmut Holzgraefe <hartmut@six.de> |
+----------------------------------------------------------------------+
- $Id: mime_magic.c,v 1.8 2002/06/26 18:49:08 derick Exp $
+ $Id: mime_magic.c,v 1.9 2002/08/22 12:21:25 iliaa Exp $
This module contains a lot of stuff taken from Apache mod_mime_magic,
so the lincense section is a little bit longer than usual:
@@ -235,7 +235,7 @@
/* {{{ PHP_INI
*/
PHP_INI_BEGIN()
-STD_PHP_INI_ENTRY("mime_magic.magicfile", "/usr/share/misc/magic.mime",
PHP_INI_SYSTEM, OnUpdateString, magicfile, zend_mime_magic_globals, mime_magic_globals)
+STD_PHP_INI_ENTRY("mime_magic.magicfile", PHP_MIME_MAGIC_FILE_PATH, PHP_INI_SYSTEM,
OnUpdateString, magicfile, zend_mime_magic_globals, mime_magic_globals)
PHP_INI_END()
/* }}} */