1 # <a name="TWiki Site Tools"></a> TWiki Site Tools
3 _Utilities for searching, navigation, and monitoring site activity_
5 TWiki Site Tools 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 **%SYSTEMWEB%** web. In particular, TWiki provides two highly configurable, automated site monitoring tools, **WebNotify**, to e-mail alerts when topics are edited, and **WebStatistics**, to generate detailed activity reports.
9 <li><a href="#TWiki Site Tools"> TWiki Site Tools</a><ul>
10 <li><a href="#WebNotify - recent changes alert"> WebNotify - recent changes alert</a></li>
11 <li><a href="#WebSearch - search TWiki site"> WebSearch - search TWiki site</a></li>
12 <li><a href="#WebChanges - what's new"> WebChanges - what's new</a></li>
13 <li><a href="#WebRss and _WebAtom - news feeds"> WebRss and WebAtom - news feeds on recent changes</a></li>
14 <li><a href="#WebIndex - list of topics"> WebIndex - list of topics</a></li>
15 <li><a href="#WebStatistics - site statistics"> WebStatistics - site statistics</a><ul>
16 <li><a href="#Configuring for automatic operat"> Configuring for automatic operation</a></li>
17 <li><a href="#Generating statistics manually b"> Generating statistics manually by URL</a></li>
20 <li><a href="#Log Files"> Log Files</a></li>
21 <li><a href="#E-mail"> E-mail</a><ul>
22 <li><a href="#Configuring outgoing mail"> Configuring outgoing mail</a></li>
23 <li><a href="#Setting the automatic e-mail sch"> Setting the automatic e-mail schedule</a></li>
26 <li><a href="#Site Permissions"> Site Permissions</a></li>
27 <li><a href="#Help with crontab"> Help with crontab</a></li>
33 <a name="WebNotify"></a>
35 ## <a name="WebNotify - recent changes alert"></a><a name="_WebNotify - recent changes aler"></a> WebNotify - recent changes alert
37 Each TWiki web has an automatic e-mail 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 e-mail to subscribed users if topics were changed in a web since the script was last run.
39 - You can create a [[WebNotify]] link using [[TWikiVariables]] with <code>**%NOTIFYTOPIC%**</code>
41 You can also use `%USERSWEB%` instead of `Main`, but this is not necessary even if you have renamed the main web by configuring `{MainWebName}` in [configure](http://www.dementia.org/twiki/configure).
43 <a name="WebSearch"></a>
45 ## <a name="WebSearch - search TWiki site"></a><a name="_WebSearch - search TWiki site"></a> WebSearch - search TWiki site
47 [[WebSearch]] is an extremely fast and flexible search facility, part of the core TWiki feature set. [[WebSearchAdvanced]] offers more options, including:
49 - topic title or full-text search
51 - search within web or site-wide
52 - index-style A-Z alphabetical listing sorted topic title
55 See also: [[SearchHelp]] for help; [[TWikiVariables]] and [[FormattedSearch]] for including hard-coded searches in text.
57 <a name="WebChanges"></a>
59 ## <a name="WebChanges - what's new"></a><a name="_WebChanges - what's new"></a> WebChanges - what's new
61 To check for the most recently edited topics while on-site, use the [[WebChanges]] link, usually located in the toolbar. It lists the most recently modified topics, newest first, along with the first couple of lines of the page content.
63 This is simply a preset `SEARCH`. The number of topics listed by the `limit` parameter.:
65 > %SEARCH{ ".*" web="%INCLUDINGWEB%" type="regex" nosearch="on" order="modified"%BR% reverse="on"
68 <a name="WebRssAndAtom"></a>
70 ## <a name="WebRss and _WebAtom - news feeds"></a><a name="_WebRss and _WebAtom - news feed"></a> WebRss and WebAtom - news feeds on recent changes
72 You can point your news reader at [[WebRss]] and [[WebAtom]] to find out what is new in a TWiki web. [[WebRssBase]] and [[WebAtomBase]] have the details. Like [[WebChanges]], this is based on a `%SEARCH{}%`.
74 <a name="WebIndex"></a>
76 ## <a name="WebIndex - list of topics"></a><a name="_WebIndex - list of topics"></a> WebIndex - list of topics
78 [[WebIndex]] lists all web topics in alphabetical order, with the first couple of lines of text. This is simply a preset `SEARCH`:
80 > %SEARCH{ "\.*" scope="topic" type="regex" nosearch="on" }%
82 <a name="WebStatistics"></a>
84 ## <a name="WebStatistics - site statistics"></a><a name="_WebStatistics - site statistics"></a> WebStatistics - site statistics
86 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.
88 - You can create a [[WebStatistics]] link using [[TWikiVariables]] with <code>**%STATISTICSTOPIC%**</code>
90 ### <a name="Configuring for automatic operat"></a> Configuring for automatic operation
92 - You can automatically generate usage statistics for all webs. To enable this:
93 - Make sure variable **\{Log\}\{view\}**, **\{Log\}\{save\}** and \*\{Log\}\{upload\} in are set in [configure](http://www.dementia.org/twiki/configure). This will generate log file entries (see below).
94 - 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.
95 - Call the `twiki/bin/statistics` script from a cron job, once a day is recommended. This will update the [[WebStatistics]] topics in all webs.
96 - **_Attention:_** The script must run as the same user as the CGI scripts are running, which is user `nobody` on many systems. Example crontab entry: %BR% `0 0 * * * (cd /path/to/twiki/bin; ./statistics >/dev/null 2>&1)`
97 - There is a workaround in case you can't run the script as user `nobody` : Run the utility `twiki/tools/geturl.pl` 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/tools; ./geturl.pl mydomain.com /urlpath/to/twiki/bin/statistics >/dev/null 2>&1)`
98 - **_NOTE:_** `geturl.pl` will do a TWiki CGI request as the TWikiGuest user, so if you use this workaround, the WebStatistics topics you are updating will have to be writable by TWikiGuest.
100 When running from the command line or a cron job, you can pass parameters to the script like this:
102 ./statistics -logdate 200605 -webs TWiki,Sandbox
104 ### <a name="Generating statistics manually b"></a> Generating statistics manually by URL
106 - The `twiki/bin/statistics` script can also be executed as a CGI script, just enter the URL in your browser. Examples:
107 - Update current month for all webs you have access to: %BR% `http://www.dementia.org/twiki/statistics`
108 - Update current month for %USERSWEB% web only: %BR% `http://www.dementia.org/twiki/statistics/%USERSWEB%`
109 - Update Jun 2010 for %USERSWEB% web: %BR% `http://www.dementia.org/twiki/statistics/%USERSWEB%?logdate=201006`
110 - Update Jun 2010 for the ProjectX, ProjectY and ProjectZ webs: %BR% `http://www.dementia.org/twiki/statistics?logdate=201006;webs=ProjectX,ProjectY,ProjectZ`
112 <a name="LogFiles"></a>
114 ## <a name="Log Files"></a> Log Files
116 TWiki generates monthly log files which are used by the statistics script
118 - The log file is defined by the **\{LogFileName\}** setting in [configure](http://www.dementia.org/twiki/configure)
119 - The file name is `log<year><month>.txt`
120 - Example path name: `twiki/logs/log201006.txt`
121 - Each access gets logged as: %BR% `| <time> | <wikiusername> | <action> | <web>.<topic> | <extra info> | <IP address> |`
122 - Example log entry: %BR% `| 29 Jun 2010 - 12:08 | %USERSWEB%.TWikiGuest | view | %SYSTEMWEB%.WebRss | | 66.124.232.02 |`
123 - Actions are logged if enabled in [configure](http://www.dementia.org/twiki/configure) by the **\{Log\}\{_action_\}** flags
124 - Logged actions: <table border="1" cellpadding="0" cellspacing="0">
126 <th bgcolor="#99CCCC"><strong> Script </strong></th>
127 <th bgcolor="#99CCCC"><strong> Action name </strong></th>
128 <th bgcolor="#99CCCC"><strong> Extra info </strong></th>
132 <td><code>attach</code></td>
133 <td> when viewing attach screen of previous uploaded attachment: <code>filename</code></td>
137 <td><code>changes</code></td>
142 <td><code>edit</code></td>
143 <td> when editing non-existing topic: <code>(not exist)</code></td>
147 <td><code>rdiff</code></td>
148 <td> higher and lower revision numbers: <code>4 3</code></td>
152 <td><code>regstart</code></td>
153 <td> WikiUserName, e-Mail address, [[Main/LoginName]]: <code>user attempts to register</code></td>
157 <td><code>register</code></td>
158 <td> E-mail address: <code>user successfully registers</code></td>
162 <td><code>bulkregister</code></td>
163 <td> WikiUserName of new, e-mail address, admin ID </td>
167 <td><code>rename</code></td>
168 <td> when moving topic: <code>moved to Newweb.NewTopic</code></td>
172 <td><code>move</code></td>
173 <td> when moving attachment: <code>Attachment filename moved to Newweb.NewTopic</code></td>
177 <td><code>save</code></td>
178 <td> when replacing existing revision: <code>repRev 3</code> %BR% when user checks the minor changes box: <code>dontNotify</code> %BR% when user changes attributes to an exising attachment: <code>filename.ext</code></td>
182 <td><code>cmd</code></td>
183 <td> special admin parameter used when saving </td>
187 <td><code>search</code></td>
188 <td> search string </td>
192 <td><code>upload</code></td>
197 <td><code>view</code></td>
198 <td> when viewing non-existing topic: <code>(not exist)</code> %BR% when viewing previous topic revision: <code>r3</code></td>
202 <a name="ConfigureEmail"></a>
204 ## <a name="E-mail"></a> E-mail
206 ### <a name="Configuring outgoing mail"></a> Configuring outgoing mail
208 Outgoing mail is required for [[TWikiRegistration]] and for [[recent changes alert|Main/WebHome#WebNotify]].
210 TWiki 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]].
212 The notify e-mail uses the default `changes.tmpl` template, or a skin if activated in the [[TWikiPreferences]].
214 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.
216 You can use an external mail program, such as <code>**sendmail**</code>, if the `Net::SMTP` module is not installed. Set the program path in <code>**\{MailProgram\}**</code> in [configure](http://www.dementia.org/twiki/configure).
218 - %H% Net::SMTP can be easily disabled (if there is an installation error) by setting <code>**SMTPMAILHOST**</code> in [[TWikiPreferences]] to an empty value.
220 - %T% You can set a separate <code>**SMTPSENDERHOST**</code> variable to define the mail sender host (some SMTP installations require this).
222 ### <a name="Setting the automatic e-mail sch"></a> Setting the automatic e-mail schedule
224 **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:
227 0 1 * * * (cd /path/to/twiki/bin; ./mailnotify -q)
229 The above line will run mailnotify nightly at 01:00. The `-q` switch suppresses all normal output.
231 **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.
233 **On Windows:** You can use a scheduled task if you have administrative privileges. TWiki:Codev/CronTabWin is a free scheduler for Windows.
235 ## <a name="Site Permissions"></a> Site Permissions
237 - [[TWikiAccessControl]] describes how to restrict read and write access to topics and webs, by users and groups
238 - [[SitePermissions]] lists the permissions settings of the webs on this TWiki site
240 ## <a name="Help with crontab"></a> Help with crontab
242 The crontab command is used to schedule commands to be executed periodically.
244 - Wikipedia.org:Crontab - crontab documentation
245 - [pycron](http://www.kalab.com/freeware/pycron/pycron.htm) - crontab for Windows
247 **_Related Topics:_** [[AdminDocumentationCategory]], [[AdminToolsCategory]]
249 -- **_Contributors:_** TWiki:Main.MikeMannix, TWiki:Main.PeterThoeny, TWiki:Main.CrawfordCurrie, TWiki:Main.KennethLavrsen, TWiki:Main.SvenDowideit