Skip to content

Commit

Permalink
Add warning if quant_purger registry is empty.
Browse files Browse the repository at this point in the history
  • Loading branch information
kepol committed Jul 30, 2023
1 parent fb31e24 commit 9c34f8a
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions modules/quant_purger/src/Controller/QuantPurgerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,21 @@ class QuantPurgerController extends ControllerBase {
* Quant Purger page with helpful information.
*/
public function content() {
// Check if database table is empty.
$count = \Drupal::database()->select('purge_queuer_quant')->countQuery()->execute()->fetchField();
if ($count) {
$text = $this->t('The Quant Purger registry database table has :count entries.<br/><br/>', [':count' => $count]);
}
else {
$warning = $this->t("The Quant Purger registry database table is empty which can happen if you haven't configured this module or run a seed yet.<br/>This will not affect the normal Quant functionality, but does affect the purger functionality.");
\Drupal::messenger()->addWarning($warning);
}

if (\Drupal::moduleHandler()->moduleExists('purge_ui')) {
$text = $this->t('You can add or remove cache tags and URLs via the <a href=":url">Purge UI</a>.<br/><br/>', [':url' => '/admin/config/development/performance/purge']);
$text .= $this->t('You can add and update the Quant Purger settings via the <a href=":url">Purge UI</a>.<br/><br/>', [':url' => '/admin/config/development/performance/purge']);
}
else {
$text = $this->t('Enabling the <a href=":url">Purge UI module</a> will allow you to configure the Quant Purger module through the UI.<br/><br/>', [':url' => 'https://www.drupal.org/project/purge']);
$text .= $this->t('Enabling the <a href=":url">Purge UI module</a> will allow you to configure the Quant Purger module through the UI.<br/><br/>', [':url' => 'https://www.drupal.org/project/purge']);
}
$text .= $this->t('For more information about the Quant Purger module, refer to the <a href=":url">documentation</a>.', [':url' => 'https://docs.quantcdn.io/docs/integrations/drupal/purger']);
$build = [
Expand Down

0 comments on commit 9c34f8a

Please sign in to comment.