function adstxt_requirements in AdsTxt 8
Same name and namespace in other branches
- 7 adstxt.install \adstxt_requirements()
Implements hook_requirements().
File
- ./
adstxt.install, line 54 - Install, update and uninstall functions for the adstxt module.
Code
function adstxt_requirements($phase) {
$requirements = [];
switch ($phase) {
case 'runtime':
// Module cannot work without Clean URLs.
$request = \Drupal::request();
if (!RequestHelper::isCleanUrl($request)) {
$requirements['adstxt_cleanurl'] = [
'title' => t('Ads.txt'),
'severity' => REQUIREMENT_ERROR,
'value' => t('Not enabled.'),
'description' => t('Clean URLs are mandatory for this module.'),
];
}
// Webservers prefer the ads.txt file on disk and does not allow menu
// path overwrite.
if (file_exists(DRUPAL_ROOT . '/ads.txt')) {
$requirements['adstxt_file'] = [
'title' => t('Ads.txt'),
'severity' => REQUIREMENT_WARNING,
'value' => t('ads.txt exists.'),
'description' => t('Please remove the existing ads.txt file in the docroot.'),
];
}
}
return $requirements;
}