On 07/05/2008, Daniel Barrett danb@vistaprint.com wrote:
Something like this loop should work, if you haven't defined any custom namespaces in your wiki:
global $wgCanonicalNamespaceNames; foreach ($wgCanonicalNamespaceNames as $ns => $name) { // If namespace ID is non-negative and even, protect it. if ($ns >= 0 && $ns % 2 == 0) { $wgNamespaceProtection[$ns] = array( 'sysop' ); } }
Don't you need namespace ids, rather than namespace names? I may just be mis-remembering what the various arrays are called...