TimeTrex and MySQL Timezone

Ask your questions regarding TimeTrex installation here.
Locked
matthewk
Posts: 1
Joined: Mon Sep 25, 2006 7:30 pm

TimeTrex and MySQL Timezone

Post by matthewk »

Ok, I have read the FAQ from here in regards to the timezone import, and have done those steps, checked inside phpMyAdmin and the zimezone tables appear and are now populated with data.
http://forums.timetrex.com/viewtopic.php?t=40

However, im still getting an error as soon as I log in, and it goes to EditUser.php (freshly installed timetrex)

Code: Select all

Fatal error: Uncaught exception 'ADODB_Exception' with message 'mysqlt error: [1298: Unknown or incorrect time zone: ''] in EXECUTE("SET SESSION time_zone=''") ' in /opt/lampp/htdocs/timetrex/classes/adodb/adodb-exceptions.inc.php:78 Stack trace: #0 /opt/lampp/htdocs/timetrex/classes/adodb/adodb.inc.php(886): adodb_throw('mysqlt', 'EXECUTE', 1298, 'Unknown or inco...', 'SET SESSION tim...', false, Object(ADODB_mysqlt)) #1 /opt/lampp/htdocs/timetrex/classes/adodb/adodb.inc.php(861): ADOConnection->_Execute('SET SESSION tim...', false) #2 /opt/lampp/htdocs/timetrex/includes/Interface.inc.php(77): ADOConnection->Execute('SET SESSION tim...') #3 /opt/lampp/htdocs/timetrex/interface/users/EditUser.php(29): require_once('/opt/lampp/htdo...') #4 {main} thrown in /opt/lampp/htdocs/timetrex/classes/adodb/adodb-exceptions.inc.php on line 78
Any idea's, as I cant seem to work out what it actually wants.
mikeb
Posts: 709
Joined: Thu Jul 27, 2006 11:58 am

Re: TimeTrex and MySQL Timezone

Post by mikeb »

matthewk wrote:Ok, I have read the FAQ from here in regards to the timezone import, and have done those steps, checked inside phpMyAdmin and the zimezone tables appear and are now populated with data.
http://forums.timetrex.com/viewtopic.php?t=40

However, im still getting an error as soon as I log in, and it goes to EditUser.php (freshly installed timetrex)

Code: Select all

Fatal error: Uncaught exception 'ADODB_Exception' with message 'mysqlt error: [1298: Unknown or incorrect time zone: ''] in EXECUTE("SET SESSION time_zone=''") ' in /opt/lampp/htdocs/timetrex/classes/adodb/adodb-exceptions.inc.php:78 Stack trace: #0 /opt/lampp/htdocs/timetrex/classes/adodb/adodb.inc.php(886): adodb_throw('mysqlt', 'EXECUTE', 1298, 'Unknown or inco...', 'SET SESSION tim...', false, Object(ADODB_mysqlt)) #1 /opt/lampp/htdocs/timetrex/classes/adodb/adodb.inc.php(861): ADOConnection->_Execute('SET SESSION tim...', false) #2 /opt/lampp/htdocs/timetrex/includes/Interface.inc.php(77): ADOConnection->Execute('SET SESSION tim...') #3 /opt/lampp/htdocs/timetrex/interface/users/EditUser.php(29): require_once('/opt/lampp/htdo...') #4 {main} thrown in /opt/lampp/htdocs/timetrex/classes/adodb/adodb-exceptions.inc.php on line 78
Any idea's, as I cant seem to work out what it actually wants.
Unfortunately this bug sneaked in to v1.2.0-beta2, it'll be fixed for beta3. In the mean time you can fix it by doing the following:

At line 74 of includes/Interface.inc.php change:

Code: Select all

                //Since MySQL can't store timezones in timestamp columns,
                //We need to set the timezone for this MySQL session.
                if ( $db->dataProvider == 'mysql' ) {
                        $db->Execute('SET SESSION time_zone=\''. $current_user_prefs->getTimeZone() .'\'');
                }
to:

Code: Select all

                //Since MySQL can't store timezones in timestamp columns,
                //We need to set the timezone for this MySQL session.
                $db_time_zone_error = FALSE;
                if ( $db->dataProvider == 'mysql' AND $current_user_prefs->getTimeZone() != '' ) {
                        //Instead of using timezone names, we could set time_zone = "-08:00";
                        //This might get around the fact that MySQL doesn't always have timezone data imported.
                        if ( @$db->Execute('SET SESSION time_zone=\''. $current_user_prefs->getTimeZone() .'\'') ==
FALSE ) {
                                //Setting timezone failed, alert user to this fact.
                                $db_time_zone_error = TRUE;
                        }
                }

TimeTrex Community Edition is developed and supported by volunteers.
Help motivate us to continue by showing your appreciation!
shaunw
Posts: 7839
Joined: Tue Sep 19, 2006 2:22 pm

Post by shaunw »

Mathew, TimeTrex v1.2.0 beta3 fixes this bug and was released yesterday. If you get a chance please give it a try and let us know.
Locked