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

🚧 402 use fewer postmeta values 🚧 #489

Closed
wants to merge 29 commits into from

Conversation

boonedev
Copy link
Contributor

@boonedev boonedev commented Feb 6, 2024

This PR adds a standard way to handle the edac specific data we stored about a site and posts.

  1. Adds a singleton Options class:
  • Uses a single interface to set/get/delete the data items. Consolidatse the separate wp_options records into a single wp_options record that stores the grouped data as an array.
  • Enforces rules to insure data is of the name, datatype and value we expect.
  • Sets the default values for items.
  • Performs a one-time migration of the legacy data items to the new format.
  • Handles backward compatibility when user is running an older version of Pro or Audit that directly accesses options with - get_option/update_option/delete_option.
  • Adds EDACAdminOptionsTest.php unit test.
  1. Adds a Post_Options class:
  • Uses a single interface to set/get/delete the data items.
  • Enforces rules to insure data is stored in the format we expect (grouped into a single record or as separate records).
  • Enforces rules to insure data is of the name, datatype and value we expect.
  • Sets the default values for grouped items.
  • Handles backward compatibility for legacy _edac_summary data.
  • Handles backward compatibility when user is running an older version of Pro or Audit that directly accesses options with get_post_metadata/update_post_metadata/delete_post_metadata.
  • Adds EDACAdminPostOptionsTest.php unit test.

 - Adds EDAC\Admin\Options for managing site options
 - Adds EDAC\Admin\Options_Post_Meta for managing post meta options
 - make constructors private so interface() is the only point of entry
 - remove singleton from Options_Post_Meta
 - rename Options_Post_Meta to Post_Options
 - add tests
 - minor refactor on EDAC\Admin\Options
 - update unit tests
 - convert plugin options to use EDAC\Admin\Options class
 - add npm run lint:fix, lint:php:fix
 - wiring options-page
 - add sanitizers to /Admin/Options class
 - bugfixes for options-page
 - update composer
 - remove duplicate
 - bugfix: correctly call edac_sanitize_settings_callback
 - bugfix: fix SQL syntax error in edac_delete_cpt_posts
 - add url datatype
 - add EDACAdminOptionsTest.php
 - ! untested, likely breaking.
 - adds post_options class
 - replaces get/update_post_meta with post_options get/set
 - replaces class-setting with class-scannable-posts
 - Adds Options::boot to rest_api constructor b/c some routes need access to Options
 - Adds check to Options::boot so it only fills the Options once
 - cleanup summary field
 - prevents adding invalid option and post-option fields
 - adds get-post-options and set-post-options rest routes
 - adds vue framework to editorApp so can replace ajax hooks with vue and rest calls
 - post_options tweaks
 - adds post_options unit test
@boonedev boonedev linked an issue Feb 6, 2024 that may be closed by this pull request
@boonedev boonedev marked this pull request as ready for review February 7, 2024 17:34
@@ -187,12 +189,12 @@ function edac_update_database() {
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
dbDelta( $sql );

}
// Update database version option.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved this to inside the if statement so it will only make the db call if the version has changed.

@boonedev boonedev marked this pull request as draft February 7, 2024 22:17
 - Reworking hooks
 - Reworking tests
 - Reworking hooks
 - Reworking tests
@boonedev boonedev marked this pull request as ready for review February 9, 2024 21:02
@boonedev boonedev marked this pull request as draft February 9, 2024 21:06
 - remove preload options for test
@boonedev boonedev marked this pull request as ready for review February 9, 2024 21:12
@SteveJonesDev SteveJonesDev marked this pull request as draft February 11, 2024 02:39
@SteveJonesDev SteveJonesDev changed the title 402 use fewer postmeta values 🚧 402 use fewer postmeta values 🚧 Feb 11, 2024
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

Successfully merging this pull request may close these issues.

Use fewer postmeta values
2 participants