Skip to content
Snippets Groups Projects
Commit d63d2c63 authored by Myron Turner's avatar Myron Turner
Browse files

added option to wantedpages.php to show or not show pages where broken links occur

parent ffe3602c
No related branches found
No related tags found
No related merge requests found
......@@ -12,7 +12,7 @@ class WantedPagesCLI extends DokuCLI {
const DIR_CONTINUE = 1;
const DIR_NS = 2;
const DIR_PAGE = 3;
private $show_pages = false;
/**
* Register options and arguments on the given $options object
*
......@@ -28,6 +28,11 @@ class WantedPagesCLI extends DokuCLI {
'The namespace to lookup. Defaults to root namespace',
false
);
$options->registerCommand(
'show-pages',
'Show wiki pages on which broken links (i.e. wanted pages) are found, listed as: wiki_page=>broken_link'
);
}
/**
......@@ -39,12 +44,16 @@ class WantedPagesCLI extends DokuCLI {
* @return void
*/
protected function main(DokuCLI_Options $options) {
global $argc, $argv;
if($options->args) {
$startdir = dirname(wikiFN($options->args[0].':xxx'));
} else {
$startdir = dirname(wikiFN('xxx'));
}
if($argv[1] == 'show-pages' || $argv[2] == 'show-pages') {
$this->show_pages = true;
}
$this->info("searching $startdir");
......@@ -141,7 +150,10 @@ class WantedPagesCLI extends DokuCLI {
resolve_pageid($cns, $mid, $exists);
if(!$exists) {
list($mid) = explode('#', $mid); //record pages without hashs
if($this->show_pages) {
$links[] = "$pid => $mid";
}
else $links[] = $mid;
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment