Commit 56dcc6a2 by Aaron Wells

Allow users to specify magicdb location (or use PHP's default)

Bug 1249858 Change-Id: I0dd741dad20bc17b33fb6d1a3bb9cf3d845d28df
parent bfaf9fa0
......@@ -222,8 +222,17 @@ $cfg->unziplistarg = '-l';
// you must change this to something unique, eg /tmp/mahara1/ and /tmp/mahara2/
// $cfg->unziptempdir = '/tmp/mahara/';
// How often Mahara should update the last access time for users. Setting this
// lower means the field will be updated more regularly, but means a database
// Whether to use PHP's internal magicdb or an external one, and if external,
// where it's located.
//
// * (default) NULL: use the magicdb at /usr/share/misc/magic, or if that's a
// symlink or directory, use /usr/share/misc/magic.mgc
// * FALSE: use PHP's internal magicdb
// * Anything else: Use this value as the path to the magicdb
$cfg->pathtomagicdb = NULL;
// How often Mahara should update the last access time for users. Setting this
// lower means the field will be updated more regularly, but means a database
// write will be required for more requests.
// Setting it to zero means the access time will be updated every request
$cfg->accesstimeupdatefrequency = 300;
......
......@@ -324,13 +324,19 @@ function file_mime_type($file, $originalfilename=false) {
// according to manual (http://www.php.net/manual/en/function.finfo-open.php)
// default option is /usr/share/misc/magic, then /usr/share/misc/magic.mgc
//
// if /usr/share/misc/magic is a directory then finfo still succeeds and
// if /usr/share/misc/magic is a directory then finfo still succeeds and
// doesn't fall back onto the .mcg magic_file
// force /usr/share/misc/magic.mgc instead in this case
$MAGICPATH = '/usr/share/misc/magic';
$magicfile = null;
if (is_dir($MAGICPATH) or is_link($MAGICPATH)) {
$magicfile = '/usr/share/misc/magic.mgc';
$MAGICPATH = get_config('pathtomagicdb');
if ($MAGICPATH === null) {
$MAGICPATH = '/usr/share/misc/magic';
$magicfile = null;
if (is_dir($MAGICPATH) or is_link($MAGICPATH)) {
$magicfile = '/usr/share/misc/magic.mgc';
}
}
else {
$magicfile = $MAGICPATH;
}
if (defined('FILEINFO_MIME_TYPE')) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment