Skip to content
Snippets Groups Projects
Commit ef7634dd authored by Giuseppe Rota's avatar Giuseppe Rota
Browse files

Added checks to prevent installing this module when webprofiler is present

parent 1686c30f
No related branches found
No related tags found
No related merge requests found
......@@ -7,9 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
## [1.0-rc3] - 2021-09-16
### Added
- A bunch of explicit dev deps to make both drupalci odd pipelines work and local `composer run tests`.
- Checks to prevent installing this module when webprofiler is present.
Webprofiler changes without discrimination the cache backend classes even is
a bin`->`backend association is forced in the settings.php.
Webprofiler's cache backend class does not have pcb's `deleteAllPermanent` method.
## [1.0-rc2] - 2021-08-20
......
<?php
/**
* @file
* This is the Prometheus Exporter module for exporting metrics.
*/
/**
* Implements hook_requirements().
*/
function prometheusio_exporter_requirements($phase) {
$requirements = [];
if ($phase === 'install' && \Drupal::service('module_handler')->moduleExists('webprofiler')) {
$requirements['prometheusio_exporter_incompatible_with_webprofiler'] = [
'title' => t('PrometheusIO exporter incompatible with webprofiler.'),
'description' => t('PrometheusIO exporter is incompatible with webprofiler, please uninstall webprofiler first.'),
'severity' => REQUIREMENT_ERROR,
];
}
return $requirements;
}
......@@ -40,3 +40,22 @@ function prometheusio_exporter_modules_installed($modules, $is_syncing) {
$collector_manager->syncPluginConfig();
}
}
/**
* Implements hook_module_preinstall().
*
* Launch an exception if webprofiler is present.
* The hook_requirements in .install is enough for web based module
* installation but not enough for (all versions of) drush.
* See https://github.com/drush-ops/drush/pull/4337 .
*/
function prometheusio_exporter_module_preinstall() {
if (\Drupal::service('module_handler')->moduleExists('webprofiler')) {
$extension_config = \Drupal::configFactory()->getEditable('core.extension');
$modules = $extension_config->get('module');
unset($modules['prometheusio_exporter']);
$extension_config->set('module', $modules)->save(TRUE);
drupal_flush_all_caches();
throw new \Exception('Prometheus.io Exporter is incompatible with webprofiler, please uninstall webprofiler first.');
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment