mirror of
https://github.com/ShaYmez/allmon2-last-heard.git
synced 2024-11-30 03:39:01 -05:00
Check for outdated node database
This commit is contained in:
parent
a2c3bf6872
commit
eb0e773540
@ -81,7 +81,7 @@ function fetchNodeInfoIRLP($node) {
|
|||||||
|
|
||||||
function fetchAllStarDb() {
|
function fetchAllStarDb() {
|
||||||
$dbFile = __DIR__.'/storage/allstar.txt';
|
$dbFile = __DIR__.'/storage/allstar.txt';
|
||||||
if (!file_exists($dbFile)) {
|
if (!file_exists($dbFile) || outdatedFile($dbFile)) {
|
||||||
$db = file_get_contents("http://allmondb.allstarlink.org");
|
$db = file_get_contents("http://allmondb.allstarlink.org");
|
||||||
file_put_contents($dbFile, $db);
|
file_put_contents($dbFile, $db);
|
||||||
return $db;
|
return $db;
|
||||||
@ -93,7 +93,7 @@ function fetchAllStarDb() {
|
|||||||
function fetchIRLPDb() {
|
function fetchIRLPDb() {
|
||||||
$dbFile = __DIR__.'/storage/irlp.txt';
|
$dbFile = __DIR__.'/storage/irlp.txt';
|
||||||
|
|
||||||
if (!file_exists($dbFile)) {
|
if (!file_exists($dbFile) || outdatedFile($dbFile)) {
|
||||||
$db = file_get_contents("http://status.irlp.net/nohtmlstatus.txt.zip");
|
$db = file_get_contents("http://status.irlp.net/nohtmlstatus.txt.zip");
|
||||||
file_put_contents("${dbFile}.zip", $db);
|
file_put_contents("${dbFile}.zip", $db);
|
||||||
shell_exec("/usr/bin/unzip -p ${dbFile}.zip > ${dbFile}");
|
shell_exec("/usr/bin/unzip -p ${dbFile}.zip > ${dbFile}");
|
||||||
@ -102,3 +102,7 @@ function fetchIRLPDb() {
|
|||||||
return file_get_contents($dbFile);
|
return file_get_contents($dbFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function outdatedFile($path)
|
||||||
|
{
|
||||||
|
return time() - filemtime($path) > 3600;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user