12345678910111213141516171819202122232425262728293031323334353637383940 |
- <?php
- /**
- * @file
- * Installation file for Piwik - Web analytics module.
- */
- use Drupal\Core\Url;
- /**
- * Implements hook_uninstall().
- *
- * Remove cache directory if module is uninstalled.
- */
- function piwik_uninstall() {
- piwik_clear_js_cache();
- }
- /**
- * Implements hook_requirements().
- */
- function piwik_requirements($phase) {
- $requirements = [];
- if ($phase == 'runtime') {
- $config = \Drupal::config('piwik.settings');
- // Raise warning if Piwik user account has not been set yet.
- if (!preg_match('/^\d{1,}$/', $config->get('site_id'))) {
- $requirements['piwik_site_id'] = [
- 'title' => t('Piwik module'),
- 'description' => t('Piwik module has not been configured yet. Please configure its settings from the <a href=":url">Piwik settings page</a>.', [':url' => Url::fromRoute('piwik.admin_settings_form')->toString()]),
- 'severity' => REQUIREMENT_WARNING,
- 'value' => t('Not configured'),
- ];
- }
- }
- return $requirements;
- }
|