class Purge in Acquia Content Hub 8.2
Same name in this branch
- 8.2 modules/acquia_contenthub_subscriber/src/EventSubscriber/HandleWebhook/Purge.php \Drupal\acquia_contenthub_subscriber\EventSubscriber\HandleWebhook\Purge
- 8.2 modules/acquia_contenthub_publisher/src/EventSubscriber/HandleWebhook/Purge.php \Drupal\acquia_contenthub_publisher\EventSubscriber\HandleWebhook\Purge
Class PurgePublisher.
Reacts on "purge" webhook and purges the publish export tracking database table and the export queue.
@package Drupal\acquia_contenthub_publisher\EventSubscriber\HandleWebhook
Hierarchy
Expanded class hierarchy of Purge
1 file declares its use of Purge
- PurgeTest.php in tests/
src/ Kernel/ EventSubscriber/ HandleWebhook/ PurgeTest.php
2 string references to 'Purge'
- acquia_contenthub_publisher.services.yml in modules/
acquia_contenthub_publisher/ acquia_contenthub_publisher.services.yml - modules/acquia_contenthub_publisher/acquia_contenthub_publisher.services.yml
- ContentHubExportQueueForm::buildForm in modules/
acquia_contenthub_publisher/ src/ Form/ ContentHubExportQueueForm.php - Form constructor.
1 service uses Purge
- acquia_contenthub_publisher.handle_webhook.purge in modules/
acquia_contenthub_publisher/ acquia_contenthub_publisher.services.yml - Drupal\acquia_contenthub_publisher\EventSubscriber\HandleWebhook\Purge
File
- modules/
acquia_contenthub_publisher/ src/ EventSubscriber/ HandleWebhook/ Purge.php, line 18
Namespace
Drupal\acquia_contenthub_publisher\EventSubscriber\HandleWebhookView source
class Purge extends PurgeBase {
/**
* The Database connection.
*
* @var \Drupal\Core\Database\Connection
*/
protected $database;
/**
* Purge constructor.
*
* @param \Drupal\Core\Queue\QueueFactory $queue_factory
* The queue factory.
* @param \Drupal\Core\Logger\LoggerChannelInterface $logger_channel
* The logger channel.
* @param \Drupal\Core\Database\Connection $database
* The database connection.
*/
public function __construct(QueueFactory $queue_factory, LoggerChannelInterface $logger_channel, Connection $database) {
parent::__construct($queue_factory, $logger_channel);
$this->database = $database;
}
/**
* {@inheritdoc}
*/
protected function getQueueName() : string {
return 'acquia_contenthub_publish_export';
}
/**
* Reacts on "purge successful" webhook.
*
* @see \Drupal\acquia_contenthub\EventSubscriber\HandleWebhook\PurgeBase::onHandleWebhook()
*/
protected function onPurgeSuccessful() {
parent::onPurgeSuccessful();
$this->database
->truncate('acquia_contenthub_publisher_export_tracking')
->execute();
$this->logger
->info('Database table "acquia_contenthub_publisher_export_tracking" has been truncated successfully.');
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Purge:: |
protected | property | The Database connection. | |
Purge:: |
protected | function |
Returns the queue name to delete. Overrides PurgeBase:: |
|
Purge:: |
protected | function |
Reacts on "purge successful" webhook. Overrides PurgeBase:: |
|
Purge:: |
public | function |
Purge constructor. Overrides PurgeBase:: |
|
PurgeBase:: |
protected | property | The logger service. | |
PurgeBase:: |
protected | property | The Queue. | |
PurgeBase:: |
public static | function | Returns an array of event names this subscriber wants to listen to. | |
PurgeBase:: |
public | function | On handle webhook event. | |
PurgeBase:: |
protected | constant | The webhook's "purge" event name. |