OrphansWanted Plugin

orphanswanted plugin by D A Edmunds
Find Orphan pages, Wanted pages with reference counts. Also shows reference counts for linked pages

Last updated on 2006-06-07. Provides Syntax.
No compatibility info given!

Tagged with orphan, pages, wanted.

by Doug Edmunds (I am no longer actively updating this plugin. Read entries added by others to maintain compatibility with more recent versions. I suggest that the main program provide these features in the future.)

Description

Use this plugin to find orphan pages and wanted pages.

OrphansWanted show which pages are:

  • Orphans (the page exists, but it has no links to it)
  • Wanted (the page does not exist, but there are link(s) to it elsewhere on the site)
  • Valid (the page exists, and it can be reached through a link)

Each table shows the reference count.

Version 2 now allows you to exclude namespaces from the results.

Usage

Basic usage is to place the one of the following four lines into the page markup:

 
 ~~ORPHANSWANTED:orphans~~
 ~~ORPHANSWANTED:wanted~~
 ~~ORPHANSWANTED:valid~~    
 ~~ORPHANSWANTED:all~~      << makes all three tables 
 Anything other than these 4 words will generate a syntax error message. 

Enhanced usage adds optional namespaces, each prefixed with an exclamation point '!' (think 'not')

 
 ~~ORPHANSWANTED:orphans|wanted|valid|all[!namespace!another!one:with:subspaces]~~

Example -- exclude one namespace:

 ~~ORPHANSWANTED:wanted!wiki~~   Shows wanted pages, but none that are under the wiki: namespace

Example -- exclude multiple namespaces:

 ~~ORPHANSWANTED:orphans!wiki!sys:personal~~  Shows orphan pages, but none in the wiki: or in the sys:personal: namespaces  

Version/Requirements

:!: Seems to work fine with Dokuwiki v2007-06-26. (Added this note in case the note below scares you off.) – brett, 2008-03-03

:!: There appear to be some problems with using this plugin with the latest release of DokuWiki (2006-11-06). It doesn't appear to work correctly, and it breaks the Configuration Manager. — DGM2 2007-01-05 00:19

:!: The plugin does seem not to support default namespace linking (as in x:y: tries to link to x:y:home and if that doesn't exist, it points to x:y), we use that a lot in our (very large) wiki, where we would obviously require a list of orphaned/wanted pages to detect false links etc. - Bernhard

Proposed fix for above issue…add the following code after the namespace fix around line 94:

        if( $link[strlen($link)-1] == ":" ) {
            $link .= $conf["start"];
        }

– Nathan


  • Version 2.3 released 2006-6-07. Modified call-by-reference (moved from function call to function args). Added file: as an excluded link type. Allow spaces after opening [[ and before excluded types http|https|mailto|ftp|file, so they do not appear as wanted pages.
  • Version 2.2 released 2006-04-02. Minor change to regex to prevent email entries like this: [[x@y.com?subject=test email | send email test this]], from appearing as a wanted page.
  • Version 2.1 released 2006-02-14. Minor fixes to pass XHTML 1.0 validation (http://validator.w3.org/check/referer).
  • Version 2.0 released 2006-02-09. Adds ability to use namespaces. Now excludes windows shares. Improves exclusion of email addresses. Removed comments from html source that revealed pagenames searched.
  • Version 1.2 released 2006-02-03. Fixed so pagenames intended to be unformatted (inside nowiki, double %'s and code) are ignored. Also fixed so email addresses that appear between [[ and ]] are ignored.
  • Version 1.1 released 2006-01-28. Changed global function names to add orph_ prefix to avoid possible clashes. Removed one function that was not being called.
  • Version 1.0 released 2006-01-27. Developed tested using 2005-09-22 stable version of DokuWiki.
  • General approach was developed by Kite [at] puzzlers [dot] org. http://wiki.splitbrain.org/wiki:discussion:orphans_wanted

Notes

  • I strongly suggest you put ~~NOCACHE~~ on the page where this plugin is used. This helps assure that ACL permissions get applied. Otherwise some other user, with lesser ACL permissions, may see a cached copy of the results.
  • ACL settings are applied first, before any exclusions. Only pages you have permission to view can be listed. To be sure to see everything, login as superuser.
  • Reference counts (number of links) may include pages that cannot be viewed due to ACL settings.
  • It is fast enough for a site with 200+ short pages.

When viewing the results, the links can be clicked. To find out the pagenames of the references, then do one of two things:

  • Click the link, then when that page opens, click the [[page name]] at the top, to see backlinks. If backlinks are not working for you, then check this site for info on how to fix the code. http://wiki.splitbrain.org/wiki:backlinks. Another thing that may help backlinks to work is to reindex the site. There is a plugin that you can install for that too. http://wiki.splitbrain.org/plugin:searchindex_manager
  • If backlinks don't work for you, then type the pagename in the search box. This will bring up a list of pages in which that link appears.
  • If you see something that you think must have a link, check your spelling. If you typed the pagename wrong on the other page, you created a “wanted” page instead of a link to an existing page.
  • Try fixing bad links one by one after you figure out what is wrong. Do this until your orphan/wanted lists are as clean as you need.

False links: Paragraphs that start with two or more spaces (but not followed by an *) create an unformatted text box. The plugin does not exclude these. How or where the program parses two or more leading spaces remains a mystery to me. If you know, let me know.

Example:

This is not really a link, but it would be included as wanted by the plugin: [[false_link]].

Installation

Create a directory called orphanswanted inside your lib/plugins/ directory, and then copy the following source into syntax.php in that directory (lib/plugins/orphanswanted/syntax.php).

Zip download at http://douglasedmunds.com/z_dokuwiki_code/orphanswanted.zip. Should work with plugin manager.

Plugin Source

 
<?php
/**
 * OrphansWanted Plugin: Display Orphans, Wanteds and Valid link information
 * version 2.3 2006-06-07  
 * syntax ~~ORPHANSWANTED:<choice>[!<exclude list>]~~  <choice> :: orphans | wanted | valid | all
 * [!<exclude list>] :: optional.  prefix each with ! e.g., !wiki!comments:currentyear
 * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
 * @author     dae@douglasedmunds.com >
 */
 
if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/');
if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
require_once(DOKU_PLUGIN.'syntax.php');
 
require_once(DOKU_INC.'inc/search.php');
 
 
//-------------------------------------
 
//mod dae
function orph_handle_link(&$data, $link) {
    $item = &$data["$link"];
	if(isset($item)) {
		// This item already has a member in the array
		// Note that the file search found it
		$item['links'] = 1 + $item['links'];   // count the link
		// echo "      <!-- added count? " . $item['links'] . " --> \n";
    } else {
		// Create a new entry
		$data["$link"]=array('exists' => false,  // Only found a link, not the file
        		'links' => 1);
		// echo "      <!-- added link to list --> \n";
	}
}
 
function orph_fileNS($file) {
    $path_probs   = array("!^/!", "!/$!", "!/!", "!::!");
    $replacements = array(  "",     "",    ":",    ":");
    $x = strrpos($file, '/');
	switch($x) {
	case 0:
	    $result = "";
		break;
	default:
	    // replace all the / with : after dropping the file off the filename
	  	$result = preg_replace($path_probs, $replacements, substr($file, 1, $x -1 ));
	}
	//echo "<!-- $x NS= $result file= $file -->\n";
	return $result;
}
 
function orph_Check_InternalLinks(&$data,$base,$file,$type,$lvl,$opts) {
    define("LINK_PATTERN", "%\[\[([^\]|#]*)(#[^\]|]*)?\|?([^\]]*)]]%");
 
    if(preg_match("/.*\.txt$/", $file)) {
		global $conf;
		// echo "  <!-- checking file: $file -->\n";
		$body = @file_get_contents($conf['datadir'] . $file);
 
        // ignores entries in <nowiki>, %%, <code> and emails with @
		foreach ( array("/<nowiki>[\W\w]*<\/nowiki>/",
                        "/%%.*%%/",
                        "/<code>[\W\w]*<\/code>/" ,
                        "/\[\[\\ *\\\\.*\]\]/" , //windows shares
                        "/\[\[\ *[a-zA-Z0-9._-]+@[a-zA-Z0-9-]+\..*\ *\]\]/" //email address with tags
                        //"/\[\[\ *[a-zA-Z0-9._-]+@[a-zA-Z0-9-]+\.[a-zA-Z.]+\ *\]\]/" //email address
                        //source http://www.sitepoint.com/article/regular-expressions-php
                         )  as $ignored){
             $body = preg_replace($ignored, "",  $body);
        }
 
        $links = array();
		preg_match_all(LINK_PATTERN, $body, $links);
        foreach($links[1] as $link) {
		    if( (0 < strlen(ltrim($link)))
			   and ( $link[0] <> "/" )
			   and (!preg_match("/^\ *(https?|mailto|ftp|file):/", $link))  //mod 7 june 06: allow spaces before http, etc.
			   and (!preg_match("/^(.*)>/", $link))
			   and (!strpos("@", $link)) ) {
				// Try fixing the link...
				//$link = preg_replace("![ ]!", "_", strtolower($link));
				// need to fix the namespace?
				if( $link[0] == ":" ) {       // forced root namespace
				   $link = substr($link, 1);
				   //echo "\t\t<!--  !! (2) $link -->\n";
				} else {
					if($link[0] == ".") { // forced relative namespace
					   $link = preg_replace("!::!", ":",orph_fileNS($file) . ":" . substr($link, 1));
					   //echo "\t\t<!--  !! (2) $link -->\n";
					} else if(strpos($link,':') === false) {
					   $link = preg_replace("!::!", ":",orph_fileNS($file) . ":" . $link);
					   //echo "\t\t<!--  !! (3) $link -->\n";
					}
				} // namespace fix
 
				// looks like an ID?
				$link = cleanID($link);
				if(((strlen(ltrim($link)) > 0)           // there IS an id?
				   and !auth_quickaclcheck($link) < AUTH_READ)) {    // should be visible to user
//				   and (!preg_match("/^(http|mailto):/", $link))  // URL
//				   and (!preg_match("/^(.*)>/", $link))) {        // interwiki
					//check ACL
					//echo "      <!-- adding $link -->\n";
					//dae mod
					//orph_handle_link(&$data, $link);
					orph_handle_link($data, $link);				}
			} // link is not empty?
		} // end of foreach link
	}
}
 
 
function orph_report_table($data, $page_exists, $has_links, $params_array) {
    //take off $params_array[0];
    $exclude_array = array_slice($params_array,1);
 
    $count = 1;
    $output = '';
    // for valid html - need to close the <p> that is feed before this
    $output .= '</p>';
	$output .= "<table class='inline'><tr><th> # </th><th> ID </th>" .
	 	($page_exists ? "<th>Title</th>" : "" ) . "<th>Links</th></tr>\n";
 
	foreach($data as $id=>$item) {
 
		if(($item["exists"] == $page_exists) and (($item["links"] <> 0)== $has_links)) {
 
			// $id is a string, looks like this: page, namespace:page, or namespace:<subspaces>:page
			$match_array = explode(":", $id);
			//remove last item in array, the page identifier
			$match_array = array_slice($match_array, 0, -1);
			//put it back together
			$page_namespace = implode (":", $match_array);
			//add a trailing :
			$page_namespace = $page_namespace . ':';
 
			//set it to show, unless blocked by exclusion list
			$show_it = true;
			foreach ($exclude_array as $exclude_item){
				//add a trailing : to each $item too
				$exclude_item = $exclude_item . ":";
				// need === to avoid boolean false
				// strpos(haystack, needle)
				// if exclusion is beginning of page's namespace , block it
				if (strpos($page_namespace, $exclude_item) === 0){
				   //there is a match, so block it
				   $show_it = false;
				}
			}
 
			if ($show_it) {
			   $output .=  "<tr><td>$count</td><td><a href=\"". DOKU_URL. "doku.php?id=" .
			   		$id . "\" class=\"" . ($page_exists ? "wikilink1" : "wikilink2") . "\"  onclick=\"return svchk()\" onkeypress=\"return svchk()\">" .
					$id ."</a></td>" .
					($page_exists ? "<td>" . p_get_first_heading($id) ."</td>" : "" ) .
					"<td>" . $item["links"] . "</td></tr>\n";
				$count++;
			}
 
		}
	}
	//close the html table
	$output .=  "</table>\n";
	//for valid html = need to reopen a <p>
	$output .= "<p>";
        return $output;
}
 
 
function orph_search_wanted(&$data,$base,$file,$type,$lvl,$opts) {
 
	if($type == 'd'){
		return true; // recurse all directories, but we don't store namespaces
	}
 
    if(!preg_match("/.*\.txt$/", $file)) {  // Ignore everything but TXT
		return true;
	}
 
	// search the body of the file for links
	// dae mod
  //	orph_Check_InternalLinks(&$data,$base,$file,$type,$lvl,$opts);
	orph_Check_InternalLinks($data,$base,$file,$type,$lvl,$opts);
 
	// get id of this file
	$id = pathID($file);
 
	//check ACL
	if(auth_quickaclcheck($id) < AUTH_READ) {
		return false;
	}
 
	// try to avoid making duplicate entries for forms and pages
	$item = &$data["$id"];
	if(isset($item)) {
		// This item already has a member in the array
		// Note that the file search found it
		$item['exists'] = true;
    } else {
		// Create a new entry
		$data["$id"]=array('exists' => true,
				 'links' => 0);
	}
	return true;
}
 
// --------------------
 
/**
 * All DokuWiki plugins to extend the parser/rendering mechanism
 * need to inherit from this class
 */
class syntax_plugin_orphanswanted extends DokuWiki_Syntax_Plugin {
    /**
     * return some info
     */
    function getInfo(){
        return array(
            'author' => 'Doug Edmunds',
            'email'  => 'dae@douglasedmunds.com',
            'date'   => '2006-06-07',
            'name'   => 'OrphansWanted Plugin ver 2.3',
            'desc'   => 'Find orphan pages and wanted pages .
            syntax ~~ORPHANSWANTED:<choice>[!<excluded namespaces>]~~ .
            <choice> :: orphans|wanted|valid|all .
            <excluded namespaces> are optional, start each namespace with !' ,
            'url'    => 'http://wiki.splitbrain.org/plugin:orphanswanted',
        );
    }
 
    /**
     * What kind of syntax are we?
     */
    function getType(){
        return 'substition';
    }
 
    /**
     * What about paragraphs?
     */
    function getPType(){
        return 'normal';
    }
 
    /**
     * Where to sort in?
     */
    function getSort(){
        return 990;     //was 990
    }
 
 
    /**
     * Connect pattern to lexer
     */
    function connectTo($mode) {
        $this->Lexer->addSpecialPattern('~~ORPHANSWANTED:[0-9a-zA-Z:!]+~~',$mode,'plugin_orphanswanted');
    }
 
    /**
     * Handle the match
     */
 
    function handle($match, $state, $pos, &$handler){
        $match_array = array();
        $match = substr($match,16,-2); //strip ~~ORPHANSWANTED: from start and ~~ from end
        $match = strtolower($match);
        //create array, using ! as separator
        $match_array = explode("!", $match);
        // $match_array[0] will be orphan, wanted, valid, all, or syntax error
        // if there are excluded namespaces, they will be in $match_array[1] .. [x]
        // this return value appears in render() as the $data param there
        return $match_array;
    }
 
    /**
     * Create output
     */
    function render($format, &$renderer, $data) {
        global $INFO, $conf;
        if($format == 'xhtml'){
 
			// user needs to add ~~NOCACHE~~ manually to page, to assure ACL rules are followed
			// coding here is too late, it doesn't get parsed
			// $renderer->doc .= "~~NOCACHE~~";
 
            // $data is an array
            // $data[1]..[x] are excluded namespaces, $data[0] is the report type
            //handle choices
            switch ($data[0]){
                case 'orphans':
                    $renderer->doc .= $this->orphan_pages($data);
                    break;
                case 'wanted':
                    $renderer->doc .= $this->wanted_pages($data);
                    break;
                case 'valid':
                    $renderer->doc .= $this->valid_pages($data);
                    break;
                case 'all':
                    $renderer->doc .= $this->all_pages($data);
                    break;
                default:
                    $renderer->doc .= "ORPHANSWANTED syntax error";
                   // $renderer->doc .= "syntax ~~ORPHANSWANTED:<choice>~~<optional_excluded>  <choice> :: orphans|wanted|valid|all  Ex: ~~ORPHANSWANTED:valid~~";
            }
 
             return true;
        }
        return false;
    }
 
 
//    three choices
//    $params_array used to extract excluded namespaces for report
//    orphans =  orph_report_table($data, true, false, $params_array);
//    wanted =  orph_report_table($data, false, true), $params_array;
//    valid  =  orph_report_table($data, true, true, $params_array);
 
 
    function orphan_pages($params_array) {
      global $conf;
      $result = '';
      $data = array();
      search($data,$conf['datadir'],'orph_search_wanted',array('ns' => $ns));
      $result .=  orph_report_table($data, true, false,$params_array);
 
      return $result;
    }
 
    function wanted_pages($params_array) {
      global $conf;
      $result = '';
      $data = array();
      search($data,$conf['datadir'],'orph_search_wanted',array('ns' => $ns));
      $result .= orph_report_table($data, false, true,$params_array);
 
      return $result;
    }
 
    function valid_pages($params_array) {
      global $conf;
      $result = '';
      $data = array();
      search($data,$conf['datadir'],'orph_search_wanted',array('ns' => $ns));
      $result .= orph_report_table($data, true, true, $params_array);
 
      return $result;
    }
 
    function all_pages($params_array) {
      global $conf;
      $result = '';
      $data = array();
      search($data,$conf['datadir'],'orph_search_wanted',array('ns' => $ns));
 
      $result .= "</p><p>Orphans</p><p>";
      $result .= orph_report_table($data, true, false,$params_array);
      $result .= "</p><p>Wanted</p><p>";
      $result .= orph_report_table($data, false, true,$params_array);
      $result .= "</p><p>Valid</p><p>";
      $result .= orph_report_table($data, true, true, $params_array);
 
 
      return $result;
    }
 
}
 
?>

Discussion

Maybe being able to find empty or near empty pages by size (find all pages less than 150 bytes) is good too. So pages that are blank or have only a few characters can be cleaned up. I supposed with the blog plugin people can tag pages as needing work, but I like your solution of automatically finding them.

This plugin is about links and the lack of them, not file size. Use an FTP program, sort by size. The page files don't have any metadata, so the file size will give you all the info you need about near empty pages. [dae 2006-01-30]

Really nice plugin, but the wanted-list also lists file:-links (on Windows)

I have posted Version 2, which should prevent MSWindows shares from appearing in the results tables. [dae 2006-02-09]

I like this plugin and have been using it for administration quite a bit over the past few days. There are a couple of things that are keeping me from putting public links to the page that has the function, however.

  1. I have quite a few example links that I created on my page using % signs to prevent wiki formatting so I could show users how to make a link in a format that keeps things organized. The find wanted part of this plugin finds all of those examples that aren't really links.
  1. I am using mediawiki style discussion pages on my site based on the code here: discussion. All of the discussion pages are seen as orphans, which they technically are since there are no wiki links to them, but they clutter the list. Is there a way to prevent the function from searching a particular namespace for orphans?

carl [dot] thorpe [at] gmail [dot] com 2006-01-30 14:50cdt

First issue: The code has been fixed to ignore pagenames that appear in nowiki, double %'s, and code section. Also, email addresses that appear in double square brackets are ignored.
dae [at] douglasedmunds [dot] com 2006-02-03
Second issue: I made a small modification on my orphanswanted script to drop anything in the discussion namespace. In the function orph_report_table you have to add the stuff indicated by the two comments:
	foreach($data as $id=>$item) {
	  $idknack = explode(':', $id);	  // Add this line
		if(($item["exists"] == $page_exists) and (($item["links"] <> 0)== $has_links) and !($idknack[0] == 'discussion')) { // Add the third conditional
			$output .=  "<tr><td>$count</td><td><a href=\"". DOKU_URL. "doku.php?id=" .
			    $id . "\" class=\"" . ($page_exists ? "wikilink1" : "wikilink2") . "\"  onclick=\"return svchk()\" onkeypress=\"return svchk()\">" .
				$id ."</a></td>" .
				($page_exists ? "<td>" . p_get_first_heading($id) ."</td>" : "" ) .
				"<td>" . $item["links"] . "</td></tr>\n";
			$count++;
		}
	}

Now my discussion pages don't show up in the orphans list. – Christopher Wellons (mosquitopsu – gmail)

SECOND ISSUE UPDATE:

I have posted Version 2 of the plugin. It now allows ANY namespace or namespace:subspace to be excluded from the results.
The code changes suggested above (which hardcode the 'discussion' namespace) are no longer necessary.
To exclude orphans appearing in the discussion namespace, use this line:
~~ORPHANSWANTED:orphans!discussion~~
— Doug Edmunds dae [at] douglasedmunds [dot] com 2006-02-09

Wow! This is perfect! I actually have two namespaces I want to eliminate and it works perfectly for that as well. Not only do I get rid of discussion pages, but also anything in the wiki namespace in order to eliminate user pages (wiki:users:*).

~~ORPHANSWANTED:orphans!discussion!wiki~~

— Chris Wellons (mosquitopsu – gmail)

BUG FIXED: Valid Dokuwiki mailto: links appear in the Wanted Pages list.

I have a link on one page: example Please email [[blah@blah.com?subject=Blah|John Blah]]. In the Wanted pages, it shows up like this: blah_blah.com_subject_blah. What's more, you can click on that page, and then when you click it's title you don't see the backlink for it. – Dean-Ryan Stone (dhry@dhryland.com) - 20060322

I have updated the email regex to avoid this kind of email entry from appearing as a wanted page
— Doug Edmunds dae [at] douglasedmunds [dot] com 2006-04-02

Bugs reported

1) I have following external link which generates an entry in the orphans list:

Link Repetitive Strain Injury

[[ http://en.wikipedia.org/wiki/Repetitive_strain_injury | Repetitive Strain Injury ]]

Entry http:en.wikipedia.org_wiki_repetitive_strain_injury

FIXED version 2.3

— Doug Edmunds dae [at] douglasedmunds [dot] com 2006-06-07

2) the same problem is with file links like file:///user/exampls.pdf

[[file:///user/exampls.pdf]]
FIXED version 2.3 (file: has been added to the types of links excluded)

— Doug Edmunds dae [at] douglasedmunds [dot] com 2006-06-07

— Markus 2006-04-03

Current development version of Dokuwiki

I can't get it to work with the current development version. I installed it via plugin manager. All that appears it the source code. Any idea what could be the problem? —Martin 2006-05-9

I can't help you here. I am not working with the dev version. Try doing a manual install (download the zip, then upload it to the lib/plugins directory). If anyone else has a suggestion, pls post it. [dae 2006-05-30]

Info provided by email on 1 Sept 2006 from Reinhold Kainhofer:

I'm using the OrphansWanted DokuWiki plugin, and I just realized that you hardcode the link URL rather than using DokuWiki's wl(..) method to generate the Link URL (which also works correctly with the various URL rewrite settings). Attached is a patch which fixes this “problem”.

 			if ($show_it) {
-			   $output .=  "<tr><td>$count</td><td><a href=\"". DOKU_URL. "doku.php?id=" .
-			   		$id . "\" class=\"" . ($page_exists ? "wikilink1" : "wikilink2") . "\"  onclick=\"return svchk()\" onkeypress=\"return svchk()\">" .
+			   $output .=  "<tr><td>$count</td><td><a href=\"". wl($id) . "\" class=\"" . ($page_exists ? "wikilink1" : "wikilink2") . "\"  onclick=\"return svchk()\" onkeypress=\"return svchk()\">" .
 					$id ."</a></td>" .
 					($page_exists ? "<td>" . p_get_first_heading($id) ."</td>" : "" ) .
 					"<td>" . $item["links"] . "</td></tr>\n";
Thanks. I will look into this, and will work it into the next revision. If anyone else needs this fix now, make these changes to the orph_report_table function, around lines 152-153. — Doug Edmunds dae [at] douglasedmunds [dot] com 2006-09-01

Got some problem with preventing namespaces with an underscore in it's name from showing in the list. Is this a bug or must i do something special with the underscored namespace?

— Matthias Pitzl silamael [at] coronamundi [dot] de 2006-11-03


How about not only excluding namespaces, but also limiting the orhans generation to a certain namespace? That way a large wiki (such as ours) with different people responsible for different namespaces can only find their orphans and their wanted pages?- bernhard

Using the internal links plugin that resolves bracket bracket @ something into an internal link outside the wiki - those links also show up as wanted. Would be great if you could check for links to 'pages' starting with '@' - great plugin! Nils



First: Great and very useful plugin. The only thing I considered annoying was that the entries weren't sorted by number of links. It makes it hard to find out which pages are really wanted. After reading through the source and DokuWiki Reference for two hours and trying to implement some mystical special sorting functions on my own (being a php newbie…), I found out that the simple command

arsort($data);

just before the foreach-loop in function orph_report_table did the trick. Just in case someone is interested ;-)kokstitan 2006-12-05 01:23


Another Idea for improvement: In orph_report_table, it isn't checked, wheter $conf['useheading'] is set and just calls p_get_first_heading whenever the page exists. A simple check on wheter both $page_exists and $conf['useheading'] are true, make the empty Title column go away.

For example, one could add

global $conf;
if ($page_exists && $conf['useheading']) {
  $show_heading = true;
}

to the beginning of orph_report_table and replace

($page_exists ? "<th>Title</th>" : "" )

with

($show_heading ? "<th>Title</th>" : "" )

and

($page_exists ? "<td>" . p_get_first_heading($id) ."</td>" : "" )

with

($show_heading ? "<td>" . p_get_first_heading($id) ."</td>" : "" )

Like this, the Title column is only shown, when useheading is set true. — kokstitan 2006-12-05 02:10

Note that the JavaScript function “svchk()” no longer exists (and is now unnecessary) in Dokuwiki, and does cause JavaScript errors, so it should be removed.
todd [at] rollerorgans [dot] com 2007-02-26

This Plugin works fine if you use lowercase-namespaces - but if you use namespaces that start with a capital letter (in my case “Hilfe” etc. it is impossible to exclude namespaces with ~~ORPHANSWANTED:valid!wiki!Diskussion!Hilfe~~ It is possible to change this behaviour: edit line 268 (third line in function handle):

$match = strtolower($match);

to

  //$match = strtolower($match);

or just or delete this line

– Wolfgang 2007-08-29


An exploit can be executed! Replace

($page_exists ? "<td>" . p_get_first_heading($id) ."</td>" : "" ) .

with:

($page_exists ? "<td>" . htmlspecialchars(p_get_first_heading($id)) ."</td>" : "" ) .

you wrote:

False links: Paragraphs that start with two or more spaces (but not followed by an *) create an unformatted text box. The plugin does not exclude these.
How or where the program parses two or more leading spaces remains a mystery to me. If you know, let me know.

I believe this happens inside inc/parser/parser.php at that place:

        'monospace'=> array (
            'entry'=>'\x27\x27(?=.*\x27\x27)',
            'exit'=>'\x27\x27',
            'sort'=>100
            ),

I'd be very pleased if those false links would no longer occur.


One bug annoy me : I have false entries in the orphaned list, when using relative path as [[..:test:foobar]]

Any idea ?

— Wally 2008-06-10

 
plugin/orphanswanted.txt · Last modified: 2008/06/10 17:00 by 82.230.252.42 · Currently locked by: 74.6.18.230,74.6.29.247
 
Imprint Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki
WikiForumIRCBugsTranslate