This is manifest across multiple sites on a multi-site installation, and it appears that somehow something related to the media module got hosed. When I try to upload new media to an existing gallery page it just hangs, though the media did get uploaded. If I try to add media from the library I get an "error getting media" popup. If I try to edit a gallery page I get a server 500 error. I can edit "all galleries" and I can edit media within a gallery, just cannot edit the gallery page itself or add new media to it. All existing media displays just fine.

The PHP error that pops up in the log looks like this:

[25-Nov-2012 19:07:07] PHP Fatal error: Call to undefined function file_info_file_types() in /home2/spinland/public_html/drupal7/sites/all/modules/media/media.module on line 1063

I've tried re-uploading all the modules on the server to make sure nothing got deleted, and have disabled and re-enabled Media Gallery on different sites, and nothing seems to help. I'm hoping there's some kind of configuration reset or something I can do to get this working again? I don't understand why it suddenly quit working; it was working fine for months.

If it helps, here's the cited bit of code from media.module:

function media_get_thumbnail_preview($file, $link = NULL) {
// If a file has an invalid type, allow file_view_file() to work.
if (!file_info_file_types($file->type)) { //////////////////////// line 1063
$file->type = media_get_type($file);
}

Many thanks in advance!

Comments

Spinland’s picture

Okay, this is what I've tried since I posted above...

I restored one of the sites from a database backup made before this trouble started.

I reinstalled Drupal 7.17 core.

I replaced the contents of sites/all with that from another multi-site installation where the media uploads work fine.

I created a new Drupal site and gave it a media gallery.

Nothing worked. In all cases I am still unable to upload media, nor edit a gallery that already has media in it. I still get the PHP error I cited above.

Is there anyone who has an idea what could be happening here?

ludo1960’s picture

sounds like a permission problem (maybe!) double check the permissions on the files folder.

Spinland’s picture

This is affecting six different sites on the same multi-site installation. The permissions are 755 for all the files folders. The media are getting uploaded just fine, but then they cannot be accessed. If I try to add media from the library I get an "error getting media" popup, and again a fatal PHP error in the media module.

ludo1960’s picture

what is the file type? Try it with a youtube clip and see what happens. Shouldn't sites/default/files be 777?

Spinland’s picture

When I try a youtube clip I just get a blank overlay and it hangs until I refresh the page. This multi-site was working fine for months, this problem just cropped up recently. I noticed it for the first time yesterday. I was uploading content as recently as the 17th.

Spinland’s picture

The media doesn't get uploaded to default/files, each site has its own files folder. /sites/example.com/files.

ludo1960’s picture

/sites/example.com/files hmm still think the files permission should be 777 -R, could be wrong, just my 2 cents worth. Good luck!

Spinland’s picture

Since the files are actually getting uploaded there doesn't seem to be any sort of write issues. Just to be sure I changed one of the sites' files folder to 777 and tried to edit one of the gallery pages: same error. Thanks anyway!

Spinland’s picture

I migrated one of the affected sites to a different hosting account with the same company, under a new domain name, and now gallery page edits and media uploads are working. Does this sound like some kind of PHP or MySQL issue with my host provider?

ludo1960’s picture

have you got access to your php.ini file? I know the media module works a treat for me, so yes you are probably correct in thinking it is a php issue, doubt very much it is a mysql config error. Any clues in the apache log files?

Spinland’s picture

It's on a Hostmonster server, all I think I get are the PHP errors. At least that's all that turns up when I try to get error logs via cpanel. The error that comes up every time I try to edit a gallery page is the same one I posted above:

[26-Nov-2012 08:35:43] PHP Fatal error: Call to undefined function file_info_file_types() in /home2/spinland/public_html/drupal7/sites/all/modules/media/media.module on line 1063

Spinland’s picture

I have my own php.ini file in my home directory, but again all this worked just fine less than a week ago and I haven't made any changes to it. I tried deleting it this morning but it made no difference.

I was online with Hostmonster tech support last night and they said it was a Drupal issue and washed their hands.

ludo1960’s picture

Hostmonster suck, get a vps! Sorted!

Spinland’s picture

It's now clear than I missed something when I re-installed, either the modules or the core. This time I went in from the command line and made doubly sure everything that wasn't site specific was deleted and then did another full re-install of core and the modules.

I don't know what got corrupted, or how, but now it appears as though the media module is again working properly.

Spinland’s picture

It's the November 18 update to the File entity (fieldable files) module. After I did the latest full re-install, that module wanted to be updated; when I did so all the sites were again broken. Reverting to the last version of this module fixed it again.

I've logged a bug report with that module's page.

Spinland’s picture

I never saw this disclaimer:

"This module is not compatible with Media 1.x. You must use the File entity module that is included with Media 1.x and not this separate project. This is only for use with Media 2.x."

Media Gallery only currently works with Media 1.x. I should never have included this module.

ludo1960’s picture

glad you got it sorted!

sdk’s picture

This was the problem! I encountered the same error message on my system. I accidentally updated from file_entity 7.x-2.0-unstable6 to file_entity 7.x-2.0-unstable7. Going back to the previous version made things work again. Thank you for the pointer!

wishow’s picture

Right!

I Just replaced the Entity file module folder with the previous version of the module: file_entity-7.x-2.0-unstable6.zip.

Shurik Barkov’s picture

I had the same problem.
All the evil was in file_entity.

There was media-2 module installed on site before.
Media-2 has dependence on file_entity module.
>> File Entity (separate module for Media 7.x-2.x only, included in Media 7.x-1.x)

I have uninstalled media-2 and installied media-1.
In media library i recieved fatal error: Call to undefined function file_info_file_types()

To solve this you need uninstall and remove file_entity module before installition of media-1.

#drush pm-uninstall file_entity
#rm -r sites/all/modules/file_entity

And you do not need to install unstable module file_entity-7.x-2.0-unstableXX.
You can use stable version 7.x-1.3.
In case of installing media-1 using drush it will be installed automaticaly (version 7.x-1.3).

# drush en media

Now media works again on my project.