public function AcquiaLiftAPI::getCallsForPreviousMonth in Acquia Lift Connector 7
Returns the counts of API calls for the month prior to the date provided.
Parameters
$timestamp: The timestamp representing the date from which to calculate the previous month's API calls.
Return value
array An associative array with type of call as keys and counts for each type as values, e.g. array( 'decisions' => 1000, 'goals' => 100, 'expires' => 2, 'webactions' => 0, 'other' => 10 )
1 call to AcquiaLiftAPI::getCallsForPreviousMonth()
- AcquiaLiftAPI::getTotalRuntimeCallsForPreviousMonth in includes/
acquia_lift.classes.inc - Returns the total number of runtimeAPI calls for the month prior to the date provided.
File
- includes/
acquia_lift.classes.inc, line 1298 - Provides an agent type for Acquia Lift
Class
- AcquiaLiftAPI
- @file Provides an agent type for Acquia Lift
Code
public function getCallsForPreviousMonth($timestamp) {
$date = getdate($timestamp);
$current_month = $date['mon'];
$current_month_year = $last_month_year = $date['year'];
if ($current_month == 1) {
$last_month = 12;
$last_month_year = $current_month_year - 1;
}
else {
$last_month = $current_month - 1;
if ($last_month < 10) {
$last_month = '0' . $last_month;
}
}
// Get a timestamp for the first of the month in question.
$ts_last_month = strtotime("{$last_month}/01/{$last_month_year}");
// Use this timestamp to get the number of days in that month.
$num_days_last_month = date('t', $ts_last_month);
$date_start = $last_month_year . '-' . $last_month . '-01';
$date_end = $last_month_year . '-' . $last_month . '-' . $num_days_last_month;
$calls_last_month = $this
->getAPICallsForPeriod($date_start, $date_end);
return $calls_last_month;
}