=== UpdateSafe Scheduler ===
Contributors: forniks
Tags: updates, scheduled updates, backup, maintenance
Requires at least: 6.3
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.1.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html

Schedule WordPress.org-hosted updates with existing UpdraftPlus backup checks, update history and post-update health reports.

== Description ==

UpdateSafe Scheduler provides manual and scheduled updates using WordPress's native upgraders. It installs only direct HTTPS packages from downloads.wordpress.org. Vendor-hosted premium packages, local archives, download overrides and redirects are not supported. Manage vendor updates through their normal updater outside this plugin.

Features:

* Manual plugin and theme updates, including multiple selected plugins.
* Scheduled plugin, theme and optional WordPress core updates.
* Existing-backup safety checks before updates. No backup creation.
* A configurable backup age limit, defaulting to 30 days.
* Database, plugins, themes, uploads and other-files component checks where expected.
* Local archive readability/size checks and remote completion-record verification.
* Update history, post-update health checks and optional email alerts.
* Permission checks, filesystem-policy checks and a shared database update lock.

All included features are free to use. There are no license keys, paid unlocks, trials, usage quotas, advertising or promotional links. The backup, permissions and package-source requirements are operational safety rules, not commercial feature gates.

= Backup dependency =

Install and configure UpdraftPlus separately, including its independent backup schedule. Its free edition is sufficient; no purchase is required. UpdateSafe Scheduler does not install UpdraftPlus or start backups. It requires UpdraftPlus to be active and the latest backup to have a matching successful completion record. Missing, stale, incomplete or unverified backups block updates.

This plugin is independently developed and is not affiliated with or endorsed by UpdraftPlus or the WordPress project. UpdraftPlus source is not bundled.

= Source code and build instructions =

All human-readable PHP, CSS and JavaScript source is included. No compilation or external build tools are required. To package, ZIP the updatesafe-scheduler directory with that directory at the archive root. LICENSE.txt contains the GPLv2 license text; this plugin is licensed under GPLv2 or any later version. WordPress's installed APIs and Dashicons are reused, not bundled.

= External communication and privacy =

The plugin uses WordPress's native update checks and upgraders. WordPress.org receives update metadata such as WordPress/PHP and component versions and the site URL as part of these native requests. Installed plugins may register their own update-check hooks; their metadata checks remain controlled by those plugins. UpdateSafe Scheduler itself accepts executable packages only from downloads.wordpress.org. It adds no author-operated service, telemetry, analytics, remote assets or tracking.

WordPress.org services are used to check and download updates when an administrator requests updates or enables a schedule. Simply viewing this plugin's dashboard uses cached WordPress update metadata; WordPress may independently perform its own normal update checks.

WordPress.org privacy policy: https://wordpress.org/about/privacy/
WordPress.org terms: https://wordpress.org/about/terms-of-service/

Email alerts are off until an administrator saves an email address. Alerts include the site name/URL, operation time, component names and update/health results. They are sent only to that configured address through the site's WordPress mail transport. Any SMTP provider is selected by the site owner. Blank the email field and save to disable alerts. The plugin does not email its author.

The database stores settings, the scheduling user's ID, notification email, update/health history and email acceptance status. Browser localStorage remembers dismissed administrator reports. Deactivation/deletion retains these records and all UpdraftPlus backups. No visitor tracking, public-site credits or frontend content is added.

== Upgrading from the previous directory name ==

Deactivate the old Easy Update Scheduler plugin before installing UpdateSafe Scheduler. Do not run both packages together. Existing directory-edition settings, history and scheduler authorization are preserved. Open Tools > UpdateSafe Scheduler and Save Schedule after activation to restore an event cleared by deactivation. The old EASY_US_MAX_BACKUP_AGE wp-config constant is supported for compatibility; use UPDATESAFE_MAX_BACKUP_AGE for new configuration.

== Installation ==

1. Install and configure UpdraftPlus and obtain a successful existing backup.
2. Upload the updatesafe-scheduler folder to wp-content/plugins or install the ZIP through Plugins > Add New > Upload Plugin.
3. Activate UpdateSafe Scheduler.
4. Open Tools > UpdateSafe Scheduler. Review the backup status, select update categories and save a schedule with an authorized administrator account.
5. Optionally enter an email address for blocked/failed-update and incomplete/failed-health alerts.

Scheduling starts disabled. This edition retains settings/history from the previous directory edition through its existing database keys. Private BMA data is separate and is not imported or deleted. Disable BMA Update Scheduler and any old scheduler snippets before activation. Use only one scheduler edition at a time.

Multisite settings/history are per site. Network activation is supported. New sites start with scheduling disabled. Network update permissions are honored; a database lock coordinates BMA/Easy scheduler operations sharing the installation. Avoid simultaneous schedules on sites sharing plugin files.

== Frequently Asked Questions ==

= Which schedules are available? =

Daily, weekly, selected weekdays and monthly. Monthly dates that do not exist fall back to the last day of that month; an explicit Last day option is also available. The next-three-runs preview uses your unsaved settings and WordPress timezone. Save Schedule to apply. WP-Cron execution may be delayed by low traffic. Nonexistent daylight-saving times shift forward using the timezone rules; a repeated time is scheduled once per calendar day.

= Can it update premium plugins or themes? =

Only if the actual update package is an eligible WordPress.org-hosted package. Vendor-hosted packages are unsupported and cannot be unlocked by payment. Use the vendor's ordinary updater outside UpdateSafe Scheduler. If a batch includes an unsupported plugin/theme package, the entire selection is blocked before installation; select only supported components.

= How do I change the backup age limit? =

Add this before the stop-editing line in wp-config.php; the value is seconds:

define( 'UPDATESAFE_MAX_BACKUP_AGE', 30 * 24 * 60 * 60 );

= Does a verified backup guarantee restoration? =

No. The plugin checks recorded components, completion, age and available local files. Remote archive availability and restorability require independent restore testing. Health checks are request-level observations, not a live frontend availability test. No automatic reactivation or rollback is performed.

= What does deactivation do? =

It removes this plugin's scheduled events while retaining settings, reports and backups. After reactivation, save the schedule to restore a missing event. Activation performs local setup only: it does not query advisory locks, check for updates, download packages or send email. Deletion retains data; there is no destructive uninstall routine. The History screen allows an authorized administrator to clear update history explicitly.

= Can it update itself? =

It excludes itself and Code Snippets from its own batches. Update those through WordPress's normal Plugins screen while no scheduler operation is running. There is no private updater or external update feed in this edition.

= What does the server need? =

WordPress 6.3+, PHP 7.4+, filesystem access for WordPress updates, and a consistent MySQL/MariaDB connection supporting advisory locks. SQLite can activate the plugin without advisory-lock SQL being executed. Update execution still requires advisory-lock support; unsupported databases receive a blocked-update explanation rather than continuing without a lock. WP-Cron requires site traffic or a server cron trigger. Email delivery depends on the site's configured mail transport.

== Changelog ==

= 1.1.0 =
* Added Selected weekdays and Monthly schedules, including last-day-of-month fallback.
* Added relevant-field visibility and a server-calculated preview of the next three runs.
* Existing daily/weekly schedules and update safety gates are retained.

= 1.0.4 =
* Removed the Protected text background in the Backup Safety statistic.
* Retained the WordPress.org contributor username forniks.

= 1.0.3 =
* Renamed to UpdateSafe Scheduler with slug and text domain updatesafe-scheduler.
* Updated public names, PHP identifiers, assets and documentation.
* Retained legacy option/cron keys to preserve existing settings and reports.

= 1.0.2 =
* Corrected the contributor username to forniks.
* Removed advisory-lock checks and schedule restoration from activation.
* Activation performs no update checks, downloads or email delivery.
* Unsupported runtime lock operations fail closed without rendering SQL errors.
* Added a specific explanation when update locking is unavailable.

= 1.0.1 =
* Added the owner-reported Tested up to release (7.1).
* Made direct-access guards and submitted-value sanitization explicit.
* Added nonce verification for redirected administrator notices.
* Documented necessary uncached advisory-lock SQL exceptions.

= 1.0.0 =
* Initial UpdateSafe Scheduler directory edition.
* WordPress.org-only package source policy and redirect/override protection.
* Existing-backup gate, update history, health checks and optional notifications.
* GPLv2-or-later source with local dashboard assets.
