/**
  * 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
 private static function convertCollectionAsListToArray($collection, $deep = false)
 {
     return Api_Bo_Util::convertCollectionAsListToArray($collection, $deep);
 }
Ejemplo n.º 3
0
 /**
  * Returns statistics containing API duration data for all APIs.
  * 
  * @return M3_Util_Stats API duration statistics
  */
 public function getApiDurations()
 {
     $q = Doctrine_Query::create();
     $q->select('m.api_name api_name, count(m.id) count, min(m.duration) min, max(m.duration) max, avg(m.duration) avg')->from('RingsideM3MeasApiCall m')->groupBy('m.api_name');
     $_executeResults = $q->execute();
     $_listArray = Api_Bo_Util::convertCollectionAsListToArray($_executeResults);
     $_stats = array();
     foreach ($_listArray as $_arr) {
         $_stats[$_arr['api_name']] = array(M3_Util_Stats::COUNT => $_arr['count'], M3_Util_Stats::MIN => $_arr['min'], M3_Util_Stats::MAX => $_arr['max'], M3_Util_Stats::AVERAGE => $_arr['avg']);
     }
     return new M3_Util_Stats($_stats);
 }