User:Delhovlyn/Trad

Il est possible de déplacer ou de copier un wiki utilisant le logiciel MediaWiki vers un autre serveur. Cela est souvent nécessaire lors d'un déplacement vers un nouveau domaine ou un nouvel hébergeur.

Versions et mises à jour edit

Les instructions données dans cette page devraient pouvoir s'appliquer plus ou moins uniformément à n'importe quelle version de MediaWiki. Assurez-vous, avant de procéder au déplacement, que toute mise à jour du logiciel et de la structure de la base de données a été faite. Vous devriez éviter de déplacer la base de données depuis une ancienne version du logiciel vers un version plus récente ; ça ne fonctionnera pas.

Vue d'ensemble edit

  1. Sauvegardez la base de données
  2. Sauvegardez l'ensemble des fichiers MediaWiki
  3. Recréez la base de données, avec utilisateurs et permissions
  4. Importez la sauvegarde de la base de données
  5. Importez les fichiers MediaWiki
  6. Vérifiez et/ou corrigez le fichier de configuration
  7. Testez

Sauvegarde edit

Pour déplacer ou copier votre wiki, vous devez bien sûr commencer par faire une copie (c'est-à-dire une sauvegarde). Il vous faut copier au moins les données suivantes :

  • le contenu du wiki, dans la base de données
  • les images et autres fichiers multi-médias (le contenu du dossier images)
  • les fichiers de configuration ; LocalSettings.php et AdminSettings.php (si existant)
  • les fichiers système de MediaWiki, y compris tous les skins et extensions

Voir Manual:Backing up a wiki (anglais) pour des instructions sur la sauvegarde d'un wiki.

Re-create the database, user and permissions edit

On the destination server, create a new MySQL database and a user, and grant that user permissions on the database. SELECT, INSERT, UPDATE and DELETE permissions should suffice. You may need to consult the MySQL documentation, your hosting provider's control panel documentation, or the documentation of any other utilities you are using for information on how to do this.

Note: It doesn't matter if the database doesn't have the same name; indeed, in a commercial hosting environment, where database names are usually prefixed with a hosting account username, a different database name is almost guaranteed. In addition, the username can differ, as can that user's password. You will have to adjust the LocalSettings.php file on the new location accordingly.

Import the database backup edit

The next step is to import the database backup you made earlier. This will create the tables in the database and populate them with data. Following this point, you will have a duplicate of the database on the other server. Again, according to the means you are using to manage your MySQL databases, the process for this varies. You may need to upload the .sql script file from earlier to your server via FTP, or this may be done for you by the utilities you are using. Consult the documentation to find out how it's done.

After importing, which takes a variable amount of time, depending upon the number of pages, users, edits, etc. in your wiki, you should have a few dozen tables in the new database.

Possible methods edit

Possible methods for performing the import include:

Import the MediaWiki files edit

The final "large" step in the moving process is to upload/copy the MediaWiki files to the destination server. If you followed the instructions above, and backed up the entire directory, this will include the images and extensions directories, plus custom skins, etc. and the configuration file.

If you backed up only portions of the directory, e.g. images, extensions, etc. then you will need to first upload/copy a fresh install of the MediaWiki files, then transfer the backed-up directories and files into the correct locations in the new filesystem.

Notes edit

  • If following the latter process, ensure that your "fresh install" consists of the same version of MediaWiki as the old one did
  • Check that the upload directory has the correct permissions set if using uploads; it needs to be writable by the web server

Check the configuration file edit

The final, real task is to tweak the LocalSettings.php file. Certain entries in this will almost undoubtedly require changing, and you may need to change the database connection information as well.

Check the following configuration options:

$IP Needs to be correct for the paths on the new server
$wgScriptPath Needs to be correct for the path on the new server
$wgDBserver Check the database server name is correct
$wgDBname This might have changed in a shared hosting environment
$wgDBuser This might have changed in a shared hosting environment
$wgDBpassword Check this is correct for the new user

You might also need to check the paths to diff3, ImageMagick, etc.

Test edit

At this point, attempt to access the wiki on the new server and use it. Log in as a sysop and a regular user and check that viewing, creating and editing pages and uploading files still works. You will need to fix any problems reported either by PHP or MediaWiki itself.