How to solve the Moodle Plugin Update Loop

3 min read

Encountering the 'Higher version already installed' error during a Moodle plugin update can leave administrators in a challenging loop. This common issue, known as the Plugin Check Update Loop, often occurs when an existing plugin version surpasses the required update version, hindering further progress.

Understanding the Issue

  • Faced with a Plugin Check Update Loop in Moodle.
  • An error message 'Higher version already installed' appears during the plugin update process
    • The error typically stems from a mismatch between the installed plugin version and the version Moodle expects.
  •  An update for a plugin is processed but you cannot get passed the systems check page, i.e. there is no warning.

Solution 1: Exiting the Plugin Check Update Loop

  1. Redirect to Admin Tool: Utilise the URL http://YOUR-MOODLE-URL/admin/tool/installaddon to move away from the stuck update page.
  2. Access Plugin Administration: Proceed to the Admin area and open the 'Plugins' section.
  3. Uninstall the Troublesome Plugin: Identify and uninstall the plugin that's causing the loop.
  4. Proceed with Remaining Updates: Continue updating other plugins that aren't affected by the loop.
  5. Reinstalling the Plugin: Be prepared to potentially reinstall any removed plugins, possibly within the context of a full site update.

Solution 2: Updating the Plugin Directory

  1. Acquire the Correct Plugin Version: Download the specific plugin version that Moodle is requesting.
  2. Replace the Plugin Folder: Overwrite the existing plugin folder with the contents of the downloaded version.
  3. Refresh the System: Click 'Reload' to update and reflect the changes.

Solution 3: Advanced Steps to Resolve the Moodle Plugin Update Loop (Use with Caution)

If you're facing persistent issues with Moodle plugin updates, here are detailed steps for a more comprehensive solution.

Step 1: Check Plugins Overview

Navigate to Site administration > Plugins > Plugins overview.
This page lists all plugins and highlights any that are "Missing from disk", indicating they've been removed from the code but not the database.
Direct url: /admin/plugins.php

Step 2: Clean Up Orphan Configuration

It's crucial to remove these orphan configurations from the database to prevent errors related to missing plugin functionality.

Step 3: Use Moodle's CLI Script for Bulk Removal


Moodle now includes a CLI script, uninstall_missing_plugins.php, for bulk removal of missing plugins.

To identify missing plugins, execute:

php admin/cli/uninstall_plugins.php --show-missing

For a dry run to see what would be purged, run: 

php admin/cli/uninstall_plugins.php --purge-missing

If satisfied with the dry run, proceed with: 

php admin/cli/uninstall_plugins.php --purge-missing --run

Step 4: Manual Database Adjustment (If Necessary, use with caution)

In cases where the CLI script or plugin overview page can't remove a plugin, you may need to edit the database directly, starting with the mdl_config_plugins table. Look for entries related to the problematic plugin and remove them.

Step 5: Purge Moodle Cache

After making changes, especially direct database edits, ensure to purge Moodle's cache to reflect the updates.

Adjusting Debug Settings for Troubleshooting

  • To increase error message verbosity, change the debug setting in the mdl_config table to a higher value (e.g., 32767).
  • Set debugdisplay to 1 to show these messages on your screen, aiding in troubleshooting.

Manual Override of the Update URL (Use with caution)

If stuck in the update loop, modify the URL from

/admin/index.php?cache=0&confirmrelease=0&confirmplugincheck=0&confirmupgrade=0

To

/admin/index.php?cache=0&confirmrelease=1&confirmplugincheck=1&confirmupgrade=1

This manual URL adjustment can force Moodle to proceed past the update loop.

Conclusion

While the Plugin Check Update Loop is a frequent hurdle in Moodle administration, these structured solutions can efficiently resolve the issue. Whether it's by escaping the loop via the admin tool or updating the plugin directory, these methods ensure the smooth functioning of your Moodle system, allowing you to resume regular operations without undue delay.