mirror of
https://github.com/rottenwheel/moner.ooo.git
synced 2024-11-09 20:53:46 +01:00
feat: auto-generate coingecko.json on first run
Added logic to check for the existence of 'coingecko.json' and generate it by executing 'coingecko.php' if it doesn't exist. This ensures that the necessary data file is available on first run, preventing potential errors or missing data.
This commit is contained in:
parent
57a7bca599
commit
90f6f6ce3e
@ -9,6 +9,12 @@ $currentUrl = $protocol . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
|
||||
$parentUrl = dirname($currentUrl);
|
||||
|
||||
// Get currency data from JSON
|
||||
if (!file_exists('coingecko.json')) {
|
||||
// Special case: First run.
|
||||
exec('php coingecko.php');
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
$api_cg = json_decode(file_get_contents('coingecko.json'), true);
|
||||
|
||||
// Configuration file
|
||||
|
Loading…
Reference in New Issue
Block a user