none
[openafs-wiki.git] / TWiki / TWikiSiteTools.mdwn
1 <div>
2   <ul>
3     <li><a href="#TWiki Site Tools"> TWiki Site Tools</a><ul>
4         <li><a href="#WebNotify Recent Changes Alert"> WebNotify Recent Changes Alert</a><ul>
5             <li><a href="#Configuring Outgoing Mail"> Configuring Outgoing Mail</a></li>
6             <li><a href="#Setting the Automatic Email Sche"> Setting the Automatic Email Schedule</a></li>
7           </ul>
8         </li>
9         <li><a href="#WebStatistics Site Usage Log"> WebStatistics Site Usage Log</a><ul>
10             <li><a href="#Configuring for Automatic Operat"> Configuring for Automatic Operation</a></li>
11             <li><a href="#Generating Statistics Manually b"> Generating Statistics Manually by URL</a></li>
12           </ul>
13         </li>
14         <li><a href="#WebSearch"> WebSearch</a><ul>
15             <li><a href="#WebChanges"> WebChanges</a></li>
16             <li><a href="#WebIndex"> WebIndex</a></li>
17           </ul>
18         </li>
19       </ul>
20     </li>
21   </ul>
22 </div>
23
24 # <a name="TWiki Site Tools"></a> TWiki Site Tools
25
26 _Utilities for searching, navigation, and monitoring site activity_
27
28 [[TWikiSiteTools]] include utilities for navigating, searching and keeping up with site activity. Preferences can be configured by web or site-wide. You are currently in the **TWiki** web. In particular, TWiki provides two highly configurable, automated site monitoring tools, **WebNotify**, to email alerts when topics are edited, and **WebStats**, to generate detailed activity reports.
29
30 ## <a name="WebNotify Recent Changes Alert"></a><a name="_WebNotify Recent Changes Alert"></a> WebNotify Recent Changes Alert
31
32 Each TWiki web has an automatic email alert service that sends a list of recent changes on a preset schedule, like once a day. Users can subscribe and unsubscribe using [[WebNotify]] in each web. The Perl script `mailnotify` is called by a background process at regular intervals. The script sends an automated email to subscribed users if topics were changed in a web since the script was last run.
33
34 - You can create a [[WebNotify]] link using [[TWikiVariables]] with <code>**%NOTIFYTOPIC%**</code>
35
36 TWiki handles WebNotify entries that include the [[WikiName]] of a user or a [[TWikiGroup|Main/TWikiGroups]] and an optional e-mail address. Example entries in WebNotify:
37
38          * Main.FredBloggs
39          * Main.FredBloggs - secondary@home.com
40          * Main.EngineeringGroup
41
42 The first entry is the default form, the notification gets sent to the e-mail address specified in the user's home page. The second entry lists an alternative e-mail address. The third entry specifies a group, the notification gets sent to each member of the group.
43
44 You can also use `%MAINWEB%` instead of `Main`, but this is not necessary even if you have renamed the main web by configuring `$mainWebname` in `TWiki.cfg`.
45
46 ### <a name="Configuring Outgoing Mail"></a> Configuring Outgoing Mail
47
48 %WIKITOOLNAME% will use the <code>**Net::SMTP**</code> module if it is installed on your system. Set this with the <code>**SMTPMAILHOST**</code> variable in [[TWikiPreferences]].
49
50 The notify e-mail uses the default `changes.tmpl` template, or a skin if activated in the [[TWikiPreferences]].
51
52 mailnotify also relies on two hidden files in each `TWiki/data/[web]` directory: `.changes` and `.mailnotify.` Make sure both are writable by your web server process. `.changes` contains a list of changes; go ahead and make this empty. `.mailnotify` contains a timestamp of the last time notification was done.
53
54 You can use an external mail program, like <code>**sendmail**</code>, if the `Net::SMTP` module is not installed. Set the program path in <code>**$mailProgram**</code> in <code>**TWiki.cfg**</code>.
55
56 - %H% Net::SMTP can be easily disabled (ex: if there is an installation error) by setting <code>**SMTPMAILHOST**</code> in [[TWikiPreferences]] to an empty value.
57
58 - %T% You can set a separate <code>**SMTPSENDERHOST**</code> variable to define the mail sender host (some SMTP installations require this).
59
60 ### <a name="Setting the Automatic Email Sche"></a> Setting the Automatic Email Schedule
61
62 **For Unix platforms:** Edit the `cron` table so that `mailnotify` is called in an interval of your choice. Please consult `man crontab` of how to modify the table that schedules program execution at certain intervals. Example:
63
64     % crontab -e
65     15,45 * * * * (cd ~twiki/public_html/bin; ./mailnotify -q)
66
67 The above line will call mailnotify at 15 minutes and 45 minutes past every hour. The `-q` switch suppresses all normal output.
68
69 **For ISP installations:** Many ISPs don't allow hosted accounts direct cron access, as it's often used for things that can heavily load the server. Workaround scripts are available.
70
71 **On Windows NT/2000:** You can use a scheduled task if you have administrative privileges. **_Note:_** AT on an NT machine is pretty limited. Microsoft lists several third-party [replacements](http://www.microsoft.com/ntserver/partners/findoffering/serversolutions/Maintnce.asp#cron) (as of 2001-11-20, none of them free).
72
73 ## <a name="WebStatistics Site Usage Log"></a><a name="_WebStatistics Site Usage Log"></a> WebStatistics Site Usage Log
74
75 You can generate a listing manually, or on an automated schedule, of visits to individual pages, on a per web basis. Compiled as a running total on a monthly basis. Includes totals for Topic Views, Topic Saves, Attachment Uploads, Most Popular Topics with number of views, and Top Contributors showing total of saves and attachment uploads. Previous months are saved.
76
77 - You can create a [[WebStatistics]] link using [[TWikiVariables]] with <code>**%STATISTICSTOPIC%**</code>
78
79 ### <a name="Configuring for Automatic Operat"></a> Configuring for Automatic Operation
80
81 - You can automatically generate usage statistics for all webs. To enable this:
82   - Make sure variable `$doLogTopicView, $doLogTopicSave and $doLogTopicUpload` in `TWiki.cfg` are set. This will generate log entries in file `twiki/data/log<date>.txt` .
83   - The [[WebStatistics]] topic must be present in all webs where you want to have statistics. You can use the topic in the Main web as a template.
84   - Call the `twiki/bin/statistics` script from a cron job, once a day is recommended. This will update the [[WebStatistics]] topics in all webs.
85   - **_Attention:_** The script must run as the same user as the CGI scripts are running, which is user `nobody` on most systems. Example crontab entry: <br />`0 0 * * * (cd /path/to/TWiki/bin; ./statistics >/dev/null 2>&1)`
86   - There is a workaround in case you can't run the script as user `nobody` : Run the utility `twiki/bin/geturl` in your cron job and specify the URL of the `twiki/bin/statistics` script as a parameter. Example: <br />`0 0 * * * (cd /path/to/TWiki/bin; ./geturl mydomain.com /urlpath/to/TWiki/bin/statistics >/dev/null 2>&1)`
87
88 ### <a name="Generating Statistics Manually b"></a> Generating Statistics Manually by URL
89
90 - The `twiki/bin/statistics` script can also be executed as a CGI script, just enter the URL in your browser. Examples:
91   - Update current month for all webs: <br />`http://mydomain.com/twiki/bin/statistics`
92   - Update current month for Main web only: <br />`http://mydomain.com/twiki/bin/statistics/Main`
93   - Update January 2000 for Main web: <br />`http://mydomain.com/twiki/bin/statistics/Main?logdate=200001`
94
95 ## <a name="WebSearch"></a><a name="_WebSearch"></a> WebSearch
96
97 [[WebSearch]] is an extremely fast and flexible search facility, part of the core TWiki feature set. Options include:
98
99 - topic title or full-text search
100 - regular expressions
101 - search within web or site-wide
102 - index-style A-Z alphabetical listing sorted topic title
103 - many more
104
105 See also: [[TWikiVariables]] for including hard-coded searches in text.
106
107 ### <a name="WebChanges"></a><a name="_WebChanges"></a> WebChanges
108
109 To check for the most recently edited topics while on-site, use the [[WebChanges]] link, usually located on the upper toolbar. It lists the most recently modified topics, newest first, along with the first couple of lines of the page content.
110
111 This is simply a preset `SEARCH`. The number of topics listed by the `limit` parameter.:
112
113 > <pre>
114 > %SEARCH{".*" web="%INCLUDINGWEB%" regex="on" nosearch="on" order="modified" <br />reverse="on" limit="50"}%
115 > </pre>
116
117 ### <a name="WebIndex"></a><a name="_WebIndex"></a> WebIndex
118
119 [[WebIndex]] lists all web topics in alphabetical order, with the first couple of lines of text. This is simply a preset `SEARCH`:
120
121 > %SEARCH{"\.*" scope="topic" regex="on" nosearch="on"}%
122
123 -- [[MikeMannix]] - 01 Dec 2001 %BR% -- [[PeterThoeny]] - 30 Jan 2003