{"id":350278,"date":"2026-08-14T11:09:18","date_gmt":"2026-08-14T11:09:18","guid":{"rendered":"https:\/\/wordpress.org\/plugins\/tornado-database-maintenance\/"},"modified":"2026-08-14T11:08:42","modified_gmt":"2026-08-14T11:08:42","slug":"shcd-database-maintenance","status":"publish","type":"plugin","link":"https:\/\/ca-valencia.wordpress.org\/plugins\/shcd-database-maintenance\/","author":23223703,"comment_status":"closed","ping_status":"closed","template":"","meta":{"version":"1.0.0","stable_tag":"1.0.0","tested":"7.0.4","requires":"7.0","requires_php":"8.3","requires_plugins":null,"header_name":"Shabnam Tornado Database Maintenance","header_author":"SHABNAM","header_description":"Database cleanup, integrity checks, verified backups, and controlled post ID reindexing for WordPress.","assets_banners_color":"d7c8e2","last_updated":"2026-08-14 11:08:42","external_support_url":"","external_repository_url":"","donate_link":"","header_plugin_uri":"https:\/\/shabnam.dev","header_author_uri":"https:\/\/shcd.ir","rating":0,"author_block_rating":0,"active_installs":0,"downloads":34,"num_ratings":0,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","installation","faq","changelog"],"tags":{"1.0.0":{"tag":"1.0.0","author":"shcd","date":"2026-08-14 11:08:42"}},"upgrade_notice":[],"ratings":[],"assets_icons":{"icon-128x128.png":{"filename":"icon-128x128.png","revision":3647201,"resolution":"128x128","location":"assets","locale":"","width":128,"height":128},"icon-256x256.png":{"filename":"icon-256x256.png","revision":3647201,"resolution":"256x256","location":"assets","locale":"","width":256,"height":256}},"assets_banners":{"banner-1544x500.png":{"filename":"banner-1544x500.png","revision":3647201,"resolution":"1544x500","location":"assets","locale":"","width":1544,"height":500},"banner-772x250.png":{"filename":"banner-772x250.png","revision":3647201,"resolution":"772x250","location":"assets","locale":"","width":772,"height":250}},"assets_blueprints":{},"all_blocks":[],"tagged_versions":["1.0.0"],"block_files":[],"assets_screenshots":{"screenshot-1.png":{"filename":"screenshot-1.png","revision":3647201,"resolution":"1","location":"assets","locale":"","width":1600,"height":900},"screenshot-2.png":{"filename":"screenshot-2.png","revision":3647201,"resolution":"2","location":"assets","locale":"","width":1600,"height":900},"screenshot-3.png":{"filename":"screenshot-3.png","revision":3647201,"resolution":"3","location":"assets","locale":"","width":1600,"height":900}},"screenshots":[]},"plugin_section":[],"plugin_tags":[151,3786,153,173015,275432],"plugin_category":[59],"plugin_contributors":[270201],"plugin_business_model":[],"class_list":["post-350278","plugin","type-plugin","status-publish","hentry","plugin_tags-backup","plugin_tags-cleanup","plugin_tags-database","plugin_tags-integrity","plugin_tags-reindex","plugin_category-utilities-and-tools","plugin_contributors-shcd","plugin_committers-shcd"],"banners":{"banner":"https:\/\/ps.w.org\/shcd-database-maintenance\/assets\/banner-772x250.png?rev=3647201","banner_2x":"https:\/\/ps.w.org\/shcd-database-maintenance\/assets\/banner-1544x500.png?rev=3647201","banner_rtl":false,"banner_2x_rtl":false},"icons":{"svg":false,"icon":"https:\/\/ps.w.org\/shcd-database-maintenance\/assets\/icon-128x128.png?rev=3647201","icon_2x":"https:\/\/ps.w.org\/shcd-database-maintenance\/assets\/icon-256x256.png?rev=3647201","generated":false},"screenshots":[{"src":"https:\/\/ps.w.org\/shcd-database-maintenance\/assets\/screenshot-1.png?rev=3647201","caption":""},{"src":"https:\/\/ps.w.org\/shcd-database-maintenance\/assets\/screenshot-2.png?rev=3647201","caption":""},{"src":"https:\/\/ps.w.org\/shcd-database-maintenance\/assets\/screenshot-3.png?rev=3647201","caption":""}],"raw_content":"<!--section=description-->\n<p>Shabnam Tornado Database Maintenance is a database inspection and maintenance toolkit for WordPress administrators and developers. It combines preview-first cleanup, integrity checks, verified logical backups, reference discovery, and an optional controlled Post ID reindex workflow.<\/p>\n\n<p>The plugin reads the active WordPress table names from <code>$wpdb<\/code>. It does not assume the default <code>wp_<\/code> prefix, so installations using custom prefixes such as <code>shcd_<\/code> are supported.<\/p>\n\n<p>Post ID reindexing is an advanced, destructive operation. It is disabled by default, is not required for ordinary cleanup, and should be tested on a staging copy before use on a production site.<\/p>\n\n<h4>Main features<\/h4>\n\n<ul>\n<li>Database schema discovery through <code>INFORMATION_SCHEMA<\/code>, including tables, columns, indexes, engines, and foreign keys.<\/li>\n<li>Preview-first cleanup for revisions, auto drafts, trash, autosaves, pending revisions, expired transients, and supported orphaned records.<\/li>\n<li>Configurable WordPress revision retention and an optional independent revision archive.<\/li>\n<li>Logical SQL backups with file checksums, database fingerprints, and consistency reporting.<\/li>\n<li>Integrity checks for WordPress core relationships and supported plugin data.<\/li>\n<li>Dry-run reports before destructive maintenance.<\/li>\n<li>Controlled <code>AUTO_INCREMENT<\/code> normalization without renumbering existing rows.<\/li>\n<li>Reversible quarantine for suspected unused plugin tables before permanent deletion.<\/li>\n<li>Audit logs, operation reports, retention controls, and WP-CLI commands.<\/li>\n<li>Optional repair and cache rebuilding for Elementor-related data after a completed reindex.<\/li>\n<\/ul>\n\n<h4>Controlled Post ID reindexing<\/h4>\n\n<p>The optional reindex workflow creates a dense <code>1..N<\/code> sequence for rows in the active <code>$wpdb-&gt;posts<\/code> table. This includes posts, pages, custom post types, revisions, and Media Library attachments that still exist when the mapping is created.<\/p>\n\n<p>Tornado uses a collision-resistant two-phase mapping:<\/p>\n\n<ol>\n<li>Build an immutable Old ID to Temporary ID to Final ID mapping from the current Posts table.<\/li>\n<li>Move registered references from Old IDs to Temporary IDs.<\/li>\n<li>Move the Posts primary keys from Old IDs to Temporary IDs.<\/li>\n<li>Move registered references from Temporary IDs to Final IDs.<\/li>\n<li>Move the Posts primary keys from Temporary IDs to Final IDs.<\/li>\n<li>Verify reference parity, row counts, sequence boundaries, zero gaps, and the final <code>AUTO_INCREMENT<\/code> value.<\/li>\n<\/ol>\n\n<p>The Posts table is the source of truth for the mapping. Adapters synchronize references; they do not independently choose or renumber the Posts primary-key sequence.<\/p>\n\n<p>Reindex execution requires matching Discovery, Mapping, and Backup fingerprints. It also requires supported transactional tables, successful Preflight checks, administrator capabilities, a REST nonce, a session-bound one-time authorization token, and an explicit confirmation phrase. Blocking failures before commit cause the operation to stop or roll back.<\/p>\n\n<h4>Adaptive plugin-reference detection<\/h4>\n\n<p>Tornado includes dedicated reference handling for known relationships and a conservative adaptive detector for conventional plugin tables.<\/p>\n\n<p>The adaptive detector can evaluate:<\/p>\n\n<ul>\n<li>Integer columns with semantic names such as <code>post_id<\/code>, <code>page_id<\/code>, <code>product_id<\/code>, or <code>attachment_id<\/code>.<\/li>\n<li>Polymorphic pairs such as <code>object_id<\/code> with <code>object_type<\/code>, or <code>element_id<\/code> with <code>element_type<\/code>.<\/li>\n<li>Strictly formatted ID lists in semantically named columns.<\/li>\n<li>Supported JSON and PHP-serialized paths that clearly represent WordPress object IDs.<\/li>\n<li>Explicit foreign keys that reference the active Posts table.<\/li>\n<\/ul>\n\n<p>Detection is evidence-based. The plugin checks column type, naming, mapping intersection, row resolution, table scope, and compatible WordPress post types. Ambiguous, encrypted, compressed, binary, proprietary, remotely stored, or free-text references are not guessed. They remain blocking until an administrator selects an explicit policy or a dedicated adapter is provided.<\/p>\n\n<h4>Plugin and builder compatibility<\/h4>\n\n<p>Tornado includes dedicated or structured handling for selected WordPress, WooCommerce, Elementor, Gutenberg, and Rank Math relationships. It also exposes an adapter registration hook for site-specific integrations.<\/p>\n\n<p>Compatibility does not mean that every extension or external system can be detected automatically. IDs copied to a CRM, ERP, payment gateway, search service, mobile application, custom API, arbitrary HTML, shortcode, URL, or remote database may remain outside WordPress and must be reviewed separately.<\/p>\n\n<h4>Cleanup and revision management<\/h4>\n\n<p>Cleanup operations provide a Preview before deletion and operate in bounded batches. Supported cleanup categories include:<\/p>\n\n<ul>\n<li>All revisions or only revisions beyond the configured retention limit.<\/li>\n<li>Auto drafts, trash, autosaves, and optionally aged pending revisions.<\/li>\n<li>Orphaned post meta, comments, comment meta, user meta, term meta, and term relationships.<\/li>\n<li>Selected WooCommerce orphaned lookup and permission data.<\/li>\n<li>Expired transients.<\/li>\n<li>Stale local media rows covered by the plugin's explicit media policies.<\/li>\n<\/ul>\n\n<p>The optional revision archive stores selected snapshots in Tornado's own table instead of keeping ordinary WordPress revision rows indefinitely. Elementor and WooCommerce content can be included according to the configured archive policy. This archive does not replace Elementor's complete editor history or an external backup.<\/p>\n\n<h4>Backups and recovery<\/h4>\n\n<p>Tornado creates local logical SQL backups and verifies the resulting file with SHA-256. By default, backup files are stored below the directory returned by <code>wp_upload_dir()<\/code> in a Tornado-owned directory with a persisted random storage token, restrictive file permissions, and Apache\/IIS deny files. A site administrator may explicitly provide <code>SHCD_TORNADO_DBM_BACKUP_DIR<\/code> for a custom storage location. A backup records the Posts ID fingerprint, schema fingerprint, consistency status, and storage classification.<\/p>\n\n<p>A backup is accepted for reindex only when the required snapshot and protected-storage checks pass. Mixed storage engines or an insufficiently protected custom backup location can produce warnings or prevent the backup from being accepted for reindex.<\/p>\n\n<p>Full database restore is intentionally available through WP-CLI rather than a browser request, reducing the risk of HTTP timeout or connection loss during import.<\/p>\n\n<h4>Important limitations<\/h4>\n\n<ul>\n<li>Network-wide Multisite reindexing is not supported.<\/li>\n<li>WooCommerce HPOS order-ID reindexing is not supported.<\/li>\n<li>Legacy WooCommerce order IDs are not reindexed unless the related advanced option is explicitly enabled.<\/li>\n<li>Unknown proprietary data is not rewritten without sufficient evidence or an adapter.<\/li>\n<li>Remote systems and copied IDs outside the WordPress database cannot be discovered reliably.<\/li>\n<li>A successful local backup is not a substitute for an independently tested hosting or infrastructure backup.<\/li>\n<\/ul>\n\n<h3>Privacy<\/h3>\n\n<p>Tornado does not send site data to an external service and does not include usage tracking or telemetry. Administration requests are made to the site's own WordPress REST API.<\/p>\n\n<p>The plugin stores operational data locally, including settings, discoveries, mappings, backup records, jobs, logs, revision archives, and short-lived authorization data. SQL backup files may contain the complete database and must be treated as sensitive data.<\/p>\n\n<p>Uninstall removes scheduled events and plugin capabilities. Operational tables and backup files are removed only when the corresponding uninstall options are enabled by an administrator.<\/p>\n\n<h3>Requirements<\/h3>\n\n<ul>\n<li>WordPress 7.0 or later.<\/li>\n<li>PHP 8.3 or later.<\/li>\n<li>A MySQL-compatible database that provides the required <code>INFORMATION_SCHEMA<\/code> metadata.<\/li>\n<li>InnoDB for every base table in the active database when creating a backup that will be accepted for reindex.<\/li>\n<li>Sufficient database privileges for the selected operation. Discovery and cleanup require fewer privileges than backup, quarantine, restore, or reindex.<\/li>\n<li>Enough disk space for a complete logical database backup.<\/li>\n<\/ul>\n\n<h3>WP-CLI<\/h3>\n\n<p>Tornado registers commands under <code>wp shcd-tornado-dbm<\/code> when WP-CLI is available. Examples include:<\/p>\n\n<ul>\n<li><code>wp shcd-tornado-dbm discover<\/code><\/li>\n<li><code>wp shcd-tornado-dbm mapping build<\/code><\/li>\n<li><code>wp shcd-tornado-dbm dry-run &lt;mapping-uuid&gt;<\/code><\/li>\n<li><code>wp shcd-tornado-dbm backup create<\/code><\/li>\n<li><code>wp shcd-tornado-dbm integrity check<\/code><\/li>\n<li><code>wp shcd-tornado-dbm cleanup preview<\/code><\/li>\n<li><code>wp shcd-tornado-dbm cleanup execute --yes<\/code><\/li>\n<li><code>wp shcd-tornado-dbm tables scan-unused<\/code><\/li>\n<li><code>wp shcd-tornado-dbm reindex prepare<\/code><\/li>\n<li><code>wp shcd-tornado-dbm reindex preflight &lt;mapping-uuid&gt; &lt;backup-uuid&gt;<\/code><\/li>\n<\/ul>\n\n<p>Destructive WP-CLI commands require their documented confirmation arguments. Use <code>wp help shcd-tornado-dbm<\/code> for the commands available in the installed version.<\/p>\n\n<!--section=installation-->\n<ol>\n<li>Create a full external backup of the site and database.<\/li>\n<li>Upload the <code>shcd-database-maintenance<\/code> directory to <code>\/wp-content\/plugins\/<\/code>, or install the ZIP through Plugins &gt; Add New &gt; Upload Plugin.<\/li>\n<li>Activate Shabnam Tornado Database Maintenance.<\/li>\n<li>Open Tools &gt; Tornado.<\/li>\n<li>Review System Status and run Discovery.<\/li>\n<li>Use Preview before any cleanup operation.<\/li>\n<li>Test Mapping, Backup, Preflight, and Reindex workflows on a staging copy before considering production use.<\/li>\n<\/ol>\n\n<p>No <code>wp-config.php<\/code> edit is required for normal operation. An optional emergency constant can disable destructive operations; review the plugin settings and inline administrator guidance before enabling destructive operations.<\/p>\n\n<!--section=faq-->\n<dl>\n<dt id=\"does%20tornado%20automatically%20renumber%20my%20wordpress%20posts%3F\"><h3>Does Tornado automatically renumber my WordPress posts?<\/h3><\/dt>\n<dd><p>No. Post ID reindexing is disabled by default and requires a separate, explicit workflow with Discovery, Mapping, Backup, Preflight, authorization, and typed confirmation.<\/p><\/dd>\n<dt id=\"do%20i%20need%20reindexing%20to%20clean%20the%20database%3F\"><h3>Do I need reindexing to clean the database?<\/h3><\/dt>\n<dd><p>No. Cleanup, revision retention, orphan checks, backup, integrity reporting, and <code>AUTO_INCREMENT<\/code> normalization can be used without changing existing Post IDs.<\/p><\/dd>\n<dt id=\"does%20it%20support%20a%20custom%20database%20prefix%3F\"><h3>Does it support a custom database prefix?<\/h3><\/dt>\n<dd><p>Yes. Core table names are read from <code>$wpdb<\/code>, and plugin tables are resolved from the active <code>$wpdb-&gt;prefix<\/code>. The plugin does not hard-code <code>wp_posts<\/code>.<\/p><\/dd>\n<dt id=\"what%20is%20the%20difference%20between%20post%20id%20reindexing%20and%20auto_increment%20normalization%3F\"><h3>What is the difference between Post ID reindexing and AUTO_INCREMENT normalization?<\/h3><\/dt>\n<dd><p>Reindexing changes existing IDs and synchronizes registered references. <code>AUTO_INCREMENT<\/code> normalization changes only the next generated value when the database allows it; it does not renumber existing rows or remove interior gaps.<\/p><\/dd>\n<dt id=\"how%20does%20adaptive%20detection%20handle%20an%20unknown%20plugin%20table%3F\"><h3>How does adaptive detection handle an unknown plugin table?<\/h3><\/dt>\n<dd><p>It evaluates schema and data evidence before registering a relationship. Clear conventional references can be included in Preflight and the two-phase mapping. Ambiguous data remains blocked instead of being rewritten by guesswork.<\/p><\/dd>\n<dt id=\"does%20the%20plugin%20support%20rank%20math%3F\"><h3>Does the plugin support Rank Math?<\/h3><\/dt>\n<dd><p>Version 1.0.0 includes a dedicated Rank Math adapter for supported internal-link, internal-meta, and analytics object relationships. The adapter is conditional and only acts on tables and columns that exist in the current installation.<\/p><\/dd>\n<dt id=\"does%20the%20plugin%20support%20elementor%3F\"><h3>Does the plugin support Elementor?<\/h3><\/dt>\n<dd><p>It includes structured Elementor reference handling, media repair tools, selected builder-registry support, and post-operation CSS or cache rebuilding. Elementor and third-party widget data can vary, so unresolved proprietary paths remain blocking.<\/p><\/dd>\n<dt id=\"can%20tornado%20detect%20ids%20stored%20outside%20wordpress%3F\"><h3>Can Tornado detect IDs stored outside WordPress?<\/h3><\/dt>\n<dd><p>No. Remote services, custom applications, external databases, exported files, and copied IDs outside the current WordPress database must be audited separately.<\/p><\/dd>\n<dt id=\"are%20backups%20sent%20to%20another%20server%3F\"><h3>Are backups sent to another server?<\/h3><\/dt>\n<dd><p>No. Backups are created locally. The default location is a protected, randomized Tornado directory below the WordPress uploads base directory returned by <code>wp_upload_dir()<\/code>. Administrators remain responsible for server permissions, off-site backups, encryption, retention, and restore testing.<\/p><\/dd>\n<dt id=\"is%20multisite%20supported%3F\"><h3>Is Multisite supported?<\/h3><\/dt>\n<dd><p>The plugin can inspect the active site's tables, but network-wide Multisite reindexing is intentionally not supported. Do not use the reindex workflow as a network-wide operation.<\/p><\/dd>\n<dt id=\"what%20happens%20when%20preflight%20finds%20an%20unresolved%20reference%3F\"><h3>What happens when Preflight finds an unresolved reference?<\/h3><\/dt>\n<dd><p>Reindex remains blocked. Review the table and column, choose an explicit supported policy, register a site-specific adapter, or leave the operation unexecuted.<\/p><\/dd>\n<dt id=\"what%20happens%20when%20i%20uninstall%20the%20plugin%3F\"><h3>What happens when I uninstall the plugin?<\/h3><\/dt>\n<dd><p>Scheduled hooks and Tornado capabilities are removed. By default, operational tables and backup files are retained to avoid accidental data loss. They are deleted only when the relevant uninstall settings were enabled before uninstalling.<\/p><\/dd>\n\n<\/dl>\n\n<!--section=changelog-->\n<h4>1.0.0<\/h4>\n\n<ul>\n<li><p>WordPress.org pre-review fixes: standardized backup storage resolution, hardened protected backup paths and serialized-data handling, and clarified third-party Elementor option writes.<\/p><\/li>\n<li><p>Published under the <code>shcd-database-maintenance<\/code> repository slug and matching text domain.<\/p><\/li>\n<li>Added custom-prefix-aware database discovery using <code>$wpdb<\/code>.<\/li>\n<li>Added preview-first cleanup, revision policies, orphan checks, and retention controls.<\/li>\n<li>Added checksum-verified logical SQL backups with snapshot fingerprints.<\/li>\n<li>Added immutable Old to Temporary to Final Post ID mapping and dry-run reporting.<\/li>\n<li>Added controlled, repeatable, gapless Post ID reindex generations with fail-closed Preflight checks.<\/li>\n<li>Added dedicated Rank Math reference handling.<\/li>\n<li>Added conservative adaptive discovery for conventional scalar, polymorphic, structured, and strict ID-list references.<\/li>\n<li>Added selected Elementor, Gutenberg, WooCommerce, builder, media, and cache repair strategies.<\/li>\n<li>Added reversible table quarantine, audit logs, reports, and WP-CLI commands.<\/li>\n<li>Added optional independent revision archiving and operational-data retention.<\/li>\n<\/ul>","raw_excerpt":"Safely inspect, clean, back up, verify, and reindex WordPress database records with adaptive plugin-reference detection.","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/ca-valencia.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/350278","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ca-valencia.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/ca-valencia.wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/ca-valencia.wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=350278"}],"author":[{"embeddable":true,"href":"https:\/\/ca-valencia.wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/shcd"}],"wp:attachment":[{"href":"https:\/\/ca-valencia.wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=350278"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/ca-valencia.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=350278"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/ca-valencia.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=350278"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/ca-valencia.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=350278"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/ca-valencia.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=350278"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/ca-valencia.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=350278"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}