How useful is section protection, I used to think hmm, sounds like a good idea, but can't think of anywhere wikimedia would get much use of it, afterall you could always jsut slap some <noinclude> tags around the sectoin and replace it..... ----- Original Message ----- From: "Jim Hu" jimhu@tamu.edu To: "Wikimedia developers" wikitech-l@lists.wikimedia.org Sent: Monday, January 29, 2007 12:05 PM Subject: [Wikitech-l] ProtectSection.php modification - where topost/discuss?
There was some discussion on one of the mailing lists about protecting specific sections in a wiki page, where Rob Church noted an extension called ProtectSection.php. I have modified the code to run one of the functions at a different hook, which allows me to also kill any subsection Edit links on headings inside a protected section. I have it working on 1.8.3 and 1.7.1 locally.
I noticed that ProtectSection in svn has been modified by tstarling and hashar (tstarling says "It's still completely broken with section editing, though." ... but it seems to work for me, unless I'm misunderstanding the issue. Also, if the section edit links are gone, the issue may be moot.). How should I submit the code modification for others to look at? I wasn't sure if this should go to bugzilla bug 4375 or here. I hope that my code modification may be worth looking at, but I worry that it's too hacky to warrant consideration yet for the topic of the bug.
Please advise.
===================================== Jim Hu
p.s. What I did was move the call to one of the functions, wfStripProtectTags, to ParserAfterTidy, and changed it to:
function wfStripProtectTags ( &$parser , &$text) {
$tmp = explode("<protect>",$text); $sections = array(); $sections[] = array_shift($tmp); foreach($tmp as $block){ $tmp = explode("</protect>",$block); $sections[] = "<span class='protected'>".preg_replace("/<div class="editsection(.*?)</div>/i", "", $tmp[0])."</span>"; array_shift($tmp); $sections[] = implode('',$tmp); } $text = implode("",$sections); return true; }
someday I'll learn how to use diff :(
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/wikitech-l