Requirements 1-8 + all non-negotiables:
1. Model manager (CRUD): PRV_Model_Registry, prv_models v2 option, versioned
idempotent migration from v0.1.x flat-string format, Settings page CRUD.
2. Per-model run-health: PRV_Model_Registry::update_health() after each run;
health badges (Healthy/Retired?/Disabled/Unknown) in model table + dashboard.
3. Metric comparability: PRV_Config_Version stamps every run with config_version;
save-bar warning on scoring-relevant changes; orphaned rows excluded by version.
4. Projected cost at save: PRV_Config::get_projected_cost(); over-cap warning;
prv_last_run_truncated option + visible notice when cap hit mid-run.
5. Config surface: peptide set, intents, cadence (reschedules cron), budget cap;
all validated + sanitized; next-run timestamp shown.
6. API-key three-state: not-defined / defined-ok / defined-failed; derived from
ledger; never displays the key.
7. Run-lock: PRV_Run_Lock (transient); cron tick skips if locked; Run-now
refuses with clear message; lock released in finally block.
8. Design fixes: dark-ink focus ring on bright fills; disabled-row full AA
contrast (no opacity); toggle disabled on retired rows; save-bar-level
warning (role=alert); chip text #B4BDC7 6.83:1 AA; keyboard-sortable headers
(<button>+aria-sort); aria-live on Test chip; z-index:50 save-bar;
run-now double-fire guard; @media print light overrides.
New: PRV_Upgrader (runs migrations on plugins_loaded, not just activation),
PRV_Config_Version, PRV_Run_Lock, PRV_Settings_Page, PRV_Settings_Renderer,
PRV_Model_Manager_Table, PRV_Model_Test_Ajax.
Tests: test-model-registry, test-run-lock, test-config-version,
test-projected-cost, test-cron-reschedule (+ updated probe-runner,
uninstall, bootstrap).
Schema: config_version INT column added via dbDelta (idempotent).
Uninstall: purges all v0.2 prv_* options + transients.
76 lines
1.9 KiB
PHP
76 lines
1.9 KiB
PHP
<?php
|
|
/**
|
|
* Class and interface autoloader for the PR Vision plugin.
|
|
*
|
|
* @package PrVision
|
|
*/
|
|
|
|
declare(strict_types=1);
|
|
|
|
/**
|
|
* Class and interface autoloader for the PR Vision plugin.
|
|
*
|
|
* Converts PRV_* class/interface names to file paths under includes/.
|
|
* Naming conventions:
|
|
* PRV_Foo_Bar (class) -- class-prv-foo-bar.php
|
|
* PRV_Foo_Bar (interface) -- interface-prv-foo-bar.php (tried second)
|
|
*
|
|
* Who triggers: Plugin boot (pr-vision.php) -- called once before
|
|
* any PRV_* class or interface is instantiated.
|
|
* Dependencies: None (pure PHP).
|
|
*
|
|
* @package PrVision
|
|
*/
|
|
class PRV_Autoloader {
|
|
|
|
/**
|
|
* Register the autoloader with the SPL stack.
|
|
*
|
|
* @return void
|
|
*/
|
|
public static function register(): void {
|
|
spl_autoload_register( array( static::class, 'load' ) );
|
|
}
|
|
|
|
/**
|
|
* Attempt to load a PRV_* class or interface file.
|
|
*
|
|
* Walks the known include subdirectories in order, trying the class-
|
|
* filename first and the interface-filename second.
|
|
*
|
|
* Side effects: require_once on a matching file.
|
|
*
|
|
* @param string $class_name Fully-qualified class or interface name.
|
|
*
|
|
* @return void
|
|
*/
|
|
public static function load( string $class_name ): void {
|
|
if ( 0 !== strpos( $class_name, 'PRV_' ) ) {
|
|
return;
|
|
}
|
|
|
|
$slug = strtolower( str_replace( '_', '-', $class_name ) );
|
|
|
|
$search_dirs = array(
|
|
PRV_PLUGIN_DIR . 'includes/core/',
|
|
PRV_PLUGIN_DIR . 'includes/providers/',
|
|
PRV_PLUGIN_DIR . 'includes/collector/',
|
|
PRV_PLUGIN_DIR . 'includes/panel/',
|
|
PRV_PLUGIN_DIR . 'includes/',
|
|
);
|
|
|
|
// Try class file first, then interface file.
|
|
$candidates = array( 'class-' . $slug . '.php', 'interface-' . $slug . '.php' );
|
|
|
|
foreach ( $search_dirs as $dir ) {
|
|
foreach ( $candidates as $file ) {
|
|
$path = $dir . $file;
|
|
if ( file_exists( $path ) ) {
|
|
require_once $path;
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|