function robotstxt_install in RobotsTxt 7
Same name and namespace in other branches
- 8 robotstxt.install \robotstxt_install()
- 5 robotstxt.install \robotstxt_install()
- 6 robotstxt.install \robotstxt_install()
Implements hook_install().
File
- ./
robotstxt.install, line 11 - Install, update and uninstall functions for the robotstxt module.
Code
function robotstxt_install() {
$content = '';
// List of candidates for import.
$files = array(
DRUPAL_ROOT . '/robots.txt',
DRUPAL_ROOT . '/sites/default/default.robots.txt',
drupal_get_path('module', 'robotstxt') . '/robots.txt',
);
foreach ($files as $file) {
if (file_exists($file) && is_readable($file)) {
$content = file_get_contents($file);
break;
}
}
variable_set('robotstxt', $content);
}