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             <li><a href="#Log File Details"> Log File Details</a></li>
13           </ul>
14         </li>
15         <li><a href="#WebSearch"> WebSearch</a><ul>
16             <li><a href="#WebChanges"> WebChanges</a></li>
17             <li><a href="#WebIndex"> WebIndex</a></li>
18           </ul>
19         </li>
20       </ul>
21     </li>
22   </ul>
23 </div>
24
25 # <a name="TWiki Site Tools"></a> TWiki Site Tools
26
27 _Utilities for searching, navigation, and monitoring site activity_
28
29 [[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.
30
31 ## <a name="WebNotify Recent Changes Alert"></a><a name="_WebNotify Recent Changes Alert"></a> WebNotify Recent Changes Alert
32
33 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.
34
35 - You can create a [[WebNotify]] link using [[TWikiVariables]] with <code>**%NOTIFYTOPIC%**</code>
36
37 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:
38
39          * Main.FredBloggs
40          * Main.FredBloggs - secondary@home.com
41          * Main.EngineeringGroup
42
43 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.
44
45 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`.
46
47 ### <a name="Configuring Outgoing Mail"></a> Configuring Outgoing Mail
48
49 %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]].
50
51 The notify e-mail uses the default `changes.tmpl` template, or a skin if activated in the [[TWikiPreferences]].
52
53 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.
54
55 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>.
56
57 - %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.
58
59 - %T% You can set a separate <code>**SMTPSENDERHOST**</code> variable to define the mail sender host (some SMTP installations require this).
60
61 ### <a name="Setting the Automatic Email Sche"></a> Setting the Automatic Email Schedule
62
63 **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:
64
65     % crontab -e
66     0 2 * * * (cd /path/to/twiki/bin; ./mailnotify -q)
67
68 The above line will run mailnotify nightly at 02:00. The `-q` switch suppresses all normal output.
69
70 **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.
71
72 **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). TWiki:Codev/CronTabWin is a free scheduler for Windows.
73
74 ## <a name="WebStatistics Site Usage Log"></a><a name="_WebStatistics Site Usage Log"></a> WebStatistics Site Usage Log
75
76 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.
77
78 - You can create a [[WebStatistics]] link using [[TWikiVariables]] with <code>**%STATISTICSTOPIC%**</code>
79
80 ### <a name="Configuring for Automatic Operat"></a> Configuring for Automatic Operation
81
82 - You can automatically generate usage statistics for all webs. To enable this:
83   - Make sure variable `$doLogTopicView, $doLogTopicSave and $doLogTopicUpload` in `TWiki.cfg` are set. This will generate log file entries (see below).
84   - 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.
85   - Call the `twiki/bin/statistics` script from a cron job, once a day is recommended. This will update the [[WebStatistics]] topics in all webs.
86   - **_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)`
87   - 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)`
88
89 ### <a name="Generating Statistics Manually b"></a> Generating Statistics Manually by URL
90
91 - The `twiki/bin/statistics` script can also be executed as a CGI script, just enter the URL in your browser. Examples:
92   - Update current month for all webs: <br />`http://mydomain.com/twiki/bin/statistics`
93   - Update current month for Main web only: <br />`http://mydomain.com/twiki/bin/statistics/Main`
94   - Update January 2000 for Main web: <br />`http://mydomain.com/twiki/bin/statistics/Main?logdate=200001`
95
96 ### <a name="Log File Details"></a> Log File Details
97
98 TWiki generates monthly log files which are used by the statistics
99
100 - The log directory is defined by the `$logDir` variable in TWiki.cfg
101 - The file name is `log<year><month>.txt`
102 - Example path name: `twiki/data/log201006.txt`
103 - Each access gets logged as: %BR% `| <time> | <wikiusername> | <action> | <web>.<topic> | <extra info> | <IP address> |`
104 - Example log entry: %BR% `| 29 Jun 2010 - 11:45 | Main.TWikiGuest | view | TWiki.WebRss |  | 66.124.232.02 |`
105 - Actions are logged if enabled in TWiki.cfg by the `$doLogTopic<action>` flags
106 - Logged actions: <table border="1" cellpadding="0" cellspacing="0">
107   <tr>
108     <th bgcolor="#99CCCC"><strong> Script </strong></th>
109     <th bgcolor="#99CCCC"><strong> Action name </strong></th>
110     <th bgcolor="#99CCCC"><strong> Extra info </strong></th>
111   </tr>
112   <tr>
113     <td> attach </td>
114     <td><code>attach</code></td>
115     <td> when viewing attach screen of previous uploaded attachment: <code>filename</code></td>
116   </tr>
117   <tr>
118     <td> changes </td>
119     <td><code>changes</code></td>
120     <td>   </td>
121   </tr>
122   <tr>
123     <td> edit </td>
124     <td><code>edit</code></td>
125     <td> when editing non-existing topic: <code>(not exist)</code></td>
126   </tr>
127   <tr>
128     <td> register </td>
129     <td><code>register</code></td>
130     <td> E-mail address </td>
131   </tr>
132   <tr>
133     <td> save </td>
134     <td><code>save</code></td>
135     <td> when replacing existing revision: <code>repRev 1.3</code> %BR% when user checks the minor changes box: <code>dontNotify</code></td>
136   </tr>
137   <tr>
138     <td> search </td>
139     <td><code>search</code></td>
140     <td> search string </td>
141   </tr>
142   <tr>
143     <td> rdiff </td>
144     <td><code>rdiff</code></td>
145     <td><code>1.4 1.3</code></td>
146   </tr>
147   <tr>
148     <td> rename </td>
149     <td><code>rename</code></td>
150     <td> when moving topic: <code>moved to Newweb.NewTopic</code></td>
151   </tr>
152   <tr>
153     <td> rename </td>
154     <td><code>move</code></td>
155     <td> when moving attachment: <code>Attachment filename moved to Newweb.NewTopic</code></td>
156   </tr>
157   <tr>
158     <td> upload </td>
159     <td><code>upload</code></td>
160     <td> filename </td>
161   </tr>
162   <tr>
163     <td> view </td>
164     <td><code>view</code></td>
165     <td> when viewing non-existing topic: <code>(not exist)</code> %BR% when viewing previous topic revision: <code>r1.3</code></td>
166   </tr>
167 </table>
168
169 ## <a name="WebSearch"></a><a name="_WebSearch"></a> WebSearch
170
171 [[WebSearch]] is an extremely fast and flexible search facility, part of the core TWiki feature set. Options include:
172
173 - topic title or full-text search
174 - regular expressions
175 - search within web or site-wide
176 - index-style A-Z alphabetical listing sorted topic title
177 - many more
178
179 See also: [[TWikiVariables]] for including hard-coded searches in text.
180
181 ### <a name="WebChanges"></a><a name="_WebChanges"></a> WebChanges
182
183 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.
184
185 This is simply a preset `SEARCH`. The number of topics listed by the `limit` parameter.:
186
187 > <pre>
188 > %SEARCH{".*" web="%INCLUDINGWEB%" regex="on" nosearch="on" order="modified" <br />reverse="on" limit="50"}%
189 > </pre>
190
191 ### <a name="WebIndex"></a><a name="_WebIndex"></a> WebIndex
192
193 [[WebIndex]] lists all web topics in alphabetical order, with the first couple of lines of text. This is simply a preset `SEARCH`:
194
195 > %SEARCH{"\.*" scope="topic" regex="on" nosearch="on"}%
196
197 -- TWiki:Main.MikeMannix - 01 Dec 2001 %BR% -- TWiki:Main.PeterThoeny - 24 Apr 2004