You are here

function drush_acquia_purge_ap_purge in Acquia Purge 6

Same name and namespace in other branches
  1. 7 acquia_purge.drush.inc \drush_acquia_purge_ap_purge()

Purge a specified path from your balancers.

Parameters

string $path: The Drupal path (e.g. '<front>', 'user/1' or an aliased path).

File

./acquia_purge.drush.inc, line 131
Drush integration providing common maintenance tasks.

Code

function drush_acquia_purge_ap_purge($path = NULL) {

  // 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.");
  }

  // Check if the path was provided.
  if (!is_string($path)) {
    return drush_set_error("You haven't provided a path to be purged.");
  }

  // Block invocations with URL's instead of paths, we'll handle the URLs!
  if (stristr($path, 'http:') || stristr($path, 'https:')) {
    return drush_set_error("You can't provide a URL, only paths...");
  }

  // Strip the path and remove potentially added double paths.
  $path = trim($path, '/');
  $path = str_replace('//', '/', $path);

  // If the path is empty, assume <front>.
  if (empty($path)) {
    $path = '<front>';
  }

  // Add the given path to the queue and dispatch processing to ap-process.
  acquia_purge_purge_path($path);
  drush_acquia_purge_ap_process();
}