Old quiz and question attempts deletion

Local plugins ::: local_deleteoldquizattempts
Maintained by Vadim Dvorovenko
Deletes old quiz and question attempts by scheduler task or by CLI command.

Old quiz and question attempts deletion 3.0.1

Moodle 4.0, 4.1, 4.2, 4.3, 4.4, 4.5, 5.0
Released: Linggo, 16 Pebrero 2025, 8:59 PM

Delete old quiz and question attempts Moodle plugin

Build Status

Requirements

  • Moodle 4.0 (build 2022041900) or later.

Installation

Copy the deleteoldquizattempts folder into your Moodle /local directory and visit your Admin Notification page to complete the installation.

Usage

Navigate to plugin settings and specify maximum lifetime of quiz attempts. Older attempts will be automatically deleted with scheduler task.

You can also specify to delete unused hidden questions. Hidden questions are questions, that were logically deleted, but were not deleted physically, because they were referenced in some quiz attempts. After quiz attempts deletion, such questions are probably no longer required.

You can also delete quiz attempts and unused hidden questions with command line job.

Deleting quiz attempts with CLI

Dispay help.

sudo -u www-data /usr/bin/php local/deleteoldquizattempts/cli/delete_attempts.php --help

Delete attempts that are older than 90 days and shows progress.

sudo -u www-data /usr/bin/php local/deleteoldquizattempts/cli/delete_attempts.php --days=90 --verbose

Delete attempts that are created before specified timestamp.

sudo -u www-data /usr/bin/php local/deleteoldquizattempts/cli/delete_attempts.php --timestamp=1514764800 --timelimit=300

Delete attempts that are created before 2018-01-01 00:00:00 (UTC).

sudo -u www-data /usr/bin/php local/deleteoldquizattempts/cli/delete_attempts.php --date="2018-01-01 00:00:00"

Delete attempts for specified quiz (check id in *_quiz table).

sudo -u www-data /usr/bin/php local/deleteoldquizattempts/cli/delete_attempts.php --days=90 --quizid=99

Delete attempts for all quizzes in specified course.

sudo -u www-data /usr/bin/php local/deleteoldquizattempts/cli/delete_attempts.php --days=90 --courseid=99

Deleting unused hidden questions with CLI

Dispay help.

sudo -u www-data /usr/bin/php local/deleteoldquizattempts/cli/delete_unused_questions.php --help

Delete unused hidden questions.

sudo -u www-data /usr/bin/php local/deleteoldquizattempts/cli/delete_unused_questions.php --timelimit=300 --verbose

Author

  • Vadim Dvorovenko (Vadimon@mail.ru)

Links

Changes

Release 3.0.1 (build 2025021600): - Deleting attempts and questions in chunks to prevent exceeding of memory limit.

Release 3.0.0 (build 2024011400): - Moodle 4 support. - Dropped support for Moodle versions lower than 4.0 due to changes in core.

Release 2.2.1 (build 2022010200): - Added option for 3, 7 and 15 days.

Release 2.2 (build 2020060600): - CLI options to delete attempts for specified quizzes and courses.

Release 2.1 (build 2019032801): - Do not try to delete questions that are used by slots. - Privacy API support.

Release 2.0 (build 2019010800): - Deletion of unused hidden questions.

Release 1.0 (build 2019010600): - Initial release.

Version information

Version build number
2025021600
Version release name
3.0.1
Maturity
Stable version
MD5 Sum
d936ce343c5b60e970fd0d4614775e4a
Supported software
Moodle 4.0, Moodle 4.1, Moodle 4.2, Moodle 4.3, Moodle 4.4, Moodle 4.5, Moodle 5.0
  • Latest release for Moodle 4.0
  • Latest release for Moodle 4.1
  • Latest release for Moodle 4.2
  • Latest release for Moodle 4.3
  • Latest release for Moodle 4.4
  • Latest release for Moodle 4.5
  • Latest release for Moodle 5.0

Version control information

Version control system (VCS)
GIT
VCS repository URL
VCS tag
2025021600

Default installation instructions for plugins of the type Local plugins

  1. Make sure you have all the required versions.
  2. Download and unpack the module.
  3. Place the folder in the "local" subdirectory.
  4. Visit http://yoursite.com/admin to finish the installation.