Move ~94 root class shells and root *-traits into domain directories (core, auth, user, credits, content, payment/gateways, forum, shop, sms, ai, messages, extensions, widgets, settings, admin). Update bootstrap require paths, co-locate traits with owners, fix forum/user relative requires, drop duplicate shop controller requires, and wire home-modules load. Path-only; class names and init order unchanged.
53 lines
1.4 KiB
PHP
53 lines
1.4 KiB
PHP
<?php
|
|
/**
|
|
* AKSRT DB Migrator
|
|
*
|
|
* Maintains runtime tables (credits / download tokens / shop / forum support, etc.).
|
|
* Schema only via dbDelta — no option/data migration, no legacy option dual-write.
|
|
*
|
|
* Trigger:
|
|
* 1. after_switch_theme
|
|
* 2. admin_init when aksrt_db_schema_version !== SCHEMA_VERSION
|
|
*
|
|
* @package AKSRT
|
|
*/
|
|
|
|
defined('ABSPATH') || exit;
|
|
|
|
class AKSRT_DB_Migrator {
|
|
use AKSRT_DB_Migrator_Part_2;
|
|
use AKSRT_DB_Migrator_Part_3;
|
|
|
|
/** 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);
|
|
}
|
|
}
|