mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-26 23:34:08 +02:00
modules/doc: Tell which doc directory does not exist, in case it does not exist :)
Thanks Michael refs #4820
This commit is contained in:
parent
5627c09b37
commit
89bddb10e7
@ -35,16 +35,16 @@ class DocParser
|
|||||||
$dir = Icinga::app()->getApplicationDir('/../doc');
|
$dir = Icinga::app()->getApplicationDir('/../doc');
|
||||||
} else {
|
} else {
|
||||||
$mm = Icinga::app()->getModuleManager();
|
$mm = Icinga::app()->getModuleManager();
|
||||||
if (!$mm->hasInstalled($module)) {
|
if (! $mm->hasInstalled($module)) {
|
||||||
throw new DocException('Module is not installed');
|
throw new DocException('Module is not installed');
|
||||||
}
|
}
|
||||||
if (!$mm->hasEnabled($module)) {
|
if (! $mm->hasEnabled($module)) {
|
||||||
throw new DocException('Module is not enabled');
|
throw new DocException('Module is not enabled');
|
||||||
}
|
}
|
||||||
$dir = $mm->getModuleDir($module, '/doc');
|
$dir = $mm->getModuleDir($module, '/doc');
|
||||||
}
|
}
|
||||||
if (!is_dir($dir)) {
|
if (! is_dir($dir)) {
|
||||||
throw new DocException('Doc directory does not exist');
|
throw new DocException('Doc directory `' . $dir .'\' does not exist');
|
||||||
}
|
}
|
||||||
$this->dir = $dir;
|
$this->dir = $dir;
|
||||||
$this->module = $module;
|
$this->module = $module;
|
||||||
@ -81,7 +81,7 @@ class DocParser
|
|||||||
throw new DocException('Couldn\'t get the lock');
|
throw new DocException('Couldn\'t get the lock');
|
||||||
}
|
}
|
||||||
$line = null;
|
$line = null;
|
||||||
while (!$fileObject->eof()) {
|
while (! $fileObject->eof()) {
|
||||||
// Save last line for setext-style headers
|
// Save last line for setext-style headers
|
||||||
$lastLine = $line;
|
$lastLine = $line;
|
||||||
$line = $fileObject->fgets();
|
$line = $fileObject->fgets();
|
||||||
@ -156,7 +156,7 @@ class DocParser
|
|||||||
*/
|
*/
|
||||||
protected function extractHeader($line, $lastLine)
|
protected function extractHeader($line, $lastLine)
|
||||||
{
|
{
|
||||||
if (!$line) {
|
if (! $line) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
$header = null;
|
$header = null;
|
||||||
@ -167,7 +167,7 @@ class DocParser
|
|||||||
// Atx-style
|
// Atx-style
|
||||||
$level = strlen($match[0]);
|
$level = strlen($match[0]);
|
||||||
$header = trim(substr($line, $level));
|
$header = trim(substr($line, $level));
|
||||||
if (!$header) {
|
if (! $header) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
} elseif (
|
} elseif (
|
||||||
@ -177,7 +177,7 @@ class DocParser
|
|||||||
) {
|
) {
|
||||||
// Setext
|
// Setext
|
||||||
$header = trim($lastLine);
|
$header = trim($lastLine);
|
||||||
if (!$header) {
|
if (! $header) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if ($match[0][0] === '=') {
|
if ($match[0][0] === '=') {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user