Skip to content
Snippets Groups Projects
Commit ebd3919b authored by Andreas Gohr's avatar Andreas Gohr
Browse files

Merge branch 'master' of git://github.com/turnermm/dokuwiki into pull-request-2044

* 'master' of git://github.com/turnermm/dokuwiki:
  using $options->getCmd to retrieve show-pages parameter
  added option to wantedpages.php to show or not show pages where broken links occur
  show pages where broken links occur: page_id => broken_link
parents c6162b5a 964efa9c
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'
);
}
/**
......@@ -45,6 +50,11 @@ class WantedPagesCLI extends DokuCLI {
} else {
$startdir = dirname(wikiFN('xxx'));
}
$cmd = $options->getCmd();
if($cmd == 'show-pages') {
$this->show_pages = true;
}
$this->info("searching $startdir");
......@@ -134,13 +144,17 @@ class WantedPagesCLI extends DokuCLI {
$links = array();
$cns = getNS($page['id']);
$exists = false;
$pid = $page['id'];
foreach($instructions as $ins) {
if($ins[0] == 'internallink' || ($conf['camelcase'] && $ins[0] == 'camelcaselink')) {
$mid = $ins[1][0];
resolve_pageid($cns, $mid, $exists);
if(!$exists) {
list($mid) = explode('#', $mid); //record pages without hashs
$links[] = $mid;
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