You are here

abstract class AcquiaPurgeProcessorBase in Acquia Purge 7

Base class for processors that process items from the queue.

Hierarchy

Expanded class hierarchy of AcquiaPurgeProcessorBase

File

lib/processor/AcquiaPurgeProcessorBase.php, line 11
Contains AcquiaPurgeProcessorBase.

View source
abstract class AcquiaPurgeProcessorBase implements AcquiaPurgeProcessorInterface {

  /**
   * The Acquia Purge service object.
   *
   * @var AcquiaPurgeService
   */
  protected $service;

  /**
   * Construct a new AcquiaPurgeProcessorBase instance.
   *
   * @param AcquiaPurgeService $service
   *   The Acquia Purge service object.
   */
  public function __construct(AcquiaPurgeService $service) {
    $this->service = $service;
  }

  /**
   * Attempt to process a chunk from the queue.
   *
   * @param bool $log
   *   (optional) Whether diagnostic failure should be logged or not.
   */
  protected function processQueueChunk($log = TRUE) {

    // Test if the diagnostic tests prohibit purging the queue.
    if ($err = $this->service
      ->diagnostics()
      ->isSystemBlocked()) {
      if ($log) {
        $this->service
          ->diagnostics()
          ->log($err);
      }
      return;
    }

    // Acquire a lock and process a chunk from the queue.
    if ($this->service
      ->lockAcquire()) {
      $this->service
        ->process();
      $this->service
        ->lockRelease();
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
AcquiaPurgeProcessorBase::$service protected property The Acquia Purge service object.
AcquiaPurgeProcessorBase::processQueueChunk protected function Attempt to process a chunk from the queue. 1
AcquiaPurgeProcessorBase::__construct public function Construct a new AcquiaPurgeProcessorBase instance. 2
AcquiaPurgeProcessorInterface::getSubscribedEvents public function Subscribe to the events this processor requires. 3
AcquiaPurgeProcessorInterface::isEnabled public static function Determine if the processor is enabled or not. 3