tomyvi / php-tracks-recorder

PHP front & backend for owntracks & overland payload
GNU General Public License v3.0
66 stars 34 forks source link

time stamp problem #23

Closed x-sven closed 4 years ago

x-sven commented 4 years ago

Hi, I got the code to work. However, the record_log.txt shows an error about "duplicate location found for epoch". All of the time stamps are having the same number. Here is my config.inc.php:

`<?php

//RENAME TO config.inc.php

setlocale(LC_TIME, 'de_DE.utf8');

//overland / owntracks
$_config['recorder'] = 'owntracks';

// MySQL / MariaDB
$_config['sql_type'] = 'mysql';

$_config['sql_host'] = 'localhost';
$_config['sql_user'] = '***';
$_config['sql_pass'] = ****';
$_config['sql_db'] = '***';
$_config['sql_prefix'] = '';

// SQLite
//$_config['sql_type'] = 'sqlite';
//$_config['sql_db'] = 'owntracks.db3';

$_config['log_enable'] = True;
    $_config['default_accuracy'] = 1000; //meters
$_config['default_trackerID'] = 'all';

$_config['geo_reverse_lookup_url'] = "http://193.63.75.109/reverse?format=json&zoom=18&accept-language=fr&addressdetails=0&email=sjobs@apple.com&";

$_config['geo_reverse_boundingbox_url'] = "http://nominatim.openstreetmap.org/reverse?format=json&osm_type=W&osm_id=";

?>`

I've tried different settings for setlocale(). Does not have any effects. I'm using the latest git version.

I would be happy for any support!

Best regards Sven

mbirth commented 4 years ago

The message indicates that you're trying to add a location to the database where there already exists a location for. One tracker can not be in multiple places at the same time.

x-sven commented 4 years ago

Thanks for the hint. I'm using android's owntrack app. It seems to be more or less a problem of the app. The log says, the record.php got multiple times the same location/time-combination.

mbirth commented 4 years ago

It might be that the server didn't indicate a success (code 200) and so the app is trying to upload the same record again.

x-sven commented 4 years ago

Hi Markus, I'm getting HTTP code 500 within the owntrack app and the endpoints are queued. I've cleared the buffer by restarting the app, then, the first data set is logged in the database, but the rest is queued again.

mbirth commented 4 years ago

What does your Apache(?) server log say?

x-sven commented 4 years ago

I'm using a webspace and do not know what kind of server is behind. I've found the following in the error.log:

[proxy_fcgi:error] [pid 112070:tid 140417362220800] [client 89.183.53.81:42082] AH01071: Got error 'PHP message: PHP Fatal error: Uncaught Error: Call to a member function getFriends() on null in /var/www/vhosts/serveraddress/lib/recorder/OwntracksRecorder.php:114\nStack trace:\n#0 /var/www/vhosts/serveraddress/record.php(78): OwntracksRecorder->getFriendsLocation(Object(OwntracksRecordStructure))\n#1 {main}\n thrown in /var/www/vhosts/serveraddress/lib/recorder/OwntracksRecorder.php on line 114'

Does that say anything?

mbirth commented 4 years ago

Looks like a bug.

https://github.com/tomyvi/php-tracks-recorder/blob/master/lib/recorder/OwntracksRecorder.php#L114 tries to use $sql without $sql being defined anywhere.

x-sven commented 4 years ago

Ok, can I support the issue with more details. I'm not an expert in php, however, I'm able to become one by the time... :-)

mbirth commented 4 years ago

I think @tomyvi didn't quite finish this feature. You info should be enough, though.

In the meantime, you could try my fork: https://github.com/mbirth/php-owntracks-recorder .

x-sven commented 4 years ago

Hi, thanks for the support! I guess, I would give your fork a trial, however, I use a common webspace and cannot install this yarn package manager that you are using.

mbirth commented 4 years ago

You can run Composer and Yarn locally on your machine and then copy over the whole directory to your webspace.