%META:TOPICINFO{author="TWikiContributor" date="1272696338" format="1.1" version="$Rev$"}%
---+ Orphans Plugin
<!--
   Contributions to this plugin are appreciated. Please update the plugin page at
   http://twiki.org/cgi-bin/view/Plugins/OrphansPlugin or provide feedback at
   http://twiki.org/cgi-bin/view/Plugins/OrphansPluginDev.
   If you are a TWiki contributor please update the plugin in the SVN repository.

   * Set SHORTDESCRIPTION = Locate orphaned topics in TWiki webs
-->
%SHORTDESCRIPTION%

<div style="float:right; background-color:#eeeeee; margin:0 0 20px 20px; padding: 0 10px 0 10px; width:380px">
%TOC%
</div>

---++ Introduction

This Plugin assists in the management of topics within a TWiki web by locating orphaned topics (topics that have no parent, or their parent has been deleted).

Orphaned topics are displayed in a table, optionally with a reference count. Example:
<literal>
<style>
.link {
      color: #66E;
      text-decoration: underline;
}
</style>
</literal>
| *Action* | *Lost Topic* | *References* | *Referees* |
| <span class="link">delete</span> | <span class="link">JohnLocke</span> | 4 | <span class="link">TheFaithless</span> |
| <span class="link">delete</span> | <span class="link">SayidJarrah</span> | 8 | <span class="link">HugoReyes</span>. <span class="link">FrenchChick</span> |
| <span class="link">delete</span> | <span class="link">KateAusten</span> | 15 |<span class="link">JackShepherd</span>, <span class="link">JamesSawyer</span> |
| <span class="link">delete</span> | <span class="link">WaltLloyd</span> | 16 | <span class="link">MichaelDawson</span>, <span class="link">TheLost</span> |
| <span class="link">delete</span> | <span class="link">MichaelDawson</span> | 23 | <span class="link">TheOthers</span>, <span class="link">TheIrritating</span> |
| <span class="link">delete</span> | <span class="link">JamesSawyer</span> | 42 | <span class="link">TheHidden</span>, <span class="link">TheOthers</span>, <span class="link">TheFaithful</span> |

---++ Tools

The plugin is used from a page in the %SYSTEMWEB% web, %SYSTEMWEB%.ManageOrphanedPages. Normally you should be able to get away with just this topic, though you can use the plugin from any topic in any web if you want to.

---++ Syntax Rules

Write <code> %<nop>FINDORPHANS{ _parameters_ }% </code> anywhere in a topic.

Supported parameters:
| *Parameter and Values* | *Description* | *Default* |
| =web="..."= | TWiki web to search | Current web ="%WEB%"= |
| =allwebs="on"= %BR% =allwebs="off"= | Searches in all *public* webs for references to topic when detecting orphans | ="off"= |
| =allrefs="on"= %BR% =allrefs="off"= | Analyses count of references to each topic when searching for orphans, and includes them in the output table | ="off"= |

Example:
=%<nop>FINDORPHANS{web="Myproject" allwebs="on" allrefs="off"}%=

When the topic is viewed the Plugin will generate a table of topics in the selected web, with reference counts if you requested them, and an _action link_ that allows you to delete the topic directly (prompts you to move it to the Trash web).

*Notes*
  1 Before you can delete a topic, a final check for any topics that reference it is performed. If you searched in all webs, then the check also searches in all webs, but if you searched in the current web only, then only the current web is searched for confirmation. If you want to be _absolutely_ sure that no useful references exist, always select allwebs.
   1 References from the WebStatistics topic are not counted.

---++ Plugin Installation Instructions

You do not need to install anything in the browser to use this extension. The following instructions are for the administrator who installs the extension on the server where TWiki is running.

Like many other TWiki extensions, this module is shipped with a fully
automatic installer script written using the Build<nop>Contrib.
   * If you have TWiki 4.2 or later, you can install from the =configure= interface (Go to Plugins->Find More Extensions)
      * See the [[http://twiki.org/cgi-bin/view/Plugins/BuildContribInstallationSupplement][installation supplement]] on TWiki.org for more information.
   * If you have any problems, then you can still install manually from the command-line:
      1 Download one of the =.zip= or =.tgz= archives
      1 Unpack the archive in the root directory of your TWiki installation.
      1 Run the installer script ( =perl &lt;module&gt;_installer= )
      1 Run =configure= and enable the module, if it is a plugin.
      1 Repeat for any missing dependencies.
   * If you are *still* having problems, then instead of running the installer script:
      1 Make sure that the file permissions allow the webserver user to access all files.
      1 Check in any installed files that have existing =,v= files in your existing install (take care *not* to lock the files when you check in)
      1 Manually edit !LocalSite.cfg to set any configuration variables.

%IF{"defined 'SYSTEMWEB'" else="<div class='twikiAlert'>%X% WARNING: SYSTEMWEB is not defined in this TWiki. Please add these definitions to your %MAINWEB%.TWikiPreferences, if they are not already there:<br><pre>   * <nop>Set SYSTEMWEB = %<nop>TWIKIWEB%<br>   * <nop>Set USERSWEB = %<nop>MAINWEB%</pre></div>"}%

   * Test if the plugin is correctly installed by visiting the %SYSTEMWEB%.ManageOrphanedPages topic, select a web and see if the table is expanded correctly.

---++ Plugin Info

Many thanks to the following sponsors for supporting this work:
   * [[http://windriver.com/][Wind River]]

|  Plugin Author: | TWiki:Main.CrawfordCurrie |
|  Copyright: | &copy; 2004, Wind River; <br /> &copy; 2004-2010, TWiki:TWiki/TWikiContributor |
|  License: | GPL ([[http://www.gnu.org/copyleft/gpl.html][GNU General Public License]]) |
|  Plugin Version: | 18561 (2010-04-30) |
|  Change History: | <!-- specify latest version first -->&nbsp; |
|  2010-04-30: | TWikibug:Item6433 - doc improvements; changing TWIKIWEB to SYSTEMWEB |
|  7 Sep 2007 | Bugs:Item4571 corrected noautolink handling, and hopefully improved UTF-8 handling as well |
|  11498 | Ported to TWiki-4 |
|  25 Mar 2004: | Initial version |
|  Dependencies: | None |
|  Perl Version: | 5.008 and up |
|  TWiki:Plugins/Benchmark: | %SYSTEMWEB%.GoodStyle 99%, %SYSTEMWEB%.FormattedSearch 99%, ManageOrphanedPages 95% |
|  Plugin Home: | http://TWiki.org/cgi-bin/view/Plugins/%TOPIC% |
|  Feedback: | http://TWiki.org/cgi-bin/view/Plugins/%TOPIC%Dev |
|  Appraisal: | http://TWiki.org/cgi-bin/view/Plugins/%TOPIC%Appraisal |

__Related Topics:__ %SYSTEMWEB%.ManageOrphanedPages, %SYSTEMWEB%.TWikiPlugins, %SYSTEMWEB%.DeveloperDocumentationCategory, %SYSTEMWEB%.AdminDocumentationCategory, %SYSTEMWEB%.TWikiPreferences
