210 lines
9.0 KiB
Plaintext
210 lines
9.0 KiB
Plaintext
==Patches==
|
|
Patch um unbekannte Namespaces zu verstecken und das Cachen des Feeds zu verhindern wenn $wgFeedCacheTimeout gleich 0 ist.
|
|
<pre>
|
|
Index: includes/specials/SpecialRecentchanges.php
|
|
===================================================================
|
|
--- includes/specials/SpecialRecentchanges.php (revision 43703)
|
|
+++ includes/specials/SpecialRecentchanges.php (working copy)
|
|
@@ -192,7 +192,7 @@
|
|
* @return array
|
|
*/
|
|
public function buildMainQueryConds( FormOptions $opts ) {
|
|
- global $wgUser;
|
|
+ global $wgUser, $wgCanonicalNamespaceNames;
|
|
|
|
$dbr = wfGetDB( DB_SLAVE );
|
|
$conds = array();
|
|
@@ -253,6 +253,9 @@
|
|
}
|
|
}
|
|
|
|
+ # hidden Namespace filtering
|
|
+ $conds[] = 'rc_namespace IN (0,'.join( ',', array_map( 'intval', array_keys($wgCanonicalNamespaceNames) ) ).')';
|
|
+
|
|
return $conds;
|
|
}
|
|
|
|
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();
|
|
Index: includes/ChangesFeed.php
|
|
===================================================================
|
|
--- includes/ChangesFeed.php (revision 43703)
|
|
+++ includes/ChangesFeed.php (working copy)
|
|
@@ -47,7 +47,8 @@
|
|
self::generateFeed( $rows, $feed );
|
|
$cachedFeed = ob_get_contents();
|
|
ob_end_flush();
|
|
- $this->saveToCache( $cachedFeed, $timekey, $key );
|
|
+ if ( $wgFeedCacheTimeout > 0 )
|
|
+ $this->saveToCache( $cachedFeed, $timekey, $key );
|
|
}
|
|
return true;
|
|
}
|
|
</pre>
|
|
|
|
Der Patch für Title.php sorgt dafür, daß Mediawiki nicht solche häßlichen URLs mit index.php im Namen generiert wenn Parameter zu übergeben sind.
|
|
|
|
<pre>
|
|
Index: includes/Title.php
|
|
===================================================================
|
|
--- includes/Title.php (revision 18244)
|
|
+++ includes/Title.php (working copy)
|
|
@@ -879,6 +879,8 @@
|
|
}
|
|
else
|
|
$url = str_replace( '$1', $dbkey, $wgArticlePath );
|
|
+ } else if ( $query && $query != '' ) {
|
|
+ $url = str_replace( '$1', $dbkey, $wgArticlePath )."?".$query;
|
|
} else {
|
|
global $wgActionPaths;
|
|
$url = false;
|
|
|
|
</pre>
|
|
|
|
==Erstellen einer Kopie von index.php für den internen Bereich==
|
|
In dieser Kopie fügt man lediglich ein require für die LocalSettings des internen Bereichs hinzu
|
|
<pre>
|
|
--- index.php 2006-11-14 15:52:25.000000000 +0000
|
|
+++ index_intern.php 2006-11-23 22:32:14.000000000 +0000
|
|
@@ -2,6 +2,7 @@
|
|
|
|
# Initialise common code
|
|
require_once( './includes/WebStart.php' );
|
|
+require_once( 'LocalSettingsIntern.php' );
|
|
|
|
# Initialize MediaWiki base class
|
|
require_once( "includes/Wiki.php" );
|
|
</pre>
|
|
|
|
==LocalSettingsIntern.php==
|
|
Das ist die Konfiguration des internen Bereiches. Da die normale LocalSettings.php auch includet wird, brauchen nur Sachen reingeschrieben werden die im internen Bereich anders sein sollen.
|
|
<pre>
|
|
<?php
|
|
|
|
$wgExtraNamespaces = array(
|
|
100 => 'Intern',
|
|
101 => 'Intern_talk'
|
|
);
|
|
|
|
$wgGroupPermissions = array();
|
|
|
|
// Implicit group for all visitors
|
|
$wgGroupPermissions['*' ]['createaccount'] = false;
|
|
$wgGroupPermissions['*' ]['read'] = false;
|
|
$wgGroupPermissions['*' ]['edit'] = false;
|
|
$wgGroupPermissions['*' ]['createpage'] = false;
|
|
$wgGroupPermissions['*' ]['createtalk'] = false;
|
|
|
|
// Implicit group for all logged-in accounts
|
|
$wgGroupPermissions['user' ]['move'] = false;
|
|
$wgGroupPermissions['user' ]['read'] = false;
|
|
$wgGroupPermissions['user' ]['edit'] = false;
|
|
$wgGroupPermissions['user' ]['createpage'] = false;
|
|
$wgGroupPermissions['user' ]['createtalk'] = false;
|
|
$wgGroupPermissions['user' ]['upload'] = false;
|
|
$wgGroupPermissions['user' ]['reupload'] = false;
|
|
$wgGroupPermissions['user' ]['reupload-shared'] = false;
|
|
$wgGroupPermissions['user' ]['minoredit'] = false;
|
|
|
|
// Implicit group for accounts that pass $wgAutoConfirmAge
|
|
$wgGroupPermissions['autoconfirmed']['autoconfirmed'] = false;
|
|
|
|
// Implicit group for accounts with confirmed email addresses
|
|
// This has little use when email address confirmation is off
|
|
$wgGroupPermissions['emailconfirmed']['emailconfirmed'] = false;
|
|
|
|
// Users with bot privilege can have their edits hidden
|
|
// from various log pages by default
|
|
$wgGroupPermissions['bot' ]['bot'] = false;
|
|
$wgGroupPermissions['bot' ]['autoconfirmed'] = false;
|
|
$wgGroupPermissions['bot' ]['nominornewtalk'] = false;
|
|
|
|
// Most extra permission abilities go to this group
|
|
$wgGroupPermissions['sysop']['block'] = true;
|
|
$wgGroupPermissions['sysop']['createaccount'] = true;
|
|
$wgGroupPermissions['sysop']['delete'] = true;
|
|
$wgGroupPermissions['sysop']['deletedhistory'] = true; // can view deleted history entries, but not see or restore the text
|
|
$wgGroupPermissions['sysop']['editinterface'] = true;
|
|
$wgGroupPermissions['sysop']['import'] = true;
|
|
$wgGroupPermissions['sysop']['importupload'] = true;
|
|
$wgGroupPermissions['sysop']['move'] = true;
|
|
$wgGroupPermissions['sysop']['patrol'] = true;
|
|
$wgGroupPermissions['sysop']['protect'] = true;
|
|
$wgGroupPermissions['sysop']['proxyunbannable'] = true;
|
|
$wgGroupPermissions['sysop']['rollback'] = true;
|
|
$wgGroupPermissions['sysop']['trackback'] = true;
|
|
$wgGroupPermissions['sysop']['upload'] = true;
|
|
$wgGroupPermissions['sysop']['reupload'] = true;
|
|
$wgGroupPermissions['sysop']['reupload-shared'] = true;
|
|
$wgGroupPermissions['sysop']['unwatchedpages'] = true;
|
|
$wgGroupPermissions['sysop']['autoconfirmed'] = true;
|
|
$wgGroupPermissions['sysop']['upload_by_url'] = true;
|
|
|
|
// Implicit group for all logged-in accounts
|
|
$wgGroupPermissions['hacker' ]['move'] = true;
|
|
$wgGroupPermissions['hacker' ]['read'] = true;
|
|
$wgGroupPermissions['hacker' ]['edit'] = true;
|
|
$wgGroupPermissions['hacker' ]['createpage'] = true;
|
|
$wgGroupPermissions['hacker' ]['createtalk'] = true;
|
|
$wgGroupPermissions['hacker' ]['upload'] = true;
|
|
$wgGroupPermissions['hacker' ]['reupload'] = true;
|
|
$wgGroupPermissions['hacker' ]['reupload-shared'] = true;
|
|
$wgGroupPermissions['hacker' ]['minoredit'] = true;
|
|
|
|
// Permission to change users' group assignments
|
|
$wgGroupPermissions['bureaucrat']['userrights'] = true;
|
|
|
|
$wgCanonicalNamespaceNames = $wgCanonicalNamespaceNames + $wgExtraNamespaces;
|
|
|
|
$wgFeedCacheTimeout = 0;
|
|
|
|
?>
|
|
</pre>
|
|
|
|
==.htaccess Rewrite-Rules==
|
|
Die Hauptarbeit bei dieser Lösung wird von Rewrite-Rules erledigt. Alle Anfragen auf den internen Bereich werden auf index_intern.php umgeleitet. Zusätzlich werden noch 2 Special-Pages definiert:
|
|
# Spezial:Internpages - Liste der Seiten im internen Namensraum
|
|
# Spezial:Internchanges - RecentChanges nur für den internen Namensraum
|
|
|
|
Spezial:Log und Spezial:Movepage werden ebenfalls auf den internen Bereich umgeleitet, damit die Links im Log funktionieren bzw. damit man Seiten in den internen Namespace verschieben kann.
|
|
Die Kategorie-Seiten werden ebenfalls auf die interne index.php umgeleitet damit die Links zu internen Artikeln in den Kategorien korrekt sind.
|
|
<pre>
|
|
RewriteEngine on
|
|
|
|
RewriteCond %{REQUEST_FILENAME} !-f
|
|
RewriteRule ^(Spe[cz]ial:Internpages)$ /mediawiki/index_intern.php?title=Special:Allpages&namespace=100 [QSA,L]
|
|
|
|
RewriteCond %{REQUEST_FILENAME} !-f
|
|
RewriteRule ^(Spe[cz]ial:Internchanges)(\?(.*))?$ /mediawiki/index_intern.php?title=Spezial:Recentchanges&$3 [QSA,L]
|
|
|
|
RewriteCond %{REQUEST_FILENAME} !-f
|
|
RewriteRule ^(Spe[cz]ial:(Log|Movepage).*)$ /mediawiki/index_intern.php?title=$1 [QSA,L]
|
|
|
|
RewriteCond %{REQUEST_FILENAME} !-f
|
|
RewriteRule ^((Intern|Intern_talk|Kategorie):.*)$ /mediawiki/index_intern.php?title=$1 [QSA,L]
|
|
|
|
RewriteCond %{REQUEST_FILENAME} !-f
|
|
RewriteRule ^(.*)$ /mediawiki/index.php?title=$1 [QSA,L]
|
|
</pre>
|
|
|
|
==Interwiki-Link==
|
|
Damit im öffentlichen Teil des Wikis Links auf den internen Bereich nicht rot erscheinen, sollte man einen Interwiki-Link für den internen Bereich anlegen:
|
|
INSERT INTO interwiki(iw_prefix,iw_url,iw_local,iw_trans) VALUES ('intern', 'https://wiki.c3d2.de/Intern:$1', 0, 0);
|
|
|
|
==TODO==
|
|
Der derzeitige Ansatz ist nicht besonders schön und hat eventuell Lücken wo man doch an den Content interner Artikel rankommen könnte. [[Sven]] plant das ganze nochmal richtig cool zu machen indem der Public Teil des Wiki nur auf Views arbeitet, die interne Namespaces garnicht enthalten. Das ist mit PostgreSQL-Rules möglich und würde die Patches an Mediawiki unnötig machen.
|
|
|
|
[[Kategorie:Wissen]]
|
|
[[Kategorie:Wiki]]
|