During an install profile the database is not fully initialized, therefore when calling hook_requirements() the call to drupal_get_path() will fail as the path is not initialized for the mimedetect module. This is documented in the API for hook_requirements().

Attached is a patch which makes the install routine a bit more robust by trying 'magic', 'magic.mime', and 'magic.mgc' as shipped with mimedetect module before failing. This also adjusts mimedect.module to use the new routine.

This is similar to http://drupal.org/node/325831

Comments

jgraham’s picture

StatusFileSize
new2.5 KB

Updated patch uses the same function post install and pre-install, and verifies that the fileinfo extension is loaded prior to attempting to executing finfo_open().

See also http://drupal.org/node/927020

grkm2002’s picture

How do you install the patch? I put the file into the mimedetect folder and change ownership and put the snippet code from the readme file into settings.php and still nothing works. And.. yes i have cleared my cach and restarted apache and both magic and magic.mime works when using test.php. Using ubuntu 10.04 server.

jgraham’s picture

StatusFileSize
new2.5 KB

grkm2002 review the patch documentation found here http://drupal.org/patch/apply

New patch re-rolled. The call to finfo_open() should have been @finfo_open() like before.

grkm2002’s picture

Works like a charm. Great job
Copied mimedetect.patch to modules/mimedetect.
Change ownership and ran "patch < mimedetect.patch"

Vc Developer’s picture

Thanks, that did the job!...

jgraham’s picture

Status: Needs review » Reviewed & tested by the community

Changing status, as two others have chimed in indicating the patch worked for them.

pimok3000’s picture

patch from #3 works perfectly for me too...

rjbrown99’s picture

+1, also fixed a status report issue for me where mimedetect was showing a lack of the ability to open the info file.

gdl’s picture

The patch in #3 addressed an installation issue for me as well.

paulrooney’s picture

Patch in #3 resolved this error on status page:

Mime type detection PHP Fileinfo Extension
Fileinfo could not load the magic file. It could be corrupted. Try reinstalling the magic file distributed with the MimeDetect module.

manuel.adan’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Closed (outdated)

Closing this as outdated, feel free to re-open if you're still looking for a solution and waiting for appropriate assistance.