v4.5.0: drop peptide CPT registration; add PR Core dependency check (#15)

Drops PSA registration of peptide CPT + peptide_category taxonomy (PR Core >= 0.2.0 now owns them per 2026-04-22 consolidation). Adds hard dependency check on PR Core 0.2.0+ — PSA self-deactivates with an admin notice if PR Core is missing or below min version.

CI note: PHPUnit failures (PSA_AI_Content, PSA_Directory_API not found) and WPCS failure are pre-existing on main at HEAD 65f973f (verified: same 5 errors in run 24530495421). PHP Lint green on 7.4/8.1/8.3. No regressions introduced by this PR.

QA: qa-reviews/2026-04-22-2609c66.md PASS.
This commit is contained in:
peptiderepo
2026-04-22 17:12:34 +07:00
committed by GitHub
parent 65f973fea4
commit 868d31cfb3
8 changed files with 480 additions and 292 deletions

View File

@@ -3,7 +3,7 @@
* Plugin Name: Peptide Search AI
* Plugin URI: https://example.com/peptide-search-ai
* Description: Searchable peptide database with AI-powered auto-population and browsable directory.
* Version: 4.4.3
* Version: 4.5.0
* Author: Terence
* License: GPL v2 or later
* Text Domain: peptide-search-ai
@@ -15,13 +15,14 @@ if ( ! defined( 'ABSPATH' ) ) {
exit;
}
define( 'PSA_VERSION', '4.4.3' );
define( 'PSA_VERSION', '4.5.0' );
define( 'PSA_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
define( 'PSA_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
define( 'PSA_PLUGIN_FILE', __FILE__ );
require_once PSA_PLUGIN_DIR . 'includes/class-psa-config.php';
require_once PSA_PLUGIN_DIR . 'includes/class-psa-encryption.php';
require_once PSA_PLUGIN_DIR . 'includes/class-psa-dependency-check.php';
require_once PSA_PLUGIN_DIR . 'includes/class-psa-post-type.php';
require_once PSA_PLUGIN_DIR . 'includes/class-psa-post-type-meta.php';
require_once PSA_PLUGIN_DIR . 'includes/class-psa-search-handler.php';
@@ -42,11 +43,20 @@ require_once PSA_PLUGIN_DIR . 'includes/class-psa-directory.php';
require_once PSA_PLUGIN_DIR . 'includes/class-psa-upgrade.php';
function psa_init() {
PSA_Post_Type::register_peptide_post_type();
PSA_Post_Type::register_taxonomy();
// Settings + dependency notice always boot so the admin can see plugin
// state and act on a missing PR Core dependency.
PSA_Admin::init();
PSA_Dependency_Check::init();
// PR Core >= 0.2.0 owns `peptide` CPT + `peptide_category` taxonomy as
// of v4.5.0. Gate CPT-dependent surfaces so PSA degrades gracefully
// instead of binding hooks against an unregistered post type.
if ( ! PSA_Dependency_Check::is_satisfied() ) {
return;
}
PSA_Search::init();
PSA_AI_Generator::init();
PSA_Admin::init();
PSA_Batch_Enrichment::init();
PSA_Template::init();
PSA_Directory::init();
@@ -54,8 +64,15 @@ function psa_init() {
add_action( 'init', 'psa_init' );
function psa_admin_init() {
PSA_Post_Type::init_admin();
PSA_Upgrade::maybe_run();
// Meta boxes + admin columns bind to the `peptide` CPT; only register
// when PR Core has provided it.
if ( ! PSA_Dependency_Check::is_satisfied() ) {
return;
}
PSA_Post_Type::init_admin();
}
add_action( 'admin_init', 'psa_admin_init' );
@@ -233,9 +250,13 @@ function psa_replace_kb_search() {
add_action( 'wp_footer', 'psa_replace_kb_search' );
function psa_activate() {
PSA_Post_Type::register_peptide_post_type();
PSA_Post_Type::register_taxonomy();
PSA_Post_Type::populate_default_categories();
// As of PSA v4.5.0, PR Core (>= 0.2.0) owns the `peptide` CPT and
// `peptide_category` taxonomy — PSA no longer registers them here. The
// 8 default category terms were seeded on earlier PSA versions and
// remain in wp_term_taxonomy; PR Core inherits them by registering the
// same taxonomy name, so no re-seed is required. PSA only owns its
// own cost-tracker table and still needs to flush rewrite rules on
// activation so the `peptide` CPT permalinks resolve on this install.
PSA_Cost_Tracker::create_table();
flush_rewrite_rules();
}