chore(psr4): phase 1 — rename 7 top-level dirs to PascalCase

Atomic case-rename of the seven class-holding source directories to match the
PSR-4 namespace casing, plus every consequent path reference. No code logic
changes — pure structural rename. (config/content/resources/signals/migrations/
ministra/storage/tmp/vendor/www/bin stay lowercase.)

- git mv: core→Core, domain→Domain, infrastructure→Infrastructure,
  streaming→Streaming, modules→Modules, cli→Cli, public→Public (module subdirs
  like Modules/plex stay lowercase; loaded by ModuleLoader, not Composer).
- PHP filesystem paths updated across src/ + tests/: require/include, glob/scandir
  bases, view includes, asset/nginx-alias paths, autoload.php registerDirectories(),
  ModuleLoader/ModuleManager module roots, console.php discovery dirs.
- src/composer.json PSR-4 vendored-lib paths → Core/Parsing/...; vendor/ regenerated.
- nginx.conf: docroot + SCRIPT_FILENAME → Public/. SCRIPT_NAME and the public-facing
  /streaming/*.php compat routes are URLs, left unchanged.
- Build/CI: Makefile LB_DIRS / LB_DIRS_TO_REMOVE / LB_FILES_TO_REMOVE PascalCased
  (closes the LB-archive privileged-leak blocker); phpstan.dist.neon paths/
  scanDirectories/excludePaths; phpunit.xml.dist coverage; phpstan-baseline.neon
  regenerated (294→294 errors, no new resolution failures).
- migrations/deleted_files.txt: old lowercase trees listed for client cleanup
  (assumes case-sensitive FS — the supported Linux target).

Verified: grep-gate 0 live lowercase-dir require/include in src+tests; php -l clean;
PHPUnit 292/292; PHPStan no errors; Composer first / XC_Autoloader last in SPL stack;
global classes resolve from the renamed dirs.
This commit is contained in:
Divarion-D
2026-06-24 20:10:34 +03:00
parent 7e5732cdcb
commit 1a296d0985
1199 changed files with 1730 additions and 547 deletions
+27 -27
View File
@@ -22,10 +22,10 @@ EXCLUDES := \
.git
# Directories to copy from MAIN to LB
# NOTE: modules/ is intentionally excluded — all modules are MAIN-only.
# NOTE: Modules/ is intentionally excluded — all modules are MAIN-only.
# Modules: tmdb, plex, watch, ministra
LB_DIRS := bin cli config content core domain modules\
infrastructure public resources signals streaming tmp vendor www
LB_DIRS := bin Cli config content Core Domain Modules\
Infrastructure Public resources signals Streaming tmp vendor www
# Root-level files to copy from MAIN to LB (not inside directories)
LB_ROOT_FILES := autoload.php bootstrap.php console.php service update
@@ -35,23 +35,23 @@ LB_DIRS_TO_REMOVE := \
bin/install \
bin/redis \
bin/nginx/conf/codes \
domain/User \
domain/Device \
domain/Auth \
public/Controllers/Admin \
public/Controllers/Player \
public/Controllers/Reseller \
public/Views \
public/assets \
public/routes \
Domain/User \
Domain/Device \
Domain/Auth \
Public/Controllers/Admin \
Public/Controllers/Player \
Public/Controllers/Reseller \
Public/Views \
Public/assets \
Public/routes \
resources/langs \
resources/libs
# Files to remove from LB
LB_FILES_TO_REMOVE := \
bin/maxmind/GeoLite2-City.mmdb \
public/Controllers/Api/AdminApiController.php \
public/Controllers/Api/ResellerRestApiController.php \
Public/Controllers/Api/AdminApiController.php \
Public/Controllers/Api/ResellerRestApiController.php \
www/xplugin.php \
www/probe.php \
www/playlist.php \
@@ -62,19 +62,19 @@ LB_FILES_TO_REMOVE := \
www/admin/proxy_api.php \
www/admin/api.php \
config/rclone.conf \
cli/Commands/MigrateCommand.php \
cli/Commands/CacheHandlerCommand.php \
cli/Commands/ServerInstallCommand.php \
cli/Commands/LbInstallFlow.php \
cli/Commands/ProxyInstallFlow.php \
cli/CronJobs/RootMysqlCronJob.php \
cli/CronJobs/BackupsCronJob.php \
cli/CronJobs/CacheEngineCronJob.php \
cli/CronJobs/EpgCronJob.php \
cli/CronJobs/UpdateCronJob.php \
cli/CronJobs/ProvidersCronJob.php \
cli/CronJobs/SeriesCronJob.php \
domain/Epg/EPG.php \
Cli/Commands/MigrateCommand.php \
Cli/Commands/CacheHandlerCommand.php \
Cli/Commands/ServerInstallCommand.php \
Cli/Commands/LbInstallFlow.php \
Cli/Commands/ProxyInstallFlow.php \
Cli/CronJobs/RootMysqlCronJob.php \
Cli/CronJobs/BackupsCronJob.php \
Cli/CronJobs/CacheEngineCronJob.php \
Cli/CronJobs/EpgCronJob.php \
Cli/CronJobs/UpdateCronJob.php \
Cli/CronJobs/ProvidersCronJob.php \
Cli/CronJobs/SeriesCronJob.php \
Domain/Epg/EPG.php \
bin/nginx/conf/gzip.conf
EXCLUDE_ARGS := $(addprefix --exclude=,$(EXCLUDES))
+294 -294
View File
File diff suppressed because it is too large Load Diff
+11 -11
View File
@@ -7,12 +7,12 @@ parameters:
# Entry points to analyze. Add/remove dirs as the audit progresses.
paths:
- src/core
- src/domain
- src/infrastructure
- src/streaming
- src/modules
- src/cli
- src/Core
- src/Domain
- src/Infrastructure
- src/Streaming
- src/Modules
- src/Cli
# No Composer + no namespaces. The bootstrap only defines global constants;
# it does NOT run the project autoloader (that would force a live directory
@@ -28,7 +28,7 @@ parameters:
# are findable) but NOT reported on directly. These cover every source dir
# outside `paths` so cross-references always resolve.
scanDirectories:
- src/public
- src/Public
- src/signals
- src/ministra
- src/content
@@ -49,13 +49,13 @@ parameters:
- src/backups/*
# Composer autoloader glue (committed + shipped, generated code).
- src/vendor/*
# Vendored third-party library shipped inside core
- src/core/Parsing/M3uParser/*
# Vendored third-party library shipped inside Core
- src/Core/Parsing/M3uParser/*
# View templates: included into a controller's scope, so their
# variables ($rSettings, $language, ...) are injected by the caller.
# PHPStan analyses files standalone and would flag every such var as
# undefined — not real bugs. (Still indexed via scanDirectories.)
- src/modules/*/views/*
- src/Modules/*/views/*
treatPhpDocTypesAsCertain: false
reportUnmatchedIgnoredErrors: false
@@ -213,7 +213,7 @@ parameters:
# (PHP manual), so the defensive check below is correct, not dead code.
-
message: '#=== between resource and false will always evaluate to false#'
path: src/streaming/AsyncFileOperations.php
path: src/Streaming/AsyncFileOperations.php
includes:
# Pre-existing errors frozen so CI is green and only NEW code is checked.
@@ -85,7 +85,7 @@ class LlodCommand implements CommandInterface {
set_time_limit(0);
error_reporting(E_WARNING | E_PARSE);
cli_set_process_title('LLOD[' . $rStreamID . ']');
require MAIN_HOME . 'streaming/TimeshiftClient.php';
require MAIN_HOME . 'Streaming/TimeshiftClient.php';
$rSettings = igbinary_unserialize(file_get_contents(CACHE_TMP_PATH . 'settings'));
@@ -105,7 +105,7 @@ class LoopbackCommand implements CommandInterface {
set_time_limit(0);
cli_set_process_title('Loopback[' . $rStreamID . ']');
require MAIN_HOME . 'streaming/TimeshiftClient.php';
require MAIN_HOME . 'Streaming/TimeshiftClient.php';
$rSettings = igbinary_unserialize(file_get_contents(CACHE_TMP_PATH . 'settings'));
$rServers = igbinary_unserialize(file_get_contents(CACHE_TMP_PATH . 'servers'));
@@ -160,7 +160,7 @@ class ModuleInstallCommand implements CommandInterface {
if (!preg_match('/^[a-z0-9][a-z0-9\-]*$/', $rName)) {
return;
}
$rDir = (defined('MAIN_HOME') ? MAIN_HOME : '') . 'modules/' . $rName;
$rDir = (defined('MAIN_HOME') ? MAIN_HOME : '') . 'Modules/' . $rName;
if (is_dir($rDir)) {
shell_exec('sudo chown -R xc_vm:xc_vm ' . escapeshellarg($rDir) . ' 2>/dev/null');
}
@@ -88,13 +88,13 @@ class StartupCommand implements CommandInterface {
private function installRootCrontab(): void {
$rCrons = array();
$rCrons[] = '* * * * * ' . PHP_BIN . ' ' . MAIN_HOME . 'console.php cron:root_signals # XC_VM';
if (file_exists(MAIN_HOME . 'cli/CronJobs/RootMysqlCronJob.php')) {
if (file_exists(MAIN_HOME . 'Cli/CronJobs/RootMysqlCronJob.php')) {
$rCrons[] = '* * * * * ' . PHP_BIN . ' ' . MAIN_HOME . 'console.php cron:root_mysql # XC_VM';
}
// Renew per-machine ionCube licenses for platform modules before they
// expire (runs as xc_vm so the .lic is owned by the panel user). No-op
// when no licensed modules are installed.
if (file_exists(MAIN_HOME . 'cli/CronJobs/ModuleLicensesCronJob.php')) {
if (file_exists(MAIN_HOME . 'Cli/CronJobs/ModuleLicensesCronJob.php')) {
$rCrons[] = '17 3 * * * sudo -u xc_vm ' . PHP_BIN . ' ' . MAIN_HOME . 'console.php cron:module_licenses # XC_VM';
}
@@ -167,7 +167,7 @@ class StatusCommand implements CommandInterface {
$rCrons = array();
$rCrons[] = '* * * * * ' . PHP_BIN . ' ' . MAIN_HOME . 'console.php cron:root_signals # XC_VM';
if (file_exists(MAIN_HOME . 'cli/CronJobs/RootMysqlCronJob.php')) {
if (file_exists(MAIN_HOME . 'Cli/CronJobs/RootMysqlCronJob.php')) {
$rCrons[] = '* * * * * ' . PHP_BIN . ' ' . MAIN_HOME . 'console.php cron:root_mysql # XC_VM';
}
@@ -65,8 +65,8 @@ class CacheEngineCronJob implements CommandInterface {
shell_exec("kill -9 \$(ps aux | grep 'cache_engine' | grep -v grep | grep -v " . $this->rPID . " | awk '{print \$2}')");
}
require_once MAIN_HOME . 'core/Process/Thread.php';
require_once MAIN_HOME . 'core/Process/Multithread.php';
require_once MAIN_HOME . 'Core/Process/Thread.php';
require_once MAIN_HOME . 'Core/Process/Multithread.php';
$this->loadCron($rType, $rGroupStart, $rGroupMax);
@@ -39,7 +39,7 @@ class EpgCronJob implements CommandInterface {
set_time_limit(0);
ini_set('memory_limit', -1);
require MAIN_HOME . 'core/Parsing/XmlStringStreamer.php';
require MAIN_HOME . 'Core/Parsing/XmlStringStreamer.php';
shell_exec('kill -9 `ps -ef | grep \'XC_VM\\[EPG\\]\' | grep -v grep | awk \'{print $2}\'`;');
cli_set_process_title('XC_VM[EPG]');
@@ -92,7 +92,7 @@ class AuthRepository {
// identifiers baked into generated access-code configs — NOT filesystem paths.
// Do not rename without regenerating all deployed nginx configs.
$rType = array('admin', 'reseller', 'ministra', 'includes/api/admin', 'includes/api/reseller', 'ministra/new', 'player')[$rCode['type']];
$rAlias = array('public/Views/admin', 'reseller', 'ministra', 'includes/api/admin', 'includes/api/reseller', 'ministra/new', 'public/assets/player')[$rCode['type']];
$rAlias = array('Public/Views/admin', 'reseller', 'ministra', 'includes/api/admin', 'includes/api/reseller', 'ministra/new', 'Public/assets/player')[$rCode['type']];
$rBurst = array(500, 50, 50, 1000, 1000, 50, 500)[$rCode['type']];
$rCurrentTemplate = in_array($rType, array('ministra', 'ministra/new')) ? $rMinistraTemplate : $rTemplate;
@@ -106,7 +106,7 @@ class AuthRepository {
if (count(self::getActiveCodes($rMainHome)) == 0) {
if (!file_exists($rMainHome . 'bin/nginx/conf/codes/default.conf')) {
file_put_contents($rMainHome . 'bin/nginx/conf/codes/default.conf', str_replace(array('alias ', '#WHITELIST#', '#CODE#', '#TYPE#', '#ALIAS#'), array('root ', '', '', 'admin', 'public/Views/admin'), $rTemplate));
file_put_contents($rMainHome . 'bin/nginx/conf/codes/default.conf', str_replace(array('alias ', '#WHITELIST#', '#CODE#', '#TYPE#', '#ALIAS#'), array('root ', '', '', 'admin', 'Public/Views/admin'), $rTemplate));
}
} else {
if (file_exists($rMainHome . 'bin/nginx/conf/codes/default.conf')) {
@@ -27,12 +27,12 @@ declare(strict_types=1);
* Backward Compatibility:
*
* admin/session.php will be reduced to:
* require_once MAIN_HOME . 'core/Auth/SessionManager.php';
* require_once MAIN_HOME . 'Core/Auth/SessionManager.php';
* SessionManager::start('admin');
* SessionManager::requireAuth();
*
* reseller/session.php will be reduced to:
* require_once MAIN_HOME . 'core/Auth/SessionManager.php';
* require_once MAIN_HOME . 'Core/Auth/SessionManager.php';
* SessionManager::start('reseller');
* SessionManager::requireAuth();
*
@@ -94,7 +94,7 @@ class BackupService {
* @return bool True if the Dropbox token works and files can be listed.
*/
public static function checkRemoteConnection() {
require_once MAIN_HOME . 'core/Storage/DropboxClient.php';
require_once MAIN_HOME . 'Core/Storage/DropboxClient.php';
try {
$rClient = new DropboxClient();
@@ -113,7 +113,7 @@ class BackupService {
* @return array[] Backup file metadata (with a 'time' timestamp).
*/
public static function getRemote() {
require_once MAIN_HOME . 'core/Storage/DropboxClient.php';
require_once MAIN_HOME . 'Core/Storage/DropboxClient.php';
try {
$rClient = new DropboxClient();
@@ -148,7 +148,7 @@ class BackupService {
* @return bool True on success.
*/
public static function downloadRemote($rPath, $rFilename) {
require_once MAIN_HOME . 'core/Storage/DropboxClient.php';
require_once MAIN_HOME . 'Core/Storage/DropboxClient.php';
$rClient = new DropboxClient();
try {
@@ -170,7 +170,7 @@ class BackupService {
* @return mixed Upload result, or an object with an 'error' key on failure.
*/
public static function uploadRemote($rPath, $rFilename, $rOverwrite = true) {
require_once MAIN_HOME . 'core/Storage/DropboxClient.php';
require_once MAIN_HOME . 'Core/Storage/DropboxClient.php';
$rClient = new DropboxClient();
try {
@@ -189,7 +189,7 @@ class BackupService {
* @return bool True on success.
*/
public static function deleteRemote($rPath) {
require_once MAIN_HOME . 'core/Storage/DropboxClient.php';
require_once MAIN_HOME . 'Core/Storage/DropboxClient.php';
$rClient = new DropboxClient();
try {

Some files were not shown because too many files have changed in this diff Show More