Interner Namespace für Mediawiki: Unterschied zwischen den Versionen

Aus C3D2
Zur Navigation springen Zur Suche springen
(initial release)
(kein Unterschied)

Version vom 18. Dezember 2006, 13:42 Uhr

Patch um unbekannte Namespaces zu verstecken

Index: includes/SpecialRecentchanges.php
===================================================================
--- includes/SpecialRecentchanges.php   (revision 18244)
+++ includes/SpecialRecentchanges.php   (working copy)
@@ -17,6 +17,7 @@
        global $wgUser, $wgOut, $wgRequest, $wgUseRCPatrol;
        global $wgRCShowWatchingUsers, $wgShowUpdatedMarker;
        global $wgAllowCategorizedRecentChanges ;
+       global $wgCanonicalNamespaceNames;
        $fname = 'wfSpecialRecentchanges';

        # Get query parameters
@@ -155,6 +156,7 @@

        # Namespace filtering
        $hidem .= is_null( $namespace ) ?  '' : ' AND rc_namespace' . ($invert ? '!=' : '=') . $namespace;
+       $hidem .= ' AND rc_namespace IN (0,'.join( ',', array_map( 'intval', array_keys($wgCanonicalNamespaceNames) ) ).')';

        // This is the big thing!

Index: includes/Revision.php
===================================================================
--- includes/Revision.php       (revision 18244)
+++ includes/Revision.php       (working copy)
@@ -165,6 +165,8 @@
         * @static
         */
        private static function loadFromConds( &$db, $conditions ) {
+               global $wgCanonicalNamespaceNames;
+               array_push( $conditions, 'page_namespace IN (0,'.join( ',', array_map( 'intval', array_keys($wgCanonicalNamespaceNames) ) ).')' );
                $res = Revision::fetchFromConds( $db, $conditions );
                if( $res ) {
                        $row = $res->fetchObject();