Cannot Uninstall Old Moodle (1.x to 2.6) Themes (unsupported)

February 22, 2017

Cannot delete old themes! (in moodle 2.8 and beyond)
Cannot uninstall Disabled themes!
We deleted the theme folders from the {moodle}/themes/ folder years ago but despite every attempt to "uninstall" them, they still show up in the plugins overview list.

error:
core_plugin/err_uninstalling_unknown_plugin

Of course, you have to turn on error reporting to see this. If not, no error is displayed, moodle may just "hang" and you still get nowhere.

On our server, mdl 2.8.1 and a test copy of mdl 3.0.2 clicking uninstall on the plugins overview page only caused the the cpu to process for a few seconds and then quit, never leaving the overview page and accomplishing nothing. On a backup server, I got a copy of mdl 2.8.1 and 3.0.2 to bring up the uninstall page and then when continue was selected, it hung. . . . I manually returned to the overview page and the theme was now removed. But hanging like that makes one wonder what might have been wrecked in the process. Safer to "do it myself" in the database.

To uninstall all the old core themes that were removed in Moodle 2.7

Old moodle themes cannot be deleted. They are Disabled. They do not use the current (since ver. 2.1) core that all moodle themes must be built on; so even if the folder with all the code was still there, they/it would not run.

There have been a lot of sample themes in moodle, from before 1.5 to 2.6, that have varied from one version to the next.
In moodle 2.1 and 3.0 they threw out the core-framework and built a completely new core-structure-framework on which to build new themes. Also, with the version 2.7 moodle threw out the files for all but 2 (new) sample themes, Clean and More and terminated support for the pre-2.1 themes.
Moodle attitude: "all custom themes will immediately require a complete rewrite" … rewrite or stay put on your old version.
"If an out-of-date plugin causes your upgrade to fail, you can usually delete the plugin code" ["all pre 2.7 plugins! Good grief!]
-docs.moodle.org/27/en/Upgrading – moodle 2.7
and again!:
-docs.moodle.org/30/en/Upgrading – moodle 3.0 ["and all pre 3.0 plugins!]

Unfortunately, when they threw out all the files and support for the old themes, they did not remove the references to them in the database. Now, all the old themes are gone and unsupported, but the records for them are still in the database and they show up in the administrator list of installed themes (site administration >> plugins >> plugins overview)

I have just looked and learned how to get rid of them. . .

I found the records (over a 100 of them) in the mdl_config_plugins table:
take a look

SELECT *
FROM mdl_config_plugins
WHERE plugin LIKE '%theme%'
ORDER BY plugin ASC

we don’t want to remove the base, bootstrapbase, canvas, clean, or more records – which do exist in the theme folder.
We need to spell out the others:

SELECT *
FROM mdl_config_plugins
WHERE plugin LIKE 'theme%'
AND (plugin LIKE '%afterburner' OR
plugin LIKE '%anomaly' OR
plugin LIKE '%arialist' OR
plugin LIKE '%binarius' OR
plugin LIKE '%boxxie' OR
plugin LIKE '%brick' OR
plugin LIKE '%formal_white' OR
plugin LIKE '%formfactor' OR
plugin LIKE '%fusion' OR
plugin LIKE '%leatherbound' OR
plugin LIKE '%magazine' OR
plugin LIKE '%nimble' OR
plugin LIKE '%nonzero' OR
plugin LIKE '%overlay' OR
plugin LIKE '%serenity' OR
plugin LIKE '%sky_high' OR
plugin LIKE '%splash' OR
plugin LIKE '%standard' OR
plugin LIKE '%standardold' )

then,

DELETE FROM mdl_config_plugins
WHERE plugin LIKE 'theme%'
AND (plugin LIKE '%afterburner' OR
plugin LIKE '%anomaly' OR
plugin LIKE '%arialist' OR
plugin LIKE '%binarius' OR
plugin LIKE '%boxxie' OR
plugin LIKE '%brick' OR
plugin LIKE '%formal_white' OR
plugin LIKE '%formfactor' OR
plugin LIKE '%fusion' OR
plugin LIKE '%leatherbound' OR
plugin LIKE '%magazine' OR
plugin LIKE '%nimble' OR
plugin LIKE '%nonzero' OR
plugin LIKE '%overlay' OR
plugin LIKE '%serenity' OR
plugin LIKE '%sky_high' OR
plugin LIKE '%splash' OR
plugin LIKE '%standard' OR
plugin LIKE '%standardold' )

notice that after removing them, they still show up:
site administration >> plugins >> plugins overview

We should "purge all caches" but this problem is worse than that.
We need to call the "Notifications" screen and tell it to "check for available updates":
site administration >> Notifications >> check for available updates >> plugins overview
in order for the removal to be processed.
or check for updates on the plugins overview screen:

They are now gone from the plugins overview screen and gone from the database! Finally.

THEN: purge all caches. . . . yes!

(see moodle tracker MDL-46472 where they claim, to have fixed it (cleared 1 or 2 of the the above records) only for ver’s 2.7.4 and 2.8.2 apparently and then quit, "Status: closed")

 

Leave a Reply

Your email address will not be published. Required fields are marked *

We try to post all comments within 1 business day