Esempio n. 1
0
 public static function getPreviousStatID()
 {
     $stats = apc_fetch('lastStats', $success);
     if ($success === false) {
         $database = new DatabaseManager();
         StatManager::verifyTable($database);
         $resource = $database->query("SELECT * FROM `statistics` ORDER BY `date` ASC LIMIT 1");
         //maybe this should be DESC idk im not a scienctist
         if (!$resource) {
             throw new Exception("Database error: " . $database->error());
         }
         if ($resource->num_rows == 0) {
             $stats = false;
         } else {
             $row = $resource->fetch_object();
             $stats = StatManager::getFromID($row->id, $row)->getID();
         }
         $resource->close();
         apc_store('lastStats', $stats, StatManager::$previousCacheTime);
     }
     return $stats;
 }
Esempio n. 2
0
<?php

require_once realpath(dirname(__FILE__) . "/StatManager.php");
$sid = StatManager::getPreviousStats();
return StatManager::getFromID($sid);