diff --git a/src/Cli/Commands/ArchiveCommand.php b/src/Cli/Commands/ArchiveCommand.php index 2ca615fb..695df241 100644 --- a/src/Cli/Commands/ArchiveCommand.php +++ b/src/Cli/Commands/ArchiveCommand.php @@ -48,7 +48,7 @@ class ArchiveCommand implements CommandInterface { */ public function execute(array $rArgs): int { if (posix_getpwuid(posix_geteuid())['name'] != 'xc_vm') { - echo "Please run as \XC_VM!\n"; + echo "Please run as XC_VM!\n"; return 1; } diff --git a/src/Cli/Commands/CreatedCommand.php b/src/Cli/Commands/CreatedCommand.php index d424b4b9..80fb6326 100644 --- a/src/Cli/Commands/CreatedCommand.php +++ b/src/Cli/Commands/CreatedCommand.php @@ -31,7 +31,7 @@ class CreatedCommand implements CommandInterface { public function execute(array $rArgs): int { if (posix_getpwuid(posix_geteuid())['name'] != 'xc_vm') { - echo "Please run as \XC_VM!\n"; + echo "Please run as XC_VM!\n"; return 1; } diff --git a/src/Cli/Commands/DelayCommand.php b/src/Cli/Commands/DelayCommand.php index e4469400..f707656d 100644 --- a/src/Cli/Commands/DelayCommand.php +++ b/src/Cli/Commands/DelayCommand.php @@ -29,7 +29,7 @@ class DelayCommand implements CommandInterface { public function execute(array $rArgs): int { if (posix_getpwuid(posix_geteuid())['name'] != 'xc_vm') { - echo "Please run as \XC_VM!\n"; + echo "Please run as XC_VM!\n"; return 1; } diff --git a/src/Cli/Commands/LbInstallFlow.php b/src/Cli/Commands/LbInstallFlow.php index 9c4ef8e4..b6e21738 100644 --- a/src/Cli/Commands/LbInstallFlow.php +++ b/src/Cli/Commands/LbInstallFlow.php @@ -50,8 +50,8 @@ class LbInstallFlow { public static function installArchive($rConn, callable $rRunSSH, string $rInstallFiles, string $rHash, int $rServerID, $db): bool { echo "Download archive\n"; - call_user_func($rRunSSH, $rConn, 'wget --timeout=2 -O /tmp/\XC_VM.tar.gz -o /dev/null "' . $rInstallFiles . '"'); - $rFileHash = call_user_func($rRunSSH, $rConn, 'md5=($(md5sum /tmp/\XC_VM.tar.gz)); echo $md5;'); + call_user_func($rRunSSH, $rConn, 'wget --timeout=2 -O /tmp/XC_VM.tar.gz -o /dev/null "' . $rInstallFiles . '"'); + $rFileHash = call_user_func($rRunSSH, $rConn, 'md5=($(md5sum /tmp/XC_VM.tar.gz)); echo $md5;'); if (empty($rFileHash['output']) || $rHash != trim($rFileHash['output'])) { $db->query('UPDATE `servers` SET `status` = 4 WHERE `id` = ?;', $rServerID); echo "Invalid MD5 checksum! Exiting\n"; @@ -60,7 +60,7 @@ class LbInstallFlow { echo "Extracting to directory\n"; call_user_func($rRunSSH, $rConn, 'sudo rm -rf ' . MAIN_HOME . 'console.php'); - call_user_func($rRunSSH, $rConn, 'sudo tar -zxvf /tmp/\XC_VM.tar.gz -C "' . MAIN_HOME . '"'); + call_user_func($rRunSSH, $rConn, 'sudo tar -zxvf /tmp/XC_VM.tar.gz -C "' . MAIN_HOME . '"'); $rRemoteCheck = trim(call_user_func($rRunSSH, $rConn, 'test -f ' . MAIN_HOME . 'console.php && echo OK')['output']); if ($rRemoteCheck !== 'OK') { $db->query('UPDATE `servers` SET `status` = 4 WHERE `id` = ?;', $rServerID); @@ -68,7 +68,7 @@ class LbInstallFlow { return false; } - call_user_func($rRunSSH, $rConn, 'sudo rm -f "/tmp/\XC_VM.tar.gz"'); + call_user_func($rRunSSH, $rConn, 'sudo rm -f "/tmp/XC_VM.tar.gz"'); return true; } @@ -109,7 +109,7 @@ class LbInstallFlow { * Securely provision config.enc onto a freshly-installed LB node. * * The DB password never enters PHP: we read the node's install_id over the - * SSH channel, then \XC_VM::config_pack() pulls the credentials from MAIN's + * SSH channel, then XC_VM::config_pack() pulls the credentials from MAIN's * own config.enc and returns a transport blob (XCVT) encrypted for that * install_id. The node re-encrypts it to its at-rest format on first read. * @@ -151,7 +151,7 @@ class LbInstallFlow { // Pack config.enc targeted at the node's install_id. Credentials are // read from MAIN's config.enc inside the extension, never exposed here. - $rBlob = \XC_VM::config_pack($rInstallId, array( + $rBlob = XC_VM::config_pack($rInstallId, array( 'hostname' => $rServers[SERVER_ID]['server_ip'], 'database' => 'xc_vm', 'port' => intval(ConfigReader::get('port')), diff --git a/src/Cli/Commands/LlodCommand.php b/src/Cli/Commands/LlodCommand.php index 388ab7f3..8dd9f037 100644 --- a/src/Cli/Commands/LlodCommand.php +++ b/src/Cli/Commands/LlodCommand.php @@ -27,7 +27,7 @@ class LlodCommand implements CommandInterface { public function execute(array $rArgs): int { if (posix_getpwuid(posix_geteuid())['name'] !== 'xc_vm') { - echo "Please run as \XC_VM!\n"; + echo "Please run as XC_VM!\n"; return 1; } diff --git a/src/Cli/Commands/LoopbackCommand.php b/src/Cli/Commands/LoopbackCommand.php index a1c4d342..9f105726 100644 --- a/src/Cli/Commands/LoopbackCommand.php +++ b/src/Cli/Commands/LoopbackCommand.php @@ -28,7 +28,7 @@ class LoopbackCommand implements CommandInterface { public function execute(array $rArgs): int { if (posix_getpwuid(posix_geteuid())['name'] != 'xc_vm') { - echo "Please run as \XC_VM!\n"; + echo "Please run as XC_VM!\n"; return 1; } diff --git a/src/Cli/Commands/MonitorCommand.php b/src/Cli/Commands/MonitorCommand.php index ba036de2..76d5885b 100644 --- a/src/Cli/Commands/MonitorCommand.php +++ b/src/Cli/Commands/MonitorCommand.php @@ -57,7 +57,7 @@ class MonitorCommand implements CommandInterface { */ public function execute(array $rArgs): int { if (posix_getpwuid(posix_geteuid())['name'] != 'xc_vm') { - echo "Please run as \XC_VM!\n"; + echo "Please run as XC_VM!\n"; return 1; } diff --git a/src/Cli/Commands/OndemandCommand.php b/src/Cli/Commands/OndemandCommand.php index 308c6977..9e4f6129 100644 --- a/src/Cli/Commands/OndemandCommand.php +++ b/src/Cli/Commands/OndemandCommand.php @@ -32,7 +32,7 @@ class OndemandCommand implements CommandInterface { public function execute(array $rArgs): int { if (posix_getpwuid(posix_geteuid())['name'] != 'xc_vm') { - echo "Please run as \XC_VM!\n"; + echo "Please run as XC_VM!\n"; return 1; } diff --git a/src/Cli/Commands/ProxyInstallFlow.php b/src/Cli/Commands/ProxyInstallFlow.php index 78a81dde..7c68da37 100644 --- a/src/Cli/Commands/ProxyInstallFlow.php +++ b/src/Cli/Commands/ProxyInstallFlow.php @@ -38,10 +38,10 @@ class ProxyInstallFlow { public static function buildConfig(array $rServers, int $rServerID, int $rPrivateIP): string { if ($rPrivateIP) { - return '; \XC_VM Configuration' . "\n" . '; -----------------' . "\n\n" . '[\XC_VM]' . "\n" . 'hostname = "' . $rServers[SERVER_ID]['private_ip'] . '"' . "\n" . 'port = ' . intval($rServers[SERVER_ID]['http_broadcast_port']) . "\n" . 'server_id = ' . $rServerID; + return '; XC_VM Configuration' . "\n" . '; -----------------' . "\n\n" . '[XC_VM]' . "\n" . 'hostname = "' . $rServers[SERVER_ID]['private_ip'] . '"' . "\n" . 'port = ' . intval($rServers[SERVER_ID]['http_broadcast_port']) . "\n" . 'server_id = ' . $rServerID; } - return '; \XC_VM Configuration' . "\n" . '; -----------------' . "\n\n" . '[\XC_VM]' . "\n" . 'hostname = "' . $rServers[SERVER_ID]['server_ip'] . '"' . "\n" . 'port = ' . intval($rServers[SERVER_ID]['http_broadcast_port']) . "\n" . 'server_id = ' . $rServerID; + return '; XC_VM Configuration' . "\n" . '; -----------------' . "\n\n" . '[XC_VM]' . "\n" . 'hostname = "' . $rServers[SERVER_ID]['server_ip'] . '"' . "\n" . 'port = ' . intval($rServers[SERVER_ID]['http_broadcast_port']) . "\n" . 'server_id = ' . $rServerID; } public static function configureRuntime($rConn, callable $rSendFileSSH, callable $rRunSSH, array $rServers, array $rParentIDs, int $rPrivateIP, int $rHTTPPort, int $rHTTPSPort, int $rServerID): int { diff --git a/src/Cli/Commands/RecordCommand.php b/src/Cli/Commands/RecordCommand.php index fc6f5d8f..a8709a44 100644 --- a/src/Cli/Commands/RecordCommand.php +++ b/src/Cli/Commands/RecordCommand.php @@ -29,7 +29,7 @@ class RecordCommand implements CommandInterface { public function execute(array $rArgs): int { if (posix_getpwuid(posix_geteuid())['name'] != 'xc_vm') { - echo "Please run as \XC_VM!\n"; + echo "Please run as XC_VM!\n"; return 1; } diff --git a/src/Cli/Commands/ServerInstallCommand.php b/src/Cli/Commands/ServerInstallCommand.php index 7784dede..a4ae0226 100644 --- a/src/Cli/Commands/ServerInstallCommand.php +++ b/src/Cli/Commands/ServerInstallCommand.php @@ -35,7 +35,7 @@ class ServerInstallCommand implements CommandInterface { public function execute(array $rArgs): int { if (posix_getpwuid(posix_geteuid())['name'] != 'xc_vm') { - echo "Please run as \XC_VM!\n"; + echo "Please run as XC_VM!\n"; return 1; } @@ -73,7 +73,7 @@ class ServerInstallCommand implements CommandInterface { $rUpdateSysctl = (empty($rArgs[7]) ? 0 : intval($rArgs[7])); $rPrivateIP = (empty($rArgs[8]) ? 0 : intval($rArgs[8])); $rParentIDs = (empty($rArgs[9]) ? array() : json_decode($rArgs[9], true)); - $rSysCtl = '# \XC_VM' . PHP_EOL . PHP_EOL . 'net.ipv4.tcp_congestion_control = bbr' . PHP_EOL . 'net.core.default_qdisc = fq' . PHP_EOL . 'net.ipv4.tcp_rmem = 8192 87380 134217728' . PHP_EOL . 'net.ipv4.udp_rmem_min = 16384' . PHP_EOL . 'net.core.rmem_default = 262144' . PHP_EOL . 'net.core.rmem_max = 268435456' . PHP_EOL . 'net.ipv4.tcp_wmem = 8192 65536 134217728' . PHP_EOL . 'net.ipv4.udp_wmem_min = 16384' . PHP_EOL . 'net.core.wmem_default = 262144' . PHP_EOL . 'net.core.wmem_max = 268435456' . PHP_EOL . 'net.core.somaxconn = 1000000' . PHP_EOL . 'net.core.netdev_max_backlog = 250000' . PHP_EOL . 'net.core.optmem_max = 65535' . PHP_EOL . 'net.ipv4.tcp_max_tw_buckets = 1440000' . PHP_EOL . 'net.ipv4.tcp_max_orphans = 16384' . PHP_EOL . 'net.ipv4.ip_local_port_range = 2000 65000' . PHP_EOL . 'net.ipv4.tcp_no_metrics_save = 1' . PHP_EOL . 'net.ipv4.tcp_slow_start_after_idle = 0' . PHP_EOL . 'net.ipv4.tcp_fin_timeout = 15' . PHP_EOL . 'net.ipv4.tcp_keepalive_time = 300' . PHP_EOL . 'net.ipv4.tcp_keepalive_probes = 5' . PHP_EOL . 'net.ipv4.tcp_keepalive_intvl = 15' . PHP_EOL . 'fs.file-max=20970800' . PHP_EOL . 'fs.nr_open=20970800' . PHP_EOL . 'fs.aio-max-nr=20970800' . PHP_EOL . 'net.ipv4.tcp_timestamps = 1' . PHP_EOL . 'net.ipv4.tcp_window_scaling = 1' . PHP_EOL . 'net.ipv4.tcp_mtu_probing = 1' . PHP_EOL . 'net.ipv4.route.flush = 1' . PHP_EOL . 'net.ipv6.route.flush = 1'; + $rSysCtl = '# XC_VM' . PHP_EOL . PHP_EOL . 'net.ipv4.tcp_congestion_control = bbr' . PHP_EOL . 'net.core.default_qdisc = fq' . PHP_EOL . 'net.ipv4.tcp_rmem = 8192 87380 134217728' . PHP_EOL . 'net.ipv4.udp_rmem_min = 16384' . PHP_EOL . 'net.core.rmem_default = 262144' . PHP_EOL . 'net.core.rmem_max = 268435456' . PHP_EOL . 'net.ipv4.tcp_wmem = 8192 65536 134217728' . PHP_EOL . 'net.ipv4.udp_wmem_min = 16384' . PHP_EOL . 'net.core.wmem_default = 262144' . PHP_EOL . 'net.core.wmem_max = 268435456' . PHP_EOL . 'net.core.somaxconn = 1000000' . PHP_EOL . 'net.core.netdev_max_backlog = 250000' . PHP_EOL . 'net.core.optmem_max = 65535' . PHP_EOL . 'net.ipv4.tcp_max_tw_buckets = 1440000' . PHP_EOL . 'net.ipv4.tcp_max_orphans = 16384' . PHP_EOL . 'net.ipv4.ip_local_port_range = 2000 65000' . PHP_EOL . 'net.ipv4.tcp_no_metrics_save = 1' . PHP_EOL . 'net.ipv4.tcp_slow_start_after_idle = 0' . PHP_EOL . 'net.ipv4.tcp_fin_timeout = 15' . PHP_EOL . 'net.ipv4.tcp_keepalive_time = 300' . PHP_EOL . 'net.ipv4.tcp_keepalive_probes = 5' . PHP_EOL . 'net.ipv4.tcp_keepalive_intvl = 15' . PHP_EOL . 'fs.file-max=20970800' . PHP_EOL . 'fs.nr_open=20970800' . PHP_EOL . 'fs.aio-max-nr=20970800' . PHP_EOL . 'net.ipv4.tcp_timestamps = 1' . PHP_EOL . 'net.ipv4.tcp_window_scaling = 1' . PHP_EOL . 'net.ipv4.tcp_mtu_probing = 1' . PHP_EOL . 'net.ipv4.route.flush = 1' . PHP_EOL . 'net.ipv6.route.flush = 1'; $rInstallDir = BIN_PATH . 'install/'; if ($rType == 1) { @@ -198,7 +198,7 @@ class ServerInstallCommand implements CommandInterface { } private function updateSystemAndInstallPackages($rConn, callable $rRunSSH, array $rPackages, int $rType): void { - echo "\nStopping any previous version of \XC_VM\n"; + echo "\nStopping any previous version of XC_VM\n"; call_user_func($rRunSSH, $rConn, 'sudo systemctl stop xc_vm'); call_user_func($rRunSSH, $rConn, 'sudo killall -9 -u xc_vm'); @@ -231,7 +231,7 @@ class ServerInstallCommand implements CommandInterface { return; } - echo "Creating \XC_VM system user\n"; + echo "Creating XC_VM system user\n"; call_user_func($rRunSSH, $rConn, 'sudo adduser --system --shell /bin/false --group --disabled-login xc_vm'); call_user_func($rRunSSH, $rConn, 'sudo mkdir ' . MAIN_HOME); call_user_func($rRunSSH, $rConn, 'sudo rm -rf ' . BIN_PATH); diff --git a/src/Cli/Commands/ServiceCommand.php b/src/Cli/Commands/ServiceCommand.php index 2fab9bc3..16551737 100644 --- a/src/Cli/Commands/ServiceCommand.php +++ b/src/Cli/Commands/ServiceCommand.php @@ -5,7 +5,7 @@ namespace XcVm\Cli\Commands; use XcVm\Cli\CommandInterface; /** - * Управление сервисом \XC_VM (start/stop/restart/reload). + * Управление сервисом XC_VM (start/stop/restart/reload). * * Команда: service {start|stop|restart|reload} * Требует: root @@ -27,7 +27,7 @@ class ServiceCommand implements CommandInterface { } public function getDescription(): string { - return 'Manage \XC_VM service: start, stop, restart, reload'; + return 'Manage XC_VM service: start, stop, restart, reload'; } public function execute(array $rArgs): int { @@ -60,7 +60,7 @@ class ServiceCommand implements CommandInterface { return 1; } - echo "Starting \XC_VM...\n"; + echo "Starting XC_VM...\n"; exec('sudo chown -R xc_vm:xc_vm /sys/class/net'); exec('sudo chown -R xc_vm:xc_vm ' . MAIN_HOME . 'content/streams'); @@ -93,7 +93,7 @@ class ServiceCommand implements CommandInterface { return 1; } - echo "Stopping \XC_VM...\n"; + echo "Stopping XC_VM...\n"; exec('sudo killall -u xc_vm'); sleep(1); exec('sudo killall -u xc_vm'); @@ -114,7 +114,7 @@ class ServiceCommand implements CommandInterface { return 1; } - echo "Reloading \XC_VM...\n"; + echo "Reloading XC_VM...\n"; exec('sudo -u xc_vm ' . MAIN_HOME . 'bin/nginx/sbin/nginx -s reload'); exec('sudo -u xc_vm ' . MAIN_HOME . 'bin/nginx_rtmp/sbin/nginx_rtmp -s reload'); return 0; diff --git a/src/Cli/Commands/StartupCommand.php b/src/Cli/Commands/StartupCommand.php index 262ee959..2bff4f36 100644 --- a/src/Cli/Commands/StartupCommand.php +++ b/src/Cli/Commands/StartupCommand.php @@ -89,15 +89,15 @@ class StartupCommand implements CommandInterface { private function installRootCrontab(): void { $rCrons = array(); - $rCrons[] = '* * * * * ' . PHP_BIN . ' ' . MAIN_HOME . 'console.php cron:root_signals # \XC_VM'; + $rCrons[] = '* * * * * ' . PHP_BIN . ' ' . MAIN_HOME . 'console.php cron:root_signals # XC_VM'; if (file_exists(MAIN_HOME . 'Cli/CronJobs/RootMysqlCronJob.php')) { - $rCrons[] = '* * * * * ' . PHP_BIN . ' ' . MAIN_HOME . 'console.php cron:root_mysql # \XC_VM'; + $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')) { - $rCrons[] = '17 3 * * * sudo -u xc_vm ' . PHP_BIN . ' ' . MAIN_HOME . 'console.php cron:module_licenses # \XC_VM'; + $rCrons[] = '17 3 * * * sudo -u xc_vm ' . PHP_BIN . ' ' . MAIN_HOME . 'console.php cron:module_licenses # XC_VM'; } foreach ((new ModuleLoader())->loadAll()->collectCronEntries() as $rEntry) { @@ -108,10 +108,14 @@ class StartupCommand implements CommandInterface { $rOutput = array(); exec('sudo crontab -l', $rOutput); - // Удаляем старые записи от \XC_VM v1.x.x, чтобы не было дубликатов, и проверяем наличие нужных записей + // Удаляем старые записи XC_VM: путь v1.x.x (crons/root_) и любые + // строки с нашим маркером — включая старый '# \XC_VM' от прошлой + // миграции — чтобы при апгрейде не появлялись дубликаты. $rFiltered = array(); foreach ($rOutput as $rLine) { - if (strpos($rLine, MAIN_HOME . 'crons/root_') !== false) { + if (strpos($rLine, MAIN_HOME . 'crons/root_') !== false + || strpos($rLine, '# XC_VM') !== false + || strpos($rLine, '# \XC_VM') !== false) { $rWrite = true; continue; } diff --git a/src/Cli/Commands/StatusCommand.php b/src/Cli/Commands/StatusCommand.php index 6047f9f5..cbf617cf 100644 --- a/src/Cli/Commands/StatusCommand.php +++ b/src/Cli/Commands/StatusCommand.php @@ -196,9 +196,9 @@ class StatusCommand implements CommandInterface { private function installRootCrontab(): void { $rCrons = array(); - $rCrons[] = '* * * * * ' . PHP_BIN . ' ' . MAIN_HOME . 'console.php cron:root_signals # \XC_VM'; + $rCrons[] = '* * * * * ' . PHP_BIN . ' ' . MAIN_HOME . 'console.php cron:root_signals # XC_VM'; if (file_exists(MAIN_HOME . 'Cli/CronJobs/RootMysqlCronJob.php')) { - $rCrons[] = '* * * * * ' . PHP_BIN . ' ' . MAIN_HOME . 'console.php cron:root_mysql # \XC_VM'; + $rCrons[] = '* * * * * ' . PHP_BIN . ' ' . MAIN_HOME . 'console.php cron:root_mysql # XC_VM'; } foreach ((new ModuleLoader())->loadAll()->collectCronEntries() as $rEntry) { @@ -209,6 +209,18 @@ class StatusCommand implements CommandInterface { $rOutput = array(); exec('sudo crontab -l', $rOutput); + // Удаляем старые строки с нашим маркером (включая '# \XC_VM' от + // прошлой миграции), чтобы при апгрейде не появлялись дубликаты. + $rFiltered = array(); + foreach ($rOutput as $rLine) { + if (strpos($rLine, '# XC_VM') !== false || strpos($rLine, '# \XC_VM') !== false) { + $rWrite = true; + continue; + } + $rFiltered[] = $rLine; + } + $rOutput = $rFiltered; + foreach ($rCrons as $rCron) { if (!in_array($rCron, $rOutput)) { $rOutput[] = $rCron; @@ -417,7 +429,7 @@ class StatusCommand implements CommandInterface { } if ($rOffline === 0) { - echo "All servers are Online and reporting back to \XC_VM!\n\n"; + echo "All servers are Online and reporting back to XC_VM!\n\n"; } else { echo "\n"; } diff --git a/src/Cli/Commands/ThumbnailCommand.php b/src/Cli/Commands/ThumbnailCommand.php index 1be32427..ea79d5e2 100644 --- a/src/Cli/Commands/ThumbnailCommand.php +++ b/src/Cli/Commands/ThumbnailCommand.php @@ -29,7 +29,7 @@ class ThumbnailCommand implements CommandInterface { public function execute(array $rArgs): int { if (posix_getpwuid(posix_geteuid())['name'] != 'xc_vm') { - echo "Please run as \XC_VM!\n"; + echo "Please run as XC_VM!\n"; return 1; } diff --git a/src/Cli/Commands/ToolsCommand.php b/src/Cli/Commands/ToolsCommand.php index 012e8716..899248f1 100644 --- a/src/Cli/Commands/ToolsCommand.php +++ b/src/Cli/Commands/ToolsCommand.php @@ -85,7 +85,7 @@ class ToolsCommand implements CommandInterface { // xc_vm subcommands if ($rUser !== 'xc_vm') { - echo "Please run as \XC_VM!\n"; + echo "Please run as XC_VM!\n"; return 1; } @@ -134,7 +134,7 @@ class ToolsCommand implements CommandInterface { if ($database !== null) { echo 'Restoring: ' . $database . "\n"; - if (!\XC_VM::db_restore($database, 'xc_vm_migrate')) { + if (!XC_VM::db_restore($database, 'xc_vm_migrate')) { echo "Error: Restore failed. Check the SQL file and database credentials.\n"; return 1; } @@ -212,7 +212,7 @@ class ToolsCommand implements CommandInterface { echo " migration Clear migration database and optionally restore .sql backup\n"; echo " user Create a rescue admin user for the admin panel\n"; echo " mysql Reauthorise load balancers on MySQL\n"; - echo " database Restore blank \XC_VM database (requires --confirm)\n"; + echo " database Restore blank XC_VM database (requires --confirm)\n"; echo " flush Flush all blocked IPs (iptables + database)\n"; } diff --git a/src/Cli/CronJobs/RootSignalsCronJob.php b/src/Cli/CronJobs/RootSignalsCronJob.php index b966c2a8..b57f2ec0 100644 --- a/src/Cli/CronJobs/RootSignalsCronJob.php +++ b/src/Cli/CronJobs/RootSignalsCronJob.php @@ -261,7 +261,7 @@ class RootSignalsCronJob implements CommandInterface { $rXC_VMList = trim(implode("\n", array_unique($rXC_VMList))); $rCurrentList = (trim(file_get_contents(BIN_PATH . 'nginx/conf/realip_xc_vm.conf')) ?: ''); if ($rXC_VMList != $rCurrentList) { - echo 'Updating \XC_VM IP List...' . "\n"; + echo 'Updating XC_VM IP List...' . "\n"; file_put_contents(BIN_PATH . 'nginx/conf/realip_xc_vm.conf', $rXC_VMList); $rReload = true; } @@ -494,7 +494,7 @@ class RootSignalsCronJob implements CommandInterface { $rJobs = []; $db->query('SELECT * FROM `crontab` WHERE `enabled` = 1;'); foreach ($db->get_rows() as $rRow) { - $rJobs[] = $rRow['time'] . ' ' . PHP_BIN . ' ' . MAIN_HOME . 'console.php cron:' . $rRow['filename'] . ' # \XC_VM'; + $rJobs[] = $rRow['time'] . ' ' . PHP_BIN . ' ' . MAIN_HOME . 'console.php cron:' . $rRow['filename'] . ' # XC_VM'; } $rActualCron = trim(implode("\n", $rJobs)); if ($rCurrentCron != $rActualCron) { @@ -505,10 +505,10 @@ class RootSignalsCronJob implements CommandInterface { } } if (file_exists(CONFIG_PATH . 'sysctl.on')) { - if (strtoupper(substr(explode("\n", file_get_contents('/etc/sysctl.conf'))[0], 0, 9)) != '# \XC_VM') { + if (strtoupper(substr(explode("\n", file_get_contents('/etc/sysctl.conf'))[0], 0, 7)) != '# XC_VM') { echo 'Sysctl missing! Writing it.' . "\n"; exec('sudo modprobe ip_conntrack'); - file_put_contents('/etc/sysctl.conf', implode(PHP_EOL, ['# \XC_VM', '', 'net.core.somaxconn = 655350', 'net.ipv4.route.flush=1', 'net.ipv4.tcp_no_metrics_save=1', 'net.ipv4.tcp_moderate_rcvbuf = 1', 'fs.file-max = 6815744', 'fs.aio-max-nr = 6815744', 'fs.nr_open = 6815744', 'net.ipv4.ip_local_port_range = 1024 65000', 'net.ipv4.tcp_sack = 1', 'net.ipv4.tcp_rmem = 10000000 10000000 10000000', 'net.ipv4.tcp_wmem = 10000000 10000000 10000000', 'net.ipv4.tcp_mem = 10000000 10000000 10000000', 'net.core.rmem_max = 524287', 'net.core.wmem_max = 524287', 'net.core.rmem_default = 524287', 'net.core.wmem_default = 524287', 'net.core.optmem_max = 524287', 'net.core.netdev_max_backlog = 300000', 'net.ipv4.tcp_max_syn_backlog = 300000', 'net.netfilter.nf_conntrack_max=1215196608', 'net.ipv4.tcp_window_scaling = 1', 'vm.max_map_count = 655300', 'net.ipv4.tcp_max_tw_buckets = 50000', 'net.ipv6.conf.all.disable_ipv6 = 1', 'net.ipv6.conf.default.disable_ipv6 = 1', 'net.ipv6.conf.lo.disable_ipv6 = 1', 'kernel.shmmax=134217728', 'kernel.shmall=134217728', 'vm.overcommit_memory = 1', 'net.ipv4.tcp_tw_reuse=1'])); + file_put_contents('/etc/sysctl.conf', implode(PHP_EOL, ['# XC_VM', '', 'net.core.somaxconn = 655350', 'net.ipv4.route.flush=1', 'net.ipv4.tcp_no_metrics_save=1', 'net.ipv4.tcp_moderate_rcvbuf = 1', 'fs.file-max = 6815744', 'fs.aio-max-nr = 6815744', 'fs.nr_open = 6815744', 'net.ipv4.ip_local_port_range = 1024 65000', 'net.ipv4.tcp_sack = 1', 'net.ipv4.tcp_rmem = 10000000 10000000 10000000', 'net.ipv4.tcp_wmem = 10000000 10000000 10000000', 'net.ipv4.tcp_mem = 10000000 10000000 10000000', 'net.core.rmem_max = 524287', 'net.core.wmem_max = 524287', 'net.core.rmem_default = 524287', 'net.core.wmem_default = 524287', 'net.core.optmem_max = 524287', 'net.core.netdev_max_backlog = 300000', 'net.ipv4.tcp_max_syn_backlog = 300000', 'net.netfilter.nf_conntrack_max=1215196608', 'net.ipv4.tcp_window_scaling = 1', 'vm.max_map_count = 655300', 'net.ipv4.tcp_max_tw_buckets = 50000', 'net.ipv6.conf.all.disable_ipv6 = 1', 'net.ipv6.conf.default.disable_ipv6 = 1', 'net.ipv6.conf.lo.disable_ipv6 = 1', 'kernel.shmmax=134217728', 'kernel.shmall=134217728', 'vm.overcommit_memory = 1', 'net.ipv4.tcp_tw_reuse=1'])); exec('sudo sysctl -p > /dev/null'); } } @@ -577,7 +577,7 @@ class RootSignalsCronJob implements CommandInterface { break; case 'update_binaries': echo 'Updating binaries...' . "\n"; - $db->query("INSERT INTO `mysql_syslog`(`server_id`, `type`, `error`, `username`, `ip`, `database`, `date`) VALUES(?, 'BINARIES', 'Updating \XC_VM binaries from \XC_VM server...', 'root', 'localhost', NULL, ?);", SERVER_ID, time()); + $db->query("INSERT INTO `mysql_syslog`(`server_id`, `type`, `error`, `username`, `ip`, `database`, `date`) VALUES(?, 'BINARIES', 'Updating XC_VM binaries from XC_VM server...', 'root', 'localhost', NULL, ?);", SERVER_ID, time()); shell_exec('sudo ' . PHP_BIN . ' ' . MAIN_HOME . 'console.php binaries 2>&1 &'); break; case 'install_module': @@ -592,7 +592,7 @@ class RootSignalsCronJob implements CommandInterface { break; case 'update': echo 'Updating...' . "\n"; - $db->query("INSERT INTO `mysql_syslog`(`server_id`, `type`, `error`, `username`, `ip`, `database`, `date`) VALUES(?, 'UPDATE', 'Updating \XC_VM...', 'root', 'localhost', NULL, ?);", SERVER_ID, time()); + $db->query("INSERT INTO `mysql_syslog`(`server_id`, `type`, `error`, `username`, `ip`, `database`, `date`) VALUES(?, 'UPDATE', 'Updating XC_VM...', 'root', 'localhost', NULL, ?);", SERVER_ID, time()); shell_exec('sudo ' . PHP_BIN . ' ' . MAIN_HOME . 'console.php update update 2>&1 &'); break; case 'set_services': diff --git a/src/Cli/CronJobs/StreamsCronJob.php b/src/Cli/CronJobs/StreamsCronJob.php index 938301e8..4529de78 100644 --- a/src/Cli/CronJobs/StreamsCronJob.php +++ b/src/Cli/CronJobs/StreamsCronJob.php @@ -297,14 +297,14 @@ class StreamsCronJob implements CommandInterface { $db->query('SELECT `stream_id` FROM `streams_servers` WHERE `on_demand` = 1 AND `server_id` = ?;', SERVER_ID); $rOnDemandIDs = array_keys($db->get_rows(true, 'stream_id')); - $rProcesses = shell_exec('ps aux | grep \XC_VM'); - if (preg_match_all('/\XC_VM\\[(.*)\\]/', $rProcesses, $rMatches)) { + $rProcesses = shell_exec('ps aux | grep XC_VM'); + if (preg_match_all('/XC_VM\\[(.*)\\]/', $rProcesses, $rMatches)) { $rRemove = array_diff($rMatches[1], $rStreamIDs); $rRemove = array_diff($rRemove, $rOnDemandIDs); foreach ($rRemove as $rStreamID) { if (is_numeric($rStreamID)) { echo 'Kill Stream ID: ' . $rStreamID . "\n"; - shell_exec("kill -9 `ps -ef | grep '/" . intval($rStreamID) . '_.m3u8\\|\XC_VM\\[' . intval($rStreamID) . "\\]' | grep -v grep | awk '{print \$2}'`;"); + shell_exec("kill -9 `ps -ef | grep '/" . intval($rStreamID) . '_.m3u8\\|XC_VM\\[' . intval($rStreamID) . "\\]' | grep -v grep | awk '{print \$2}'`;"); shell_exec('rm -f ' . STREAMS_PATH . intval($rStreamID) . '_*'); } } diff --git a/src/Cli/CronJobs/UpdateCronJob.php b/src/Cli/CronJobs/UpdateCronJob.php index 66e7828c..dea03373 100644 --- a/src/Cli/CronJobs/UpdateCronJob.php +++ b/src/Cli/CronJobs/UpdateCronJob.php @@ -29,7 +29,7 @@ class UpdateCronJob implements CommandInterface { } public function getDescription(): string { - return 'Cron: check for \XC_VM updates'; + return 'Cron: check for XC_VM updates'; } public function execute(array $rArgs): int { diff --git a/src/Cli/CronTrait.php b/src/Cli/CronTrait.php index cfaf39c7..ce38ef6d 100644 --- a/src/Cli/CronTrait.php +++ b/src/Cli/CronTrait.php @@ -29,7 +29,7 @@ trait CronTrait { */ protected function assertRunAsXcVm(): bool { if ((posix_getpwuid(posix_geteuid())['name'] ?? null) !== 'xc_vm') { - echo "Please run as \XC_VM!\n"; + echo "Please run as XC_VM!\n"; return false; } return true; diff --git a/src/Cli/DaemonTrait.php b/src/Cli/DaemonTrait.php index 1bf0e8ea..979cf7b6 100644 --- a/src/Cli/DaemonTrait.php +++ b/src/Cli/DaemonTrait.php @@ -39,7 +39,7 @@ trait DaemonTrait { */ protected function assertRunAsXcVm(): bool { if (posix_getpwuid(posix_geteuid())['name'] !== 'xc_vm') { - echo "Please run as \XC_VM!\n"; + echo "Please run as XC_VM!\n"; return false; } return true; diff --git a/src/Cli/migration_logic.php b/src/Cli/migration_logic.php index 7c163b85..28f3aceb 100644 --- a/src/Cli/migration_logic.php +++ b/src/Cli/migration_logic.php @@ -50,7 +50,7 @@ if ($odb->num_rows() > 0) { echo "\n" . "Couldn't find anything to migrate in the `xc_vm_migrate` database. Please ensure you restore your backup to that database specifically." . "\n\n"; exit(); } - echo "\n" . 'Migrating database to \XC_VM...' . "\n\n"; + echo "\n" . 'Migrating database to XC_VM...' . "\n\n"; if (in_array('access_codes', $rMigrateOptions)) { $odb->query('SELECT * FROM `access_codes`;'); @@ -644,7 +644,7 @@ if ($odb->num_rows() > 0) { echo "\n" . "Couldn't find anything to migrate in the `xc_vm_migrate` database. Please ensure you restore your backup to that database specifically." . "\n\n"; exit(); } - echo "\n" . 'Migrating database to \XC_VM...' . "\n\n"; + echo "\n" . 'Migrating database to XC_VM...' . "\n\n"; echo 'Remapping bouquets.' . "\n"; $rSeriesMap = $rBouquetMap = array(); @@ -1595,7 +1595,7 @@ try { if (in_array('access_codes', $rMigrateOptions)) { echo "\n" . 'Admin acces code: ' . $AdminAccesCode; } -echo "\n" . 'Migration has been completed!' . "\n\n" . 'Your settings have been reset to the \XC_VM default, please take some time to review the settings page and make the desired changes.' . "\n"; +echo "\n" . 'Migration has been completed!' . "\n\n" . 'Your settings have been reset to the XC_VM default, please take some time to review the settings page and make the desired changes.' . "\n"; file_put_contents(TMP_PATH . '.migration.status', 2); if (is_object($odb)) { diff --git a/src/Core/Database/QueryHelper.php b/src/Core/Database/QueryHelper.php index 151975b8..e9a4e41f 100644 --- a/src/Core/Database/QueryHelper.php +++ b/src/Core/Database/QueryHelper.php @@ -3,7 +3,7 @@ namespace XcVm\Core\Database; /* - * \XC_VM — Утилиты для работы с SQL-запросами + * XC_VM — Утилиты для работы с SQL-запросами * * Статические методы для подготовки данных и проверки существования записей. */ diff --git a/src/Core/GeoIP/MaxMindUpdater.php b/src/Core/GeoIP/MaxMindUpdater.php index 15c0619d..3d7e6f14 100644 --- a/src/Core/GeoIP/MaxMindUpdater.php +++ b/src/Core/GeoIP/MaxMindUpdater.php @@ -13,7 +13,7 @@ use XcVm\Core\Util\GeoIP; * @link https://github.com/Vateron-Media/XC_VM * @license AGPL-3.0 https://www.gnu.org/licenses/agpl-3.0.html * - * A PHP class created for the \XC_VM project to update GeoIP databases. + * A PHP class created for the XC_VM project to update GeoIP databases. * Supports free GeoLite2 and paid GeoIP2 editions via MaxMind API, * downloads tar.gz archives, extracts .mmdb files, and updates version metadata. * @@ -91,7 +91,7 @@ class MaxMindUpdater { $destPath = self::MAXMIND_DIR . $edition . '.mmdb'; $result = ['edition' => $edition, 'updated' => false, 'error' => null]; - $headers = ['User-Agent: \XC_VM-MaxMind-Updater/1.0']; + $headers = ['User-Agent: XC_VM-MaxMind-Updater/1.0']; if (!$force && file_exists($destPath)) { $headers[] = 'If-Modified-Since: ' . gmdate('D, d M Y H:i:s', filemtime($destPath)) . ' GMT'; diff --git a/src/Core/Init/LegacyInitializer.php b/src/Core/Init/LegacyInitializer.php index b38cb4d8..4a016f91 100644 --- a/src/Core/Init/LegacyInitializer.php +++ b/src/Core/Init/LegacyInitializer.php @@ -94,7 +94,7 @@ class LegacyInitializer { $rJobs = array(); $db->query('SELECT * FROM `crontab` WHERE `enabled` = 1;'); foreach ($db->get_rows() as $rRow) { - $rJobs[] = $rRow['time'] . ' ' . PHP_BIN . ' ' . MAIN_HOME . 'console.php cron:' . $rRow['filename'] . ' # \XC_VM'; + $rJobs[] = $rRow['time'] . ' ' . PHP_BIN . ' ' . MAIN_HOME . 'console.php cron:' . $rRow['filename'] . ' # XC_VM'; } shell_exec('crontab -r'); diff --git a/src/Core/Localization/Translator.php b/src/Core/Localization/Translator.php index f2133d40..f00ddddf 100644 --- a/src/Core/Localization/Translator.php +++ b/src/Core/Localization/Translator.php @@ -3,12 +3,12 @@ namespace XcVm\Core\Localization; /** - * Translator — \XC_VM multilingual support system. + * Translator — XC_VM multilingual support system. * * Loads translations from INI files, switches language via cookie, * automatically copies missing keys from en.ini into the current language. * - * @package \XC_VM\Core\Localization + * @package XC_VM\Core\Localization * @author Divarion_D * @copyright 2025-2026 Vateron Media * @license AGPL-3.0 https://www.gnu.org/licenses/agpl-3.0.html diff --git a/src/Core/Process/ProcessManager.php b/src/Core/Process/ProcessManager.php index 462b58f6..d94c891d 100644 --- a/src/Core/Process/ProcessManager.php +++ b/src/Core/Process/ProcessManager.php @@ -17,7 +17,7 @@ namespace XcVm\Core\Process; * // Check if a process with specific executable is running * if (ProcessManager::isRunning($pid, 'ffmpeg')) { ... } * - * // Check named process (\XC_VM[123], Thumbnail[456], etc.) + * // Check named process (XC_VM[123], Thumbnail[456], etc.) * if (ProcessManager::isNamedProcessRunning($pid, 'XC_VM', $streamId, PHP_BIN)) { ... } * * // Kill a process @@ -82,7 +82,7 @@ class ProcessManager { } /** - * Check if a named process is running (e.g., \XC_VM[123]) + * Check if a named process is running (e.g., XC_VM[123]) * * Reads /proc/PID/cmdline and matches against "NAME[ID]" pattern. * @@ -379,7 +379,7 @@ class ProcessManager { * Check if a monitor/proxy process is running. * * Extracted from ProcessManager::isMonitorAlive(). - * Checks for \XC_VM[streamID] OR XC_VMProxy[streamID] in cmdline. + * Checks for XC_VM[streamID] OR XC_VMProxy[streamID] in cmdline. * * @param int $pid Process ID * @param int|string $streamID Stream identifier diff --git a/src/Core/Updates/GitHubReleases.php b/src/Core/Updates/GitHubReleases.php index cc973d31..01d95b77 100644 --- a/src/Core/Updates/GitHubReleases.php +++ b/src/Core/Updates/GitHubReleases.php @@ -11,7 +11,7 @@ namespace XcVm\Core\Updates; * @link https://github.com/Vateron-Media/XC_VM * @license AGPL-3.0 https://www.gnu.org/licenses/agpl-3.0.html * - * A PHP class created specifically for the \XC_VM project to interact with the GitHub Releases API. + * A PHP class created specifically for the XC_VM project to interact with the GitHub Releases API. * Provides methods to fetch release versions, changelogs, asset hashes, and GeoLite database information * with caching support. */ @@ -306,7 +306,7 @@ class GitHubReleases { curl_setopt($ch, CURLOPT_TIMEOUT, $this->timeout); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $this->connect_timeout); curl_setopt($ch, CURLOPT_HTTPHEADER, $this->headers); - curl_setopt($ch, CURLOPT_USERAGENT, 'Vateron-Media/\XC_VM'); + curl_setopt($ch, CURLOPT_USERAGENT, 'Vateron-Media/XC_VM'); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); diff --git a/src/Core/Util/StreamUtils.php b/src/Core/Util/StreamUtils.php index e0302d52..72b9bbb3 100644 --- a/src/Core/Util/StreamUtils.php +++ b/src/Core/Util/StreamUtils.php @@ -163,10 +163,10 @@ class StreamUtils { } /** - * Heuristically detect whether a URL is an \XC_VM stream endpoint. + * Heuristically detect whether a URL is an XC_VM stream endpoint. * * @param string $rURL URL to inspect. - * @return bool True if the path matches a known \XC_VM stream pattern. + * @return bool True if the path matches a known XC_VM stream pattern. */ public static function detectXC_VM($rURL) { $rPath = parse_url($rURL)['path']; diff --git a/src/Streaming/AsyncFileOperations.php b/src/Streaming/AsyncFileOperations.php index e904c7fb..df9a81c1 100644 --- a/src/Streaming/AsyncFileOperations.php +++ b/src/Streaming/AsyncFileOperations.php @@ -11,7 +11,7 @@ namespace XcVm\Streaming; * @link https://github.com/Vateron-Media/XC_VM * @license AGPL-3.0 https://www.gnu.org/licenses/agpl-3.0.html * - * A PHP class created specifically for the \XC_VM project to perform + * A PHP class created specifically for the XC_VM project to perform * efficient non-blocking file system operations. * * The class replaces CPU-heavy polling and blocking sleep() calls with