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

Delete settings of all plugins when deleting an instance #73

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ferishili
Copy link
Contributor

This PR fixes #40,

Description

Currently, all settings of deleted instances in all plugins remain in the db! Which is logically not ideal and they need to be deleted upon deleting the instance no matter in which plugin!

How it works

  • In admin_setting_configtextwithvalidation admin setting which is responsible to hold the instances value, we now keep track of the old value and new values.
  • By comparing old and new values after the setting is saved, we make sure that:
    • first, there was a deletion happening, so that we proceed with cleanup => this help to execute the cleanup process only upon deletion.
    • second, we now know which instance "id" is getting deleted, therefore we traget the settings in plugins to removed them accurately based on the fact that instance deriven settings follow the naming convention of "[%setting_name%]_[instance id]".
  • We then prepare and extract the plugins configs from "config_plugins" db table for those instances being deleted and we use "unset_config" in a loop, in order to make sure that the built-in function does its job!

To TEST

  • Need to patch this PR
  • Generally you should test the add instance/delete instance in tool_opencast plugin admin setting.
  • [1] When adding instance and save changes in tool plugin, just select one extra opencast plugin e.g. block_opencast, and add configs of your choice (make it unique and rememberable) for the newly added instance settings in that plugin as well.
  • [2] Go back to tool plugin and delete that instance, click save changes.
  • [3] Go back to the selected extra plugin e.g. block_opencast, make sure that instance setting/category does not exists.
  • [4] Repeat the [1] for adding new instance that gets the same id (e.g. 2) then save changes.
  • [5] Go back to the selected extra plugin e.g. block_opencast, now make sure that the unique setting value that you have added in [1] is has been changed to default.

Any question, please don't hesitate to ask.

@ferishili ferishili added the bug Something isn't working label Dec 19, 2024
@ferishili ferishili requested a review from bluetom December 19, 2024 10:02
@ferishili ferishili self-assigned this Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Delete settings
2 participants