Created
August 18, 2016 12:26
-
-
Save wschoot/aaa98abe161532f160d06ea713a960db to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
## If dir exists, maintain cache so that messages don't repeat themselves | |
if (is_dir(__DIR__ . '/cache')) { | |
$filename = __DIR__ . '/cache/' . hash('crc32b', $poke_id.$gone); | |
if(!file_exists($filename)) { | |
file_put_contents($filename, "$poke_id $poke $gone\n"); | |
} else { | |
exit; | |
} | |
# Check if files are older than 15 minutes | |
if ($handle = opendir(__DIR__ . '/cache')) { | |
while (false !== ($entry = readdir($handle))) { | |
if ($entry != "." && $entry != "..") { | |
$leeftijd = (time() - filemtime(__DIR__ . '/cache/'.$entry)); | |
if ($leeftijd > 900) { | |
unlink(__DIR__ . '/cache/'.$entry); | |
} | |
} | |
} | |
closedir($handle); | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment