m
Line 1: Line 1:
 +
= MediaWiki tips & tricks =
 +
 
This is a list of tips and tricks I use on various [[MediaWiki]] that I run.
 
This is a list of tips and tricks I use on various [[MediaWiki]] that I run.
  
 
Various versions, such as 1.15.1 for <tt>1.15.1 – 2009-07-13</tt>, may appear.
 
Various versions, such as 1.15.1 for <tt>1.15.1 – 2009-07-13</tt>, may appear.
  
= Disable caching =
+
== Disable caching ==
  
 
There is an extension called ''magic cache'' for single pages. To disable all sort of caching [http://thinkhole.org/wp/2006/09/13/disabling-caching-in-mediawiki/]:
 
There is an extension called ''magic cache'' for single pages. To disable all sort of caching [http://thinkhole.org/wp/2006/09/13/disabling-caching-in-mediawiki/]:
Line 15: Line 17:
 
</PRE>
 
</PRE>
  
= Disable links =
+
== Disable links ==
  
 
On [[Laussywiki]], you can't follow a red-link (that refers to a page that still does not exist), unless you're [[Elena]] or [[Fabrice|myself]]. If you try to force your way, you will be blocked by login permissions. Regular users do not get distracted in opening a page that tells them it does not exist and that they cannot create it. The link, however, exists, to inform it will/should appear at some point and brings light on how the authors structure their thoughts.
 
On [[Laussywiki]], you can't follow a red-link (that refers to a page that still does not exist), unless you're [[Elena]] or [[Fabrice|myself]]. If you try to force your way, you will be blocked by login permissions. Regular users do not get distracted in opening a page that tells them it does not exist and that they cannot create it. The link, however, exists, to inform it will/should appear at some point and brings light on how the authors structure their thoughts.
Line 21: Line 23:
 
This is achieved by patching ''includes/Linker.php'':
 
This is achieved by patching ''includes/Linker.php'':
  
== 1.16.0 ==
+
=== 1.16.0 ===
  
 
Line 285:
 
Line 285:
Line 38: Line 40:
 
</pre>
 
</pre>
  
== 1.15.1 ==
+
=== 1.15.1 ===
  
 
Line 287:
 
Line 287:

Revision as of 07:33, 14 October 2011

Contents

MediaWiki tips & tricks

This is a list of tips and tricks I use on various MediaWiki that I run.

Various versions, such as 1.15.1 for 1.15.1 – 2009-07-13, may appear.

Disable caching

There is an extension called magic cache for single pages. To disable all sort of caching [1]:

## Disable all forms of MediaWiki caching
$wgMainCacheType = CACHE_NONE;
$wgMessageCacheType = CACHE_NONE;
$wgParserCacheType = CACHE_NONE;
$wgCachePages = false;

Disable links

On Laussywiki, you can't follow a red-link (that refers to a page that still does not exist), unless you're Elena or myself. If you try to force your way, you will be blocked by login permissions. Regular users do not get distracted in opening a page that tells them it does not exist and that they cannot create it. The link, however, exists, to inform it will/should appear at some point and brings light on how the authors structure their thoughts.

This is achieved by patching includes/Linker.php:

1.16.0

Line 285:

		# Get a default title attribute.
		if( $target->getPrefixedText() == '' ) {
			# A link like [[#Foo]].  This used to mean an empty title
			# attribute, but that's silly.  Just don't output a title.
		} elseif( in_array( 'known', $options ) ) {
			$defaults['title'] = $target->getPrefixedText();
		} else {
			$defaults['title'] = wfMsg( 'red-link-title', $target->getPrefixedText() );
			if ( !($wgUser->isLoggedIn()) ) { $defaults['onclick'] = "return false;"; }
		}

1.15.1

Line 287:

		# Get a default title attribute.
		if( in_array( 'known', $options ) ) {
			$defaults['title'] = $target->getPrefixedText();
		} else {
		  $defaults['title'] = wfMsg( 'red-link-title', $target->getPrefixedText() );
		  if ( !($wgUser->isLoggedIn()) ) { $defaults['onclick'] = "return false;"; }
		}
We added the line that puts
onclick="return false;"
to the a tag, which prevents unlogged users to go further.