Uninstalling CodeRunner

Uninstalling CodeRunner

by Richard Lobb -
Number of replies: 0

I've had some queries lately on how to uninstall CodeRunner, and I realise there's an old posting that contains instructions that should NOT be followed. So I'm posting here what you should do (copied from this github posting):

Before starting this process, backup your server. Only then ...

The site administrators Plugins > Plugins overview page shows all the plugins installed and many will have an Uninstall option showing. You won't see that option for CodeRunner, but you can make it appear as follows.

Question-type plugins use a function 'is_uninstall_allowed()' to check if the Uninstall option can be displayed. The critical line of code in that function is

    return !$DB->record_exists('question', array('qtype' => $this->name));

where for coderunner the value of $this->name is 'coderunner'.

So, you must delete any CodeRunner questions that you know about in your question bank including the built-in prototypes (using the usual web UI not SQL) and then see if the Uninstall option is available. If not, the SQL query

    select id, category, name from mdl_question where qtype='coderunner';

should let you find all the undeleted ones. Note that when you delete a question through the web UI, there's a check to see if it's in use in a quiz. If so, it doesn't actually get deleted but gets put into a special category of old questions. So you should first delete coderunner questions from any quizzes. This does not apply to question prototypes.

If you have a lot of coderunner questions you may be able to just delete all the coderunner questions from mdl_question with SQL but I'd be very reluctant to do that myself as it will break the database integrity and I'm not sure that the subsequent plugin deletion will clean up the mess. Certainly any quizzes referring to deleted questions will break (but of course they're going to break anyway if you uninstall CodeRunner).