Extension:SpecialNamespaces/sourcecode (ver 0.1)

";                       }                        $wgOut->addHTML($out);                }        }

SpecialPage::addPage( new Namespaces ); }

function wfNamespaces(&$namespaceNames,&$namespaceAliases) {       global $wgDBname,$wgMemc; $key = "$wgDBname:SpecialNamespaces:names"; $cached = $wgMemc->get ($key);
 * 1) Insert translated custom namespace name/aliases from namespace_names database
 * 2) destination format is:
 * 3)     $this->namespaceNames[100]="ns_100";
 * 4)     $this->namespaceAliases =  array("Centurion" => 100);

if (!is_array($cached)) {               $dbr =& wfGetDB( DB_SLAVE ); $res = $dbr->select( 'namespace_names', '*' ); $numrows = $dbr->numRows( $res ); if ($numrows > 0) while( $s = $dbr->fetchObject( $res ) ) { $nsindex = htmlspecialchars( $s->ns_id ); $nsname = htmlspecialchars( $s->ns_name); $nscanonical = htmlspecialchars( $s->ns_canonical ); $nsdefault = htmlspecialchars( $s->ns_default );

if ($nsdefault>0) $namespaceNames[$nsindex] = $nsname; $namespaceAliases = $namespaceAliases + array($nsname => $nsindex); }               $dbr->freeResult( $res ); $wgMemc->set ($key, $namespaceNames); $key = "$wgDBname:SpecialNamespaces:alias"; $wgMemc->set ($key, $namespaceAliases); } else { $namespaceNames = $cached; $key = "$wgDBname:SpecialNamespaces:alias"; $namespaceAliases = $wgMemc->get ($key); } }

function wfNamespacesAddLogType( &$types ) { if ( !in_array( 'namespaces', $types ) ) $types[] = 'namespaces'; return true; }

function wfNamespacesAddLogName( &$names ) { $names['namespaces'] = 'ns_logpagename'; return true; }

function wfNamespacesAddLogHeader( &$headers ) { $headers['namespaces'] = 'ns_logpagetext'; return true; }

function wfNamespacesAddActionText( &$actions ) { $actions['namespaces/namespaces'] = 'ns_logentry'; return true; }

?>