function piwik_requirements in Piwik Web Analytics 8
Same name and namespace in other branches
- 5 piwik.install \piwik_requirements()
- 6.2 piwik.install \piwik_requirements()
- 6 piwik.install \piwik_requirements()
- 7.2 piwik.install \piwik_requirements()
- 7 piwik.install \piwik_requirements()
Implements hook_requirements().
File
- ./
piwik.install, line 22 - Installation file for Piwik - Web analytics module.
Code
function piwik_requirements($phase) {
$requirements = [];
switch ($phase) {
case 'install':
if (\Drupal::moduleHandler()
->moduleExists('matomo')) {
// https://matomo.org/blog/2018/01/piwik-is-now-matomo/
$requirements['piwik_matomo_is_installed'] = array(
'title' => t('Piwik is now Matomo!'),
'value' => t('Fails'),
'severity' => REQUIREMENT_ERROR,
'description' => t('Piwik has been renamed to Matomo Analytics. Piwik module is blocked now and cannot re-enabled! Please remove piwik module from your system. It is no longer used.'),
);
}
break;
case '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'),
];
}
break;
}
return $requirements;
}