Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uninstall? #134

Open
larsaam opened this issue Dec 3, 2021 · 6 comments
Open

Uninstall? #134

larsaam opened this issue Dec 3, 2021 · 6 comments

Comments

@larsaam
Copy link

larsaam commented Dec 3, 2021

How to uninstall the plugin?

@trampgeek
Copy link
Owner

You first need to delete all the CodeRunner questions from your server. Namely, all the so-called prototype questions in the context System/CR_PROTOTYPES plus any that you or others have added. Once all those questions are deleted there will be an Uninstall link beside the plugin in the Plugins overview page. Click that to delete CodeRunner. You will also probably wish to delete the adaptive_adapted_for_coderunner question behaviour.

@larsaam
Copy link
Author

larsaam commented Jan 7, 2022

Thank you.

In a backup I tried to:

drop table question_coderunner_tests;
drop table question_coderunner_options;
delete from question_categories where id = 11; (GCR_PROTOTYPES)
delete from question where name like "BUILT_IN%";

Still no uninstall option on the CodeRunner plugin..

What did I miss?

@trampgeek
Copy link
Owner

trampgeek commented Jan 7, 2022

I'm pleased you did that in a backup, not the live server. Dropping tables is a bad idea. In fact, you shouldn't need to use SQL at all unless you've written a lot of CodeRunner questions and don't have the patience to hunt them all down and delete them.

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 I suggest you create another backup, 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.

If you do have a lot of CodeRunner questions, then I'm wondering why you want to delete CodeRunner. What went wrong for you?

@trampgeek trampgeek reopened this Jan 7, 2022
@larsaam
Copy link
Author

larsaam commented Jan 8, 2022

I do not have a lot of CodeRunner questions.. I only had one.

I can not understand that this is called a "Plug-in" - It certainly is not straight forward to plug out.

Anyway, it is sorted now. Thank you.

@jpahullo
Copy link

jpahullo commented Aug 8, 2022

Hi!

We are going to use it in production.

In my tests, I tried to unistall it, and it was really hard to do so. It is not documented (only found this issue by chance).

I propose to male it explicit in the documentation “How to uninstall?”

Also, I’ll propose to enable unistall it all-in-one, without manual actions.

If deleting questions and prototypes are necessary, you could provide the db/unistall.php that would do that for the admin. If you run it as admin you know what are you doing. Maybe you can ask the admin a double check (i.e., “are you sure?”) begore deleting the plugin.

Hoping this helps.

Thank you a lot for your time.

Jordi

@trampgeek
Copy link
Owner

trampgeek commented Aug 9, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants