=== kanenas — Minor/Patch Auto-Updates ===
Contributors: kanenas
Tags: auto-update, minor, patch, automatic updates, semver
Requires at least: 5.5
Tested up to: 6.9
Stable tag: 1.0.3
Requires PHP: 7.4
License: GPLv2
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Adds an "Enable auto-updates minor/patch" option, allowing automatic updates only for minor and patch versions while preventing major updates.

== Description ==

**kanenas — Minor/Patch Auto-Updates** gives you granular control over automatic updates. While WordPress allows you to enable or disable auto-updates entirely, this adds a third option: auto-update only minor and patch versions while keeping major versions at bay.

= Why Use This? =

Major version updates often introduce significant changes that may:

* Break compatibility with other extensions
* Introduce new features that require testing
* Change the behavior of existing functionality
* Require database migrations or manual intervention

With this, you can:

* **Receive security patches automatically** - Minor and patch versions typically contain security fixes
* **Get bug fixes without intervention** - Patch versions are generally safe to apply automatically
* **Control major updates manually** - Review major version changes before applying them
* **Maintain site stability** - Reduce the risk of unexpected breaking changes

= How It Works =

It uses semantic versioning (MAJOR.MINOR.PATCH) to determine update types:

* **Major update** (e.g., 1.0.0 → 2.0.0): Blocked from auto-update
* **Minor update** (e.g., 1.0.0 → 1.1.0): Allowed to auto-update
* **Patch update** (e.g., 1.0.0 → 1.0.1): Allowed to auto-update

Internally, this plugin runs only on WordPress auto-update decision filters:

* `auto_update_plugin`
* `auto_update_theme`

When you enable minor/patch mode for a plugin or theme, it also adds that item to WordPress core's `auto_update_plugins` / `auto_update_themes` site options so the automatic updater treats it as opted-in the same way as the Plugins/Themes screen toggle.

It does not rewrite update API responses (`plugins_api`) and does not modify updater transients (`pre_set_site_transient_update_plugins`). Premium update discovery and license validation remain managed by each vendor updater.

= Features =

* **Per-item control** - Enable minor/patch auto-updates for specific items
* **Easy toggle** - Simple links in the admin pages
* **Non-intrusive** - Works alongside WordPress's native auto-update system
* **Clean uninstall** - Removes all data when uninstalled
* **Translation ready** - Fully prepared for localization

= Usage =

1. Go to **Plugins** → **Installed Plugins**
2. Look for the "Enable auto-updates minor/patch" link below each plugin's auto-update setting
3. Click to enable/disable minor/patch auto-updates for that plugin

For themes:
1. Go to **Appearance** → **Themes**
2. Click on a theme to view its details
3. Look for the "Enable auto-updates minor/patch" option in the theme details overlay

== Installation ==

= From WordPress Admin =

1. Go to **Add New** in your admin
2. Search for "kanenas — Minor/Patch Auto-Updates"
3. Click **Install Now** and then **Activate**

= Manual Installation =

1. Download the ZIP file
2. Go to **Add New** → **Upload**
3. Choose the ZIP file and click **Install Now**
4. Activate it

= Via FTP =

1. Download and unzip
2. Upload the plugin folder (for example `kanenas-minor-patch-auto-updates`) to `/wp-content/plugins/`
3. Activate through the admin menu

== Frequently Asked Questions ==

= Does this work with premium extensions? =

Yes, for automatic-update decisions. This plugin can only allow/block the final auto-update decision after an update has already been discovered by the vendor updater.

If a premium update is not detected at all, the cause is usually in that vendor's update/auth stack and not in this plugin.

= What if an extension doesn't follow semantic versioning? =

The plugin classifies versions as `minor_or_patch`, `major`, or `unknown`.

If a version cannot be categorized safely, it now defers to WordPress's existing auto-update decision instead of forcing allow/deny.

= Can I use this alongside WordPress's native auto-updates? =

Yes. If you enable both the native "Enable auto-updates" and "Enable auto-updates minor/patch" options, the minor/patch setting will take precedence and block major version updates.

= Are there compatibility filters for premium updater edge-cases? =

Yes.

* `eaump_bypass_plugin_update_gate` - bypass this plugin's gate for a specific plugin update object.
* `eaump_bypass_theme_update_gate` - bypass this plugin's gate for a specific theme update object.
* `eaump_debug_log_updates` - enable JSON decision logs (defaults to `WP_DEBUG`).

If your premium updater has custom version formats or non-standard metadata, use a bypass filter to defer to core/vendor logic for that item.

= Troubleshooting premium updater flows =

1. Confirm the premium updater detects an available update first.
2. Check whether your item is opted into "auto-updates minor/patch".
3. Enable debug logging with `eaump_debug_log_updates` and inspect decision reason codes.
4. If needed, add a targeted bypass via `eaump_bypass_plugin_update_gate` or `eaump_bypass_theme_update_gate`.

= Why do debug logs show the same current and new version? =

On the Plugins screen, WordPress may invoke `auto_update_plugin` for every row using metadata where the offered version equals the installed version (no pending upgrade). In that case you will see `reason: defer_same_version_no_pending_upgrade` — it does not mean an update failed; it means there was nothing to upgrade in that pass.

= Does disabling minor/patch remove WordPress auto-updates for that item? =

Yes. Disabling minor/patch removes that plugin/theme from core `auto_update_plugins` / `auto_update_themes`, matching the enable action which opted it in.

= Will this work on multisite? =

Yes, it supports WordPress multisite installations.

= How do I report a bug or request a feature? =

Please visit [kanenas.net](https://kanenas.net/) or use the WordPress.org support forum.

== Screenshots ==

1. The "Enable auto-updates minor/patch" link appears below each plugin's auto-update setting
2. Success notification when enabling minor/patch auto-updates
3. Theme details overlay showing the minor/patch auto-update option

== Changelog ==

= 1.0.3 =
* Sync EAUMP-enabled plugins/themes with core `auto_update_plugins` / `auto_update_themes` so background updates align with WordPress's opted-in list.
* When installed version equals the offered version (no pending upgrade), defer instead of logging a false "allow" decision.
* One-time migration merges existing EAUMP selections into core auto-update lists.

= 1.0.2 =
* Added conservative update classification (`minor_or_patch`, `major`, `unknown`) for safer handling of vendor-specific version formats.
* Changed ambiguous version behavior to defer to WordPress/core decision instead of hard blocking.
* Added premium compatibility bypass filters: `eaump_bypass_plugin_update_gate`, `eaump_bypass_theme_update_gate`.
* Added optional structured debug logging via `eaump_debug_log_updates`.

= 1.0.1 =
* Renamed plugin for WordPress.org distinctiveness; text domain is now `kanenas-minor-patch-auto-updates`.
* Plugin directory and bootstrap file are `kanenas-minor-patch-auto-updates/kanenas-minor-patch-auto-updates.php` (matches SVN slug).

= 1.0.0 =
* Initial release

== Upgrade Notice ==

= 1.0.3 =
Syncs opted-in plugins/themes with WordPress core auto-update options; clearer logs when no upgrade is pending.

= 1.0.2 =
Safer premium updater compatibility: ambiguous versions now defer to existing updater decisions, with optional bypass and debug hooks.

= 1.0.1 =
Renamed for directory guidelines; update translations if you ship custom `.mo` files. If you upgrade from an older folder name, deactivate the old copy, remove it, then install this layout and activate again.

= 1.0.0 =
Initial release.

== Privacy Policy ==

This plugin does not collect, store, or transmit any personal data. It only stores plugin/theme preferences in your WordPress database.
