function flag_requirements in Flag 7.3
Same name and namespace in other branches
- 8.4 flag.install \flag_requirements()
- 5 flag.install \flag_requirements()
- 6.2 flag.install \flag_requirements()
- 6 flag.install \flag_requirements()
- 7.2 flag.install \flag_requirements()
Implements hook_requirements().
File
- ./
flag.install, line 230 - Flag module install/schema/update hooks.
Code
function flag_requirements($phase) {
$requirements = array();
$t = get_t();
if ($phase == 'runtime') {
if (module_exists('translation') && !module_exists('translation_helpers')) {
$requirements['flag_translation'] = array(
'title' => $t('Flag'),
'severity' => REQUIREMENT_WARNING,
'description' => $t('To have the flag module work with translations, you need to install and enable the <a href="http://drupal.org/project/translation_helpers">Translation helpers</a> module.'),
'value' => $t('Translation helpers module not found.'),
);
}
if (module_exists('session_api')) {
if (file_exists('./robots.txt')) {
$flag_path = url('flag') . '/';
// We don't use url() because this may return an absolute URL when
// language negotiation is set to 'domain'.
$flag_path = parse_url($flag_path, PHP_URL_PATH);
$robots_string = 'Disallow: ' . $flag_path;
$contents = file_get_contents('./robots.txt');
if (strpos($contents, $robots_string) === FALSE) {
$requirements['flag_robots'] = array(
'title' => $t('Flag robots.txt problem'),
'severity' => REQUIREMENT_WARNING,
'description' => $t('Flag module may currently be used with anonymous users, however the robots.txt file does not exclude the "@flag-path" path, which may cause search engines to randomly flag and unflag content when they index the site. It is highly recommended to add "@robots-string" to your robots.txt file (located in the root of your Drupal installation).', array(
'@flag-path' => $flag_path,
'@robots-string' => $robots_string,
)),
'value' => $t('Search engines flagging content'),
);
}
}
}
}
return $requirements;
}