Comment minimiser la banque de questions lors d'une sauvegarde/restauration d'un cours

De MoodleDocs
Aller à :navigation, rechercher

Remarque : la traduction de cette page 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.


When you back up and restore a course or a quiz, often a very large question bank is backed up which includes many questions not being used in the course or quiz. This can be a problem when the question bank on a site gets very large (over 1000 questions or over 500mb). At this point, backup and restore may fail due to timeouts or other technical reasons. Sharing courses on the Hub is also difficult because large question banks of unrelated questions are included which make sharing backup files difficult and confusing to teachers receiving the question bank.

Lorsque vous sauvegardez un cours ou un test et que ce cours ou test utilise des questions qui sont dans un contexte extérieur au cours (niveau catégorie de cours ou niveau système), l'archive inclue l'ensemble de la banque de questions même si les questions ne sont pas utilisées. Cela génère une archive de grosse taille pouvant poser des problèmes à la restauration :

  • archive refusée car de taille supérieure à celle autorisée par le site ;
  • requête php interrompue car dépassant le temps limite défini sur le serveur ;
  • duplication indésirable de questions
  • surpoids inutile du site Moodle
  • perte de lisibilité de la banque de questions
  • perte de lisibilité des liens des tests du cours avec la banque de questions

Actuellement, lors d'une sauvegarde d'un cours vous n'avez le choix qu'entre inclure ou non la banque de questions. La possibilité d'inclure uniquement les questions utilisées dans le cours ou le test n'existe pas.

Cette demande d'amélioration de Moodle est signalée depuis 2007 dans le Tracker : (MDL-12403) puis (MDL-41924). Voir la document anglaise (lien en bas de page) pour l'historique de ces demandes.

En attendant une évolution, voici des stratégies de contournement de ce problème.

This workaround strategy is based on the design of the question bank which only includes questions in a backup that are in the same category or a higher level category. Thus System Level questions are included in every backup on the site. Note that Moodle uses the word "category" in two ways which can be confusing. A "category" can refer to a group of courses (Course Category) or a group of questions (question bank category). In this section, we usually use "category" to mean a group of questions in the question bank. These categories are also called "contexts".

Workaround to Minimize Questions in a Course Backup

  1. Move all questions from System Level and other upper level Categories in your question bank to lower category levels--down to course level categories. (this makes it difficult to view and share, but is necessary).
  2. Move the course (or a copy of the course) to a temporary Course Category somewhere on your site where there are no other courses.
  3. Make a backup of your course and restore this backup in the same Course Category. (Moodle will automatically push all upper level category questions into course level categories--you will see this happen on the screen).
  4. Go into the newly restored course and open the Question Bank. You will see all questions are at the course level.
  5. Prune (delete) all unneeded questions in your newly restored course. Do not worry about deleting here, because you are only deleting course level copies of the questions. The original questions on your site are not affected.
  6. As you delete groups of questions, Moodle will list and confirm the questions you wish to delete. If you mistakenly try to delete a question that is being used in your course, Moodle will mark that one with an asterisk. Then cancel the deletion, and try selecting again. Note those questions and cancel the deletion and choose only unneeded questions. (in the case of thousands of questions, this deletion process can take a long time).
  7. After you have minimized the questions manually by deletion at these course level categories, you can now make a another backup file and when you restore it, only the remaining questions you selected will be included.

In addition, you can encourage Moodle HQ to tackle this issue by voting, watching, and commenting in these two tracker issues: MDL-41924 and MDL-12403.