refactor(autoload): migrate theme classes to Composer PSR-4

Move 288 types from global AKSRT_* + inc/classes manual requires into
namespace AKSRT\{Domain} under src/AKSRT/, wire composer.json psr-4,
and slim bootstrap to helpers/modules/hooks only. Split multi-class
widget/gateway files, update admin contract audit paths, and document
the layout in ADR/README.
This commit is contained in:
kate522 committed 2026-07-17 13:29:22 +08:00
1 parent 8f349b40fb
commit aaf458af1c
404 files changed
+13602 -7705

No files matched your search

+45
View File
@@ -0,0 +1,45 @@
<?php
/**
* @package AKSRT
*/
namespace AKSRT\Core;
defined('ABSPATH') || exit;
class DBMigrator {
use DBMigratorPart2;
use DBMigratorPart3;
/** Current schema version; changing it re-runs dbDelta. */
const SCHEMA_VERSION = '1.15.0';
const OPT_KEY = 'aksrt_db_schema_version';
/**
* Historical flag still readable by older code paths.
* Plate CPT is now native when registered; prefer post_type_exists().
*/
const OPT_PLATE_CPT_MIGRATED = 'aksrt_plate_cpt_migrated';
/**
* Register hooks.
*/
public static function init(): void {
add_action('after_switch_theme', [self::class, 'maybe_migrate']);
add_action('admin_init', [self::class, 'maybe_migrate']);
}
/**
* Run table schema upgrade when version mismatches.
*/
public static function maybe_migrate(): void {
$current = get_option(self::OPT_KEY, '');
if ($current === self::SCHEMA_VERSION) {
return;
}
self::run();
update_option(self::OPT_KEY, self::SCHEMA_VERSION);
}
}