You are here

function robotstxt_requirements in RobotsTxt 7

Same name and namespace in other branches
  1. 8 robotstxt.install \robotstxt_requirements()
  2. 5 robotstxt.install \robotstxt_requirements()
  3. 6 robotstxt.install \robotstxt_requirements()

Implements hook_requirements().

File

./robotstxt.install, line 41
Install, update and uninstall functions for the robotstxt module.

Code

function robotstxt_requirements($phase) {
  $requirements = array();
  $t = get_t();
  switch ($phase) {
    case 'runtime':

      // Module cannot work without Clean URLs.
      if (!variable_get('clean_url', 0)) {
        $requirements['robotstxt_cleanurl'] = array(
          'title' => $t('RobotsTxt'),
          'severity' => REQUIREMENT_ERROR,
          'value' => $t('<a href="!clean_url">Clean URLs</a> are mandatory for this module.', array(
            '!clean_url' => url('admin/config/search/clean-urls'),
          )),
        );
      }

      // Webservers prefer the robots.txt file on disk and does not allow menu
      // path overwrite.
      if (file_exists(DRUPAL_ROOT . '/robots.txt')) {
        $requirements['robotstxt_file'] = array(
          'title' => $t('RobotsTxt'),
          'severity' => REQUIREMENT_WARNING,
          'value' => $t('RobotsTxt module works only if you remove the existing robots.txt file in your website root.'),
        );
      }
  }
  return $requirements;
}