mirror of
https://github.com/rottenwheel/moner.ooo.git
synced 2024-12-22 08:07:47 +00: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
1 changed files with 6 additions and 0 deletions
|
@ -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 a new issue