1.2.2->1.2.4 upgrade fails with "Failed to upgrade!" error on core in upgrade.php

Bug #556972 reported by Greg Lund-Chaix
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Fix Released
High
Richard Mansfield

Bug Description

Upgrading from 1.2.2 to 1.2.4
Gentoo Linux
Apache 2.2.11
PHP 5.2.12
Suhosin 0.9.29
Postgres 8.2.7

When running upgrade.php, the first item - core - reports "Failed to upgrade!"

Process to reproduce:
1) un-tar mahara-1.2.4
2) "close" site
3) copy config.php & 3rd party artefacts over to 1.2.4
4) point apache at the new 1.2.4 webroot
5) run /admin/upgrade.php

/var/log/messages shows the following error:
PHP Fatal error: Call to undefined function mime_content_type() in /var/www/mahara/mahara-1.2.4/htdocs/lib/db/upgrade.php on line 1317

Greg Lund-Chaix (gchaix)
description: updated
Revision history for this message
Richard Mansfield (richard-mansfield) wrote :
Download full text (3.5 KiB)

Adding irc log for more information:

 [11:54] < gchaix> Huh. Anyone reporting problems going from 1.2.2 to 1.2.4? I'm getting a very uninformative "Failed to
                   upgrade!" error on core in upgrade.php
 [11:55] < gchaix> Not quite sure where to look for details :-)
 [12:05] <@richardm> gchaix: is there anything in the error log?
 [12:05] < gchaix> apache error log?
 [12:05] <@richardm> yeah
 [12:06] < gchaix> I don't think so ... I'll look again
 [12:06] < gchaix> it's on a pretty busy webhost, so I could have missed it in the noise
 [12:07] < gchaix> nope, doesn't appear to be any errors there
 [12:09] < gchaix> aha .. found something in syslog: PHP Fatal error: Call to undefined function mime_content_type() in
                   /var/www/mahara/mahara-1.2.4/htdocs/lib/db/upgrade.php on line 1317
 [12:10] <@richardm> gchaix: what version of php are you running?
 [12:11] < gchaix> checking
 [12:11] < gchaix> 5.2.12 gentoo (suhosin)
 [12:12] <@fmarier> gchaix, is the "mime_magic.magicfile" variable defined in your php.ini?
 [12:12] <@richardm> hm, that's not good, we should be checking whether that function exists before calling it
 [12:12] <@fmarier> (reading from http://nz.php.net/manual/en/function.mime-content-type.php#77429)
 [12:12] < gchaix> fmarier: one sec .. checking
 [12:13] < gchaix> fmarier: no, it's not defined in php.ini
 [12:14] < gchaix> for that matter that file dosn't exist on my system outside a Drupal module
 [12:15] <@richardm> maybe mime_magic.magicfile can be added in .htaccess
 [12:16] < gchaix> richardm: what would ship that magicfile? Mahara? Or should I be pulling it from somewhere global?
 [12:23] <@richardm> gchaix: mahara doesn't ship one
 [12:24] < gchaix> so I see :-) More importantly, is it a requirement? I can certainly add one if needed
 [12:26] <@richardm> Well I guess you've found out that it's a requirement to do the upgrade unless you hack the mahara code
                     :(
 [12:26] <@richardm> I'm not sure where the best place to get one is though
 [12:26] <@richardm> I thought it'd be available in your os somewhere but maybe not
 [12:27] < gchaix> I see one in /etc/apache2/magic that looks like it might work
 [12:27] * gchaix tries
 [12:30] < gchaix> Hm. The error disappeared in /var/log/messages, but I'm still getting the failed to upgrade error on
                   upgrade.php
 [12:31] <@richardm> And still nothing in the apache log?
 [12:33] < gchaix> no ... but apparently something is buffering my messages log (weird) it finally showed up. Same undefined
                   function mime_content_type() error
 [12:35] < gchaix> maybe php isn't happy with the .htaccess config. I'll try it in php.ini
 [12:40] < gchaix> No luck. I did notice that the apache mod_mime_magic module is loaded, but PHP seems to be ignoring
                   mime_magic.magicfile = "/etc/apache2/magic"
 [13:13] < gchaix> richardm: I need to get my site back online, so I'm going to revert to 1.2.2 for now. I did file a bug on
                   it, though: https://bugs.launchpad.net/mahara/+bug/556972
 [13:24] <@richardm> gchaix: sorry about that, if your problem is common I guess we migh...

Read more...

Revision history for this message
Richard Mansfield (richard-mansfield) wrote :

This can be fixed in windows by installing the php_fileinfo.dll extension, see:

http://mahara.org/interaction/forum/topic.php?id=1639#post8030

Revision history for this message
Richard Mansfield (richard-mansfield) wrote :

Added a dummy mime_content_type function in http://gitorious.org/mahara/mahara/commit/b1f4ed71c562effe9ed343ca2acc9e96e84bb365 to deal with the upgrade problem.

Changed in mahara:
milestone: none → 1.2.5
assignee: nobody → Richard Mansfield (richard-mansfield)
importance: Undecided → High
status: New → Fix Committed
Changed in mahara:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.