Merge BD Bookshelf (0.1.0), BD BookShelfHelper (2.0.0) and BD SimpleEmail
(2.0.0) into a single plugin released as Umbra Bookshelf 1.0.0, with the
BD Bookshelf theme left as a separate, unrenamed artifact.
Modules
includes/books/ catalogue, ISBN/ASIN, series, retail, ratings, shortcodes,
SEO, GDPR, scrapers, admin, CSV/post import
includes/library/ book post type + series taxonomy, pen names, data entry,
shortlinks, reviews, migrate
includes/email/ subscribers, newsletters, composition, sending
Renamed: plugin headers, text domains (all three -> umbra-bookshelf), classes
(BD_*/BDM_* -> Umbra_*), constants (-> UMBRA_BOOKSHELF_*), asset handles, JS
globals and admin slugs.
Deliberately not renamed -- persisted contract with live installs and with
published post content: table names, option keys, post meta keys, transients,
nonce actions, cron hooks, AJAX actions, shortcodes ([bd-book], [bd-books],
[bdm_signup]), post type `book`, taxonomy `series`, cookies and CSS classes.
BD_BookShelfHelper survives only as a class_alias for the unmodified theme.
Collisions resolved
* class-umbra-theme-compatibility.php declared BD_BookShelfHelper, the same
name as the library module's helper. Latent while the plugins were
separate (only fired when both were active), but an unconditional fatal
once merged. Renamed to Umbra_Theme_Compatibility with a class_alias.
* All three modules called add_menu_page. One top-level menu is now
registered by the bootstrap at admin_menu priority 9.
* BD Bookshelf and BookShelfHelper both claimed bd-bookshelf-settings, leaving
one Settings screen unreachable -> umbra-bookshelf-settings and
umbra-bookshelf-library-settings.
* Catalogue and library both enqueued bd-bookshelf-admin; the second enqueue
was silently discarded -> unique handles per module.
* Umbra_Admin and Umbra_Migration both registered bd_bookshelf_import_csv, so
one handler silently replaced the other. The import page now lives only in
Umbra_Admin (the variant wired to the admin JS); Umbra_Migration keeps only
the preview/run endpoints it uniquely provides.
* Modules were constructed from an init callback, so their own init
registrations raced the hook being dispatched. Now constructed on
plugins_loaded behind a re-entrancy guard.
Also
* Missing assets created: assets/images/default-cover.png (referenced but
never committed, so every cover-less book 404'd) and email/assets/js/
admin.js (enqueued on every email admin page but never committed).
* Library module's strpos($hook, 'bd-bookshelf') asset check matched every
catalogue and email screen once slugs shared the umbra-bookshelf- prefix;
now matched against its own slug list.
* Consolidated uninstall deduplicates the double drop of bd_books/bd_series.
* Specs aligned to the new name; pre-merge specs retained under
spec/archive/ with provenance notes.
* Tests added: tests/verify_structure.py (static) and tests/smoke_runtime.php
(WordPress-stub runtime boot, front-end and admin contexts).
Deferred and recorded in docs/KNOWN-ISSUES.md: the catalogue and library
modules still create bd_books and bd_series with two incompatible schemas
(pre-existing, now unconditional), and Goodreads/Amazon scraping is still
implemented twice on shared cron hooks.
72 lines
2.3 KiB
PHP
72 lines
2.3 KiB
PHP
<?php
|
|
// Copyright 2026 Umbra Tools (umbratools.com)
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
/**
|
|
* Umbra Bookshelf Uninstall
|
|
*
|
|
* Fired when the plugin is deleted from the Plugins page. Removes every table
|
|
* and option owned by all three consolidated modules (books, library, email).
|
|
*
|
|
* Table names and option keys are the historical bd_* keys and are preserved
|
|
* verbatim -- that is what the data on disk is actually called.
|
|
*
|
|
* @package Umbra_Bookshelf
|
|
*/
|
|
|
|
if (!defined('WP_UNINSTALL_PLUGIN')) {
|
|
exit;
|
|
}
|
|
|
|
// Include database class
|
|
require_once __DIR__ . '/includes/books/class-umbra-database.php';
|
|
|
|
// Drop catalogue tables (bd_books, bd_series, bd_book_authors, ...)
|
|
$database = new Umbra_Database();
|
|
$database->drop_tables();
|
|
|
|
// Drop library and email tables.
|
|
// bd_books and bd_series are intentionally NOT repeated here: the catalogue
|
|
// module's drop_tables() above already covers them, and dropping the same table
|
|
// twice is only a wasted query.
|
|
global $wpdb;
|
|
|
|
$additional_tables = array(
|
|
// Library module
|
|
$wpdb->prefix . 'bd_book_meta',
|
|
$wpdb->prefix . 'bd_pen_names',
|
|
$wpdb->prefix . 'bd_reviews',
|
|
$wpdb->prefix . 'bd_ratings',
|
|
$wpdb->prefix . 'bd_review_shortlinks',
|
|
|
|
// Email module
|
|
$wpdb->prefix . 'bd_subscribers',
|
|
$wpdb->prefix . 'bd_newsletters',
|
|
);
|
|
|
|
foreach ($additional_tables as $table) {
|
|
$wpdb->query("DROP TABLE IF EXISTS {$table}");
|
|
}
|
|
|
|
// Remove catalogue options and transients (preserved bd_bookshelf_* keys)
|
|
$wpdb->query("DELETE FROM {$wpdb->options} WHERE option_name LIKE 'bd_bookshelf_%'");
|
|
$wpdb->query("DELETE FROM {$wpdb->options} WHERE option_name LIKE '_transient_bd_bookshelf_%'");
|
|
$wpdb->query("DELETE FROM {$wpdb->options} WHERE option_name LIKE '_transient_timeout_bd_bookshelf_%'");
|
|
|
|
// Remove library options
|
|
delete_option('bdm_affiliate_codes');
|
|
delete_option('bdm_goodreads_author_id');
|
|
delete_option('bdm_awards');
|
|
|
|
// Remove email options
|
|
delete_option('bdm_gmail_address');
|
|
delete_option('bdm_gmail_password');
|
|
delete_option('bdm_sender_name');
|
|
delete_option('bdm_reply_to');
|
|
delete_option('bdm_gemini_api_key');
|
|
|
|
// Clear scheduled events (preserved hook names)
|
|
wp_clear_scheduled_hook('bd_bookshelf_sync_ratings');
|
|
wp_clear_scheduled_hook('bd_bookshelf_goodreads_refresh');
|
|
wp_clear_scheduled_hook('bd_bookshelf_amazon_scrape');
|