=== SiteHale ===
Contributors: sitehale, macsolutionsplus
Tags: monitoring, site health, maintenance, managed service, diagnostics
Requires at least: 5.6
Tested up to: 7.0.3
Requires PHP: 7.4
Stable tag: 0.5.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Free one-click Site Checkup — cron health, PHP fatals, database bloat, updates, admin audit, mail test — plus the SiteHale managed care companion.

== Description ==

**Site Checkup — free, no account needed.** Install, click SiteHale → Site Checkup, and get an honest, read-only health check of your WordPress site, run locally in that page load:

* **Scheduled tasks** — overdue WP-Cron events and Action Scheduler backlog. Dead cron silently stops scheduled posts, backups and update checks.
* **PHP errors** — fatal errors hiding in logs nobody reads, plus oversized logs quietly eating disk.
* **Database health** — autoloaded-options weight (the most common hidden cause of a slow site), expired transients, table overhead.
* **Updates & environment** — pending core/plugin/theme updates, and whether your PHP and MySQL/MariaDB versions are past their security-support end dates.
* **Administrator audit** — every admin account listed. A new admin you didn't create is the classic compromise sign.
* **Outbound email test** — one click proves whether your site can actually send mail, before a customer tells you the contact form is broken.

The checkup sends nothing anywhere — it reads your site and prints the results. It is yours, free, forever, with no account and no connection.

**It tells you when it could not check.** If your site's PHP error log cannot be read — logging switched off, a custom log path, or PHP writing to the web server's own file, which is normal on shared hosting — the checkup says exactly that, and marks the card "Could not check". It will not show you a green tick it did not earn.

**Checkup history & weekly re-check (also free, also local).** Every checkup stores a compact snapshot (last 12, on your own site), so the page shows what changed since last time — "autoloaded options grew 40%", "2 fewer fatal errors". A weekly background re-check runs the same snapshot automatically, and if something *regresses* — a new administrator account, new fatal errors, cron gone overdue, an autoload jump — you get one dismissible admin notice. No regression, no notice, ever. The page also shows when the next automatic re-check is due, and warns you if it has stopped running — a plugin that promises a weekly check should be able to prove it is happening.

**In Site Health too.** The checkup result and the weekly re-check appear as tests under **Tools → Site Health**, and a SiteHale panel is added to **Site Health → Info** — the screen you copy into a support ticket when you need someone else to look. These read the last stored checkup, so they add no work to your dashboard.

**Email the checkup.** Send yourself (or your developer) a plain-text copy of the results via your own site's wp_mail(). An optional, off-by-default checkbox also shares the summary with SiteHale so a human can review it and reply with recommendations — that is the only way the free half of the plugin ever sends anything anywhere, and only if you tick the box.

**The other half: SiteHale managed care.** The checkup runs once, when you click it. The SiteHale service (https://sitehale.com) runs checks like these — plus SEO optimization, content work, verified backups and uptime monitoring — on a schedule, every week, with a human reviewing alerts and a monthly report you can actually read. If you connect, this plugin becomes the companion:

1. **Connect** — a one-click handshake using WordPress core's own Application Passwords authorization screen. The plugin never creates users and never mints credentials itself; you approve access on WordPress's native consent page, under your own account, and can revoke it any time from Users → Profile.
2. **Health diagnostics** — read-only REST endpoints (the same data the Site Checkup shows) that let the SiteHale service watch over sites it cannot reach any other way. All endpoints require an Application Password plus administrator capability.
3. **Care reports** — your monthly SiteHale care report, rendered right in your dashboard: a dashboard widget with the latest summary plus a Care Reports page with the last 12 full reports. Reports are pushed by the SiteHale service (authenticated, size-limited, HTML sanitized on arrival).

**Who builds it.** SiteHale is built and operated by MacSolutions Plus, an Apple Authorized Service Provider in Buffalo, NY, in business since 2001. The checks in this plugin are the same ones we run across the sites we look after every week.

= External services =

This plugin connects to the SiteHale managed care service (https://sitehale.com), operated by the plugin author. It makes exactly three kinds of outbound requests, each strictly after an explicit administrator action:

1. `https://connect.sitehale.com/connect/facts` — a one-time site snapshot (WordPress/PHP/database versions, theme, plugin list, permalink settings) sent when you click Connect, so the service can be configured for your site.
2. `https://connect.sitehale.com/connect/pair` — the Application Password you approved on WordPress's authorization screen, sent once to complete the connection. WordPress core returns that credential to *your own site*, and the plugin forwards it from your server directly to SiteHale over an encrypted connection, so it is never placed in a web address or handled by your browser.
3. `https://connect.sitehale.com/connect/checkup` — sent ONLY when you tick the off-by-default "share with SiteHale" checkbox on the Email-this-checkup form: the checkup summary (the health lines shown on the page — no content, no visitor data) plus the email address you entered, so a SiteHale human can reply with recommendations.

No other outbound requests are made. The diagnostic and report endpoints are *inbound*: the SiteHale service calls your site, authenticated with the Application Password you approved. Disconnecting (or revoking the Application Password under Users → Profile) fully stops all access and transmission. Service information, pricing, and support live at https://sitehale.com — see How It Works (https://sitehale.com/how-it-works/), Support (https://sitehale.com/support/), Privacy Policy (https://sitehale.com/privacy/), and Terms (https://sitehale.com/terms/).

= Privacy =

**The free half of the plugin transmits nothing at all.** The Site Checkup, its history, the weekly re-check and the regression notice run entirely on your own site, and are fully usable without an account, a connection, or a subscription.

The plugin makes **no outbound request until you explicitly ask for one** — clicking Connect, or ticking the off-by-default "share with SiteHale" checkbox on the Email-this-checkup form. When you connect, a one-time snapshot of your site's environment (WordPress/PHP/database versions, theme, plugin list, permalink settings — no content, no visitor data) is sent to SiteHale so the service can be configured for your site. Disconnecting (or revoking the Application Password) fully stops all access and transmission.

Full policy: https://sitehale.com/privacy/ · Terms: https://sitehale.com/terms/

== Installation ==

Using the free Site Checkup — no account, no configuration, no connection:

1. Install and activate the plugin.
2. Go to **SiteHale → Site Checkup**. The checkup runs on that page load and shows your results immediately.
3. Optionally use **Email me this checkup** to send yourself a copy, and **Send test email** to prove outbound mail works.

That is the whole free setup. A weekly background re-check starts on its own and only speaks up if something regresses.

Optional — connecting to the paid SiteHale care service:

1. Go to **SiteHale** and click **Connect to SiteHale**.
2. Approve access on WordPress's own Application Passwords authorization screen.
3. Connecting is free and does not sign you up for a paid plan. Care and Managed are paid monthly plans arranged directly with SiteHale; care reports appear under **SiteHale → Care Reports** once you have a plan and it is active. Revoke any time from **SiteHale → Disconnect** or **Users → Profile**.

== Frequently Asked Questions ==

= Does this plugin slow my site down? =

No. It adds no front-end code at all. The diagnostic endpoints only run when the SiteHale service calls them (authenticated), and each is a cheap, bounded read.

= What data leaves my site? =

Nothing, unless you ask. The Site Checkup and the weekly re-check are entirely local. Data leaves your site in only two cases, both listed under External services: when you click Connect, and when you tick the off-by-default share checkbox on the Email-this-checkup form. The recipient is always SiteHale, never a third party. Disconnect stops everything.

= Can I use this without a SiteHale subscription? =

Yes — the Site Checkup page, its history, and the weekly background re-check are free, run entirely locally, and never expire. The Connect flow, remote diagnostics and monthly care reports are the parts that pair with the paid managed service.

= Does clicking Connect start a subscription or charge me? =

No — connecting by itself is free and never charges you. Care and Managed are paid monthly plans, and clicking Connect does not sign you up for one: it only pairs your site so a plan can be set up if you decide to buy one. Payment is never handled by the plugin — you arrange a plan directly with SiteHale, and it starts only once you have agreed to it. Connect without a plan and your site simply stays on Free. The SiteHale page shows your plan status (Free, Care, or Managed: not active / awaiting activation / active) at all times.

= Does the weekly background check send anything anywhere? =

No. It runs the same local snapshot the checkup page uses and stores the result on your own site. Its only visible output is a dismissible admin notice, and only when something actually regressed (a new admin account, new fatal errors, overdue cron, an autoload jump). A clean week produces nothing at all.

= Will this plugin nag me with notices? =

No. There is exactly one notice, it only appears when the weekly check finds a regression, it is dismissible, and a subsequent clean check clears it automatically.

= Does it work on WordPress Multisite? =

Yes, per site. The Site Checkup, its history and the weekly re-check are per-site, so each site in a network gets its own results, and each site connects to SiteHale separately if you want it to. Network-activating the plugin makes it available everywhere; only users who can manage a site's options see it. Uninstalling from the network removes the plugin's data from every site in it, not just the one you were on.

= Where do I get support? =

Managed clients: https://sitehale.com/support/ or plugins@sitehale.com. Free-plugin questions are welcome on the WordPress.org support forum for this plugin.

== Screenshots ==

1. Site Checkup — free local health check: cron, PHP errors, database weight, updates and environment EOL, admin audit, mail test.
2. The SiteHale page — what the free plugin does on its own, what the paid Care and Managed plans add, and your connection status. Connecting is one click and uses WordPress core's own Application Passwords flow; the plugin never creates users or mints credentials itself.
3. WordPress core's native authorization screen — you approve SiteHale under your own account and can revoke it any time from Users → Profile.
4. Care Reports — your monthly SiteHale care report rendered right in wp-admin, with the last 12 reports on file.
5. The dashboard widget — latest care summary and the number of automated checks that ran on your site this period.

== Upgrade Notice ==

= 0.5.0 =
Adds the Site Checkup to Tools → Site Health, shows when the weekly re-check is next due (and warns if it has stopped), and stops the PHP-errors card reporting a clean result when it could not actually read a log.

= 0.4.2 =
Care reports now render full-width with their new dashboard layout on the Care Reports page. Older email-style reports in your history keep their original framing.

== Changelog ==

= 0.5.0 =
* New: Site Health integration — the Site Checkup result and the weekly re-check now appear as tests under Tools → Site Health, and a SiteHale panel is added to Site Health → Info. Both read the checkup already stored on your site, so nothing extra runs on your dashboard.
* New: the Site Checkup page shows when the next automatic weekly re-check is due, and says so plainly when it is not scheduled or has stopped running because this site's WP-Cron is not firing. The plugin promised a weekly check; now it verifies one is actually going to happen.
* New: when your site is connected, the SiteHale page and dashboard widget show when the service last contacted it — proof you can see, rather than a promise you have to take on trust.
* Fixed: the PHP errors card could report "no logs found", which reads as a clean bill of health, on sites where no log could be read at all — error logging switched off, a custom WP_DEBUG_LOG path, or PHP writing to the web server's own log (the normal arrangement on much of shared hosting). It now names which of those it found and marks the card "Could not check". A custom WP_DEBUG_LOG path is also read properly now, instead of being missed.
* Fixed: uninstalling left one stored setting behind, and on a Multisite network cleaned up only the site it was run from. Uninstall now removes everything the plugin stored, on every site in the network.
* Fixed: fatal errors caused by your own WP-CLI `wp eval` commands were counted as faults on the site. They share the same error log, so a typo at the command line was reported back as a production fatal — and would have triggered the weekly regression notice. They are now listed separately and excluded from the count. A genuine error that happens to occur while WP-CLI runs a scheduled task still counts, because your site would hit it on a page load too.
* Compatibility: tested against WordPress 7.0.3. WordPress 7.0 raised its own minimum PHP version to 7.4, which this plugin has always required.
* Fixed: the diagnostics could emit PHP notices of their own when a check came back empty — unhelpful in a plugin whose job is reporting PHP notices. Also, the Action Scheduler table lookup now escapes the table prefix so it cannot match a similarly named table.

= 0.4.11 =
* Hardened: the SiteHale page no longer updates the stored connection timestamp from a page address. The connection is recorded only by the server-to-server handshake that actually completes it, so a crafted link can never make a site appear connected.
* Clarified the readme: the Site Checkup, its history and the weekly re-check are free and fully usable on their own; the Privacy section no longer implied a subscription is required. Installation now documents the free setup first.

= 0.4.10 =
* Internal code-quality annotation only. No functional change.

= 0.4.9 =
* Removed an unused connection setting left over from the previous release. No change to behaviour; the plugin now contacts only the three addresses listed under External services.

= 0.4.8 =
* Security: the Application Password created when you click Connect is no longer passed through a redirect to an external address. WordPress now returns it to your own site, and the plugin sends it to SiteHale directly over an encrypted server-to-server request. Nothing about what is shared changes; it simply never travels in a web address.
* Connect failures are now reported instead of failing quietly, so you are never left with an unused Application Password and no explanation.

= 0.4.7 =
* Housekeeping: stored care reports are now reconciled when a new report arrives, so a report body can no longer linger in the database after its entry has gone. No change to what is shown or reported.

= 0.4.6 =
* Connect: the confirmation URL shown on the WordPress authorization screen is now much shorter and easier to read. No change to how the connection works or what is sent.

= 0.4.5 =
* Hardened: the database-health and Action Scheduler diagnostic queries now bind every value through $wpdb->prepare() with explicit placeholders instead of interpolating them. No change to the data reported.

= 0.4.4 =
* Fixed: sites set up by the SiteHale service directly (without the browser Connect flow) showed "Not connected" even while receiving care reports. Receiving an authenticated care report now marks the site as connected, so the Connection section always matches the plan status.

= 0.4.3 =
* New: "Your plan" panel now shows the SiteHale Managed plan ($149/mo) — everything in Care plus updates applied for you (staging-tested first), speed and database optimization, and verified backups with restore drills. The badge lights up when your site is on the Managed plan.
* Improved: care report delivery now records which plan the site is on, keeping the plan panel accurate automatically.

= 0.4.2 =
* Improved: the Care Reports page lets modern dashboard-style care reports use the full admin width; legacy email-style reports in the history keep the original boxed rendering.

= 0.4.1 =
* New: "Your plan" panel on the SiteHale page — a side-by-side breakdown of the Free plan (the full plugin: Site Checkup, weekly re-check, regression notices — free forever) versus the paid SiteHale Care service ($49/mo), with a live status badge: Not active, Awaiting activation (connected but Care not yet started), or Active (a care report has been delivered).
* Clarified: connecting links your site so Care can be set up — it is free, does not start a subscription, and nothing is ever charged through the plugin. The connected state now says so instead of implying the service is running.

= 0.4.0 =
* New: Checkup history — every Site Checkup stores a compact local snapshot (last 12) and the page shows what changed since last time, in both directions.
* New: Weekly background re-check (WP-Cron, local only) with a single dismissible admin notice shown only when something regressed: new administrator account, new fatal errors, cron gone overdue, autoload-weight jump, or an environment component reaching end of security support. A clean check clears the notice.
* New: Email this checkup — send the summary to any address via your own site's wp_mail(). Optional off-by-default checkbox shares the summary with SiteHale for a human follow-up (disclosed under External services).
* Uninstall now also removes the checkup history, regression state, and the scheduled event.
* Fix: database-health diagnostics on MySQL 8 hosts emitted PHP 8 "Undefined array key" warnings (information_schema returns UPPERCASE column names on MySQL, lowercase on MariaDB) — every column is now explicitly aliased.

= 0.3.0 =
* New: Site Checkup — a free wp-admin page that runs the plugin's health diagnostics locally (cron health, PHP error logs, database health, pending updates plus PHP/database end-of-support grading, administrator audit, outbound mail test). No account, no network calls, read-only.

= 0.2.1 =
* Connect intake moved to the connect.sitehale.com subdomain (marketing site now lives at sitehale.com). No change to already-connected sites.

= 0.2.0 =
* Care reports: authenticated report-push endpoint, SiteHale → Care Reports admin page (last 12 reports), and a dashboard widget showing the latest care summary.

= 0.1.0 =
* Initial release: Connect flow (core Application Passwords authorization), connect-code fallback, diagnostic REST endpoints (cron, PHP errors, DB health, updates, admins, mail probe).
