Mode name | Description | Context |
---|---|---|
local | editable locally and not shared with other sites | |
master | editable locally and mirrored to other sites | content_master |
slave | not editable locally and mirrored from the master site | content_slave |
read-only | cannot be edited | inactive |
$TWiki::cfg{ReadOnlyAndMirrorWebs}{SiteName}
enables this feature.
There are two ways to set read-only and mirroring related information.
One is to use MetadataRepository and the other is setting preferences on WebPreferences.
For a site federation having hundreds or thousands of webs, MetadataRepository should be the only practical option.
But just to make %SYSTEMWEB% read-only, that's too much.
So you can accomplish that without introducing MetadataRepository.
That should be handy if you want to try it out before diving into it.
$TWiki::cfg{ReadOnlyAndMirrorWebs}{SiteName}
value.
If it's a mirror site copied from another site which is accessible, you need to set MASTERWEBSCRIPTURLTMPL to e.g. http://twiki.example.com/cgi-bin//WebName.
If the master site needs a file name extension such as .cgi for CGI programs, you need to set MASTERSCRIPTSUFFIX.
There are cases where the view URL format is different from URLs for other operations. For example, view URLs may be http:/twiki.example.com/Web/Topic.
In such cases, you should set MASTERWEBVIEWURL to e.g. http:/twiki.example.com/Web.
Because this is not the norm, MASTERWEBVIEWURL is optional.
$TWiki::cfg{ReadOnlyAndMirrorWebs}{SiteName}
) and preferences on WebPreferences don't matter.
The web's 'master' field specifies the master site.
If it's the same as $TWiki::cfg{ReadOnlyAndMirrorWebs}{SiteName}
, then the web's content mode is 'master'.
Otherwise, the sites table is referred to get information of the master site.
If the sites table doesn't have the record for the master site, the web is regarded as 'read-only'. Even if there is a record, if the record doesn't have the 'scripturl' field, the web is still regarded as 'read-only'
If the 'scripturl' field is present, the web is regarded as 'slave' and the 'scripturl' value is used to make the 'webScriptUrlTmpl' value of the web.
In addition, the 'scriptsuffix' and 'viewurl' fields of the site record are examined.
viewtopicactionbuttons.mirror.tmpl
defining "action_master".
Here's an example:
%TMPL:INCLUDE{"viewtopicactionbuttons"}% %TMPL:DEF{"action_master"}%%TMPL:P{"mirror_to_all_link"}%%TMPL:P{"sep"}%%TMPL:END% %TMPL:DEF{"mirror_to_all_link"}%<span> <a href='%SCRIPTURL{"mirror"}%?webs=%WEB%;push=1' rel='nofollow' onClick='return confirm("%MAKETEXT{"Do you really want to mirror to all slave sites now?\nIt may take a while to complete."}%");' %MAKETEXT{"title='Mirror this web to all slave sites'>Mirror to all"}%</a> </span>%TMPL:END%Then you would define SKIN as follows.
* Set SKIN = mirror, tagme, topmenu, pattern
viewtopicactionbuttons.tmpl
template file, which is supposed to be used by all properly made skins, is enhanced for this behavior.
If you have a federation of sites,
you may provide a manual mirroring feature.
That feature would show the "Mirror to all" button on a master web as follows.
For this, aforementioned viewtopicactionbuttons.tmpl
has been enhanced to refer to the mirror_to_all_link
template block, which is a null string by default.
You would provide viewtopicactionbuttons.mirror.tmpl
defining the mirror_to_all_link
displaying the "Mirror to all" link.
And then you would set SKIN to e.g. mirror, topmenu, pattern
.
$TWiki::cfg{ReadOnlyAndMirrorWebs}{SiteName}
if it's defined. Otherwise, it returns the null string.
%IF{"context content_slave" ...}%
and %TMPL:P{context="content_master" then="..." else="..."}%
.
statistics
script behaves differently in the presence of read-only and/or mirror webs.
There are additional configuration parameters of read-only and mirror webs.
strawman
, woodenman
, and tinman
, rather than each server has its own stats.
For that, access log files need to be copied among the federation members.
Concretely speaking, strawman
needs to get access logs of woodenman
and tinman
, woodenman
needs to get access logs of strawman
and tinman
, etc.
This should be done as a part of content mirroring.
If {Stats}{LogFileGlob}
configuration parameter is set as shown below, the statistics
script reads access log files matching the file glob (wildcard) instead of the file specified by {LogFileName}
.
$TWiki::cfg{Stats}{LogFileGlob} = "$TWiki::cfg{LogDir}*/log%DATE%.*.txt";In the example above, the following things are assumed/implied.
$TWiki::cfg{LogDir}
has the directory having access log (logYYYYMM.txt
), warning log (warnYYYYMM.txt
), and debug log (debugYYYYMM.txt
) files /var/twiki/logs
"$TWiki::cfg{LogDir}-$site_name"
/var/twiki/logs-eu
and /var/twiki/logs-as
statistics
script writes to WebStatistics only on the master site of a web. For example, WebOne.WebStatistics is written only on strawman
.
And then, WebStatistics is mirrored to slave sites together with other updated topics.
{Stats}{ReadOnlyWebs}
and {Stats}{ReadOnlyWebStatsOn}
configuration parameters as follows, read-only webs' statistics is written as WEBNAMEWebStatistics topic on the web specified by {Stats}{ReadOnlyWebStatsOn}
on the master site.
$TWiki::cfg{Stats}{ReadOnlyWebs} = [qw(TWiki)]; $TWiki::cfg{Stats}{ReadOnlyWebStatsOn} = $TWiki::cfg{UsersWebName};On a read-only web, WebStatistics is supposed be as follows. This way, users don't have to know where read-only webs' statistics are housed.
%INCLUDE{"%USERSWEB%.%WEB%WebStatistics" disablefixlinks="on"}%
{UsersWebName}
web (Main by default),
which might be a slave or read-only.
It's processed and written only if the {UsersWebName}
web is writable.
tools/mailnotify
happens only with local or master webs for the obvious reasons.
tick_twiki.pl
is slightly enhanced so that only webs writable locally are subject to processing by tick_twiki.pl
.
Related Topics: AdminDocumentationCategory, MetadataRepository, VarCONTENTMODE, VarSCRIPTURL2, VarWEBLIST
I | Attachment | Action | Size | Date | Who | Comment |
---|---|---|---|---|---|---|
png | bottom-toolbar-w-mirror-to-all.png | manage | 8.9 K | 2012-08-22 - 14:44 | TWikiContributor | |
png | bottom-toolbar-w-view-master.png | manage | 9.6 K | 2012-08-22 - 14:44 | TWikiContributor |
Copyright © 1999-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Daya Bay? Send feedback Note: Please contribute updates to this topic on TWiki.org at TWiki:TWiki.ReadOnlyAndMirrorWebs. |