Error 500 when importing team data

Discussion forum about Anuko Time Tracker
Post Reply
serath
Posts: 10
Joined: Mon Feb 19, 2018 12:39 pm

Error 500 when importing team data

Post by serath » Mon Mar 19, 2018 1:51 pm

Hi,

Size of my team data is 123kb, so nothing really big. However when I try to import it to the server I get Error #500 and in logs I see:

Code: Select all

 PHP Warning:  in_array() expects parameter 2 to be array, null given in (...)/public_html/aaaaa/WEB-INF/lib/ttProjectHelper.class.php on line 215, referer: http://aaaa/import.php
Script timed out before returning headers: import.php

Increasing time or even putting a proper flag in PHP file to have infinite amount of time still leads to the same result.

Nik
Posts: 453
Joined: Wed May 26, 2010 5:55 pm

Re: Error 500 when importing team data

Post by Nik » Mon Mar 19, 2018 3:48 pm

What s the database version of TT you are importing from?

What is the database version of TT you are importing to? You can see it in dbinstall.php (on the bottom of the environment check output).

It looks like you may have a version inconsistency, as ttProjectHelper.class.php on line 215 calls ttTeamHelper::getActiveUsers immediately before, and this may return a false instead of user array. Note that new code left joins with tt_roles now, and you will definitely run into problems if database structure was not properly updated.

serath
Posts: 10
Joined: Mon Feb 19, 2018 12:39 pm

Re: Error 500 when importing team data

Post by serath » Mon Mar 19, 2018 8:59 pm

Hi Nik,

DB version (import to) was pulled directly from GitHub - 1.17.56. I now see that it was updated 3h ago, so lemme upgrade my DB version and redo the import.
Import from I would have to check - it was something done with my previous issue reported, so approx ~1 month ago.

Best regards

Nik
Posts: 453
Joined: Wed May 26, 2010 5:55 pm

Re: Error 500 when importing team data

Post by Nik » Mon Mar 19, 2018 9:50 pm

serath wrote:Hi Nik,

DB version (import to) was pulled directly from GitHub - 1.17.56. I now see that it was updated 3h ago, so lemme upgrade my DB version and redo the import.
Import from I would have to check - it was something done with my previous issue reported, so approx ~1 month ago.

Best regards
I you took the old one from github, then 1 month ago it was approximately 1.17.24.4002. If this is the case and assuming the current one is 1.17.64, then:

To upgrade the existing server:
- Back up database and the existing code including config.php just in case.
- Deploy new code.

in dbinstall.php execute the following 3 steps on the bottom:

Under Update database structure (v1.14 to v1.17.44)
- Click Update.
- Then click Update role_id.

Under Update database structure (v1.17.44 to v1.17.64)
- Click Update. At this point your server should be updated and ready to use. Remove dbinstall.php.


If you need to do export-import then:
- First upgrade the server to the most recent version, then export team data from it to XML.
- Deploy another new server somewhere else (most recent version). Then import XML into it. Importing an XML from a radically different version will NOT work.

I hope it helps.

serath
Posts: 10
Joined: Mon Feb 19, 2018 12:39 pm

Re: Error 500 when importing team data

Post by serath » Tue Mar 20, 2018 10:58 am

It worked now - thank you. The only problem now is that in my local DB I have all times registered, while in the new one (that I import to) there is none - while the reported time is listed in the XML file that is being imported.

Nik
Posts: 453
Joined: Wed May 26, 2010 5:55 pm

Re: Error 500 when importing team data

Post by Nik » Tue Mar 20, 2018 1:51 pm

serath wrote:It worked now - thank you. The only problem now is that in my local DB I have all times registered, while in the new one (that I import to) there is none - while the reported time is listed in the XML file that is being imported.
I am not sure I understand.

Do you have 2 separate Time Tracker installations?

If so, was the old server ugraded with dbinstall.php procedure, and what is the DB version it shows on the bottom of environment check? The normal response (as of now) is:

Code: Select all

Connection to database successful.
There are 23 tables in database.
Database version is: 1.17.64. 
Did you then imported the data to an XML file from the old, but updated server? The import completed and looks good with <log_item> pieces in the file.

The new server was installed, and a clean DB in it shows version 1.17.64. in dbinstall.php like below.

Code: Select all

There are 23 tables in database.
Database version is: 1.17.64. 
Notice that DB versions are the same in the old and new servers.

Then you do import of an XML file. If after successful import you don't see time items in the new server, then there is a problem, but my understanding of your process may be incorrect. Please clarify what is wrong / where exactly things stop working.

serath
Posts: 10
Joined: Mon Feb 19, 2018 12:39 pm

Re: Error 500 when importing team data

Post by serath » Tue Mar 20, 2018 2:53 pm

Yes - I have two instances: test instance and production instance. Test instance was running for a month to collect data etc. and now, once those tests are completed, I want to move to production server.

So what I did:
1) Upgrade test instance to Database version is: 1.17.64. -> SUCCESS
2) Export XML file -> I see times inside
3) Switch to production
4) Wipe DB, make a fresh install of 1.17.64 (just in case)
5) Import XML file -> I have a message that import went successful
6) Check users -> they are inside
7) Check imported time registered by users -> MISSING

So I see the time reported by users in test server and XML, but I dont see it in production server after it is imported (no error reported, I get the message that import was successful)

Nik
Posts: 453
Joined: Wed May 26, 2010 5:55 pm

Re: Error 500 when importing team data

Post by Nik » Wed Mar 21, 2018 4:04 am

Well, I see that we dropped the timestamp field from tt_log table but it still was used while importing entries.

I removed this in Time Tracker 1.17.64.4123.

One file is changed, WEB-INF/lib/ttImportHelper.class.php

This may or may not be the problem explaining missing time log entries in your situation.

If importing XML with code version 1.17.64.4123 does not help, consider sending us your XML file to see if we can figure out what is going on (free of charge). You can find the email on the contact form on the website.

serath
Posts: 10
Joined: Mon Feb 19, 2018 12:39 pm

Re: Error 500 when importing team data

Post by serath » Wed Mar 21, 2018 8:16 am

Now we went back to error 500 ;-) So I pulled back the version and I will simply start the registration there without this one test-month. And the worst thing is that even if I go back to the 'proper' class that skips timelog, then when I try to enter a new one I get 'Database error' result when submitting in the TimeRegistration tab - so I will simply do the SQL export/import and move all files.

Nik
Posts: 453
Joined: Wed May 26, 2010 5:55 pm

Re: Error 500 when importing team data

Post by Nik » Wed Mar 21, 2018 2:56 pm

serath wrote:when I try to enter a new one I get 'Database error' result when submitting in the TimeRegistration tab
This most likely means something is out of sync, either a database structure or code. By design, you SHOULD see a database error when an insert of time entry into the database fails.

The code roughly works like this (I removed parts to keep the example simple) :

Code: Select all

// Submit.
if ($request->isPost()) {
    // Validate user input here...

    $result = ttTimeHelper::insert(... parameters here ...);

   // If insert fails, display Database error.
   if (!result)
     $err->add($i18n->getKey('error.db')); // This is what you see.
}
What exactly is happening in your situation is hard to guess without seeing / verifying the data in your XML, database structure, or code deployed. To troubleshoot, one would have to verify that the db structure is as it is expected to be, the code is the latest, the XML file is properly formatted and contains all required pieces. One would normally open a support incident for this.

Post Reply