Last modified: 2014-11-17 09:21:35 UTC
Some wikimedia projects (Wikisource) would largely benefit from a method to
partially protect the text of an article.
A new syntax would delimit protected sections, e.g. <protect>protected
text</protect>, or maybe <div class="protected">. Protected text may be edited
only by sysops. Other parts of the text may be edited by anybody.
No modification of the edit window is required in order to implement this. If a
user who is not allowed tries to edit a protected section, he will simply
receive an error message when he submits his text, (or something similar to what
one gets in case of edit conflict).
Needless to say, unpriviledged users should not be allowed to add new <protect>
tags to articles.
*** Bug 4376 has been marked as a duplicate of this bug. ***
You may want to consider, instead, protecting sections, which MediaWiki is far
more aware of and can simply strip out of edit box before other users get to it.
I guess transclusion is too clunky for the task.
ok, made a crude implementation of it.
Here is an example: http://thecircle.dyndns.org/wiki/index.php/Apple
I will attach my code once I have figured out how to make it an extension.
Created attachment 1247 [details]
ok, created an extension.
Created attachment 1281 [details]
don't call error_reporting()
don't use private field mOutputType
Created attachment 1283 [details]
extension file, corrected after feedback by avar & hashar
implements a new permission
messages can be localized
Commited as 'ProtectSection' directory in module 'extensions'.
could this extension be enabled on Wikisource? I tested it on my own wiki, and
it was also successfully installed on ihate.org.uk.
following Angela's suggestion, I organised a vote :
Given the tremendous support in favor of this extension, I hereby request its
Any thoughts about implementing [[Wikipedia:Semi-protection
Policy|Semi-protection]]? This would be useful for things that don't change too
much and get constantly vandalized, like Record Sales or facts that keep getting
incorrectly modified (like Howard Zinn's birthdate).
(In reply to comment #7)
> Commited as 'ProtectSection' directory in module 'extensions'.
Is there a particular way to install this to an existing wiki? I copied the
Protect.php script to extensions and pointed the LocalSettings.php to that file.
When I try to use the <protect></protect> tags, they work when the section is
edited, but not if the entire article or higher heading is edited. Is there more
to using this extension than what I did?
Created attachment 1436 [details]
bugfix + "protected" div
there was a bug in the regexp, this patche fixes it.
it also surrounds protected text with "<div class=protected> </div>", so that a
user can set his/her preferences to make protected sections visible.
Created attachment 1437 [details]
minor change to previous...
(In reply to Comment number 10)
This is not about vandalism. Wikisource has a policy of protecting throughly
proof-read sources for integrity issues. This bug would allow a section to
remain open for editing which could contain a short introduction or other notes.
For more details read the Scriptorium at the mulitilingual Wikisource as well
as the English policy pages on text integrity.
Applied the fix to r16619. Please open another bug to ask the ProtectSection
extension to be enabled on Wikisource sites.
OK - this bug is referenced from some places, therefore I'm reopening it a
request to enable the extension.
The extension doesn't work with section editing.
What do you mean by that ? It is not supposed to work that way...
Created attachment 3158 [details]
Proposed alternative version of ProtectSection
I modified ProtectSection to remove Section Edit links for unauthorized users
within the protected block of text. This involved moving wfStripProtectTags to
run under ParserAfterTidy.
(In reply to comment #19)
> Created an attachment (id=3158) 
> Proposed alternative version of ProtectSection
> I modified ProtectSection to remove Section Edit links for unauthorized users
> within the protected block of text. This involved moving wfStripProtectTags to
> run under ParserAfterTidy.
That probably won't work well with caching; the presence/absence of links would
reflect the user the request that parsed the version in cache, not the user that
is viewing the cached version.
Created attachment 3226 [details]
Bug fix to previous submission. Now handles section edits better.
The previous version blocked editing of an unprotected section followed by a
protected section. This version should work better for section-level edits.
(In reply to comment #20)
> (In reply to comment #19)
> > Created an attachment (id=3158)  
> > Proposed alternative version of ProtectSection
> > I modified ProtectSection to remove Section Edit links for unauthorized users
> > within the protected block of text. This involved moving wfStripProtectTags to
> > run under ParserAfterTidy.
> That probably won't work well with caching; the presence/absence of links would
> reflect the user the request that parsed the version in cache, not the user that
> is viewing the cached version.
I don't have caching set up on my wiki, so I can't test this.