doc: Prefer "root" doc path over configured path

If the "root" doc path, i.e. application/doc exists, it is preferred over the configured
one.

refs #4075
This commit is contained in:
Eric Lippmann 2014-12-09 14:55:24 +01:00
parent 3120a0c090
commit d2a7254a37
2 changed files with 7 additions and 7 deletions

View File

@ -17,15 +17,15 @@ class Doc_IcingawebController extends DocController
*/ */
protected function getPath() protected function getPath()
{ {
$path = Icinga::app()->getBaseDir('doc');
if (is_dir($path)) {
return $path;
}
if (($path = $this->Config()->get('documentation', 'icingaweb2')) !== null) { if (($path = $this->Config()->get('documentation', 'icingaweb2')) !== null) {
if (is_dir($path)) { if (is_dir($path)) {
return $path; return $path;
} }
} }
$path = Icinga::app()->getBaseDir('doc');
if (is_dir($path)) {
return $path;
}
throw new Zend_Controller_Action_Exception( throw new Zend_Controller_Action_Exception(
$this->translate('Documentation for Icinga Web 2 is not available'), $this->translate('Documentation for Icinga Web 2 is not available'),
404 404

View File

@ -25,15 +25,15 @@ class Doc_ModuleController extends DocController
*/ */
protected function getPath($module, $default, $suppressErrors = false) protected function getPath($module, $default, $suppressErrors = false)
{ {
if (is_dir($default)) {
return $default;
}
if (($path = $this->Config()->get('documentation', 'modules')) !== null) { if (($path = $this->Config()->get('documentation', 'modules')) !== null) {
$path = str_replace('{module}', $module, $path); $path = str_replace('{module}', $module, $path);
if (is_dir($path)) { if (is_dir($path)) {
return $path; return $path;
} }
} }
if (is_dir($default)) {
return $default;
}
if ($suppressErrors) { if ($suppressErrors) {
return null; return null;
} }