protected function LinkCheckerCommands::analyzeCheckParams in Link checker 8
Throws an exception if base url is not set.
Throws
\Exception
2 calls to LinkCheckerCommands::analyzeCheckParams()
- LinkCheckerCommands::analyze in src/
Commands/ LinkCheckerCommands.php - Reanalyzes content for links. Recommended after module has been upgraded.
- LinkCheckerCommands::clear in src/
Commands/ LinkCheckerCommands.php - Clears all link data and analyze content for links.
File
- src/
Commands/ LinkCheckerCommands.php, line 142
Class
- LinkCheckerCommands
- Drush 9 commands for Linkchecker module.
Namespace
Drupal\linkchecker\CommandsCode
protected function analyzeCheckParams() {
$alias = $this
->getConfig()
->getContext('alias');
$options = $alias
->get('options');
if (!isset($options['uri'])) {
$httpProtocol = $this->linkcheckerSetting
->get('default_url_scheme');
$baseUrl = $httpProtocol . $this->linkcheckerSetting
->get('base_path');
}
else {
$baseUrl = $options['uri'];
}
if (empty($baseUrl)) {
throw new \Exception($this
->t('You MUST configure the site base_url or provide --uri parameter.'));
}
if (mb_strpos($baseUrl, 'http') !== 0) {
throw new \Exception($this
->t('Base url should start with http scheme (http:// or https://)'));
}
}