/**
  * Returns an associative array that contains the statistics
  * related to users.
  *
  * @return array associative array of statistics
  */
 public function execute()
 {
     $_pastTimestamp = Api_Bo_Util::getPastTimestamp(24 * 60 * 60);
     // "recent data" is for past 24 hours
     $this->totalUsers = Api_Bo_Users::getTotalCountOfUserProfiles();
     $_stats = array();
     $_stats['total_users'] = $this->totalUsers;
     $_stats['recently_added_users'] = Api_Bo_Users::getTotalCountOfUserProfiles($_pastTimestamp);
     $_stats['recently_added_friends'] = Api_Bo_Friends::getTotalCountOfFriends($_pastTimestamp);
     $_stats['friends_per_user'] = $this->getAverageCountOfFriendsPerUser();
     $_stats['recently_registered_apps_per_user'] = $this->getAverageCountOfRecentlyRegisteredAppsPerUser($_pastTimestamp);
     $_stats['mapped_identities_per_user'] = $this->getAverageCountOfMappedIdentitiesPerUser();
     $_stats['photos_per_user'] = $this->getAverageCountOfPhotosPerUser();
     return $_stats;
 }
Ejemplo n.º 2
0
 /**
  * Deletes all API call measurement data points older than the given amount of seconds.
  * 
  * @param $oldest the age (in seconds) of the oldest records that will be kept. Records
  *                that are older than this value will be purged. Pass in -1 to purge everything.
  * 
  * @return the number of rows purged, or false on error
  */
 public function purge($oldest)
 {
     $q = Doctrine_Query::create();
     $q->delete('RingsideM3MeasApiCall')->from('RingsideM3MeasApiCall m')->where('created < ?', Api_Bo_Util::getPastTimestamp($oldest));
     return $q->execute();
 }