=== Persjay Graveyard ===
Contributors: jaypeeperos
Tags: abandoned plugins, orphaned tables, database cleanup, cleanup, maintenance
Requires at least: 6.2
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 0.3.2
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Find closed and abandoned plugins, unused themes and tables left by removed plugins, with the evidence for each and snapshot-protected cleanup.

== Description ==

https://www.youtube.com/watch?v=lAR6W-UkEWY

Most WordPress sites carry dead weight: plugins that were closed on WordPress.org, plugins nobody has updated in years, themes that are never used, and database tables left behind by plugins you deleted long ago. Persjay Graveyard finds all of it, explains why each item was flagged, and lets you clean up with a safety net.

= What a scan shows =

* **Plugin status from WordPress.org.** Every installed plugin is labelled Maintained, Abandoned (no update in 2 years or more), Closed, or Premium / vendor. A plugin is only marked Closed or Abandoned when its name and author match the WordPress.org listing.
* **Theme status.** Themes get the same treatment: Maintained, Not updated in years, Premium / vendor or Child theme, with the space each unused theme takes up.
* **Orphaned database tables.** Tables left behind by plugins you already removed, each with a confidence label, the evidence behind it and its likely owner. Tables whose names resemble an installed plugin are capped at Medium confidence and never pre-selected.
* **A plugin footprint.** The tables, saved options, cached values, scheduled tasks and upload folders a plugin keeps.
* **Autoloaded options.** How much data WordPress loads on every page, measured on every scan.
* **"Since your last scan".** New leftover tables, newly closed or abandoned plugins, plugins installed or removed, and changes in autoloaded options.

= A score that explains itself =

The Persjay Graveyard Score (0 to 100) is split into **Maintenance** (closed or abandoned plugins, a security and support risk) and **Clutter** (inactive plugins, extra themes and leftover tables). Every deduction lists the rule behind it, so you can see exactly how the number adds up. The score also appears in a dashboard widget.

Every finding comes with its evidence, how sure the verdict is, and a recommended next step. You can record your own decision for a leftover table (confirmed leftover, or still in use) and ignore any plugin or table you know is fine.

= Safe table cleanup, free =

You can delete orphaned tables right from the Orphaned tables screen. Deletion needs a typed confirmation, only removes tables that are still orphaned at that moment, and never touches WordPress core tables, shared tables, or tables that belong to another WordPress install in the same database.

Before anything is deleted, Persjay Graveyard saves a **snapshot** of the selected tables (structure and rows). If the snapshot cannot be saved, nothing is deleted. In Free you get:

* Automatic snapshots before every table deletion, kept for 30 days.
* One-click restore, which never overwrites a table that already exists.
* A Verify button that reads a snapshot back and checks its SHA-256 checksums and row counts.
* ZIP downloads of any snapshot.
* Import a downloaded snapshot ZIP on the original site, then restore it separately, even after the stored original expires.
* A choice of storage: Automatic, Database, or private ZIP files outside your web root.

Snapshots cover the selected tables only. Keep a separate full site backup as well.

= Optional paid plans =

Everything above works without a license. If you want more, the paid plans are a separate download from persjay.com:

* **Pro:** plugin autopsy with full cleanup of the options, cached values and scheduled tasks an inactive plugin left behind, one-click removal of unused themes, scheduled scans with an email digest, a History tab with your score over time, and snapshot retention from 30 to 365 days.
* **Business:** closed-plugin alerts, replacement suggestions, auto-bury rules that wait for your approval, an activity log with CSV export, and WP-CLI commands.
* **Agency:** a Network Admin view of plugin usage across every site in a multisite network, bulk actions, a shared snapshot retention policy, white-label branding and printable client reports.

Plans, pricing and a free trial are on the [Persjay Graveyard page](https://persjay.com/plugins/persjay-graveyard/). Full documentation is at [persjay.com/docs/persjay-graveyard](https://persjay.com/docs/persjay-graveyard/).

= Good to know =

"Abandoned" is a signal, not a verdict: some small plugins are simply finished and still work fine. Table matching is based on names, so review each table's evidence before you delete it.

== External services ==

This plugin asks the WordPress.org plugin API (https://api.wordpress.org/plugins/info/1.2/) and theme API (https://api.wordpress.org/themes/info/1.2/) whether each installed plugin and theme is still available and when it was last updated. Only the plugin or theme folder name is sent, never your site address. This happens when you run a scan; lookups that do not fit in one scan continue in the background. Results are cached for 7 days. See the WordPress.org privacy policy: https://wordpress.org/about/privacy/

== Installation ==

1. In your WordPress admin, go to Plugins > Add New, search for "Persjay Graveyard" and click Install Now. Or upload the plugin folder to `/wp-content/plugins/persjay-graveyard`.
2. Activate the plugin.
3. Open Persjay Graveyard in the admin menu and run your first scan.

If you bought a paid plan, install the paid download and activate your license when prompted.

== Frequently Asked Questions ==

= Do I need a paid plan to restore deleted tables? =

No. Automatic snapshots before table deletion, restore, Verify, ZIP downloads and ZIP import are all included in Free. Restoring never requires an active license. Free snapshots are kept for 30 days.

= How do I restore a downloaded snapshot ZIP? =

Open Persjay Graveyard > Snapshots > Import snapshot ZIP on the original site. Choose your downloaded ZIP and import it. Graveyard validates the archive, saves it as a new snapshot, and shows its contents and verification details. Choose Restore separately when ready. Existing tables are never overwritten. Imported copies retain the original saved date and get a fresh retention period, so downloaded copies can be recovered after the original expires. ZIP import requires the PHP ZIP extension and a matching site URL and table prefix.

= What happens if a snapshot cannot be saved? =

Table deletion stops and no selected tables are deleted. This also applies when the snapshot storage is unavailable or the snapshot size limit is exceeded. If deletion is blocked, check Persjay Graveyard > Settings to make sure snapshot storage is ready.

= Are snapshots a full site backup? =

No. Table snapshots cover only the selected tables, including their structure and rows. They do not back up the whole database or your WordPress files, so keep a separate full site backup.

= Why is a plugin marked "Abandoned" when it still works? =

Abandoned only means the plugin has not been updated on WordPress.org for 2 years or more. Some plugins are simply finished. Check the evidence, and use Ignore if you are happy to keep it.

= Some plugins still say they are waiting for a WordPress.org check. =

Large sites may need more than one round of lookups. They continue in the background and finish faster while the screen is open. Wait a moment and refresh, or use Retry.

= Where are snapshots stored? =

Automatic storage uses private ZIP files when the server supports them and the database otherwise. You can choose Database or Private ZIP in Persjay Graveyard > Settings, and Persjay Graveyard > Snapshots shows the active storage and each snapshot's expiry date. Existing snapshots stay in their original storage.

Private ZIP storage needs an existing, writable directory outside all web roots. If none is available, ask your host to define `PJGY_SNAPSHOT_PRIVATE_ROOT` in `wp-config.php`. On hosts with web aliases or multiple document roots, use a location your host confirms is private.

= Can I download a ZIP without setting up a private folder? =

Yes. Keep Database storage selected and use Download ZIP on a snapshot in Persjay Graveyard > Snapshots. ZIP downloads need the PHP ZIP extension.

= Does it work on multisite? =

Yes. Each site can be scanned on its own. The Agency plan adds a Network Admin view with plugin usage across every site and bulk actions, which skip archived, spam and deleted sites.

== Screenshots ==

1. The Overview: your Persjay Graveyard Score split into Maintenance and Clutter, what needs attention, and what changed since your last scan.
2. Orphaned tables: each leftover table with its confidence, evidence and likely owner, your own decision, and cleanup controls.
3. Snapshots: saved table snapshots with verification results, one-click restore and ZIP downloads (Free).
4. Settings: choose where snapshots are stored and check private ZIP storage (Free).
5. Plugin autopsy: select a plugin and click Inspect to see the tables, options, scheduled tasks and folders it keeps (Pro).
6. The Schedule tab: recurring scans, email digest recipients and closure alerts (Pro).
7. Auto-bury: choose which items are proposed for cleanup and how long to wait before proposing them (Business).
8. Activity log with CSV export, printing and retention controls (Business). Event rows are hidden in this screenshot for privacy.
9. Network Admin: plugin status and usage across every site in a multisite network, with bulk actions and network snapshot retention (Agency).

== Changelog ==

= 0.3.2 =
* Added: import downloaded snapshot ZIPs from the Snapshots tab on every plan. Imports are validated and saved before a separate Restore action.
* Imported copies keep the original saved date, receive a new snapshot ID, and start a fresh retention period.
* ZIP import checks site and table-prefix compatibility, checksums, data records, row counts, archive paths and expansion limits. Imported theme code requires permission to install themes.

= 0.3.1 =
* Every finding now explains itself: the evidence behind it, how sure the verdict is, and a recommended next step. Leftover tables also show their likely owner, including plugins that were removed from the site.
* Record your own decision for a leftover table: confirm it as a leftover, or mark it as still in use by a plugin or another application.
* The score is split into Maintenance and Clutter, and every deduction lists its rule. Tables with only weak signs of being left over are listed but no longer cost points, and tables with mixed signs cost half.
* New "Since your last scan" summary: new leftover tables, newly closed or abandoned plugins, installed and removed plugins, and changes in autoloaded options.
* Autoloaded options are measured on every scan.
* Declared plugin dependencies (Requires Plugins) are shown, and tables that two installed plugins both match by name are flagged as possibly shared.
* WordPress.org checks that do not fit in one scan now show progress, continue faster while the screen is open, can be retried, and are labelled as partial results.
* Snapshots record SHA-256 checksums and per-table row counts. A new Verify button reads a snapshot back and checks it without changing anything.
* Themes now get a status like plugins: Maintained, Not updated in years, Premium / vendor or Child theme, with the evidence and a next step. An outdated theme in use counts towards the Maintenance score.
* Plugin rows always show what can be done: Inspect (Pro) and Delete, which opens the WordPress confirmation screen. Tabs open with a short summary, with details under "How this works".
* Fixed: Hello Dolly was shown as a premium plugin, because it is listed on WordPress.org under a different name than its file.
* Fixed: ZIP downloads of snapshots made since 0.3.0 failed. Downloads now include a README describing the format.
* Pro: the activity log can be cleared, and kept for 30, 90, 180 or 365 days.
* Pro: new History tab with the score over time, changes between every scan, and measured cleanup results. Scheduled digests list what changed since the last scan. Leftover cleanup refuses to run when another installed plugin declares a dependency on the plugin.

= 0.3.0 =
* Renamed to Persjay Graveyard (slug persjay-graveyard). Paid installs move their settings and snapshots over automatically.
* Use a unique prefix for all code, settings and hooks.
* Show the full Persjay Graveyard name throughout the plugin, emails and reports.
* Load dashboard widget styles through the WordPress style queue.
* Use the WordPress filesystem API for snapshot files.
* Table snapshots now read rows in a consistent, ordered transaction and verify each table is unchanged before it is deleted.

= 0.2.20 =
* Package the WordPress.org edition without the Freemius SDK or updater.
* Clarify translation placeholders and improve snapshot filesystem handling.
* Use Persjay Apps as the admin header byline.

= 0.2.19 =
* Prevent a fatal error when Premium is activated while the free edition is loaded.

= 0.2.18 =
* Improve spacing and button wrapping in Snapshot settings.
* Use the full available width in the Graveyard admin.

= 0.2.17 =
* Prefer private ZIP storage in Automatic mode, with database storage when private ZIP storage is unavailable.
* Add ZIP downloads and a private storage check.
* Show Settings after the paid feature tabs.

= 0.2.16 =
* Move snapshot storage and retention controls to Graveyard > Settings.
* Let all plans choose a writable private ZIP directory.
* Show the active storage and retention settings on the Snapshots tab.

= 0.2.15 =
* Store new snapshots in the database by default, with private ZIP storage available as an advanced option.
* Show each snapshot’s storage, size, and expiry date.
* Give Graveyard its own WordPress admin menu.

= 0.2.14 =
* Store snapshots outside the web root and stop cleanup when private storage is unavailable.
* Move existing snapshot folders into private storage when the filesystem permits.

= 0.2.13 =
* Pro: inspect plugin footprints and configure snapshot retention from 30 to 365 days.
* Business: log plugin activations, deactivations, and successful deletions.
* Agency: set a shared snapshot retention policy for WordPress multisite.
* Fix: use the current Graveyard logo in digest emails by default.
* Improved: explain why the last fallback theme is kept installed.

= 0.2.12 =
* New: automatic table snapshots and restore are now included in Free, with 30-day retention and no paid license required for recovery.
* Improved: table deletion stops if a snapshot provider is unavailable or does not return a valid snapshot ID.
* Fix: incomplete snapshot writes, failed file finalization and failed metadata saves now prevent cleanup from proceeding.
* Updated: table cleanup messages explain snapshot protection and the need for a separate full site backup.
* Updated: plugin author and WordPress.org contributor are now jaypeeperos.


= 0.2.11 =
* New: the Graveyard logo now appears in the admin header, on the first-run screen, in the dashboard widget and on the Freemius account screens. White-label (Agency) shows your own logo, or none.
* Improved: messages such as "Removed Extendable" now have proper spacing, an icon and a centred close button.
* Improved: plugin and theme State columns use clear Active / Inactive badges.
* Improved: the dashboard widget shows the score with a coloured ring and the last scan time.

= 0.2.10 =
* Improved: network bulk actions now say "Nothing needed cleaning." when there was nothing to clean, and report how many sites were skipped (archived, spam, deleted or over the site limit).

= 0.2.9 =
* Fix: free WordPress.org plugins that changed owner (for example WP Mail SMTP, WooCommerce Stripe Gateway, Kadence Email Designer) were shown as Premium / vendor. A matching name is now enough; a Closed verdict needs the full name to match.

= 0.2.8 =
* Fix: spacing between the stat tiles and the "What needs attention" heading in the digest email (spacers now work in Gmail and Outlook).

= 0.2.7 =
* New: plugins still waiting for a WordPress.org check are now finished automatically in the background, so you no longer need to scan again and again.
* New: "Premium / vendor" status for plugins that are not on WordPress.org or are updated by their vendor. They are no longer shown as unverified and never count against the score.
* Improved: a plugin is only marked Closed or Abandoned when both its name and its author match the WordPress.org listing, which removes false positives for premium plugins that share a folder name with a free one.
* Fix: the Graveyard row always shows the installed version.
* New: Ignore a plugin or orphaned table you know is fine. Ignored items stop counting towards the score and can be restored at any time.
* Improved: an orphaned table whose name resembles an installed plugin is capped at Medium confidence and is never pre-selected for deletion.
* Improved: a WordPress.org listing with a differently worded name is accepted when the author clearly matches.

= 0.2.6 =
* Fix: stray closing tag on the Overview screen pushed the WordPress footer up over the content.

= 0.2.5 =
* New: redesigned admin screens with a score header, pill tabs, stat tiles, cleaner tables and forms. Responsive down to phone width.

= 0.2.4 =
* New: redesigned HTML emails for the scan digest and closed-plugin alerts, with a plain-text fallback. Agency white-label colour and logo are used when set.

= 0.2.3 =
* Fix: WP-CLI commands are now `wp graveyard bury-tables` and `wp graveyard bury-leftovers`, as documented.

= 0.2.2 =
* The plugin is now simply called Graveyard.

= 0.2.1 =
* Fix: orphaned-table detection no longer lists tables of active plugins whose folder name differs from their table prefix.
* Fix: premium plugins that share a folder name with a closed WordPress.org plugin are no longer reported as closed.
* Fix: network screen now works when the license is activated on a site rather than the network.

= 0.2.0 =
* Pro: full cleanup of leftovers, unused theme removal, scheduled scans and email digest.
* Business: closed-plugin alerts, replacement suggestions, auto-bury queue, activity log, WP-CLI.
* Agency: network graveyard and bulk actions, white-label, client reports.

= 0.1.0 =
* First prototype: scan, autopsy, score, dashboard widget and orphaned table cleanup.

== Upgrade Notice ==

= 0.2.12 =
Table snapshots and restore are now free. Table deletion stops if a recovery snapshot cannot be saved. Snapshots are kept for 30 days; keep a full site backup too.
