function drush_acquia_purge_ap_process in Acquia Purge 6
Same name and namespace in other branches
- 7 acquia_purge.drush.inc \drush_acquia_purge_ap_process()
Purge all queued items from the command line.
1 call to drush_acquia_purge_ap_process()
- drush_acquia_purge_ap_purge in ./
acquia_purge.drush.inc - Purge a specified path from your balancers.
File
- ./
acquia_purge.drush.inc, line 202 - Drush integration providing common maintenance tasks.
Code
function drush_acquia_purge_ap_process() {
// Stop invocation if we are not detecting Acquia Cloud heuristics.
if (!_acquia_purge_are_we_on_acquiacloud()) {
return drush_set_error("You must be on Acquia Cloud to use Acquia Purge.");
}
// Acquire a lock and ensure nobody else is purging something.
if (!lock_acquire('acquia_purge_ajax_processor', ACQUIA_PURGE_QUEUE_LOCK_TIMEOUT)) {
return drush_set_error("Unable to acquire lock, ensure that all users " . "close their browser tabs as a different purge seems to be active!");
}
// Retrieve the statistics and determine if processing is needed.
$stats = _acquia_purge_queue_stats();
if (!$stats['running']) {
return drush_set_error("The purge queue seems to be empty!");
}
// Calculate how many iterations we need and start processing accordingly.
$log = array();
do {
$items = _acquia_purge_queue_pop('_acquia_purge_queue_processpurge');
// Retrieve the statistics and log the purged urls.
$stats = _acquia_purge_queue_stats();
foreach ($stats['purgehistory'] as $logitem) {
if (!in_array($logitem, $log)) {
drush_log(dt("Purged: @url", array(
'@url' => $logitem,
)), 'ok');
$log[] = $logitem;
}
}
} while (count($items));
// We are done so lets release the lock.
lock_release('acquia_purge_ajax_processor');
}