Difference between revisions of "WikiDB/Installation"

From TestWiki
Jump to: navigation, search
(minor edit)
m (Reverted edits by 124.6.181.174 (talk) to last revision by HappyDog)
Line 58: Line 58:
 
== Step 3: Set up the database ==
 
== Step 3: Set up the database ==
  
WikiDB has an automated script to set up the database ready for use.  The requirements for running the WikiDB maintenance scripts is the same as those for the standard MediaWiki maintenance scripts, i.e. you need command-line access and appropriate permissions to modify the DB schema.  For more details about this see <span class="plainlinks">[http://shumelsdrivingschool.co.uk/driving-lessons-stevenage/<span style="color:black;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">driving  lessons stevenage</span>] and [[mw:Manual:Maintenance scripts]].
+
WikiDB has an automated script to set up the database ready for use.  The requirements for running the WikiDB maintenance scripts is the same as those for the standard MediaWiki maintenance scripts, i.e. you need command-line access and appropriate permissions to modify the DB schema.  For more details about this see [[mw:Manual:Maintenance scripts]].
  
 
To setup the database tables, you need to run the SetupTables script:
 
To setup the database tables, you need to run the SetupTables script:

Revision as of 15:38, 4 April 2013

This page describes how to install WikiDB. If you already have WikiDB installed and need to upgrade to a later version, see WikiDB/Upgrading instead.

Requirements

  • MediaWiki v1.6 or above. I normally develop for the latest version of MediaWiki, and may not be aware of issues that arise in earlier versions, but I am happy to fix backwards-compatibility issues where possible - you just need to let me know! If you encounter any problems with a particular version of MW then please report it on the bugs page.
  • Shell access is required for the command-line setup scripts. You can avoid this for a while by manually creating the DB tables but it will probably not possible to upgrade to later versions without being able to run these scripts.
  • WikiDB used to require that the database user had Create Temporary Table privileges, however this is no longer the case.

These instructions assume that you have already got MediaWiki up and running.

Step 1: Download and install the code

You can download the latest version of WikiDB as a zipped archive.

Download WikiDB Here!
or visit the file description page for a bit more information (e.g. version details, etc).

You need to extract the file into your extensions directory, which should create a WikiDB folder containing some sub-folders and the main startup script. The path to this folder should be /path/to/mediawiki/extensions/WikiDB/.

If you need to install it to a different location, you will need to adjust the path when you add the require_once() line, below, to LocalSettings.php, and you will probably need to set the MW_INSTALL_PATH environment variable in order to run the command-line maintenance scripts, but otherwise this should not cause any problems.

Step 2: Modify LocalSettings.php

Once the files are in place, you need to modify LocalSettings.php (which is where all wiki configuration settings are stored) in order to load and configure the extension.

Load the extension

To use the extension, you first need to load it. To do this, you simply need to add the following line to LocalSettings.php:

require_once("extensions/WikiDB/WikiDB.php");

You can check that the extension is loaded properly by visiting the Special:Version page on your wiki, where it should be listed along with the correct version number.

Define table namespaces

In order for the extension to have any worthwhile effect, you need to define one or more table namespaces. Table namespaces are where your table definitions are stored, and have special properties which are different to other namespaces within the wiki (for more about the concept of namespaces see this article at MediaWiki.org). In most situations only a single table namespace is required, though it is possible to define several.

To set up a table namespace, you need to first create the namespaces by adding it to $wgExtraNamespaces, so that MediaWiki knows about it (including its associated 'talk' namespace) and then you need to add it to the $wgWikiDBNamespaces array so that WikiDB knows to treat it as special.

For example, here's what you need to add to LocalSettings.php in order to create a single table namespace called Table:

$wgExtraNamespaces = array(
	100 => "Table", 
	101 => "Table_Talk",
);
 
$wgWikiDBNamespaces = array(
	100 => true,
);

For more information, including how to set up multiple table namespaces, see the documentation for $wgWikiDBNamespaces on the Configuration page.

Further configuration

See WikiDB/Configuration settings for further (optional) configuration options.

Step 3: Set up the database

WikiDB has an automated script to set up the database ready for use. The requirements for running the WikiDB maintenance scripts is the same as those for the standard MediaWiki maintenance scripts, i.e. you need command-line access and appropriate permissions to modify the DB schema. For more details about this see mw:Manual:Maintenance scripts.

To setup the database tables, you need to run the SetupTables script:

$ cd /path/to/mediawiki/extensions/WikiDB/maintenance
$ php SetupTables.php

For completeness, and to be absolutely sure that existing pages are parsed correctly for WikiDB data, you should also run the RebuildWikiDB script. On a large wiki, this can be very slow as it involves re-parsing all pages on the wiki. It is also relatively unlikely that existing pages contain DB data if WikiDB has not already been installed, therefore you may choose to skip this step. However, it is recommended that you run it in all cases, to make absolutely sure that WikiDB is up-to-date.

$ php RebuildWikiDB.php

For further details about the various command-line scripts provided by WikiDB, see WikiDB/Maintenance scripts.

Troubleshooting

I am getting 'PHP Strict Standards' errors

In PHP 5 and above, a new type of error was introduced - E_STRICT - which is triggered whenever PHP encounters code that does not conform to the consistently moving goalposts of PHP best practice. This warning is designed to alert developers that they are using a feature that is no longer recommended and which may (but probably won't) be removed completely at some point in the future.

These errors will have absolutely no negative impact on WikiDB or MediaWiki, except to display some annoying messages (if display_errors is enabled) and to clutter up your error logs.

This is not a bug in WikiDB. WikiDB currently still supports MW 1.6, and therefore PHP4. If I make the changes that would be required to remove these issues, the code would break on PHP4, which is not acceptable at the current time. At some point I will drop support for these old versions and at the point I will update the code to remove these warnings. However, until this happens the only way round the issue is to disable the E_STRICT warnings in PHP.

To disable them, set your PHP error_reporting setting so that it does not include E_STRICT. The default setting (in PHP < 5.4.0) already omits E_STRICT errors, so if you are experiencing this issue then someone has explicitly enabled them. You can fix it at the server level by changing the error_reporting config setting in php.ini, or you can add a line to LocalSettings.php, to disable it just for your MediaWiki installation.

In PHP < 5.4.0, E_ALL confusingly means 'everything except E_STRICT'. In PHP 5.4.0 and above you need to explicitly disable E_STRICT. The following line will work in all versions (do not use in PHP 4, however!):

  error_reporting(E_ALL & ~E_STRICT);