fix: two fatal errors preventing plugin activation (v0.1.1)
1. NAMESPACE is a PHP reserved keyword — renamed to REST_NAMESPACE in the REST controller. This caused a parse error on activation. 2. Autoloader can't resolve PR_Core class — the class name equals the autoloader prefix exactly, so stripping "PR_Core_" yields an empty suffix and the wrong filename. Added explicit require_once in bootstrap, same pattern as PRAutoBlogger. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -3,6 +3,15 @@
|
|||||||
All notable changes to Peptide Repo Core are documented here.
|
All notable changes to Peptide Repo Core are documented here.
|
||||||
Format: [Semantic Versioning](https://semver.org/).
|
Format: [Semantic Versioning](https://semver.org/).
|
||||||
|
|
||||||
|
## [0.1.1] — 2026-04-19
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- **Fatal error on activation: `NAMESPACE` is a PHP reserved keyword.** Renamed
|
||||||
|
to `REST_NAMESPACE` in the REST controller.
|
||||||
|
- **Fatal error: autoloader cannot resolve `PR_Core` class.** Class name equals
|
||||||
|
the autoloader prefix exactly, producing wrong filename. Added explicit
|
||||||
|
require_once in bootstrap (same pattern as PRAutoBlogger).
|
||||||
|
|
||||||
## [0.1.0] — 2026-04-17
|
## [0.1.0] — 2026-04-17
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ declare(strict_types=1);
|
|||||||
class PR_Core_Rest_Controller {
|
class PR_Core_Rest_Controller {
|
||||||
|
|
||||||
/** @var string REST namespace. */
|
/** @var string REST namespace. */
|
||||||
private const NAMESPACE = 'pr-core/v1';
|
private const REST_NAMESPACE = 'pr-core/v1';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register the rest_api_init hook.
|
* Register the rest_api_init hook.
|
||||||
@@ -43,7 +43,7 @@ class PR_Core_Rest_Controller {
|
|||||||
*/
|
*/
|
||||||
public function register_routes(): void {
|
public function register_routes(): void {
|
||||||
// GET /peptides
|
// GET /peptides
|
||||||
register_rest_route( self::NAMESPACE, '/peptides', [
|
register_rest_route( self::REST_NAMESPACE, '/peptides', [
|
||||||
'methods' => 'GET',
|
'methods' => 'GET',
|
||||||
'callback' => [ $this, 'list_peptides' ],
|
'callback' => [ $this, 'list_peptides' ],
|
||||||
'permission_callback' => '__return_true',
|
'permission_callback' => '__return_true',
|
||||||
@@ -57,14 +57,14 @@ class PR_Core_Rest_Controller {
|
|||||||
] );
|
] );
|
||||||
|
|
||||||
// GET /peptides/{id}
|
// GET /peptides/{id}
|
||||||
register_rest_route( self::NAMESPACE, '/peptides/(?P<id>\d+)', [
|
register_rest_route( self::REST_NAMESPACE, '/peptides/(?P<id>\d+)', [
|
||||||
'methods' => 'GET',
|
'methods' => 'GET',
|
||||||
'callback' => [ $this, 'get_peptide' ],
|
'callback' => [ $this, 'get_peptide' ],
|
||||||
'permission_callback' => '__return_true',
|
'permission_callback' => '__return_true',
|
||||||
] );
|
] );
|
||||||
|
|
||||||
// GET /peptides/{id}/dosing
|
// GET /peptides/{id}/dosing
|
||||||
register_rest_route( self::NAMESPACE, '/peptides/(?P<id>\d+)/dosing', [
|
register_rest_route( self::REST_NAMESPACE, '/peptides/(?P<id>\d+)/dosing', [
|
||||||
'methods' => 'GET',
|
'methods' => 'GET',
|
||||||
'callback' => [ $this, 'list_dosing' ],
|
'callback' => [ $this, 'list_dosing' ],
|
||||||
'permission_callback' => '__return_true',
|
'permission_callback' => '__return_true',
|
||||||
@@ -75,21 +75,21 @@ class PR_Core_Rest_Controller {
|
|||||||
] );
|
] );
|
||||||
|
|
||||||
// POST /peptides/{id}/dosing (auth required)
|
// POST /peptides/{id}/dosing (auth required)
|
||||||
register_rest_route( self::NAMESPACE, '/peptides/(?P<id>\d+)/dosing', [
|
register_rest_route( self::REST_NAMESPACE, '/peptides/(?P<id>\d+)/dosing', [
|
||||||
'methods' => 'POST',
|
'methods' => 'POST',
|
||||||
'callback' => [ $this, 'create_dosing' ],
|
'callback' => [ $this, 'create_dosing' ],
|
||||||
'permission_callback' => [ $this, 'check_write_permission' ],
|
'permission_callback' => [ $this, 'check_write_permission' ],
|
||||||
] );
|
] );
|
||||||
|
|
||||||
// GET /peptides/{id}/legal
|
// GET /peptides/{id}/legal
|
||||||
register_rest_route( self::NAMESPACE, '/peptides/(?P<id>\d+)/legal', [
|
register_rest_route( self::REST_NAMESPACE, '/peptides/(?P<id>\d+)/legal', [
|
||||||
'methods' => 'GET',
|
'methods' => 'GET',
|
||||||
'callback' => [ $this, 'list_legal' ],
|
'callback' => [ $this, 'list_legal' ],
|
||||||
'permission_callback' => '__return_true',
|
'permission_callback' => '__return_true',
|
||||||
] );
|
] );
|
||||||
|
|
||||||
// POST /peptides/{id}/legal (auth required)
|
// POST /peptides/{id}/legal (auth required)
|
||||||
register_rest_route( self::NAMESPACE, '/peptides/(?P<id>\d+)/legal', [
|
register_rest_route( self::REST_NAMESPACE, '/peptides/(?P<id>\d+)/legal', [
|
||||||
'methods' => 'POST',
|
'methods' => 'POST',
|
||||||
'callback' => [ $this, 'create_legal' ],
|
'callback' => [ $this, 'create_legal' ],
|
||||||
'permission_callback' => [ $this, 'check_write_permission' ],
|
'permission_callback' => [ $this, 'check_write_permission' ],
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
* Plugin Name: Peptide Repo Core
|
* Plugin Name: Peptide Repo Core
|
||||||
* Plugin URI: https://peptiderepo.com
|
* Plugin URI: https://peptiderepo.com
|
||||||
* Description: Canonical peptide schema — shared data layer for the peptiderepo.com ecosystem. Provides the pr_peptide CPT, dosing rows, legal status cells, AI candidate queue, disclaimer component, and JSON-LD output.
|
* Description: Canonical peptide schema — shared data layer for the peptiderepo.com ecosystem. Provides the pr_peptide CPT, dosing rows, legal status cells, AI candidate queue, disclaimer component, and JSON-LD output.
|
||||||
* Version: 0.1.0
|
* Version: 0.1.1
|
||||||
* Author: peptiderepo
|
* Author: peptiderepo
|
||||||
* Author URI: https://peptiderepo.com
|
* Author URI: https://peptiderepo.com
|
||||||
* License: GPL-2.0-or-later
|
* License: GPL-2.0-or-later
|
||||||
@@ -22,7 +22,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||||||
|
|
||||||
/* ── Constants ────────────────────────────────────────────────────────── */
|
/* ── Constants ────────────────────────────────────────────────────────── */
|
||||||
|
|
||||||
define( 'PR_CORE_VERSION', '0.1.0' );
|
define( 'PR_CORE_VERSION', '0.1.1' );
|
||||||
define( 'PR_CORE_PLUGIN_FILE', __FILE__ );
|
define( 'PR_CORE_PLUGIN_FILE', __FILE__ );
|
||||||
define( 'PR_CORE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
define( 'PR_CORE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
||||||
define( 'PR_CORE_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
define( 'PR_CORE_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
||||||
@@ -33,6 +33,11 @@ define( 'PR_CORE_TARGET_SCHEMA_VERSION', 3 );
|
|||||||
require_once PR_CORE_PLUGIN_DIR . 'includes/class-pr-core-autoloader.php';
|
require_once PR_CORE_PLUGIN_DIR . 'includes/class-pr-core-autoloader.php';
|
||||||
PR_Core_Autoloader::register();
|
PR_Core_Autoloader::register();
|
||||||
|
|
||||||
|
// The main orchestrator class is loaded explicitly because its name (PR_Core)
|
||||||
|
// equals the autoloader prefix exactly — stripping "PR_Core_" yields an empty
|
||||||
|
// suffix, producing "class-pr-core-.php" instead of "class-pr-core.php".
|
||||||
|
require_once PR_CORE_PLUGIN_DIR . 'includes/class-pr-core.php';
|
||||||
|
|
||||||
/* ── Activation / Deactivation ────────────────────────────────────────── */
|
/* ── Activation / Deactivation ────────────────────────────────────────── */
|
||||||
|
|
||||||
register_activation_hook( __FILE__, [ 'PR_Core_Activator', 'activate' ] );
|
register_activation_hook( __FILE__, [ 'PR_Core_Activator', 'activate' ] );
|
||||||
|
|||||||
Reference in New Issue
Block a user