Esempio n. 1
0
 // Setting the lookup cache limit to 1 hour / 3600 seconds
 $cacheLimit = time() - 3600;
 // Getting the oldest key that isn't set to 999 (disabled) and
 $stmt = $db->prepare('SELECT * FROM core_cron WHERE cron_updated < ? AND cron_status = 1 ORDER BY cron_updated ASC LIMIT 1');
 $stmt->execute(array($cacheLimit));
 $apiLookup = $stmt->fetch(PDO::FETCH_ASSOC);
 // Checking to see if anything is out of cache
 if (isset($apiLookup['api_keyID'])) {
     // Checking the API key
     $key = new ApiKey($apiLookup['api_keyID'], $apiLookup['api_vCode'], $apiLookup['uid'], $db);
     // Checking to see if the key is valid
     if ($key->getKeyStatus() == 1) {
         // Key is valid, updating it
         $updateKey = $key->updateAPIKey();
         // Checking the access mask for the key
         if ($key->accessMaskCheck()) {
             // Looping through the characters
             foreach ($key->getCharacters() as $character) {
                 $char = new Character($character['characterID'], $key->getKeyID(), $key->getVCode(), $key->getAccessMask(), $db, $apiLookup['uid']);
                 if ($char->getExistance() or $char->getExistance() == FALSE) {
                     $char->updateCharacterInfo();
                     /*
                      * SKILLS UPDATE SECTION
                      */
                     $skills = $char->updateCharacterSkills();
                     // Checking for skills update success
                     if ($skills === "SDE Failure") {
                         echo date('Ymd H:i:s', time()) . " - cron_update.php - FAILURE - Skill detected that does not exist in SDE for charid " . $character['characterID'] . "\n";
                     } elseif ($skills === FALSE) {
                         echo date('Ymd H:i:s', time()) . " - cron_update.php - FAILURE - General processing error for charid " . $character['characterID'] . "\n";
                     }