Migrate public to private metakey#108
Open
tijmenbruggeman wants to merge 21 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR makes the plugin's post meta key private by renaming tiny_compress_images → _tiny_compress_images (so it no longer appears in WordPress's Custom Fields UI), and introduces a lightweight, version-tracked migration framework that rewrites existing meta rows in a single $wpdb->update call. A Tiny_Migrate::run() invocation is added to the main plugin bootstrap so the rename is applied automatically on upgrade.
Changes:
- Change
Tiny_Config::META_KEYto_tiny_compress_imagesand update the meta-key invariant test hash. - Add
Tiny_Migrateclass with aDB_VERSION/tinypng_db_versionoption to gate one-shot migrations, plus a first migration that renames the existing meta keys. - Extend the WordPress test stubs to support
$wpdb->update, non-callable stub values, and apostmetatable name; add unit tests forTiny_Migrate.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| tiny-compress-images.php | Loads new migration class and runs migrations at plugin bootstrap. |
| src/class-tiny-migrate.php | New migration runner with DB_VERSION tracking and the meta-key rename migration. |
| src/config/class-tiny-config.php | Prefixes META_KEY with an underscore to make it private. |
| readme.txt | Adds a = 3.7.0 = changelog entry for the meta-key migration. |
| test/helpers/wordpress.php | Exposes postmeta, registers an update method, and permits non-callable stub return values. |
| test/unit/TinyMigrateTest.php | New unit tests for the migration's run / skip / option-update behaviours. |
| test/unit/TinyImageTest.php | Updates the SHA-1 invariant test for the new meta-key value. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Will migrate the
tiny_compress_imagesto_tiny_compress_imagesmarking it as a private key. This will ensure that the field will not be editable through custom fields.Changed
Tiny_Migrateclass to contain migrations.runwhich runs before the plugin does (seetiny-compress-images.php)Considerations
After merging, we can close: