webapi for receiving data from the IDA-BGS plugin for EDMC
This API receives JSON data packages from the IDA-BGS EDMC plugin to track faction data.
Data sent to the API can requested by the IDA-BGS FrontEnd website or the IDA-BGS Bot
- Download the .PHP files to your website
- Create required SQL tables for data storage (see .sql files for details)
- Create a cron job, that runs php ./tickdetect.php
tickdetect.php is configured to get the latest tick datetime from EliteBGS Tick Bot
Once a tick is detected, tickdetect.php triggers tickprocessor.php to start mining the records timestamped between the last tick, and the one before that
tickprocessor.php should mine for data 1x per 24hrs, but ticks have been off before (due to things like updates), so there are no guarantees when the next tick will happen.
Once a tick has completed, every record with a timestamp in that tick, will be collected and merged.
Conflicting records will be compared by counting the amount of duplicate records, the record with the most exact duplications wins the election and becomes the snapshot for that system/faction.
Want to make this work for another faction, no changes are required to the files in this repo.
Some changes need to be made to the IDA-BGS EDMC plugin
Make sure you never have your database username/password inside your publicly reachable .php files.
I have placed a file 'db.inc.php' outside the /public_html/ folder (which is the root for my website).
This is why you can see an include() function in every file that references ../private/db.inc.php
As far as I am aware, this is the most secure way to store database credentials.
This API is still under construction, bugs new features WILL appear unexpectedly.
Patches are always welcome.
- Everybody who helped test the EDMC Plugin
(devnull, Optimus Stan) - HammerPiano, wouldnt have gotten the plugin working so fast without your advice
- EliteBGS Tick Bot
- Everyone at EDCD: Community Developers Discord channel
(Phelbore, Athanasius, Gazelle, tez, Garud, T'kael, VerticalBlank, anyone else I missed?)