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

feature: add activator and uninstaller #199

Closed
wants to merge 4 commits into from

Conversation

johnhooks
Copy link
Collaborator

@johnhooks johnhooks commented Mar 31, 2023

What?

Adds plugin activator and uninstaller. The database SQL to create the database tables for the plugin are in the Activator::create_tables_v1 static method.

Why?

Need to be able to install the plugin and have a database to contain the notification data.

TODO

  • register uninstall
  • multisite support
  • basic unit tests
  • research maybe_create_table as suggested by @Sephsekla, the implementation could be helpful for unit testing activation.
  • multisite unit tests multisite functionality needs more thought before writing tests

@johnhooks johnhooks force-pushed the feature/add-activate branch 3 times, most recently from a6687ee to 7c6ae18 Compare March 31, 2023 21:40
@erikyo
Copy link
Collaborator

erikyo commented Apr 1, 2023

In this way, however, it would not work for multisites... Since the code for adding support is not that complex, why we don't add it directly from the beginning? What do you think @johnhooks, multisite support is not essential but certainly welcome

@johnhooks
Copy link
Collaborator Author

@erikyo do you have a concept of how best to make this multisite compatible?

@erikyo
Copy link
Collaborator

erikyo commented Apr 1, 2023

@johnhooks
Copy link
Collaborator Author

johnhooks commented Apr 1, 2023

@erikyo it looks like the real magic is switch_to_blog( $blog_id ). Which I assume modifies $wpdb->prefix.

https://github.com/erikyo/cf7-antispam/blob/1047eb25ec63c68198696bcf0baaaa5e512ea9e8/includes/cf7a-activator.php#L271

Though in this instance, we should alway create a set of tables for the main site as well, correct?

@erikyo
Copy link
Collaborator

erikyo commented Apr 1, 2023

Which I assume modifies $wpdb->prefix

yes exactly! Anyway I don't think it's necessary but I would, because in that way we can create a network related set of notifications

@johnhooks johnhooks added [Scope] Service The core logic of the WP Notify project. php Pull requests that update Php code labels Apr 2, 2023
@johnhooks johnhooks mentioned this pull request Apr 2, 2023
1 task
@johnhooks johnhooks force-pushed the feature/add-activate branch 3 times, most recently from af653f4 to ee5e552 Compare April 2, 2023 18:30
Copy link
Collaborator Author

@johnhooks johnhooks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@erikyo and @Sephsekla I think this one is ready for review. We still need to figure out a testing strategy, though it may take some further research.

@johnhooks johnhooks mentioned this pull request Apr 2, 2023
4 tasks
@johnhooks johnhooks added the [Status] Blocked When another issue need to be taken care of first. label Apr 2, 2023
@johnhooks johnhooks removed the [Status] Blocked When another issue need to be taken care of first. label Apr 4, 2023
@johnhooks johnhooks added the [Status] Blocked When another issue need to be taken care of first. label Apr 11, 2023
fix: uninstall drop table names

fix: format error

chore: remove logging

fix: add uninstall hook

fix: use of deactivate in uninstall

fix: remove logging function

feature: add support for multisite

fix: Use Yoda Condition checks, you must

fix: add/remove options in each multisite instance

chore: fix comment formating

fix: nullable notification message meta

test: add activate and uninstall tests

refactor: add type hint to db-test-case

fix: package name PHPDoc comments
@johnhooks johnhooks marked this pull request as draft April 12, 2023 19:48
@johnhooks johnhooks mentioned this pull request Apr 12, 2023
38 tasks
@johnhooks
Copy link
Collaborator Author

Work on this is being continued in #259

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
php Pull requests that update Php code [Scope] Service The core logic of the WP Notify project. [Status] Blocked When another issue need to be taken care of first.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants