Attention : vous consultez actuellement la documentation dédiée aux versions 1.x de Moodle. La documentation pour les versions 2.x de Moodle est consultable ici : Migration de Moodle, celle pour les versions 3.x de Moodle est consultable ici : Migration de Moodle et celle pour Moodle 4.x est consultable là : Migration de Moodle.

« Migration de Moodle » : différence entre les versions

De MoodleDocs
Aller à :navigation, rechercher
Aucun résumé des modifications
 
(Il en reste à traduire...)
Ligne 8 : Ligne 8 :
== Restaurer un cours ==
== Restaurer un cours ==


You may need to restore a single course from an old site to a new one, especially if you are testing the migration. When restoring a Moodle backup file to Moodle on a different server than the one used to create the backup, the absolute referenced links to files maybe broken. To fix this problem open the ''backup-coursename.zip'' file and edit the ''moodle.xml'' file replacing links with <code>$@FILEPHP@$</code>.
Vous pouvez avoir besoin de restaurer un seul cours d'un ancien site vers un nouveau, notamment si vous testez la migration. Lorsque vous restaurez un fichier de sauvegarde Moodle sur un autre serveur que celui qui a servi à créer la sauvegarde, les liens absolus vers les fichiers peuvent être brisés. Pour corriger ce problème, ouvrez le fichier ''backup-coursename.zip'' et modifiez le fichier ''moodle.xml'' en remplaçant les liens par <code>$@FILEPHP@$</code>.


For example, replace <nowiki>http://yourserver.com/file.php/243/</nowiki> with <code>$@FILEPHP@$</code>
Par exemple, remplacez <nowiki>http://votre-serveur.com/file.php/243/</nowiki> par <code>$@FILEPHP@$</code>
   
   
When the file is restored it will use the correct file path for the new course.
Lorsque le fichier sera restauré, cela utilisera le bon chemin pour le nouveau cours.


== Migrer un site Moodle complet ==
== Migrer un site Moodle complet ==


This involves moving a whole site from one server to another. If you are changing the domain/IP address to the new server you need to do these steps:
Cela signifie migrer un site Moodle complet d'un serveur vers un autre. Si vous changez de domaine ou d'adresse IP pour votre nouveau serveur, vous devrez suivre les étapes suivantes :
* Place your current Moodle site in maintenance mode to prevent any further additions to the Moodle database. Don't let administrators login during the migration as they are not affected by the maintenance mode setting.
* Placez votre site Moodle actuel en mode de maintenance pour empêcher toute modification dans la base de données. Ne laissez pas les administrateurs se connecter durant la migration, car il ne sont pas affectés par le mode de maintenance.
* Backup your current Moodle database by following the instructions in the [[Mise à jour| upgrading Moodle]] page. This will give you a text file containing the mysql dump.
* Sauvegardez votre base de donnée Moodle en suivant les instructions de la page de [[Mise à jour|mise à jour]]. Cela vous donnera un fichier texte contenant l'export mysql.
* Copy the Moodle software code itself to the new server - upgrade the code to the latest version if you can.
* Copy the Moodle software code itself to the new server - upgrade the code to the latest version if you can.
* In your (possibly new) Moodle directory, change the <code>$CFG->wwwroot</code> variable in the ''config.php'' file for the new server.
* In your (possibly new) Moodle directory, change the <code>$CFG->wwwroot</code> variable in the ''config.php'' file for the new server.
* Copy the contents of your data directory (check for the value in <code>$CFG->dataroot</code>) to the new server. Check also that permissions remain the same on the new dataroot folder and change the value if you have changed its location on the new server.
* Copy the contents of your data directory (check for the value in <code>$CFG->dataroot</code>) to the new server. Check also that permissions remain the same on the new dataroot folder and change the value if you have changed its location on the new server.
* Copy your current Moodle database to the new server. You may need to zip the file to reduce the time taken for this process.
* Copy your current Moodle database to the new server. You may need to zip the file to reduce the time taken for this process.
* Change your Moodle database on the new server. This is needed as links to pictures, files, etc are stored as absolute links and will reference the old <code>$CFG->wwwroot</code> value. So when loading a mysql backup dump of the Moodle server into mysql on another server the absolute referenced links will be broken. This can be most easily fixed with the program ''replace.php''. After uploading the mysql dump file point your browser to <nowiki>http://yourserver.com/admin/replace.php</nowiki>
* Change your Moodle database on the new server. This is needed as links to pictures, files, etc are stored as absolute links and will reference the old <code>$CFG->wwwroot</code> value. So when loading a mysql backup dump of the Moodle server into mysql on another server the absolute referenced links will be broken. This can be most easily fixed with the program ''replace.php''. After uploading the mysql dump file point your browser to <nowiki>http://votre-serveur.com/admin/replace.php</nowiki>


:Enter the url for your old server (<nowiki>http://oldserver.com/</nowiki>) and new server (<nowiki>http://newserver.com/</nowiki>) and it will fix the mysql tables. You will also need to clear out any cached links by restarting your webserver.
:Enter the url for your old server (<nowiki>http://ancienserveur.com/</nowiki>) and new server (<nowiki>http://nouveauserveur.com/</nowiki>) and it will fix the mysql tables. You will also need to clear out any cached links by restarting your webserver.


'''Warning''': Before using ''replace.php'' make a backup of your Moodle database and test this this backup is OK by restoring it to a test install (say on a PC).
'''Attention''' : avant d'utiliser ''replace.php'', faites une sauvegarde de votre base de donnée Moodle et vérifiez que cette sauvegarde est correcte en la restaurant sur une installation de test (par exemple, sur votre ordinateur local).


An alternative is to use the search and replace feature of your text editor (or use a unix tool like sed) to replace the old URL with the new one in the mysql backup file. Once you have done this, restore the database.
An alternative is to use the search and replace feature of your text editor (or use a unix tool like sed) to replace the old URL with the new one in the mysql backup file. Once you have done this, restore the database.
  #sed -e 's/oldserver.com/newserver.com/' mysqldump.sql
  #sed -e 's/ancienserveur.com/nouveauserveur.com/' mysqldump.sql


'''Tip''': You may want to check the mysqldump file to see how the old server was referenced.
'''Astuce''' : You may want to check the mysqldump file to see how the old server was referenced.
* To test the new install, access Moodle using your browser and the new server's URL. When you have tested that a number of links in the courses work, take the new Moodle site out of maintenance mode.
* To test the new install, access Moodle using your browser and the new server's URL. When you have tested that a number of links in the courses work, take the new Moodle site out of maintenance mode.



Version du 4 septembre 2007 à 13:41

Remarque : la traduction de cet article n'est pas terminée. N'hésitez pas à traduire tout ou partie de cette page ou à la compléter. Vous pouvez aussi utiliser la page de discussion pour vos recommandations et suggestions d'améliorations.


Parfois, vous devez déplacer votre site Moodle d'un emplacement à un autre. Cela s'appelle une migration, lorsque vous devez modifier la valeur de $CFG->wwwroot dans votre fichier config.php. La migration est découpée en plusieurs phases, détaillées ci-dessous :

Mise à jour de Moodle

Lorsque vous migrez Moodle, c'est souvent une bonne idée et l'opportunité de mettre à jour Moodle vers une version plus récente. Si vous gérez votre propre serveur, suivez les instructions de mise à jour, sinon, voyez si votre hébergeur peut le faire pour vous.

Restaurer un cours

Vous pouvez avoir besoin de restaurer un seul cours d'un ancien site vers un nouveau, notamment si vous testez la migration. Lorsque vous restaurez un fichier de sauvegarde Moodle sur un autre serveur que celui qui a servi à créer la sauvegarde, les liens absolus vers les fichiers peuvent être brisés. Pour corriger ce problème, ouvrez le fichier backup-coursename.zip et modifiez le fichier moodle.xml en remplaçant les liens par $@FILEPHP@$.

Par exemple, remplacez http://votre-serveur.com/file.php/243/ par $@FILEPHP@$

Lorsque le fichier sera restauré, cela utilisera le bon chemin pour le nouveau cours.

Migrer un site Moodle complet

Cela signifie migrer un site Moodle complet d'un serveur vers un autre. Si vous changez de domaine ou d'adresse IP pour votre nouveau serveur, vous devrez suivre les étapes suivantes :

  • Placez votre site Moodle actuel en mode de maintenance pour empêcher toute modification dans la base de données. Ne laissez pas les administrateurs se connecter durant la migration, car il ne sont pas affectés par le mode de maintenance.
  • Sauvegardez votre base de donnée Moodle en suivant les instructions de la page de mise à jour. Cela vous donnera un fichier texte contenant l'export mysql.
  • Copy the Moodle software code itself to the new server - upgrade the code to the latest version if you can.
  • In your (possibly new) Moodle directory, change the $CFG->wwwroot variable in the config.php file for the new server.
  • Copy the contents of your data directory (check for the value in $CFG->dataroot) to the new server. Check also that permissions remain the same on the new dataroot folder and change the value if you have changed its location on the new server.
  • Copy your current Moodle database to the new server. You may need to zip the file to reduce the time taken for this process.
  • Change your Moodle database on the new server. This is needed as links to pictures, files, etc are stored as absolute links and will reference the old $CFG->wwwroot value. So when loading a mysql backup dump of the Moodle server into mysql on another server the absolute referenced links will be broken. This can be most easily fixed with the program replace.php. After uploading the mysql dump file point your browser to http://votre-serveur.com/admin/replace.php
Enter the url for your old server (http://ancienserveur.com/) and new server (http://nouveauserveur.com/) and it will fix the mysql tables. You will also need to clear out any cached links by restarting your webserver.

Attention : avant d'utiliser replace.php, faites une sauvegarde de votre base de donnée Moodle et vérifiez que cette sauvegarde est correcte en la restaurant sur une installation de test (par exemple, sur votre ordinateur local).

An alternative is to use the search and replace feature of your text editor (or use a unix tool like sed) to replace the old URL with the new one in the mysql backup file. Once you have done this, restore the database.

#sed -e 's/ancienserveur.com/nouveauserveur.com/' mysqldump.sql

Astuce : You may want to check the mysqldump file to see how the old server was referenced.

  • To test the new install, access Moodle using your browser and the new server's URL. When you have tested that a number of links in the courses work, take the new Moodle site out of maintenance mode.

Changements dans le DNS

Vous avez peut-être effectué des changements dans les entrées de DNS pour votre nouveau site Moodle. Si c'est le cas, il faudra un peu de temps pour que ces changements soient répercutés, soyez donc patient.

Accès interne et externe

Pour finir, vérifiez que l'accès à votre site est possible, autant en interne que depuis internet.

Voir aussi