m
m
 
(3 intermediate revisions by one user not shown)
Line 13: Line 13:
 
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/]:
  
<pre>
+
<code lang='php'>## Disable all forms of MediaWiki caching
## Disable all forms of MediaWiki caching
+
 
$wgMainCacheType = CACHE_NONE;
 
$wgMainCacheType = CACHE_NONE;
 
$wgMessageCacheType = CACHE_NONE;
 
$wgMessageCacheType = CACHE_NONE;
 
$wgParserCacheType = CACHE_NONE;
 
$wgParserCacheType = CACHE_NONE;
$wgCachePages = false;
+
$wgCachePages = false;</code>
</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.
 
 
This is achieved by patching ''includes/Linker.php'':
 
This is achieved by patching ''includes/Linker.php'':
  
Line 35: Line 32:
 
Line 285:
 
Line 285:
  
<pre>
+
<code lang='php'> # Get a default title attribute.
# Get a default title attribute.
+
 
if( $target->getPrefixedText() == '' ) {
 
if( $target->getPrefixedText() == '' ) {
 
# A link like [[#Foo]].  This used to mean an empty title
 
# A link like [[#Foo]].  This used to mean an empty title
Line 45: Line 41:
 
$defaults['title'] = wfMsg( 'red-link-title', $target->getPrefixedText() );
 
$defaults['title'] = wfMsg( 'red-link-title', $target->getPrefixedText() );
 
if ( !($wgUser->isLoggedIn()) ) { $defaults['onclick'] = "return false;"; }
 
if ( !($wgUser->isLoggedIn()) ) { $defaults['onclick'] = "return false;"; }
}
+
}</code>
</pre>
+
  
 
=== 1.15.1 ===
 
=== 1.15.1 ===
Line 52: Line 47:
 
Line 287:
 
Line 287:
  
<pre>
+
<code lang='php'> # Get a default title attribute.
# Get a default title attribute.
+
 
if( in_array( 'known', $options ) ) {
 
if( in_array( 'known', $options ) ) {
 
$defaults['title'] = $target->getPrefixedText();
 
$defaults['title'] = $target->getPrefixedText();
Line 59: Line 53:
 
  $defaults['title'] = wfMsg( 'red-link-title', $target->getPrefixedText() );
 
  $defaults['title'] = wfMsg( 'red-link-title', $target->getPrefixedText() );
 
  if ( !($wgUser->isLoggedIn()) ) { $defaults['onclick'] = "return false;"; }
 
  if ( !($wgUser->isLoggedIn()) ) { $defaults['onclick'] = "return false;"; }
}
+
}</code>
</pre>
+
  
 
We added the line that puts <pre>onclick="return false;"</pre> to the <tt>a</tt> tag, which prevents unlogged users to go further.
 
We added the line that puts <pre>onclick="return false;"</pre> to the <tt>a</tt> tag, which prevents unlogged users to go further.
 +
 +
=== Color ===
 +
 +
The color is set as black with: (the !important keyword is to override another definition elsewhere)
 +
 +
<code lang='php'>a.new { color: black !important;}</code>

Latest revision as of 23:36, 25 October 2012

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.

Unbreakable space

I use the tilde character ∼ as a synonym of &nbsp;, through the Extension:PatchOutput. This wouldn't work on a normal wiki where thinks like ∼∼∼∼ are used for signatures.

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.18.1

Same as 1.16.0 but the block starts on line 300.

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.

Color

The color is set as black with: (the !important keyword is to override another definition elsewhere)

a.new { color: black !important;}