You are here

public function AcquiaPurgeService::addPath in Acquia Purge 7

Queue a single path.

Add a path to the queue, meant for later processing. When late runtime processing is enabled, processing of the queue likely happens during this same request, but is not a guarantee. With cron-processing enabled, the added item can get processed from there. When adding items as logged-in Drupal user, the client-side AJAX processor will show up for this user when rendering any (authenticated) page. See the FAQ on instructions on how to process the queue yourself, although this is not recommended with the already available means of processing.

Parameters

string $path: The Drupal path (for example: '<front>', 'user/1' or a alias).

Return value

array Associative array with the keys 'running', 'total', 'remaining', 'good', 'bad', 'percent' and 'purgehistory'.

File

lib/AcquiaPurgeService.php, line 133
Contains AcquiaPurgeService.

Class

AcquiaPurgeService
The Acquia Purge service.

Code

public function addPath($path) {
  $path = _acquia_purge_input_clean($path);

  // Queue the item when it is unique and trigger the processors.
  if (!$this
    ->deduplicate($path)) {
    if ($this
      ->queue()
      ->createItem(array(
      $path,
    ))) {
      $this
        ->processors()
        ->emit('onItemsQueued');
    }
  }
  return $this
    ->stats();
}