From: Ilia Alshanetsky Date: Thu, 22 Aug 2002 12:21:25 +0000 (+0000) Subject: Instead of hardcoding the path of magic.mime file, try to find the file X-Git-Tag: RELEASE_0_91~318 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=848bcf75271d0640a5b604d039c1d2cbbcbad47f;p=php Instead of hardcoding the path of magic.mime file, try to find the file inside common paths for the file. --- diff --git a/ext/mime_magic/config.m4 b/ext/mime_magic/config.m4 index 9342ed2306..aca9094bef 100644 --- a/ext/mime_magic/config.m4 +++ b/ext/mime_magic/config.m4 @@ -8,4 +8,21 @@ if test "$PHP_MIME_MAGIC" = "yes"; then 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 diff --git a/ext/mime_magic/mime_magic.c b/ext/mime_magic/mime_magic.c index 54a8220205..770ef2f358 100644 --- a/ext/mime_magic/mime_magic.c +++ b/ext/mime_magic/mime_magic.c @@ -235,7 +235,7 @@ ZEND_GET_MODULE(mime_magic) /* {{{ 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() /* }}} */