Spring Cleaning: Removing Old Package Versions

Save disk space and reduce your risk by removing old MODX Extra package versions.

By Bob Ray
March 1, 2022
Spring Cleaning: Removing Old Package Versions

After running a MODX site for a while, you may end up with many versions of the various packages you have installed. You might be tempted to just delete the packages from the core/packages directory, but that’s something you should never do.

Every version of every package you’ve installed is registered and stored in the MODX database (in the modx_transport_packages table). If you delete the files manually, MODX will continue to look for them every time you go to Package Manager and fill up your error log with complaints when it doesn’t find them.

The correct thing to do is to remove them in Package Manager, but the method in MODX2 is a little obscure and you may not have noticed it.

Go to System | Package Management. Next to the package name, you should see some buttons (in some browsers, you may have to click on the little plus sign next to the package name and scroll down to reveal them). Click on the “View Details” button. That will take you to the Package Detail panel. On that panel, you’ll see two tabs. Click on the “Uploaded Versions” tab. You should see a list of all the package versions with the most recent version at the top.

MODX Revolution 3 Purge Old Packages Button

There’s a more convenient method of doing this in MODX3. There’s a “Purge Old Package Versions” button at the top of the Package Manager grid that will remove all old versions of every package. If you want to remove old versions of a single package, you can follow the steps above to get to the “uploaded versions” tab. There you have the option of clicking on the “Purge Old Package Versions” button to remove all older versions of that package, or right-clicking on an individual old package and removing just that version.

You can right-click on any package except the one that is currently installed and select “Remove Package Version” to remove it. The version that is installed on your site may not be at the top of the list because you may have downloaded newer versions, but not yet installed them. Check the “Installed” column to see which one is installed.

It may not make any difference, but if there are new versions that are not installed, I always go back to the main Package Manager panel and install them before starting to remove older versions. I believe it’s safer to do it that way.

If there are versions in the database for which there are no transport package files to remove, MODX can get confused because it expects to find them there and uses the information in the transport package to guide the removal of packages. It will also get confused if the package signature or source fields are incorrect in the database. I use SiteCheck before deleting any packages. It will correct the signature and source fields, if possible, and will check to make sure the transport package files are there. If they’re not, SiteCheck will download the transport files from the MODX Repository automatically.

Bob Ray is the author of the MODX: The Official Guide and dozens of MODX Extras including QuickEmail, NewsPublisher, SiteCheck, GoRevo, Personalize, EZfaq, MyComponent and many more. His website is Bob’s Guides. It not only includes a plethora of MODX tutorials but there are some really great bread recipes there, as well.