public function AcquiaPurgeService::stats in Acquia Purge 7
Retrieve progress statistics.
Parameters
string $key: (optional) The requested statistics key to return.
Return value
array Associative array with the keys 'running', 'total', 'remaining', 'good', 'bad', 'percent' and 'purgehistory'.
2 calls to AcquiaPurgeService::stats()
- AcquiaPurgeService::addPath in lib/
AcquiaPurgeService.php - Queue a single path.
- AcquiaPurgeService::addPaths in lib/
AcquiaPurgeService.php - Queue several paths.
File
- lib/
AcquiaPurgeService.php, line 610 - Contains AcquiaPurgeService.
Class
- AcquiaPurgeService
- The Acquia Purge service.
Code
public function stats($key = NULL) {
$info = array(
'purgehistory' => $this
->history(),
'locked' => $this
->lockActive(),
'total' => $this
->queue()
->total()
->get(),
'good' => $this
->queue()
->good()
->get(),
'bad' => $this
->queue()
->bad()
->get(),
'remaining' => 0,
'percent' => 100,
'running' => FALSE,
);
// Calculate the percentages when the queue doesn't seem to be empty.
if ($info['total'] !== 0) {
$info['running'] = TRUE;
$info['remaining'] = $info['total'] - $info['good'];
$info['percent'] = $info['remaining'] / $info['total'] * 100;
$info['percent'] = (int) (100 - floor($info['percent']));
}
return is_null($key) ? $info : $info[$key];
}