November 22, 2024, Friday, 326

Manual:FAQ(Meta)

From NeoWiki

Revision as of 02:13, 15 November 2007 by Neo (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Contents

In General

How do I change the size of automatic content window to be only on max.5 row for example?

Are "Wikimedia" and "MediaWiki" the same thing?

No. Wikimedia is the name of a group of wiki-based open-content projects managed by the non-profit Wikimedia Foundation. MediaWiki is the software developed to meet the needs of these projects.

For further clarification, see our article on the names.

I tried that but it didn't work

I had a problem, I came to this page and it told me how to fix it. But it didn't work, the problem is still there!

Nine times out of ten this is because you didn't clear your cache. The simple test for this is to request a page that hasn't been requested before. Select the part of the URL in the address bar that contains the page title (e.g. Main_Page). Twiddle your fingers on the keyboard for a while, hit enter. Check if the problem is on that page too.

MediaWiki uses both a server-side cache and a client-side cache, so clearing your browser cache is often not enough. See the relevant entry below for more details.

Here are some other things to check:

  • Were you editing the right file? Try inserting some garbage into the file you edited, does it break anything?
    • A great debugging tool in this case is to create a file called phpinfo.php, containing only <?php phpinfo() ?> . Upload it into your web directory and invoke it with your browser. Check the document root and the path to php.ini.
  • Were you editing the right part of the file? Did you create a duplicate entry in php.ini? Add new settings to the end of LocalSettings.php (but before the ?>), not to the beginning.
  • If you created a .htaccess, are you sure AllowOverrides is on? Ask your hosting provider.

If none of these things work, see the two entries below on how to get more help.

Where should I post my bug report/feature request?

Please post all bug reports and feature requests at http://bugzilla.wikimedia.org. Please search through existing entries beforehand, to check that the problem isn't fixed in a newer release version of the software, and to ensure we don't have duplicate entries.

I have a question not answered in this FAQ. Where should I ask it?

You can either

  1. Email the mediawiki-l mailing list, or
  2. Ask in our IRC channel

Installation

See also:

How do I install MediaWiki? What are the system requirements?

See Help:Installation

Is it possible to install more than one wiki (MediaWiki) on a server? How?

Yes, MediaWiki can be installed multiple times in different directories using either the same database with a different set of table prefixes (configurable upon install) or using different databases altogether.

Additionally, you may want to make some settings common for all the installations, and have a central place where changes to these can be made. Since the configuration file (LocalSettings.php) is executed as PHP code, this can be done with PHP's inclusion mechanism - for instance, by adding the line include_once("../CommonSettings.php") in each LocalSettings.php, and placing settings which apply to all wikis in ../CommonSettings.php.

If you have a large number of wikis on one host, you may not want to keep a separate copy of the source code for every one. Instead, extract the source somewhere, and for each wiki installation, symlink the entire MediaWiki directory with the sole exception of the LocalSettings.php file. This can be accomplished with the lndir command (available on some Linux installations) or an equivalent tool.

You can then either use a separate LocalSettings.php for each wiki, or (easier to maintain) determine the settings based on the URL. See also Wiki farm.

If you want your login to be persistent across Wiki's running on the same server, simply add the following line to your LocalSettings.php after $wgSiteName = ... :

ini_set("session.name", "{$wgSitename}Session" );

(Though you can expect some trouble if $wgSiteName contains spaces. In that case replace {$wgSiteName} with an explicit space-removed version). $wgSecretKey (or deprecated $wgProxyKey) must be the same across your wikis for persistent logins to work.

Have a look at http://www.mediawiki.org/wiki/Manual:Wiki_family

How to install more than one wiki on a single server, using the same source code, and using the same database (v1.5.1, May 2006)

Here is how to install the Mediawiki software just once, but use it to power more than one wiki, keeping the tables for all the wikis in a single database-- including step-by-step instructions for a Unix-type of installation. This solution should work for most shared-hosting servers, too. Level of difficulty: Novice. See the instuctions here http://www.steverumberg.com/wiki/index.php/WikiHelp Srumberg

How to have 3 wikis use the same user information, but otherwise have separate databases and files

I have three Wiki installs that are each separate, but on the same server. Their DBs are on the same mySQL server, but are in different databases. How do I make them all share the user information (and allow cross-site logins, so that if someone logs into site 1, they are also logged into site 2)? Can this be done by designating one user table as a master, and the others as views to that master? Any other possibilities?

How do I install more than one Wiki-Server with SSL on Windows - MAR 2006 ?

  • Installed Mar 2006, W2K3-Server, Apache 2.0.54, PHP5.04 (xampp-win32-1.4.14), MediaWiki 1.5.6
Solution : Shared VirtualHost with SSL, one IP-Address, one SSL-Certificate 


  • 1. Install MediaWiki
e.g. 2 Wiki-Server, installed in real DocumentRoot, 
first in /DocumentRoot/wiki1 
second in /DocumentRoot/wiki2
  • 2. Rename index.php and add entries (alias, ...) to httpd.conf
Rename index.php e.g. in wiki1ix.php and wiki2ix.php
# GLOBAL AREA httpd.conf
# First Wiki-Server 
Alias /wikisrv1 /DocumentRoot/wiki1/wiki1ix.php
Alias /wiki1ix.php /DocumentRoot/wiki1/wiki1ix.php
# Alias for upload-area
Alias /uploads /DocumentRoot/wiki1/uploads
# Second Wiki-Server 
Alias /wikisrv2 /DocumentRoot/wiki1/wiki2ix.php
Alias /wiki2ix.php /DocumentRoot/wiki2/wiki2ix.php
# Alias for upload-area
Alias /uploads /DocumentRoot/wiki2/uploads
# VIRTUALHOST AREA httpd.conf
<VirtualHost 111.111.111.111:80>
   ServerName www.domain.de
   ServerAdmin ...
   # Real DocumentRoot !
   DocumentRoot "/DocumentRoot"
   ErrorLog ...
   CustomLog ...
 ...
   # Wiki-Server 
   DirectoryIndex wiki1ix.php wiki2ix.php
 ...
   AccessFileName .htaccess
 ...
   ScriptAlias /php/ "/xampp/php/"
   Action application/x-httpd-php "/php/php.exe"
 ...    
</VirtualHost>
  • 3. Settings in LocalSettings.php
$IP = "/DocumentRoot/wiki1";
...
$wgScriptPath     = "/wiki1";
$wgScript           = "$wgScriptPath/wiki1ix.php";
...
$wgArticlePath = "/wikisrv1/$1";
(wiki2 too)
  • 4. Settings in .htaccess /DocumentRoot/wiki1
# RewriteRule SSL
RewriteEngine On
RewriteRule ^/$ /wiki1ix.php
RewriteCond %{SERVER_PORT} !443$
RewriteRule ^(.*) https://www.domain.de/$1 [R=301,L]
(wiki2 too)
  • 5. Optional Settings in .htaccess /DocumentRoot
# deny access to Root Directory, rewrite to another virtual host 
RewriteEngine On
RewriteRule ^/$ /index.html
RewriteRule ^(.*) http://www.domain.de/othervhost/
# if Alias-Directory upload is indexed, rewrite home-link back to wiki-server
RewriteCond %{HTTP_REFERER} https://www.domain.de/uploads/
RewriteRule ^(.*) https://www.domain.de/wikisrv1/InformationDirectoryPage

Can I import from other types of wiki?

There is some documentation about importing in the UPGRADE file distributed with MediaWiki.

To follow on from those, this is how at least one individual imported pages from usemod to MediaWiki:

Because MediaWiki does not automatically link to CamelCase style links, you will need to add brackets [[ ]] to all your links. You can do this with the following:

First, obtain ImportStage1.txt (or whatever you want to call it) from the importUseModWiki.php script ( use > to pipe the output to a file )

Second, do

sed '/Importing/!s/\ [A-Z]\w*[a-z]\w*[A-Z]\w*[a-zA-Z]/\ \[\[&\]\] /g'
    ImportStage1.txt > ImportStage2.txt

This should create proper links in place of your CamelCase links.

This doesn't work so well for SubPage links - someone care to fix?

Then,

sed 's/upload\:\w*\.\w*/http\:\/\/aberwiki\.org\/uploads\/& /g'
    ImportStage2.txt > ImportStage3.txt

This fixes your upload links. Change the replace text so it fills in your url such as http://www.yourwiki.org/uploads/filename

You are now ready to import ImportStage3.txt into your database with a command such as

mysql -u<mysqluser> -p<yourpass> <db name> < ImportStage3.txt

Note: If your importUseModWiki.php outputs an XML file instead of SQL statements, this probably means you have a rather new version of MediaWiki. In such a case, you case import the XML file -- see Importing a Wikipedia database dump into MediaWiki, towards the bottom of the page ('Import XML'). Don't forget to rebuild all the tables -- that page also explains how to do that.

Is it possible to define a database prefix?

It is not possible in versions 1.3.x and prior.

In versions 1.4 and later it is possible to configure a database prefix during the install process. It is a good practice to add an _ after the prefix otherwise all the tables will look really clumsy.

Why is the Help: namespace empty?

We don't currently have a clean, generic, internationalized set of help pages. Would you like to write one? However, you will find some useful pages in the MediaWiki User's Guide. They are of course open content under the GNU FDL.

I've changed $wgLanguageCode to something else, but nothing happens - what gives?

MediaWiki will look for interface text in a special namespace, MediaWiki. These messages can be viewed through Special:Allmessages. Changes to $wgLanguageCode post-install will not be reflected in the interface using the default configuration.

To permit the changes to take effect, either:

  • Run the rebuildMessages.php script from the command line in /maintenance folder
php rebuildMessages.php --rebuild

OR

Note: Using the second option will disable the MediaWiki namespace for the purposes of customizing the interface, including items such as the sidebar.

Note 2: The language settings are also influenced by the user's preferences at Special:Preferences. If you change the language of your wiki, it is possible the old messages still appear because your "Language" field at the user-preferences is still set at the old language. -- Wilinckx 17:05, 10 March 2006 (UTC)

What if I can't run rebuildMessages.php from the command line ?

If you don't have access to a shell/command line (usually the case with third party hosting services) then you may find you can use Martin Geisler's phpShell software to achieve the desired result (unless SAFE MODE is not set for php).

For more information, visit http://mgeisler.net/php-shell.

The install stops with no messages or I get a blank page!

Installation problems are sometimes weird and hard to diagnose. If possible, check PHP's error log (you may have to configure PHP to enable error logging) and report any error messages you have and the complete output from the installation script to mediawiki-l, we'll see if we can hash it out.

If you can track down the problem specifically, please report it directly to http://bugzilla.wikipedia.org/

Known issues

  • Version 1.3.3: you'll get a blank page after submitting configuration info on your config/index.php script if you don't make the config directory writeable.
  • Version 1.3.x: bugzilla:736

I want my wiki to appear in a frame as part of my site, but it keeps popping out of the frame

MediaWiki contains protection against abusive use of frame sets. Unfortunately this will trap your intentional frames as well -- to remove this, edit stylesheets/wikibits.js and remove these lines:

(Please note that if the wikibits.js file isn't in stylesheets/wikibits.js it may be skins/common/wikibits.js)

 // Un-trap us from framesets
 if( window.top != window ) window.top.location = window.location;

This may not work with MediaWiki: 1.5.8. I tried this with 1.5.8. The path was /skins/common/wikibits.js<tt>. But it still keeps popping out. Must be something else somewhere else involved as well?195.82.106.244 14:47, 14 April 2006 (UTC)
This doesn't work for 1.6.9. Still no solution?

How do I change messages of the user interface?

The user interface text is put into pages in the special MediaWiki namespace. When logged in as a sysop, you can edit those pages to immediately change the output of the wiki.

Some configuration changes (like changing $wgSitename to set the wiki's name) don't affect the pages which were generated at install time. You can edit them directly, or use the "<tt>rebuildMessages.php" script in the maintenance directory (it must be run from the command line and you must set up an AdminSettings.php file). See MediaWiki localisation.

Why doesn't my wiki work on Sourceforge?

See Running MediaWiki on Sourceforge.net.

How do I install Imagemagick for Thumbnails on Windows?

With the following installed on the server, it should work:

  • php.ini
extension=php_imagick.dll
  • Localsettings.php
$wgEnableUploads = true;
$wgUseImageResize = true;
$wgUseImageMagick = true;
$wgImageMagickConvertCommand = "convert"; #<-- this should point on the right path 

If its in the windows path variable, you can use "convert" only


Using ImageMagick-6.2.5-Q16-windows-dll:

  • Install ImageMagick. Make sure the installation directory does not contain any blank spaces.
  • LocalSettings.php
$wgEnableUploads = true;
$wgUseImageResize = true;
$wgUseImageMagick = true;
$wgImageMagickConvertCommand = "convert";  # <-- this should point on the right path
  • You don't have to add php_imagick.dll to your php.ini
  • If you are running php in safe mode, add the ImageMagick installation directory to your php.ini: e.g safe_mode_exec_dir=C:/Programs/ImageMagick.
  • Also you will have to change permissions for %systemroot%/system32/cmd.exe. Grant read and execute rights to IUSR_XXX and IWAM_XXX.


Using ImageMagick-6.3.3-Q8:

  • I installed the DLL version on our server.
  • In LocalSetting.php
    • I set $wgUseImageMagick = true;
    • I set $wgImageMagickConvertCommand = "The appropriate file path" (in quotes) WITH spaces.
  • Everything worked fine.

How do I install Imagemagick for Thumbnails on Windows - MAR 2006 ?

  • Installed Mar 2006, W2K3-Server, Apache 2.0.54, PHP5.04 (xampp-win32-1.4.14), MediaWiki 1.5.6
  • 1. Installation - ImageMagick
- Download from http://www.imagemagick.org/download/www/binary-releases.html 
- or look at http://www.imagemagick.org/download/binaries/
- DLL-version ImageMagick-6.2.6-1-Q8-windows-dll.exe 
- e.g. install in e:\usr\bin\sysexec (do not use any space in the install path)
  (no 'Program Files' allowed nor 'progra~1')
- set PATH to e:\usr\bin\sysexec (normally, this is automatically done during installation)
  • 2. Environment - LocalSettings.php :
NOT THIS FOR $IP : $IP = "E:\\xampp\\htdocs\\mediawiki"; 
MUST BE WITH SLASH : $IP = "/xampp/htdocs/mediawiki";
$wgEnableUploads = true;
$wgUseImageResize = true;
$wgUseImageMagick = true;
$wgImageMagickConvertCommand = "convert.exe";
  • 3. PHP safe_mode - httpd.conf (global or virtual host)
php_admin_flag engine on
php_admin_flag safe_mode on
php_admin_value safe_mode_exec_dir /usr/bin/sysexec
  • 4. Modify MediaWiki-PHP-Script includes/Image.php
// SHELL_EXEC COULDN'T EXECUTE WITH PHP-SAFE_MODE ON - USE EXEC !
function reallyRenderThumb( $thumbPath, $width, $height ) {
...
-REMOVE // wfEscapeShellArg( $this->imagePath ),
+ADD ( $this->imagePath ),
-REMOVE // wfEscapeShellArg( $thumbPath ) ),
+ADD ( $thumbPath ) ),
...
-REMOVE // $conv = shell_exec( $cmd );
+ADD // php safe_mode on - set shell_exec to exec
+ADD $conv = exec( $cmd );
...
-REMOVE // wfEscapeShellArg($this->imagePath) . " " .
+ADD ($this->imagePath) . " " .
-REMOVE // wfEscapeShellArg($thumbPath);
+ADD ($thumbPath);
...
-REMOVE // $conv = shell_exec( $cmd );
+ADD         // php safe_mode on - set shell_exec to exec
+ADD         $conv = exec( $cmd );
...

The index redirects to localhost or 127.0.0.1 or just times out

When constructing full URLs and HTTP redirects, MediaWiki uses the hostname provided by the web server. Under Apache this will usually be specified by the ServerName directive if not autodetected from the system.

If that is set wrong, you should do one of the following:

How do I rename a page and all (some) of the links to it?

Pages may be renamed by any logged-in user, in the standard configuration. Using the "move" tab (in monobook skin) a user may enter a new name for a page. A radio-box will allow the talk page to be moved simultaneously to the new talk page. This will also create a redirect to the new name at the old page name.

It's important to check the [[Special:Whatlinkshere]] at the new page name to check for broken redirects and links. Any link which has more than one redirect will "break", leaving the browser looking at the wrong page.

How do I add a table of contents?

A TOC is added automatically as soon as you have more than three headers. To add one with fewer than four headers, type __FORCETOC__ anywhere on the page or __TOC__ at the position where you want to have the TOC.

To remove a table of contents from a page, add __NOTOC__ to anywhere on the page. The __ character before the commands is two _ characters together See Help:Section for more information.

MediaWiki is slow, how can I make it faster?

  • First you should try a PHP cache engine such as eAccelerator or APC. It will save the parsed PHP scripts and enhance performance a lot (this is something you should use anyway on any PHP installation with non-trivial traffic). Zend Platform also contains a bytecode cache, however its "dynamic content caching" is not supported in MediaWiki at the current time.
  • Use Squid or MediaWiki's native file cache ($wgUseFileCache = true) to cache whole pages
  • Memcached will provide some performance benefit, especially for heavily viewed sites. See also the cache section of the configuration settings.
  • See the Reduction section of the configuration setting.
  • See the $wgUseDatabaseMessages setting.
  • Switching the MySQL table type to MyISAM may be faster for single-user wikis on lower-end computers. See also: MySQL Storage Comparison.
  • Disable ImageMagick in LocalSettings.php $wgUseImageMagick, though this will cause reduced thumbnail quality. ImageMagick imposes a performance penalty during various page views and edits and can slow down bulk uploads.
  • For a heavy concurrent write load, InnoDB is essential. Set $wgAntiLockFlags = ALF_NO_LINK_LOCK | ALF_NO_BLOCK_LOCK to reduce lock contention, at the expense of introducing occasional inconsistencies. Use memcached not the default MySQL-based object cache.

Can I print out my entire MediaWiki site?

Go to PDF Export, export your whole site into one PDF file and print that. Requires HTMLDOC.

What is the print-friendly url?

Normally the print stylesheet is attached so it is automatically used when printing -- just printing or print-previewing a wiki page will demonstrate this.

You can force a print friendly view. For example:

http://en.wikipedia.org/w/wiki.phtml?printable=yes&title=Main_Page

Can I use commons.wikimedia.org in my installed version of mediawiki ?

No, remote loading is discouraged. If you're really keen, you can set up a mirror of it and use that.

If I start an own commons wiki, how do I setup it, so that my other wikis can use its media?

Have a look at mw:Help:Configuration settings#Shared_uploads or Help:Wiki family for detailed information --Produnis 09:50, 16 April 2006 (UTC)

How do I run a bot?

You might want to use the python wikipediabot.

How do I completely disable caching?

Add in your LocalSettings.php file the following lines:

$wgEnableParserCache = false;
$wgCachePages = false;

How do I purge cached pages?

  1. You can use ?action=purge on individual pages to update their cache dates.
  2. There is a global $wgCacheEpoch variable which can be set in LocalSettings.php to invalidate all prior cache entries (see DefaultSettings.php)
  3. If you want to purge all pages in the parser cache, truncate objectcache table from the wiki database. You may use this command:
    TRUNCATE TABLE objectcache;
    Hint: If this fails, you might be using a prefix for your database tables!
  4. A shell script such as this may be used
#! /bin/bash
# mwpurgecache - invalidate mediawiki cache

set -e

PROG=$(basename $0)
VER=0.1

function version() {
 echo "$PROG $VER - invalidate mediawiki cache
Copyright (c) 2005 Claudio Jolowicz <[email protected]>

Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved. This programs comes with
ABSOLUTELY NO WARRANTEE.
"
}

function usage() {
 version
 echo "Syntax: $PROG [options] [--] [pages]

Options:

 -H, --host          host name           (default: localhost)
 -w, --wiki WIKI     server path to wiki (default: /wiki/)
 -u, --user USER     username for HTTP authentication
 -p, --passwd PASS   password for HTTP authentication
 -d, --dryrun        show commands without executing them
 -q, --quiet         quiet (no output)
 -v, --verbose       be verbose (print server response)
 -h, --help          display this message
 -V, --version       display version information

Options and arguments must be separated by whitespace.  WIKI must
match wgArticlePath, such that \$wgArticlePath = \"WIKI/\$1\". WIKI
must not contain regex special characters.

This script requests all wiki pages listed on the command line by
HTTP, prefixed by the wiki path, appending \`?action=purge' to the
URL. If no pages are specified, it retrieves the list of all pages
from Special:Allpages.

Examples:

 \$ $PROG Main_page Help:Contents
 \$ $PROG -H wiki.my.org -w /mediawiki -u joe -p banana
 \$ $PROG -H wiki.my.org --dryrun | wc -l
"
}

## The '-e#' is a noop option to avoid `Unsupported scheme' errors.
user='-e#'
passwd='-e#'
run=
verbose=-nv
quiet='-e#'

opt_host=http://localhost
opt_wiki=/wiki/
opt_user=
opt_passwd=
opt_dryrun=false
opt_quiet=false
opt_verbose=false
while [ "$1" ]
do
 case "$1" in
   -H|--host) opt_host="$2"; shift;;
   -w|--wiki) opt_wiki="$2"; shift;;
   -u|--user) opt_user="$2"; shift;;
   -p|--passwd) opt_passwd="$2"; shift;;
   -d|--dryrun) opt_dryrun=true;;
   -q|--quiet) opt_quiet=true;;
   -v|--verbose) opt_verbose=true;;
   -h|--help) usage; exit 0;;
   -V|--version) version; exit 0;;
   --) shift; break;;
   -*) usage 2>&1; exit 1;;
   *) break;;
 esac
 shift
done
opt_host=${opt_host%/}
opt_wiki=/${opt_wiki#/}
opt_wiki=${opt_wiki%/}/
[ x"$opt_user" = x"" ] || user="--http-user=${opt_user}"
[ x"$opt_passwd" = x"" ] || passwd="--http-passwd=${opt_passwd}"
$opt_dryrun && run=echo
$opt_verbose && verbose="--server-response"
$opt_quiet && quiet="-q"
(
 if [ $# -eq 0 ]; then
   wget -qO- "$user" "$passwd" "${opt_host}${opt_wiki}Special:Allpages" |
   sed -re '/start content/,/end content/p' -e 's/href="([^"]+)"/\nGREPME:\1\n/g' |
   sed -nre 's/^GREPME:(.*)$/\1/p' |
   grep "^${opt_wiki}"
 else
   for page; do echo "${opt_wiki}${page}"; done
 fi
) |
while read page
do
 $run wget -O/dev/null "$user" "$passwd" "$quiet" "$verbose" "${opt_host}${page}?action=purge"
done

exit 0

How do I organize pages into subdirectories like /wiki/subdir/PageName ?

See Help:Link#Subpage_feature.

How do I make interlanguage links work, like they do on Wikipedia?

The interlanguage link feature on Wikipedia presents links in the sidebar when the user types text such as [[fr:Accueil]]. This feature is strongly biased towards a multi-wiki setup, with one language per wiki. It's not recommended for the case where multiple languages are contained on the same wiki.

If you're still sure you want to use it, here's how it works: a link such as [[xx:Pagename]] will be considered an interlanguage link if the following three conditions are satisfied:

  1. $wgInterwikiMagic is enabled (which it is by default)
  2. xx is listed as a language code in languages/Names.php (which most ISO 639-2 codes are)
  3. xx is listed as an interwiki prefix in the interwiki table of the wiki database.

To add an interwiki prefix, edit the interwiki table using your favourite MySQL administration tool, or run a query such as:

INSERT INTO interwiki (iw_prefix,iw_url) VALUES ('xx', 'http://xx.mysite.com/wiki/$1');

If you want to have multiple languages on the same wiki, it's better to use templates and subpages, like we do on meta. See m:Wikimedia Foundation for an example of this.

Search returns no results for some words!

MySQL's fulltext search engine has a default set of stop words which it ignores, and a minimum word length set to 4 characters by default.

To change this you must reconfigure MySQL, see: http://dev.mysql.com/doc/mysql/en/fulltext-fine-tuning.html

However, this talks about MySQL generically, and not with regard to using it with MediaWiki.

So ... if you took all the defaults for your installation of the OS, MySQL and MetaWiki and have only a small database (i.e. just installed), here's how to go about getting three letter searches:

  • Firstly, if you already have a big wiki, the change can take a long time. The MySQL reference above has someone who did this for a 4Gb database and it took 10 days! So be careful. Now let's have a go.
  • The parameter to reset is inside MySQL, and as noted above is discussed on the MySQL web site. Go there for more details if you're into MySQL.
  • Find the config file for My SQL - this is normally my.cnf, located in /etc
  • Edit my.cnf and add the relevent parameter in this file (ft_min_word_len=3). This is normally set to 4 for performance reasons - 4 is the default and not in the my.cnf file when installed. Make sure this is put under the [mysqld] section of my.cnf
  • Restart MySql, using the Service Controller or stop and restart mysqld from the command line
  • Go into MySql (mysql at the command line)
  • Issue the MySql command that you need to look at the wiki database (use wikidb;) - note that this may be different if you changed the default wiki database install schema with something like my_wikidb
  • Rebuild the search indexes by asking to repair the searchindex table. The command line to type is: repair table searchindex quick; an example is as follows showing what you should see:
mysql> repair table searchindex quick;
+--------------------+--------+----------+----------+
| Table              | Op     | Msg_type | Msg_text |
+--------------------+--------+----------+----------+
| wikidb.searchindex | repair | status   | OK       |
+--------------------+--------+----------+----------+
1 row in set (0.08 sec)</code>
mysql>
  • Retest from your wiki server that you can see TLAs now - make sure you do have one in your wiki to find though otherwise you won't find it!
  • The above was performed on a Fedora Core 4 OS, server was a Compaq ML570. It should work ok for other distributions.

Important note

If you have upgraded mysql from v 3.xx in order to do the above, you must change the following parameter in your LocalSettings.php file in order for this to work.

From $wgDBmysql4 = false; To $wgDBmysql4 = true;

How can I recover the searchindex table?

First try REPAIR TABLE. See How to Repair Tables in the MySQL manual for more information.

If your searchindex table is broken beyond repair, you can run maintenance/rebuildtextindex.php from the command line to recreate it. Sorry, there's no web-based version of this at the current time. Instructions on executing from the commandline here and for allowing command line execution of php files here.

This fault occurred after a (old version) MediaWiki was hacked (text added fortunately not destroyed).

Can I insert data/template data from another wiki in realtime into my wiki page as my wiki page displays?

If I want to put info in my wiki from Wikipedia (eg a template such as below) without copying all the data, eg. templates, variables, images etc. etc. to my wiki can I just 'link' to the other wiki (eg. Wikipedia) in real time as my page loads?

This feature is in development. Check back when 1.6 comes out. -- Tim Starling 07:27, 1 February 2006 (UTC)

Version 1.6 is out now, but I wonder where this feature has left or where is discribed how to use it? I'm very highly interested in it! Please help me! drundanibel 2006-05-22

Configuration

I access the wiki pages on my system by writing http://localhost/directorypath. But, if I try writing http://systemname/directorypath, it throws an error that page not found.

"Localhost" means the machine you are on; it is not a real name, it's like a pronoun. You need to check two things: does your server have a name? and does the world know this name?

To find the first, in Linux, go to a system prompt and type the command "hostname". This will return the server's full name. If it doesn't have a name, you can set it (if you are logged in as root) with the command "hostname -v servername". And second, is the server known by this name on the network ? Check with your system/network administrator to find out if the server is registered in the DNS (Domain Naming Sytem) for this domain. You can test this by using PING from a command line - if you can ping the server by IP address but not by name, then it is not in the DNS.

If both of those are correct, then ...

Maybe there is something wrong with your Apache virtual hosts? See the Apache documentation for details.

If you use EasyPHP, your Apache config file will have a line: "#Listen 127.0.0.1:80". Just add another line below: #Listen <name or IP>:80" and it works.

How do I change the look and feel of MediaWiki for my own site?

See MediaWiki look and feel for a detailed explanation.

I have lost my skin after upgrading!

Clear your browser cache and reload the page.

How can I disable/enable tabs at top (monobook), add history navigation to article pages, or otherwise move around functional components from page to page?

Under 1.5, to disable all view top tabs, create a new skin according to the instructions in MediaWiki look and feel#Skin and name this MonoBookNoViews. Set this as the default theme. Logged in users will need to change their default theme to see the tabs to edit pages, however.

You will need to remove the section of code in the MonoBookNoViews.php file which generates the views (top tabs).

Search for this code:

      <div id="column-one">
 <div id="p-cactions" class="portlet">
   <h5><?php $this->msg('views') ?></h5>
   <ul>
     <?php foreach($this->data['content_actions'] as $key => $action) {
        ?><li id="ca-<?php echo htmlspecialchars($key) ?>"
        <?php if($action['class'])
                 { ?>class="<?php echo htmlspecialchars($action['class']) ?>"<?php } ?>
        ><a href="<?php echo htmlspecialchars($action['href']) ?>"><?php
        echo htmlspecialchars($action['text']) ?></a></li><?php
      } ?>
   </ul>
 </div>
 <div class="portlet" id="p-personal">

Replace it with this:

      <div id="column-one">
 <div class="portlet" id="p-personal">

To remove the "Edit" links in the content sections, modify monobooknoviews/main.css.

Replace this line: (Please note that this will only work for IE browsers - all others will still display the Edit link next to a section)

* html div.editsection { font-size: smaller; }

With this line:

* html div.editsection { display: none !important; }

How do I change the default skin for users that are not logged in?

Set $wgDefaultSkin = 'monobook'; in LocalSettings.php (see example). Make sure that the quoted skin is in lowercase in the LocalSettings.php file (ie: 'monobook', not 'MonoBook') regardless of how the skin name is actually capitalized.

I've changed settings in LocalSettings.php, such as $wgSitename, but they don't show up in my browser. Why not?

(Note: As always, first ensure that you're not viewing a cached page - perform a "hard refresh", clear the browser cache, or view a page that didn't exist before the change.)

There was a bug in versions of MediaWiki prior to 1.3.6 where variables, such as $wgSitename, were interpolated into user interface messages at install, rather than when the message was requested (Bugzilla:296). The result was that any later changes to these variables would have no effect on these messages, since the software simply saw them as plain text; all UI messages can be reset to their defaults (with the new variable values) by running the maintenance/rebuildMessages.php script. If you upgrade to the latest version of MediaWiki first, these will include dynamic references to the variables (e.g. {{SITENAME}}) and should therefore reflect future configuration changes.

Some language files incorrectly set $wgSitename to a local transliteration of "Wikipedia". If this happens, you need to edit the language file, at languages/Language??.php. Search for the $wgSitename and remove the lines where it is set. If you find a problem like this in the most recent version of MediaWiki, you should report it at bugzilla.

Does MediaWiki automatically capitalize the first letter of $wgSitename?

Yes. This can be changed using the $wgCapitalLinks configuration setting.

How do I change which page is the "Main Page"?

Visit the "MediaWiki:Mainpage" page, enter the name of the new default page, and save changes. MediaWiki should recognize the setting and use the new default page.

How can I change what the <title> of each page is? Where do I make changes?

Most of the text that you want to change, can be found in the namespace of MediaWiki.

In order to change titles, texts, announcements and the like, go to Special:Allmessages, where you will see the text associated with the pages you wish to change. (As far as I can tell, you need to log in as an administrator (like the one you made when you installed) to edit the protected entries in the MediaWiki namespace.)

If you want to change the title in your browser, you need to edit MediaWiki:pagetitle. Go there and edit it just like you would any other page in your Wiki.

In recent versions of MediaWiki, MediaWiki:pagetitle is $1 - {{SITENAME}} by default. If {{SITENAME}} is producing the wrong text for you, you need to set $wgSitename in your LocalSettings.php.

If $wgSitename is correct in LocalSettings.php but {{SITENAME}} is still wrong, it may be that you're using a user-contributed language file which incorrectly sets $wgSitename to a transliteration of "Wikipedia". Edit the language file to correct this. For example, the hebrew language file is at languages/LanguageHe.php in your wiki directory.

Don't forget to clear your browser cache after you fix it.

How do I enable uploads?

If you get the following message:

Sorry, uploading is disabled.

See http://www.mediawiki.org/wiki/Configuring_file_uploads. For more information and trouble shooting, see Uploading files.

When I try to upload files in Mediawiki 1.5 I always get a "The file is corrupt or has an incorrect extension. Please check the file and upload again." error.

With 1.5, first check whether the mediawiki temp dir exists and has the right permissions. In general, check your php- and mediawiki-logs for any obvious errors.

After, try in the maintenance directory to rebuildImages and then, display the pages with a trailing ?action=purge.

This may happen if MediaWiki fails to determine the correct MIME-Type for the file you are uploading. For images, this should always work if your PHP has the GD extension enabled. For other files, the file_info or mimemagic extensions can be used (make sure they are configured correctly if present). Alternatively, use an external program for mime detection, by settings wgMimeDetectorCommand to the desired command.

Under linux, you can use the following in LocalSettings.php:

$wgMimeDetectorCommand= "file -bi"; #use external mime detector (linux)

to your LocalSettings.php file solves this problem in some cases.

If all else fails, you should be able to solve this by adding

$wgVerifyMimeType = false;

to your LocalSettings.php file. Note that this will turn off most sanity checks on the file - this is a security hazard.

The file command did not work for me under Fedora Core 4. It turns out that SELinux was preventing the php script from running file on uploaded files. I had to disable SELinux for httpd [1] to get uploading and mime typing to work correctly. 16:02, 25 February 2006 (UTC)

When I try to upload bigger files in Mediawiki 1.5 I always get "Internal error! couldn't move "/tmp/somefile" to "/wikidir/images/temp/filename"

On top of the screen you should see a PHP-error aswell saying something like this:

Warning: move_uploaded_file():
 Unable to access /temp/somefile in /wikidir/includes/SpecialUpload.php on line 370

The most common reason for this is that upload_max_filesize in php.ini is set to the default of 8MB, and you want to upload a file that is larger. See this section of the PHP manual for more PHP-related problems. Be careful that you're editing the right php.ini -- PHP is well known for its decoy configuration files. Create a .php file with nothing but <?php phpinfo() ?> to inspect your configuration settings.

Another way to fix this could be to go to the /images folder and there to manually create two folders: /temp and /thumb Apparently they were not included in my distribution

One user has reported that setting $wgUploadSizeWarning to a large number in LocalSettings.php fixed this problem for them.

  • Try this:

(1) Create a blank php.ini file and place it in your wiki root directory.
(2) Add to that file this line: upload_max_filesize = 25M (or whatever max size you want)

It worked for me -- User:WikiDontLoseThatNumber


(traslate this, please. I speak Spanish): En una Wiki corriendo sobre Windows corregí este error dando permisos de lectura/escritura al directorio donde está instalado el php (c:\php) y al directorio en donde está la wiki. O sea que es un problema de permisos de las carpetas compartidas.

In a Wiki running on windows I fixed this by adding writing/reading permissions to the directory where php is installed (c:\php) and the directory where the wiki is. That probably means the problem is related to shared directories permissions.

How do I use templates?

See Help:Templates.

How do I set the timezone for my MediaWiki?

There are two timezone-related settings: $wgLocaltimezone and $wgLocalTZoffset. Set both in LocalSettings.php. $wgLocaltimezone is used for formatting the timezone in signatures, and should be set to the locale name, for example "Europe/Berlin". $wgLocalTZoffset sets the default user preference the number of hours your local time differs from server time, and is used for timestamps seen in recent changes and history views. $wgLocalTZoffset should be set in minutes, for example, "-480" equals 8 hours behind the server time.

How does DST (Daylight Savings Time) work with MediaWiki?

How do I make my base URLs shorter?

See eliminating index.php from the url for details. You may need access to server files like httpd.conf.


How do I enable PHP to be processed in a page rather than displayed?

How do I activate HTML-Tags, e.g. "<input>" or "<form>" ?

It seems to be possible to activate HTML-Tags like "<input>" or "<form>" (Have a look at [2], and note the PayPal Buttons working). How does it work ?

  1. if you need those HTML-tags for one action only (e.g. this PayPal-Button), but don't want HTML to be activated generally, write your own MediaWiki_Extension which outputs your HTML-needs (e.g. PayPal extension).
  2. the more "dirty"-way is to add $wgRawHtml = true; to your LocalSettings.php. If you do so, HTML-tags are activated on every page.

Note: even after adding $wgRawHtml = true;, it appears you must surround your html tags with <html> and </html>. XHTML compliance requires ALL tags to be enclosed.

How do I make $wgRawHtml = true; work only with sysop user and not with other users?

How do I make it so only admins can add full html codes to articles?

You can't. Due to the way a wiki works, it's all or nothing. But with a bit of work, one can tweak things so that the HTML code will only be executed if the page is protected, thus effectively giving whoever has the protection privilege the necessary control.

How do I make external links pop up in new browser windows?

Opening external links in a new window

Why are embedded images not displayed, not even in their image description pages?

  • This problem is often caused by a missing MIME type in image fields. Try running the maintenance/rebuildImages.php maintenance script from the command line. Rob Church Talk 17:10, 8 February 2006 (UTC)
  • If that still doesn't work, check whether the magic file used for MIME detection (e.g. /etc/httpd/conf/magic) knows about PNG. If not, adding the following line in the image section will fix it:
0       string          \x89PNG         image/png
  • I'm not sure if this will help any of you, but if you're using a subdomain with hotlink protection, add your subdomain to the list of allowed linkers. After days of installing and reinstalling MediaWiki, then trying another one, I finally realized that it was the subdomain issue.

How do I enable the "Printable version" option when using MonoBook skin?

How do I disable external links from showing in the printable version of a page?

Can somebody help me to deactivade this? When I try to print all the tables become too wide.

I was able to prevent external links from displaying by commenting out the section "// Expand links for printing" in file skins\common\IEFixes.js.

How do I change default user preferences?

The following applies to MediaWiki 1.4 and later.

The MediaWiki default user preferences are in the language file, i.e. languages/Language.php if you're using English. Don't edit that file, just use it for reference, like you do with DefaultSettings.php.

Say if you want to change the default number of search results on a page. Language.php says:

/* private */ $wgDefaultUserOptionsEn = array(
       ...
       'searchlimit'  => 20,
       ...
)

To change it to 50, put this in your LocalSettings.php:

$wgDefaultUserOptions = array( 'searchlimit' => 50 );

Note that you are setting $wgDefaultUserOptions, which contains the site overrides, not $wgDefaultUserOptionsEn, which contains the software defaults. Any settings in $wgDefaultUserOptions will override those set in the language file.

This override mechanism was introduced in MediaWiki 1.4, before then, you had to change the language file. Because this was very inconvenient, two special-case overrides were introduced before the current general override system was developed.

To change the default skin, in any version of MediaWiki, set $wgDefaultSkin in LocalSettings.php to the lowercase name of the skin.

To change the default namespaces to be searched, in any version of MediaWiki, set $wgNamespacesToBeSearchedDefault in LocalSettings.php to an array mapping namespace indexes to boolean values. For example, to search the main namespace and the category namespace, use:

$wgNamespacesToBeSearchedDefault = array(
    NS_MAIN => true,
    NS_CATEGORY => true,
);

In some cases, after you change a default user preference, you may also want to change the user preferences of all existing user accounts. This requires some database hacking. To continue the previous two examples, to change the number of search results, run the following query:

UPDATE user SET user_options = REPLACE(user_options, 'searchlimit=20', 'searchlimit=50');

To search categories by default, use:

UPDATE user SET user_options = REPLACE(user_options, 'searchNs14=0', 'searchNs14=1');

14 is the index of the category namespace. See Help:Namespace for a list.


Is there a way to easily install all Help Documentation after a mediawiki installation?

There is a project at mw:Project:PD help that is creating a self-contained help system, with links to an experimental pywikipedia bot that can mirror that.

I can login but I get a message about disabled cookies (and they're not!)

Mediawiki has problems with autostarting sessions. Check your php.ini (you can run phpinfo() to find where it is located) and look for session.auto_start. It should be '0'. Also, session.use_cookies should be '1'. If you don't have access to php.ini and you're using Apache try to create a .htaccess file with the following content:

php_value session.auto_start 0
php_value session.use_cookies 1

How do I make it go straight to editing the new topic if the topic is not found in a search?

Set the following in LocalSettings.php:

$wgGoToEdit = true;

Be warned that this will greatly limit your ability to display search results.

More complex customization

Simple Category Automation

We all like to keep our wikis tidy. This is a little system that shows every user what to copy and paste into their pages to include it in the right category.

  1. Create a new template by visiting http://www.yourdomain.com/wiki/Template:Putincategory
  2. Paste the following into it and save:
[[Image:catalert.png]] '''Please copy and paste the following into the end
 of your article to include it in this category:'''
 
 <nowiki>[[Category:</nowiki>{{PAGENAME}}<nowiki>]]</nowiki>
  1. Upload the alert image File:Catalert.png to your wiki.
  2. On every category page, simply paste the following:
{{Template:Putincategory}}

How do I add the sandbox functionality to my installation of the wiki?

In wiki terms, a sandbox is simply a "play pen"; a page which users can mess about in. This is an ordinary page created in the normal manner, and can be located wherever you like. There is no special sandbox functionality built into MediaWiki.

Users often inquire about the Wikipedia sandboxes, which seem to be self-emptying. This is not quite correct; there are a number of volunteers who run bots to clean these up and return them to a certain state at regular time intervals.

How do I change the logo?

In your LocalSettings.php add:

$wgLogo = '/path/to/your/logo.png';

Default is {$wgStylePath}/common/images/wiki.png

Default logo size is 135px by 135px

How do I show a link to create a page when searches fail?

First you need to go to the "special pages" link. Then click on "All system messages". Find and click on "nogomatch". click on "Edit this page". replace the existing text with the following:


Place wikitext similar to the following in MediaWiki:Nogomatch:

There is no page called $1. You can [[$1|create this page]].

This will create a regular "redlink" in the search results page, leading to the edit page. Your users can then create the page as usual.

Edit the file: Language.php, which locates the directory of languages.

How do I change the icon (favicon) in browser's address-line?

If you want to have another favicon,

  • you can change it in /includes/Skin.php file. Change the line from 'href' => '/favicon.ico' to 'href' => '/path/to/your/favicon.ico'.

-or-

  • you can simply replace the favicon.ico image file at the root of your wiki with whatever .ico image file you want.
  • in MediaWiki 1.6.3 there is a variable in /includes/DefaultSettings.php that can be overloaded in LocalSettings.php$wgFavicon = /path/to/your/favicon.ico

The wiki will output a <link> which references the traditional /favicon.ico, at the root URL path of your site. (Some browsers will look there even without the <link>, others require it.)

Is it somehow possible to use a "file" URI-qualifier for local intranets e.g. [file://localhost/C: C-Drive]?


From version 1.8 you need to add the following lines to LocalSettings.php as it replaces the appropriate setting in DefaultSettings.php (but here without file://):

$wgUrlProtocols = array(
 'http://',
 'https://',
 'ftp://',
 'file://',
 'irc://',
 'gopher://',
 'telnet://', // Well if we're going to support the above.. -ævar
 'nntp://', // @bug 3808 RFC 1738
 'worldwind://',
 'mailto:',
 'news:'
 );

Nothing else is needed to be done in the mediawiki system. But for some browsers you need to change the configuration of the browser settings. (see below)

Build the filelink like:

[file://///servername/directory/file.txt file.txt]

From version 1.5 you need to add one of the following lines to LocalSettings.php

$wgUrlProtocols = 'file:\/\/|http:\/\/|https:\/\/|ftp:\/\/|irc:\/\/|gopher:\/\/|news:|mailto:';

or

array_push( $wgUrlProtocols, "file://" );

Do not add both.


Maybe. You can make MediaWiki support it by adding the "file" protocol to the list of URL handlers. Right now you have to directly edit includes/Parser.php:

 /* private */ function replaceExternalLinks( $text ) {
 $fname = 'Parser::replaceExternalLinks';
 wfProfileIn( $fname );
 $text = $this->subReplaceExternalLinks( $text, 'http', true );
 $text = $this->subReplaceExternalLinks( $text, 'https', true );
 $text = $this->subReplaceExternalLinks( $text, 'ftp', false );
 $text = $this->subReplaceExternalLinks( $text, 'irc', false );
 $text = $this->subReplaceExternalLinks( $text, 'gopher', false );
 $text = $this->subReplaceExternalLinks( $text, 'news', false );
 $text = $this->subReplaceExternalLinks( $text, 'mailto', false );
 $text = $this->subReplaceExternalLinks( $text, 'file', false );
 wfProfileOut( $fname );
 return $text;
 }

From version 1.4 on, in Parser.php change the line

define( 'URL_PROTOCOLS', 'http|https|ftp|irc|gopher|news|mailto' );

to

define( 'URL_PROTOCOLS', 'http|https|ftp|irc|gopher|news|mailto|file' );


However, many browsers will ignore these URLs, so that even though you can create the link, clicking on it will have no effect. This is because URLs of this type pose an inherent security risk [3].

List of browsers supporting or not supporting the file:/// link from pages delivered from a remote server, which is common to wiki pages:
Browser Supports file: links?
Internet Explorer 7.0 (Windows XP SP2) yes
Internet Explorer 6.0 (Windows XP SP1 or SP2) no
Internet Explorer 6.0 (Windows XP Professional Version 2002 SP1) yes
Internet Explorer 6.0 (Windows 2000 SP 4) yes
Internet Explorer 5.5 (Windows 2000 SP 4) yes
Netscape 7.0 (Windows XP SP1 or SP2) no
Opera Version 7.54 Final (Linux) no
Opera Version 8 (Windows) no (2)
Mozilla 1.7 (Linux) no /yes (1)
Firefox 1.0.x (Windows) no / yes (1)
Firefox 1.5.x (Windows) no / yes (4)
Konqueror (Linux) yes (3)

Was listed as bugzilla:614 (RESOLVED WONTFIX).

(1) Enable user_pref("security.checkloaduri", false);, see below. Drag of link and drop into location bar does not work, in difference to Copy link / Paste link.

(2) Drag of link and drop into location bar works fine.

(3) Konqueror displays a warning if a remote (eg. http) URL points to a local (file, telnet, irc, whatever), and allows the user to cancel. ((Wikipedia User JensBenecke))

(4) Enable in the user.js (is not diplayed in about:config) user_pref("capability.policy.policynames", "localfilelinks");, user_pref("capability.policy.localfilelinks.checkloaduri.enabled", "allAccess"); and the sites name for the access user_pref("capability.policy.localfilelinks.sites", "http://www.example.com");. The attribute of capability.policy.localfilelinks.sites can contain several web pages separated with blanks.

Links to local pages don't work - MozillaZine Knowledge Base
A note: According to the Instiki FAQ loading of local file links from http links can be enabled on Mozilla and Firefox by putting user_pref("security.checkloaduri", false); into the file user.js.
It should also be possible to set this with the "about:config" interface (just type about:config in the address bar, typing security.ch into the filter input line then narrows down the displayed options to this one). I'm not sure which version of Mozilla introduced this (I just learned about this interface today).
However note that this setting is global, i.e. it will affect all sites you browse; while I don't know exactly what the security risk of this is, the fact that the setting is in the security section (and the note "If you don’t give a wit about the security of your local files" on the Instiki FAQ) strongly implies this is a security risk. --132.199.100.181 08:08, 29 Oct 2004 (UTC)
Perhaps if this is set, a malicious website could load a file:/// url into a frame, and read the contents with javascript? Could be a security risk if the right file was opened. --134.148.20.33 08:43, 10 May 2005 (UTC)

--194.95.179.181 13:32, 22 September 2005 (UTC) :

in addition to version 1.5:
may help using links with this format:
[[file:///%5C%5CNAME-OF-COMP-OR-IP-ADR%5SUBDIR%5C20M%F6LLER%5Cfilename.html filename.html]]
instead of
  [[file:///\\NAME-OF-COMP-OR-IP-ADR\SUBDIR\20 MöLLER\filename.html filename]]
replace Backslash with %5c, space with %20, ö with %F6 etc.
This works with MediaWiki 1.5, Explorer 6.0.2800 and Firefox 1.0.6


Also in version 1.5 I found I could change the code to accept links like:
[file:\\machine\directory\my.file text]
..by adding file:\\\\ to the define( 'HTTP_PROTOCOLS', line in parser.php and the $wgUrlProtocols variable in DefaultSettings.php, instead of file:\/\/. I am not sure if I could get away with changing just one file. This is for MediaWiki running on Windows with Apache.

-Sprintstar 12:40, 1 November 2005 (UTC)

There is an extension for this, but I can't manage to get it work. Here it is : http://meta.wikimedia.org/wiki/User:EdmundMielach/FileProtocolLinks --212.23.162.37 14:30, 7 February 2006 (UTC)

Using MediaWiki v1.5.6 and IE 6 SP2, you can make it work by modifying the following line in includes/DefaultSettings.php :

$wgUrlProtocols = 'http:\/\/|https:\/\/|ftp:\/\/|irc:\/\/|gopher:\/\/|news:|mailto:|file:';

The link syntax is then [file:\\server\UNC_Path description]. Note that spaces in UNC path must be converted to their HTML counterpart : %20.

How do I add my own dynamic content to MediaWiki?

Write an extension that implements a special page. See Writing a new special page.

How can I insert one of my PHP functions underneath the "Search" box?

Dan Kohn has a neat tutorial

How do I put MediaWiki into Read Only mode?

Set $wgReadOnlyFile in LocalSettings.php to the name of a file, then put the reason for read-only mode inside the file. The contents of the file will be displayed to anyone trying to edit the wiki.

Since 1.5 you can set $wgReadOnly to a string describing the reason for read-only mode, instead of creating a file. (Usual wiki markup is allowed in this string).

But even in this read-only mode some auxiliary fields in your database would be modified (for example, visit counters). If it isn't desirable see How do I completely lock my database?

How do I completely lock my database?

If you want to forbid really any modification of the database, you need to do this on the database itself (edit the permissions on your database to revoke UPDATE, INSERT, and DELETE operations from the wiki user, or put MySQL into read-only mode).

As a result the MediaWiki will not work properly: it will spew many SQL errors, but your database would not get tampered with. See also How do I put MediaWiki into Read Only mode?

By results of an experiment on MediaWiki 1.5.6, the minimal SQL rights for MediaWiki to work properly in read-only mode are:

GRANT INSERT, DELETE ON wikidb.objectcache TO user
GRANT UPDATE (ss_total_views) ON wikidb.wiki_site_stats TO user
GRANT UPDATE (page_counter) ON wikidb.wiki_page TO user

How do I move the location of the search box?

This is for the Monobook theme on version 1.5 only and involves modifying the Monobook.php file - you can see the effect here.

  • Find and select the following code in Monobook.php:
<div id="p-search" class="portlet">
   <h5><label for="searchInput"><?php $this->msg('search') ?></label></h5>
   <div class="pBody">
     <form name="searchform" action="<?php $this->text('searchaction') ?>" id="searchform">
       <input id="searchInput" name="search" type="text"
         <?php if($this->haveMsg('accesskey-search')) {
           ?>accesskey="<?php $this->msg('accesskey-search') ?>"<?php }
         if( isset( $this->data['search'] ) ) {
           ?> value="<?php $this->text('search') ?>"<?php } ?> />
       <input type='submit' name="go" class="searchButton" id="searchGoButton"
         value="<?php $this->msg('go') ?>"
         /> <input type='submit' name="fulltext"
         class="searchButton"
         value="<?php $this->msg('search') ?>" />
     </form>
   </div>
 </div>
 
  • Move it either up or down in the page code, depending on where you want it positioned.
  • A good place to put the search box is just below the logo. To do this, move or copy the above code directly below where you find the following:
  <div class="portlet" id="p-logo">
   <a style="background-image: url(<?php $this->text('logopath') ?>);"
     href="<?php echo htmlspecialchars($this->data['nav_urls']['mainpage']['href'])?>"
     title="<?php $this->msg('mainpage') ?>"></a>
 </div>

How do I put an alphabetical list of links on the top of the category page?

First, you'll need to edit /wiki/includes/CategoryPage.php and find the instance method shortList of class CategoryPage. The first line of the function looks like :

  • The follow instructions do not work as given. Please clarify exactly. Thanks. 195.82.106.244 00:18, 24 April 2006 (UTC)
$r = "<h3>{$articles_start_char[0]}</h3>\n";

Replace it, adding an id attribute. The method becomes :

 function shortList( $articles, $articles_start_char ) 
 {
 // !PATCH-ALPHA-CATEGORIES : CategoryPage::shortList
 $r = "<h3
 id=\"{$articles_start_char[0]}\" 
 >".$articles_start_char[0]."</h3>\n";

A more professional design could produce :

 function shortList( $articles, $articles_start_char ) 
 {
     // !PATCH-ALPHA-CATEGORIES : CategoryPage::shortList
     // !PATCH-ALPHA-CATEGORIES : // !SEE-ALSO $wgAlphaCategoriesPrefix in DefaultSettings.php
     global $wgAlphaCategoriesPrefix ;
     $wgAlphaCategoriesPrefix = isSet($wgAlphaCategoriesPrefix) ? $wgAlphaCategoriesPrefix : '' ;
     $szId = ($wgAlphaCategoriesPrefix === false) ? '' 
     : ($wgAlphaCategoriesPrefix." id=\"{$articles_start_char[0]}\" ") ;
     $r = "<h3 $szId >".$articles_start_char[0]."</h3>\n";

A few lines after, replace, in the same way, the following line:

$r .= "</ul><h3>{$articles_start_char[$index]}</h3>\n<ul>";

With :

     // !PATCH-ALPHA-CATEGORIES : CategoryPage::shortList
     $r .= "</ul><h3 
            id=\"{$articles_start_char[$index]}\"
            >{$articles_start_char[$index]}</h3>\n<ul>";

Or, in a more professional design :

     // !PATCH-ALPHA-CATEGORIES : CategoryPage::shortList
     $szId = ($wgAlphaCategoriesPrefix === false) ? '' 
        : ($wgAlphaCategoriesPrefix." id=\"{$articles_start_char[$index]}\" ") ;
     $r .= "</ul><h3 $szId >{$articles_start_char[$index]}</h3>\n<ul>";

Then, edit a Category page. Insert a line that looks like

 {{A-Z-title|Ma belle liste alphabétique}}

Of course, A-Z-title is just an example. You may use another template name.

Then, because A-Z-title is not yet defined, click on the link, edit, and enter a content such as :

=={{{1}}}==
<center>[[#A|A]] [[#B|B]] [[#C|C]] [[#D|D]] [[#E|E]] [[#F|F]] [[#G|G]] 
[[#H|H]] [[#I|I]] [[#J|J]] [[#K|K]] [[#L|L]] [[#M|M]] [[#N|N]] 
[[#O|O]] [[#P|P]] [[#Q|Q]] [[#R|R]] [[#S|S]] [[#T|T]] [[#U|U]] 
[[#V|V]] [[#W|W]] [[#X|X]] [[#Y|Y]] [[#Z|Z]]</center>

After reloading the Category page, your page will include something like :

Ma belle liste alphabétique

Template:A-Z

Later on, each time you want to add an alphabetic index to a Category page, simply reuse your A-Z-title :

 {{A-Z-title|Ma très belle liste alphabétique}}

Four related templates are available in this discussion page.

 {{A-Z}}
 {{A-Z-title|Ma belle liste}}
 {{A-Z-prefix|cp_}}
 {{A-Z-title-prefix|Ma belle liste|cp_}}

In a professional design, you should add in the /wiki/includes/DefaultSettings.php something like :

 // !PATCH-ALPHA-CATEGORIES : // !SEE-ALSO CategoryPage::shortList in CategoryPage.php
 /*
  * $wgAlphaCategoriesPrefix = false ; // disable feature
  * $wgAlphaCategoriesPrefix = '' ; // default
  * $wgAlphaCategoriesPrefix = 'myprefix_' ; // customized prefix
  */  
  $wgAlphaCategoriesPrefix = '' ;

In this case, you may eventually add, in your /wiki/LocalSettings.php something like

 $wgAlphaCategoriesPrefix = 'cp_' ;

In this case, you'll use one of these templates :

 {{A-Z-prefix|cp_}}
 {{A-Z-title-prefix|Ma belle liste|cp_}}
in this note, non-english (french, spanish, german, etc) expressions are voluntary used to denote examples,
PHP variable names such as $szId use hungarian prefixes,
patterns such as // !PATCH... are so-called haDoc comments, not to be confused with appropriate phpDoc comments.

How can I add a variable {{CURRENTWEEK}} for a "Featured article of the week" or similar?

Upgrade to 1.4 or later. Note that in PHP 4.4.1, PHP's week number function was changed to return a two-digit week number, with a leading zero for weeks less than 10. In MediaWiki 1.5.5 and later {{CURRENTWEEK}} will produce week numbers without a leading zero regardless of PHP version.

How do I change the contents of the navigation toolbar?

The solution is different between MediaWiki versions.

If the page doesn't change in the desired way after applying the changes, just point your browser to ''http://yoursite.tld/index.php/MainPage&action=purge''. Notice the "action=purge"-Part which clears the webpage cache.

Changing the files (php-installation-files)

General notes

Every link in the navigation box is specified in two parts - the text, and the target. Each of these is stored in an interface message; that is, a page in the MediaWiki namespace (in most situations, editting the LanguageXX.php files will have no effect on a running wiki).

  • if the content of the "target" message is a full URL (i.e. begins http://, etc), the result will be an external link equivalent to [<target> <text>]
  • otherwise, the target will be interpreted as the name of a wiki page, and the link will be the equivalent of an internal link like [[<target>|<text>]]

You do not need to edit any PHP files to change the text or target of existing links, you need only find and edit the appropriate MediaWiki:<whatever> pages. (Note: This way you can only edit preconfigured variables. You are not totally enabled to edit the navigation-bar)

In version 1.5

Follow instructions as per 1.4, except that instead of working with the files LocalSettings.php and DefaultSettings.php, the list is held in the [[MediaWiki:Sidebar]] page. You have to be logged into the Wiki with an adminstrator account to change these pages.

The default should be:

* navigation
** mainpage|mainpage
** portal-url|portal
** currentevents-url|currentevents
** recentchanges-url|recentchanges
** randompage-url|randompage
** helppage|help
** sitesupport-url|sitesupport
In version 1.4
How the navigation bar is rendered

File:Wiki2.png

The rendering of one of the stock items, the Community portal of the english wiki, in the 4array:

  1. (In blue) The key for the visible text is fetched from the MediaWiki namespace
  2. (In blue) The text under that key is placed in the navigation bar.
  3. (In red) The target page or URL for the link is also fetched from the Mediawiki namespace.
  4. (In red) The text from the "href" key is the link for the entry in the navigation bar.
How to customize your own navigation bar

The list of pages is defined in an array called $wgNavigationLinks; copy the entire array from includes/DefaultSettings.php to /LocalSettings.php if you wish to edit it (never edit DefaultSettings.php itself). The default array looks like this:

$wgNavigationLinks = array (
 array( 'text'=>'mainpage', 'href'=>'mainpage' ),
 array( 'text'=>'portal', 'href'=>'portal-url' ),
 array( 'text'=>'currentevents', 'href'=>'currentevents-url' ),
 array( 'text'=>'recentchanges', 'href'=>'recentchanges-url' ),
 array( 'text'=>'randompage', 'href'=>'randompage-url' ),
 array( 'text'=>'help',  'href'=>'helppage' ),
 
);

Each line of this array represents a link in the navigation box; remember that these are pointers into the database, not the actual text used.

  • To edit a link: you do not need to copy and edit the $wgNavigationLinks array; simply find the appropriate pages, such as MediaWiki:portal and MediaWiki:portal-url, and edit them while logged in with "sysop" privileges. The page Special:Allmessages can be useful for finding these and other editable interface elements.
  • To remove a link: copy the array as described above, and simply delete the appropriate line.
  • To add a new link:
    1. add a line of the form array( 'text'=>'something', 'href'=>'something-url' ),; "something" (Blue in the illustration above) and "something-url" (Red in the illustration above) can be whatever you like, and should be something you will remember and recognise later.
    2. edit (create) the pages MediaWiki:something (Blue above) and MediaWiki:something-url (Red above) in your wiki, substituting the names you chose at step 1 (the "MediaWiki:" part refers to the MediaWiki namespace; whatever names you chose at step 1, the pages to edit will be of the form "[[MediaWiki:<your name here>]]"). The first should contain whatever you want the link's text to be (e.g. "Donate") (Blue above), and the second either the name of a wiki page (e.g. "Project:Get in touch") or the full URL of an external document (e.g. "http://example.com/feedbackform.php"). Make sure that if you are linking to a wiki page that you put the name of the page, not a link to that page (no double brackets) or you will end up with a link to an error message (error: link target missing) when the Quickbar is rendered, rather than a link to the intended page.

Edited robbr 8/11/05 - colour references were incorrect

Remember: if your changes don't show up, remember to clear/by-pass your browser cache. Also you must not have $wgUseMemCached set to true, having this set will cause these links to not work.

In version 1.3 or earlier

In versions earlier than 1.4, there is no simple way to add a new link to the navigation bar. However, the existing links in version 1.3 behave in the same way as described - they are composed from two pages in the MediaWiki namespace.

  • To edit a link: find the appropriate "message" (page in your wiki), for instance by looking at your Special:Allmessages page, and make your changes. For instance, the "Community Portal" link has the text of MediaWiki:Portal, and the target found in MediaWiki:Portal-url; similarly, MediaWiki:Sitesupport and MediaWiki:Sitesupport-url, and others. The target can be either internal (just the name of a wiki page) or external (a full URL, beginning http:// etc).
  • To remove (hide) a link: set the text of the link to "-" (a single hyphen, without the quotes); e.g. if MediaWiki:portal contained only "-", no "Community portal" link would appear.

Remember: if your changes don't show up, remember to clear/by-pass your browser cache.

Using a wikipage as a source for a navigation bar

Sometimes even the navigation-bars should be available for editing by a normal user, who has no access to the PHP-scripts working in the background. A solution for this approach is to include a defined pagename. The advice below uses the namespace "MediaWiki" and the "function msgWiki( $str )", located in "include/SkinTemplate.php". That function renders a pagename within the MediaWiki-namespace to HTML. Within other skins, not using "SkinTemplate.php" this is not working.

MonoBook (MediaWiki 1.44, 1.54)

You have to modify the file skin/MonoBook.php This advice works only with the Skin MonoBook

  • Fill this article/wikipage with content (MediaWiki-Markup-Style) like:
  * [[an internal link]]
  * [[another internal link]]
  * [http://www.Link.de a external http-link]
  • open the file skins/Monobook.php
  • look for:
  <h5><?php $this->msg('navigation') ?></h5>
    <div class="pBody">
      <ul>
        <?php foreach($this->data['navigation_urls'] as $navlink) { ?>
        <li id="<?php echo htmlspecialchars($navlink['id'])
        ?>"><a href="<?php echo htmlspecialchars($navlink['href']) ?>"><?php 
        echo htmlspecialchars($navlink['text']) ?></a></li><?php } ?>
      </ul>
    </div>
  • replace the lines:
      <ul>
        <?php foreach($this->data['navigation_urls'] as $navlink) { ?>
        <li id="<?php echo htmlspecialchars($navlink['id'])
        ?>"><a href="<?php echo htmlspecialchars($navlink['href']) ?>"><?php 
        echo htmlspecialchars($navlink['text']) ?></a></li><?php } ?>
      </ul>

with:

      <?php $this->msgWiki( 'MenuNavigation' ) ?>
  • The result should look like this:
  <h5><?php $this->msg('navigation') ?></h5>
    <div class="pBody">
      <?php $this->msgWiki( 'MenuNavigation' ) ?>
    </div>
  • You can add further navigations-blocks the same way.

Example

HeinzJo 20:39, 12 Jun 2005 (UTC)

How do I change the page footer?

This is a dynamic element which is implemented in PHP code. If you are using the default MonoBook skin, the "About" and "Disclaimer" links are being generated by skins/MonoBook.php. You can either modify this file in place (but remember that it will be overwritten by updates) or copy it and make a custom skin (perhaps changing the default skin to the new one).

What about the other elements that are not inside skins/MonoBook.php ?

How do I create a small wiki farm?

After copying the mediawiki source tree in /opt/mediawiki/ you need to run something like:

 mkdir .../wiki  
 cd .../wiki
 mkdir images
 ln -s /opt/mediawiki/{languages,includes,skins,redirect.php,index.php,maintenance,StartProfiler.php} .
 cp -a /opt/mediawiki/config/ /opt/mediawiki/install-utils.inc .
 chown www-data: config/ images/
 # configure your new wiki and fix the permissions
 rm -rf config install-utils.inc

Then add /opt/mediawiki to the commands which set the include_path in config/index.php and add something like this to the main index.php, before require_once():

 ini_set( "include_path", "/opt/mediawiki:." ); # line added
 require_once( './includes/Defines.php' ); # existing line
  • Make sure that your webserver can read from /opt/mediawiki

Obviously each wiki will need its own database or at least a different table prefix.

You may also want to visit Is it possible to install more than one wiki (MediaWiki) on a server? How? for further information about standardising the log in for users across multiple wikis.

You can also look at the (rather complex) setup wikimedia is using

have a look at Help:Wiki family

How do I add w:Metatags

The page includes\OutputPage.php defines within the function addMeta () the output of metatags. This function can be used to define further metatags.

The existing command $wgOut->addMeta ( 'KEYWORDS' , $a.) ; can be added by further keywords just by adding a dot and a comma separated list. The change would look something like
$wgOut->addMeta ( 'KEYWORDS' , $a.', your Keywords, Comma separated') ;

Additional Metatags can be added too.

Just add further lines as last lines of the function addMetaTags() like:

$wgOut->addMeta ( 'LANGUAGE' , 'de') ;

HeinzJo 18:53, 14 Jun 2005 (UTC)

This solution can be used to add the same keywords to each page. How can we add specific keywords to specific pages?

Should not we define a MediaWiki tag, in the page, to define the keywords?

We currently have the opportunity to add comments, which are not displayed: Maybe a special comment could be detected by the engine and used to fill the string this->Keywords.

Any idea?

Jean-Dom 20:01, 9 Aug 2005 (UTC)

I am also interested in the ability to allow users to insert metatags into a page when they edit it. Has any thought been given to the above question?

Pekadad 15:55, 30 November 2005 (UTC)

How is this done in MediaWiki 1.6.x because those functions don't exist --Elliotgoodrich 19:41, 22 May 2006 (UTC)

I have managed to fix this http://www.psconclave.com/blog/mediawiki-mods/meta-tags feel free someone to write a proper guide for wikimedia as I don't have time at the moment. Elliotgoodrich 21:08, 25 May 2006 (UTC)

How do I add search-engines to the Search-Results for further investigations

  • Fill that page with content e.g.:
*[http://groups.google.de/groups?q=$1&hl=de alle '''Google Newsgroups''' nach "$1" durchsuchen]

Important is the variable $1. It is the content of searched words.

  • Open the PHP-file "SpecialSearch.php" within the subdirectory "includes" of the MediaWiki-installationsdirectory.
  • Find the function "function goResult( $term )"
  • Insert at the end before the last line:
    $wgOut->addWikiText( '<p>' . wfMsg('SearchInSearchEngines', $term ) . "</p>\n" );
  • Do the same with function: "function showResults( $term )"
  • Enhancements: Handling empty spaces.

How do I reset the popular page counters

In <= 1.4:
 UPDATE cur SET cur_counter=0;
In >= 1.5:
 UPDATE page SET page_counter=0;

How do I create a custom namespace?

See Help:Custom namespaces

How do I see a list of users watching a page?

You can't, mainly because watchlists are considered to be more or less "private" information. Obviously, the information's in the database if you wanted to hack up an extension to do it, but there's no in-built facility for it.

Remark: EnotifWiki indicates the number of watching users in Recent Changes views.

How do I modify the search-engine to search also all 'sister' projects?

How do I permanently remove old revisions

A description of how to permanently remove the histories of all current pages is only available for the older versions of mediawiki. How can this be done for the new Version? PHP Script? SQL?

This is the version 1.5.5 workaround that I have come up with on how to permanently remove the histories of current pages from your database.

  • The first step is to go to the page that you would like to delete the revision history of.
  • The Second step is to actually delete that page.
  • The third step is to select restore deleted page from the screen that pops up after deleting the page.
  • Restore only the latest revision of your page.
  • Then log on to phpmyadmin or your favorite db tool and go to your database.
  • Select the archive table from your database and select to empty or truancate it.

This should leave your database nice and clean of all of the former revision entries for that page. (However you might have to control-refresh or clear your history to view the changes when you browse your site.) Soylent red2722 16:12, 10 January 2006 (UTC)


The following code should do it - but dont try it on a live wiki without testing it out first.
Basically the first command deletes any entries in the text table that are NOT the latest revision of the page, and the second command removes any entries in the revision table that are not for the current revision of the page. You may well want to add a restriction to each query to limit the namespaces it runs on (I've included one which limits it to namespace 100).
DELETE FROM text USING text,page, revision WHERE text.old_id=revision.rev_text_id and revision.rev_id!=page.page_latest and revision.rev_page=page.page_id and page.page_namespace=100;
DELETE FROM revision USING page,revision WHERE revision.rev_id!=page.page_latest and revision.rev_page=page.page_id and page.page_namespace=100; 
--Steve A 16:00, 13 April 2006 (UTC)

What about deleteOldRevisions.php in the maintenance folder?

How do I display only so much of an article

Is there any way to create a template that only displays so many lines of an article?

How can you add a UTF-8 charset box on an Edit Page

Using JavaScript to insert special characters which is done via the extension CharInsert. Then you have to edit the MediaWiki:Edittools page of your site and customize it by copying and pasting from the sources of other Wikipedia sites. You need to be a Sysop to edit and save this protected page. Download the CharInsert extension from mediawiki and load it into you LocalSettings.php .

How can let the Template:Infobox Software table on right of page

I have ask many times, but nobody told me how to do. Now I install a new 1.6.3 mediawiki, but the infobox is on left of page. Who can tell me how can let the infobox on right of page? like InfoboxSoftware. Thanks.

Maybe this will set you on the right track:
box on right
<div style="float:right; width:30%; background:red">Box on right</div>
Jonathan1 23:06, 22 January 2007 (UTC)

User administration

Basic User Account Management?

As a sysop, how do I see basic information about users like username, realname, email? How do I find the ip of a user for previous edits? What is the best way to roll back a users edits globally?

The following should help (using mysql):
show columns from prefix_user;
select user_name, user_real_name, user_email from prefix_user;
Best wishes Jonathan1 22:58, 22 January 2007 (UTC)

How can I see new user-registrations in RecentChanges?

What do I have to do, to see new user-registrations in RecentChanges ?

You can use the "Newuserlog"-Extension... you can get it from the CVS-folder. Copy this file into your "extensions"-folder, and integrate the file into "LocalSettings.php"... should work then...

How do I change a user's password?

Assuming that $wgPasswordSalt is set to true (the default), you can use the following SQL query:

UPDATE user SET user_password = MD5(CONCAT(user_id, '-', 
  MD5('somepass'))) WHERE user_name = 'someuser';

Where obviously "somepass" is changed to the password you want to set and "someuser" is changed to the user name as it is listed in the table "user".

If $wgPasswordSalt is set to false, the SQL becomes:

UPDATE user SET user_password = MD5('somepass') WHERE user_name = 'someuser';

Note: the user_id in the CONCAT string is a column name and is not meant to be replaced with 'someuser'

Note: For error of table 'dbname.user' does not exist, please check the LocalSettings.php for $wgDBPrefix, the user table might be named to ($wgDBPreix)user.

User forgot his/her password, has no e-mail address

Let the user step through a "mail me a temporary password" cycle with a working e-mail address of her discretion, which you temporarily enter into her user account record.

You need to have

(a) access to the Wiki database (table user) and
(b) a working e-mail system

Check requirement (b) by mailing yourself a temporary password via the login screen button. Make sure, that you have set up correctly your own e-mail address.

  1. As WikiSysop you enter temporarily user's e-mail address into user account in db table user.
  2. Tell the user to click "Mail me a temporary password" on the wiki login screen
  3. S/he will receive a temporary password soon
  4. S/he can now login with the password and
  5. S/he now must set up a new password for her/his account

The trick also overcomes any problem with salted or unsalted passwords.

How do I allow only logged-in users to edit?

See Setting user rights in MediaWiki for questions relating to user rights.

First you need to determine MediaWiki version. Go to Special pages, Version.

MediaWiki version 1.5.1 or later

To stop people other than this SysOp (Admin) from creating accounts, add this line in LocalSettings.php:

   // Only SysOp (Admin) can create accounts -
   $wgGroupPermissions['*']['createaccount'] = false;   
  • Logged-in users will still be able to create accounts if that's the only line you change.

To stop people from anonymously editing pages without being logged in, add this line in LocalSettings.php:

   // No anonymous editing allowed -
   $wgGroupPermissions['*']['edit'] = false;

MediaWiki version earlier than 1.5.1

Add this in LocalSettings.php:

$wgWhitelistEdit = true;

Testing

To test whether anonymous editing disable worked, make sure you are really logged out. Possibly you will be kept logged in using some cookie or whatever, in such case press "Log Out" in top right corner.

How do I require an email address be specified at registration?

You can't require the user to enter a valid email - it's optional. But there are some users who patched mediawiki to do something like this. See Email_required_to_sign_up and Email_authentication_before_editing.

How do I allow only authorized users to view pages?

There are two hacks (patches) for this. See Page access restriction with MediaWiki and Hidden pages. Alternatively using native wiki Preventing Access.

This can also be done by adding the following line to the LocalSettings.php file in MediaWiki 1.9.x

$wgGroupPermissions['*']['read'] = false;

How do I reassign edits from one user to another?

Pre-1.5.7

cd <path to mediawiki>
rm attribute.sql
php maintenance/attribute.php OldUserNameOrIP NewUserName
mysql < attribute.sql

Always start with a fresh sql file, since attribute.php appends to it. The nice thing is you can run attribute.php a bunch of times, then commit them with one run of mysql.

1.5.7 upwards

Run the reassignEdits maintenance script from the command line to reassign edits from one user to another.

Usage: php reassignEdits.php <from> <to> [--force]

    <from> : Name of the user to assign edits from
      <to> : Name of the user to assign edits to
   --force : Reassign even if the target user doesn't exist

How do I make myself the Bureaucrat of my wiki?

How do I make a user a Sysop?

Goto: Special:Userrights and enter the username. Click on "sysop" from the "Available groups" list. Only a user with "Bureaucrat" rights may make a user sysop.

How do I remove Sysop-Rights from a user ?

see Setting_user_rights_in_MediaWiki

How do I manage user rights and groups?

see Setting_user_rights_in_MediaWiki (version 1.4 and older) or Help:User rights (version 1.5 and newer).

How do I allow any user to edit but the edited pages only updated on wiki after being approved by moderators?

Add the appropriate functionality to the code. ;p There is no way of doing this with the current software, although if written well it could prove a useful alternative for page protection.

Koset writes:
I have a simple solution. Replace the following line in includes/UserMailer.php

$dest = $to->toString();
with
$dest = "[email protected]";

Note, you'll have to do this in TWO places. This way, you receive all mail intended for users. You can approve them by simply forwarding them. You may want to change the "from" address to look wiki-official. --Koset http://koset.net/

How do I edit the Log in page to add a question so that only people with the correct answer are allowed to create a new account?

Add the functionality to the code, as shown above. There is no other way with the current software.

See FxParlant CAPTCHA to learn how to add a CAPTCHA capability, requiring that users correctly interpret a visual image.

How do I delete a user from my list of users?

MediaWiki does not support the deletion of user accounts. To prevent an account from being used, either scramble the password or set up an indefinite block on the account.

Do not remove users from the user table in the mySQL database; this causes problems with other parts of the wiki due to the relational structure of the database.

How do I scramble the password or set up an indefinite block?

A wiki system administrator can block a username on the Special:Blockip page (a restricted special page - look under Special pages in the toolbox). One of the options for the block length is infinite.

Alternately, an administrator with direct access to the wiki database can change a user's password. Scrambling a password is simply changing the password to some random text. The script from the "How to change a user's password" FAQ (above) can be used.

But can I rename the user, then?

Deleting the user is not strictly necessary, but it would help to be able to rename it to something neutral. Is it possible to change the username to something else?

In MediaWiki 1.5, bureaucrats can rename users directly in the wiki with the Renameuser extension installed. In previous versions, it required direct manipulation of the database:

update low_priority user set user_name='NewUsername' where user_name='OldUsername';
update low_priority user_newtalk set user_ip='NewUsername' where user_ip='OldUsername';
update low_priority cur set cur_user_text='NewUsername' where cur_user_text='OldUsername';
update low_priority old set old_user_text='NewUsername' where old_user_text='OldUsername';
update low_priority archive set ar_user_text='NewUsername' where ar_user_text='OldUsername';
update low_priority ipblocks set ipb_address='NewUsername' where ipb_address='OldUsername';
update low_priority image set img_user_text='NewUsername' where img_user_text='OldUsername';
update low_priority oldimage set oi_user_text='NewUsername' where oi_user_text='OldUsername';
update low_priority recentchanges set rc_user_text='NewUsername' where rc_user_text='OldUsername';


How do I block a range of IP?

How do I block a range of IP, e.g. 84.172.2xxx, so that every user, starting with this IP will be blocked?

Have a look at: Range_blocks. Note that even registrated user, using these IPs, will be blocked, too!!!

How do I change the name of the default administrator?

Instead of changing the name of the administrator, create a new user with the desired name, and assign sysop privileges to that user with Special:Userrights (1.5 and later), or Special:Makesysop (pre-1.5).

If this is to be your primary account on the wiki, you may want to consider assigning the bureaucrat privilege as well.

How do I assign a username to an IP address?

(Question asked by Blueeyor on 20:06, 25 Apr 2005 (UTC))

You can't have a specific IP become a specific user. You can check the "remember me" box.

If you want all the edits of one IP to be attributed to an user, see How do I reassign edits from one user to another? above.

How do I change an edit history from an IP address to a userID?

(Question asked by Blueeyor on 20:06, 25 Apr 2005 (UTC))

See How do I reassign edits from one user to another? above.

How do I make a page only viewable by a WikiSysop or Bureaucrat or a particular user?

(Question asked by Wiseleyb 26 Apr 2005)

There are three hacks (patches) for this. See Page access restriction with MediaWiki, Hidden pages and Regular expressions for wgWhitelistRead.

How to add a new user when anonymous wiki access is not allowed?

Login as a sysop/admin then use http://www.yourwikiurl.com/index.php/Special:Userlogin to add the new user account.

How do I restrict User:<username> page to be edited by only <username> and Sysop?

The current version of the Page access restriction with MediaWiki patch allows you to do this.

How do I make it so that only logged-in users can see the toolbox?

Look at this page: Customization#How_do_I_remove_the_toolbox_for_users_that_are_not_logged_in.3F --RaZorEdge qc 03:38, 4 February 2006 (UTC)

How do I add multiple user accounts?

Login as a sysop then use the special page: Special:Userlogin to add the new user's account.

I have had good luck in 1.4 and 1.5 with importing tab-delimited data into the mw_user table. This was for an "authorized-editors only" site, with public read, but only member write. I disabled public editing and account creation, imported the user data, with an illegal password field (any single character will do), then required users to use the "mail me a new password" button in order to log in and change their password. --Bytesmiths 21:24, 19 December 2005 (UTC)

One option is ImportUsers extension. --Rouslan Zenetl 00:42, 6 January 2007 (UTC)

How do I edit error messages?

Special:Allmessages contains a complete list of messages (error or otherwise), that can be edited. Alternatively, you could also view and edit your languages/Language.php file, which also contains some messages.

How can I edit wiki that everytime a new article is created, users get email notification?

Looks like there's an email notification extension that will do this.

How do I, as an owner of two wikis, get the ability to use CheckUser on those wikis?

A little more info, our wikis are not a part of wikimedia or its projects, we just use the mediawiki software. How do we get access to checkuser to help combat spam and vandals on those wikis? --PatriarchAnthony 08:20, 13 January 2006 (UTC)

  1. Install the CheckUser extension from CVS
  2. Set the value of $wgCheckUserLog in LocalSettings.php to point to a writable log file
  3. Grant the checkuser permission using Special:Userrights
Rob Church Talk 23:14, 19 February 2006 (UTC)
I got CheckUser.php - But how to do the rest? Where to read? --Reinard 13:46, 22 March 2006 (UTC)
Just to expand on the installion of CheckUser. I had a bit of trouble since it was the first extension I'd ever tried to install,
  1. Copy the php file from CVS to your extensions directory, e.g. extensions/CheckUser.php
  2. Add the following to LocalSettings.php: require_once( "extensions/CheckUser.php" );
  3. Creating a log file isn't strictly necessary, but you should probably make one and add this line to LocalSettings.php: $wgCheckUserLog = "logs/CheckUser.log";
  4. Go to your wiki page Special:Userrights as an Admin and give yourself (at least) permission to use CheckUser. Don't forget this part or you'll get an error message that the CheckUser page doesn't exist, even though Checkuser is actually working.
Littlepinkpig 23:40, 12 April 2006 (UTC)

How do I force anonymous users to login, but not create accounts, nor see any other pages?

see Disable anonymous reading,
do steps 1, 2, 3

Q: I want to create all accounts myself -- as a sysop. I set $wgGroupPermissions['*']['read']=false; as well as 'edit' and 'createaccount'. This is "very secure", but prevents the anonymous users from even accessing the "Special:Userlogin" page — the only way for them to stop being anonymous. How do I solve this problem?

A: Ok, one needs to list the "Special:Userlogin" explicitly in the $wgWhitelistRead array in DefaultSettings.php (this file provides examples, it is located in the -includes- directoy). The trick is, the page's title is different depending on the language used, and -- in case of non-ASCII language -- must be entered in Unicode. In my case -- ??????????:Userlogin.

  • I don't think you should edit DefaultSettings - copy it to LocalSettings and put it there. Otherwise it will be lost when you upgrade MediaWiki.

Additional note: Sometimes in Windows system that even you entered Unicode, it still won't work, the solution is following:

For more esoteric languages, for which your editor and PHP parser might be in disagreement over file encoding such as under Windows, you could use the PHP urldecode() to input the page names. For example in Hebrew you could use:
#                              "Special":Userlogin (in Hebrew)                    
$wgWhitelistRead = array( urldecode("%D7%9E%D7%99%D7%95%D7%97%D7%93:Userlogin"),
#                                "MainPage" in Hebrew
                          urldecode("%D7%A2%D7%9E%D7%95%D7%93_%D7%A8%D7%90%D7%A9%D7%99") ) ;

How can I exclude a few Pages from GroupPermissions control ?

on my local mediawiki 1.5.6 installation I've set GroupPermissions so that only logged in Users can edit (works well). Now I want to set a few (really just < 10) pages to be editable by anonymous. I tried hacks in index.php and Title.php, without success. It' exactly the feature wgWhitelistEdit had done till version 1.4 - but this doesn't work in 1.5 - please help. --GerhardSchwarz 13:12, 29 March 2006 (UTC)

After a few days work, here is my own solution: ExplicitEdit (de) --GerhardSchwarz 13:11, 6 April 2006 (UTC)


How can i use excel like functions (sum,avg)?

I've seen it in other wiki implementations and i find it really useful, is it possible to use it in media-wiki? One column would contain e.g. =sum(B2,B4)


Can I restrict access to a category by usergroup?

Can I search by category names?

Kita wrote:

There are pages that have been assigned to more than one categories. Is there a way to do searches based on category names? Let's say, a page "Drill" is classified as "Hardware", "Electronics", and "Tool" categories. And I'm looking for a method to search pages that have all those categories assigned, regardless of the page content.

This "category based search" would work as a tag-combination search.

How do I change noindex nofollow

I would like to know how I can change the noindex,nofollow to --> noindex, follow. I want to know because I want to change a Special page (Special:Allpages) to follow. Why: a sitemap is useful for the users and the Searchengines. Actually I dont know why such an important page is noindex, nofollow ? I hope someone can help. Thanx

How do I change the size of automatic content window to be only on max.5 row for example?