December 25, 2024, Wednesday, 359

Manual:FAQ

From NeoWiki

Jump to: navigation, search

Contents

Installation and configuration

Where do I download MediaWiki?

The latest stable release of MediaWiki can be downloaded from download.wikimedia.org or sourceforge.net. Files are supplied in a .tar.gz archive. MediaWiki can also be obtained direct from our Subversion repository. See also Download.

How do I install MediaWiki?

Installing MediaWiki takes between 10 and 30 minutes (when using MySQL), and involves uploading/copying files, creating a database and user, and running the installer script to configure the software.

Full instructions can be found in the INSTALL file supplied in the distribution archive.

How do I install MediaWiki using a package?

Many Linux distributions provide mediawiki in a packaged format for that distribution. The MediaWiki development team refers you to your Linux distribution for assistance with installing, configuring or using them. The individual communities & companies who maintain such packages should provide installation instructions.

Can I install more than one wiki on a server using MediaWiki?

It is possible to install more than one wiki on a server provided that:

  • You use a different database for each wiki

OR

  • You use a different database prefix for each wiki (for Postgres, you can achieve a similar effect by using different schemas)

For information on these options, see $wgDBname and $wgDBprefix respectively.

For information on setting up a wiki family, see Manual:Wiki family.

For information on an alternative way of setting up more then one wiki using the same server, database and source, see Steve Rumberg's excellent expose and additional comments from users.

How do I enable uploading?

File uploads are an often-used feature of MediaWiki, but are disabled by default in all current release versions. To enable them, first make the upload directory (default images) writable by the web server (CHMOD 777 or allow the Apache user to write to it, etc.) then set $wgEnableUploads to true in LocalSettings.php (i.e. "$wgEnableUploads = true;").

How do I purge a cached page?

To purge a cached page, such as when making changes to the navigation bar, add &action=purge to the end of the page url.

e.g. http://www.mediawiki.org/w/index.php?title=Main_Page&action=purge

How do I allow uploading of additional formats?

MediaWiki requires that allowed file upload formats are specified using the $wgFileExtensions configuration directive. Usually this directive is situated in LocalSettings.php in the root of your MediaWiki installation.

For example, to allow uploading of PDF files, add the following to LocalSettings.php:

$wgFileExtensions[] = 'pdf';

Note that the syntax is different to allow uploading of more than one type of file. To do so, use an array as in the example below which will allow uploading of png, gif, jpg, jpeg, pdf, and txt files.

$wgFileExtensions = array( 'png', 'gif', 'jpg', 'jpeg', 'pdf', 'txt' );

"File is corrupt or has an invalid extension"

Some users have reported that after adding a file format to the allowed extensions list, an error is encountered. The text of the error is similar to the following:

The file is corrupt or has an incorrect extension. Please check the file and upload again.

Possible solutions:

  • Set the value of $wgMimeDetectorCommand, e.g. under Unix or Linux, this would be
    $wgMimeDetectorCommand = "file -bi";
  • Compile/install the fileinfo PHP extension
    • Fedora - yum install php-pecl-Fileinfo

Initial user was not created by installer

Sometimes, the installer fails to create the default user, or the user table is lost for some reason. There are three ways to solve this:

use maintenance/createAndPromote.php

This method is convenient if you have shell access

  • make sure you have AdminSettings.php set up (see AdminSettings.sample)
  • go to the maintenance directory
  • enter php createAndPromote.php newusername newpassword

create a user normally, and promote it in the DB

This method is convenient if your are confortable modifying the database manually

  • create a user using Special:Userlogin. Go to Special:Preferences and mark the user id.
  • assign sysop group using the database: INSERT INTO user_group SET ug_id = youruserid, ug_group = "sysop"

create a user normally, and promote it using Special:Userrights

This is probably the easiest, but most unsafe method:

  • create a user using Special:Userlogin.
  • add $wgGroupPermissions['user']['userrights'] = true; to your LocalSettings.php
  • go to Special:Userrights and promote yourself.
  • remove $wgGroupPermissions['user']['userrights'] = true; from your LocalSettings.php

How can I create Interwiki Links in my Wiki?

DB Expert Answer

If the external wiki is Wikipedia, and you wish to use the prefix "wp" to link to it, run this SQL statement to modify the Interwiki table in your database:

INSERT INTO `interwiki` (`iw_prefix`, `iw_url`, `iw_local`, `iw_trans`) VALUES ('wp', 'http://en.wikipedia.org/wiki/$1', '0', '0');

The $1 indicates the article name on the external wiki.

Typical-User Answer

In an SQL Server editing program (ie: PhpMyAdmin), go to the interwiki table. Choose the option to insert (a row). In the iw_prefix field, enter your desired interwiki prefix. In the iw_url field, enter the Base URL of the external wiki plus the text "$1" as mentioned in the DB Expert Answer above. iw_local and iw_trans have default values of zero (0). You may leave them as zero.

For more information, see Help:Interwiki_linking

How do I make my base URLs shorter? (i.e. /wiki/Article_Name as opposed to /w/index.php/Article_Name)

See Manual:Short URL.'

Is Downloading and using all of mediawiki free?

Yes

Upgrading

Generic instructions on the upgrade process can be found in the UPGRADE file supplied with the software. See also Manual:Upgrading.

Changing the Interface

How do I change the logo?

The logo that appears in the top left of each page is determined by the $wgLogo configuration setting in the LocalSettings.php file.

To change this you simply need to change the value of $wgLogo to point to the URL of your own logo image. You can upload a file via the wiki and use that address (which allows it to be replaced easily, so you may want to protect the page if you use this method) or use an image uploaded to your server via other means.

Note: It is possible to simply overwrite the default logo installed with MediaWiki, but this is strongly advised against, as an upgrade may end up overwriting it or change the default location of this file.

Tip: The logo image should be 135 pixels square.

How do I customize the logo in the top left corner? Can I?

The logo is a portlet block without a pBody section. It is identified by the p-logo id. The background image is specified by the wgLogo variable, which is defined in /includes/DefaultSettings.php. This location is relative to the web server root and not the system root. Redefine this in /LocalSettings.php to change the image. If set wrong there will be no image on the page; check your web server error log and adjust accordingly. However the size of the p-logo will need to be big enough for the logo if it is not to be clipped. This is set in the stylesheet (Main.css in monobook), under the p-logo style, the default setting is:

#p-logo {
    z-index: 3;
    position:absolute; /*needed to use z-index */
    top: 0;
    left: 0;
    height: 155px;
    width: 12em;
    overflow: visible;
}

How do I customize the URL of the logo in the top left corner when you click it?

By default, clicking the logo takes you to the main page. If you want to change which page is the main page, edit MediaWiki:Mainpage. Or to make the link go to any arbitrary URL, for Monobook skin, edit Monobook.php and find and replace <?php echo htmlspecialchars($this->data['nav_urls']['mainpage']['href'])?> with the URL of your choice and replace <?php $this->msg('mainpage') ?> with the desired link title.

Note that a tag is on top of the logo so if you are trying to reduce the size of the logo's portlet you will also need to change the #p-logo a and #p-logo a:hover rules. The default setting for these is:

 #p-logo a,
 #p-logo a:hover {
    display: block;
    height: 200px;
    width: 12.2em;
    background-repeat: no-repeat;
    background-position: 35% 50% !important;
    text-decoration: none;
 }

This simple customization will re-define the size of all of them at once...

 #p-logo,
 #p-logo a,
 #p-logo a:hover {
    height: 75px;
}

There is one more rule controlling the amount of space between the logo and first portlet in the side column - the padding on the top of #column-one. By default this is:

#column-one { padding-top: 160px; }

If you want to remove the logo completely, comment out the wgLogo variable. Then set the column-one padding to a small value, such as 21:

#column-one { padding-top: 21px; }

You don't have to go edit the css file directly. You can go to <Your Wiki URL>?title=MediaWiki:Monobook.css. Hit edit and make your changes there. This has preference over the monobook main css.

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

  • Simply replace the favicon.ico image file at the root of your wiki with the .ico image file you want.
  • Alternatively edit the $wgFavicon setting in LocalSettings.php and add $wgFavicon = "$wgScriptPath/path/to/your/favicon.ico";

Rewrite Rule

If you are using a rewrite rule in .htaccess to remove "index.php" from the URL, you will also need to add an exception for .ico files. Simply add the following rule to your .htaccess:

RewriteRule .*\.ico$ - [L]

This rule must appear before the index.php rule. lllll

Case Sensitivity

When uploading the favicon file, be sure the filename is in lowercase. (That is, "favicon.ico", not "Favicon.ico".) A lot of servers (e.g., those on UNIX-like operating systems) will not be able to find the file unless its name is in lowercase.

How do I customize the navigation bar?

The contents of the navigation bar which appears to the left of each page using the Monobook skin are determined by the MediaWiki:Sidebar page. For information on customising these, please see Manual:Navigation bar.

How do I put a text message (sitenotice) on every page?

Put a text in the MediaWiki:Sitenotice page. It will be displayed on top of every article page.

How do I change the main page?

By default, MediaWiki looks for a page with the title Main Page and serves this as the default page. This can be changed by altering the contents of MediaWiki:Mainpage to point to a different title. This will not affect any of the links of the main navigation bar, including the 'Main Page' link included there at install time; to change these links, edit MediaWiki:Sidebar.

How can I hide the table of contents?

For one page

Place the magic word __NOTOC__ into the page markup.

For all pages

Edit the CSS files; locate the style for the table of contents and add display: none; to the definition.

Per user

Users can also opt to have the table of contents hidden. This is a user preference, set in Special:Preferences.

How do I change the interface text?

Interface text is altered using the MediaWiki namespace. For each deviation from the default in the site language there is a page MediaWiki:Englishmessagename, and for each deviation from the default in each other language a page MediaWiki:Englishmessagename/languagecode. (Since release 1.9 there are no pages for messages equal to the default.). On creation of a page the edit box autofills with the default. When creating a page to override the default it is useful to first save the default version, to allow diffs with it. See also meta:Help:System messages.

How do I change the interface language?

  1. Change the value of $wgLanguageCode in LocalSettings.php
  2. Run the rebuildMessages.php maintenance script to rebuild the MediaWiki namespace

for example under unix, run this: "php -f rebuildMessages.php rebuild" in your maintenance directory.

How do I remove the article/edit etc tabs for users who are not logged in?

You can achieve this by modifying the skin. For the default MonoBook skin, in the MonoBook.php file, search for this line:

foreach($this->data['content_actions'] as $key => $tab) {

and insert after $tab) this

if($this->data['loggedin']==1)

had to place inside the <?php). So it looks like this:

foreach($this->data['content_actions'] as $key => $tab) if($this->data['loggedin']==1) {

To conditionally hide individual tabs, modify the code to check the value of each $key inside the foreach loop. Or you can write a 'hook' extension (around SkinTemplateXYZ) to modify the tab list.

How do I add/remove tabs in general?

To (for example) remove the talk tab and then add one that always goes to the main page you would save this code in (for example) extensions/AR-Tabs.php:

$wgHooks['SkinTemplateContentActions'][] = 'ReplaceTabs';
function ReplaceTabs ($content_actions) {  
 unset( $content_actions['talk'] );    //only this to remove an action
    $maintitle = Title::newFromText(wfMsg('mainpage') );
     $main_action['main'] = array(
       'class' => false or 'selected',    //if the tab should be highlighted
       'text' => wfMsg('sitetitle'),     //what the tab says
       'href' => $maintitle->getFullURL(),   //where it links to
     );
     $content_actions = array_merge( $main_action, $content_actions);   //add a new action
}

and then add

require_once("extensions/AR-Tabs.php");

to the bottom of LocalSettings.php

How do I remove the "Talk for this IP" link at the top right when $wgDisableAnonTalk is true

In SkinTemplate.php line 489 (in version 1.9.2) change

   global $wgTitle, $wgShowIPinHeader;

to

   global $wgTitle, $wgShowIPinHeader, $wgDisableAnonTalk;

and lines 547 - 554 from

     $usertalkUrlDetails = $this->makeTalkUrlDetails($this->userpage);
     $href = &$usertalkUrlDetails['href'];
     $personal_urls['anontalk'] = array(
       'text' => wfMsg('anontalk'),
       'href' => $href,
       'class' => $usertalkUrlDetails['exists']?false:'new',
       'active' => ( $pageurl == $href )
     );

to (adding the if statement and indenting exiting lines)

     if( !$wgDisableAnonTalk ) {
       $usertalkUrlDetails = $this->makeTalkUrlDetails($this->userpage);
       $href = &$usertalkUrlDetails['href'];
       $personal_urls['anontalk'] = array(
        'text' => wfMsg('anontalk'),
        'href' => $href,
        'class' => $usertalkUrlDetails['exists']?false:'new',
        'active' => ( $pageurl == $href )
       );
     };


How do I remove the "Create an Account or Login" link at the top right of the screen?

In Monobook.php change this statement:

 foreach($this->data['personal_urls'] as $key => $item) {

to:

foreach($this->data['personal_urls'] as $key => $item)  if($this->data['loggedin']==1) {

How do I hide the section edit links for users who are not logged in?

Edit your skin, eg MonoBook.php, and add this before </head>:

<?php if(!$this->data['loggedin']) { ?>
      <style>
        <!--
        .editsection { display: none; }
        -->
      </style>
 <?php } ?>

If you want to hide the links for all users including logged in users, instead edit monobook/main.css and add .editsection { display: none; }

A far better way to do this is by editing your LocalSettings.php file and changing the default setting for the display of these section edits. Then it will apply to all skins, not just the default one you have selected for your wiki. What is required is to add the following line of code to the LocalSettings.php file:

$wgDefaultUserOptions ['editsection'] = 0;

How do I change the footer?

To add or remove items from the footer on your MediaWiki page, you must edit the skin.

For example: if you go in to MonoBook.php (located by default in the "Skins" folder) you will find the following code:

 $footerlinks = array(
   'lastmod', 'viewcount', 'numberofwatchingusers', 'credits', 'copyright',
   'privacy', 'about', 'disclaimer', 'tagline',
  );

In the above you can simply add and remove items from the footer that you wish to appear in your footer. Remember the changes may not appear immediatly because of MediaWiki caches.

You can also customize the individual items by modifying certain pages or parameters:

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 such, 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 make external links open in a new window?

See http://meta.wikimedia.org/wiki/Opening_external_links_in_a_new_window.

How can I suppress MediaWiki to format urls, tags, etc?

svn co <nowiki>http://somwhere.in.the.net/myproject/</nowiki>

svn co http://somewhere.in.the.net/myproject/

How can I force users to preview before they save?

To curb cursory negligence it may be desirable to disable the save button on the edit page, so users must preview first.

Here's how to reach that goal by only showing the save button on the preview page:

In /includes/EditPage.php, find (line number 1238 in mediawiki-1.9.0, 1158 in mediawiki-1.8.2):

"<div class='editButtons'>
	{$buttons['save']}
	{$buttons['preview']}

and replace these three lines with the following seven

"<div class='editButtons'>");
	if ( $this->formtype == 'preview') {
		$wgOut->addHTML(
"{$buttons['save']}");
	}
	$wgOut->addHTML(
"{$buttons['preview']}

Basic Usage

How do I edit a page?

To edit a page, simply click the edit link that appears on each page. Using the default MonoBook skin, this is in the form of a tab at the top of the page. A form will appear, containing the existing markup. When you have finished making modifications, click the Save button to commit your changes.

See also:

MetaWiki: Help:Editing


How do I create a new page?

There are several paths to creating a new page:

  • Create a link to the page on another page, then click on the red link which appears
  • Browse to the intended location of the page, e.g. http://www.foowiki.org/index.php?title=New_page and click on the edit link.

On some wikis, a failed search for a page will contain a link which allows you to edit that page.

see Help:Starting a new page

How do I delete a user?

(note that you will have to prefix the 'user' with whatever prefix was defined upon installation of mediawiki, e.g. 'mw_')

Use the following MySQL query:

DELETE FROM user WHERE user_name = 'Username';

You can also block logging for user:

UPDATE user SET user_password='*' WHERE user_name ='Username';

How do I delete an old version of a page?

Old versions of page data are retained in the database and can be accessed via the page history features. This is useful for reviewing changes and correcting or reverting undesirable ones, but in some cases, administrators might want to make this information unavailable, for legal reasons, or to reduce the size of the database.

  • Administrators can delete an old revision of a page by deleting the page, and then selectively undeleting revisions to be kept
  • The Oversight extension (also known as HideRevision) can be used to move harmful revisions out of page histories
  • The maintenance/deleteOldRevisions.php maintenance script can mass-delete all old revisions of pages and their associated text records
regarding deleteOldRevisions.php
I included it in LocalSettings.php, but it says I need to use it on commandline. So, I tried it on Putty's SSH commandline, but it is not recognized as a command. I would appreciate it very much if you would be so kind to give me a step-by-step instruction to get to the commandline in question and how to place deleteOldRevisions.php so that it works. I find many useful looking tools in the maintenance folder but I have not been able to use any of them due to the lack of this basic knowledge. Thank you in advance. --Kohyin 17:09, 23 February 2007 (UTC)

Are there any editing tutorials available?

There are several editing tutorials available, mostly on Wikimedia sister projects, such as Wikipedia. There are also markup references, etc. available on Meta.

How do I view the printable form of a page?

MediaWiki includes stylesheets which automatically style a page appropriately when it is printed; using the print or print preview function within your browser ought to render the page in a printable form.

You can also view this printable form using the printable version link in the toolbox.

How do I reset a password?

You can use the maintenance/changePassword.php maintenance script to reset a user's password.

You have to run the script from the command line. In other words, log into the server where your wiki is installed, then open a command prompt. Go to the installation directory, then go to the maintenance subdirectory. Run the following command:

php changePassword.php --user=someuser --password=somepass

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

You can also use the old way (copied here from Meta)

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

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.

Customising Further

How can I prevent editing by anonymous users?

As of MediaWiki 1.5 onwards, there have been significant improvements to user permissions settings which make restricting access to certain functions easier and more flexible. These are controlled by the $wgGroupPermissions configuration option.

For information on using this option, see the Preventing Access page on Meta.

How can I allow uploading of HTML files?

Full info here: Allowing HTML Uploads

Why...?

...is the Help namespace empty?

We don't currently have a clean, internationalised set of help pages under a free license. A few developers are hoping to make this possible; however, the Help namespace currently ships in a blank state. You are free to add your own help pages, or copy certain of the items from Meta, e.g. the user guide or MediaWiki Handbook, these two collections being free to use under the GNU Free Documentation License.

...are some of my images not showing up after an upgrade?

Several users have reported that, following an upgrade or a moving of their wiki, several images fail to be shown inline. The files exist, and the image description pages show a MIME type of unknown / unknown and, in some cases, a warning about potentially dangerous files.

To fix this, run the maintenance/rebuildImages.php script from the command line. This will set MIME information for each file in the database.

...are all PNG files not being turned into thumbnails?

After upgrading to a more recent version of PHP, it is possible a different MimeMagic.php function is being used to detect file MIME types, particularly the built-in PHP function mime_content_type, which fails to detect PNG files. Search the web for mime_content_type png for information on fixing this bug at the PHP level, possibly by editing your magic.mime file.

See here for more info.

...is a search for a short keyword giving no hits?

By default, MediaWiki uses MyISAM's fulltext matching functionality to allow searching page content. The default settings for this mean that words of less than four characters won't be indexed, so results won't be returned for those queries.

To alter this behaviour, MySQL needs to be reconfigured to index shorter terms, and MediaWiki's search index table needs to be repaired, to rebuild the indices.

...can't I download MediaWiki 1.10?

MediaWiki 1.10 is in a development state at present, and has not been packaged into a general release. The code can be downloaded from Subversion if desired.

...doesn't this work? It works on Wikipedia!

Wikipedia and other Wikimedia web sites use the current version of the code in development; at present, this is MediaWiki 1.10alpha. Coupled with the use of several extensions, this means that functionality between these wikis and your particular setup may differ.

...do I get a 403 Forbidden error after setting permissions on my Fedora system?

Fedora Core enables SELinux by default. Instructions for setting SELinux permissions for MediaWiki are available.

...do I get logged out constantly?

This is probably related to cookies or session data, for example a problem with PHP's session.save_path setting. See meta:Help:Logging_in#Log_in_problems.

Anti-spam

Where do I get the spam blacklist from and how do I install it?

The spam blacklist extension can be found in Subversion. For installation and configuration instructions, consult the README file.

How do I use $wgSpamRegex to block more than one string?

$wgSpamRegex is a powerful filter for page content. Adding multiple items to the regex, however, can be awkward. Consider this snippet:

$wgSpamRegexLines[] = 'display\s*:\s*none';
$wgSpamRegexLines[] = 'overflow:\s*\s*auto';
[...]
$wgSpamRegex = '/(' . implode( '|', $wgSpamRegexLines ) . ')/i';

This example code allows convenient addition of additional items to the regex without fiddling about each time. It also demonstrates two popular filters, which block some of the most common spam attacks.

Where Now?

I've found a bug or have a feature request. Where do I post it?

Bugs and feature requests should be posted on MediaZilla, our implementation of Bugzilla. Please search the database prior to posting, to avoid creating duplicate entries.

I have a question not answered here. Where do I go next?

If you've exhausted the FAQ above, please try the following:

Recommended reading