fix: correct cli.php path for phar
This commit is contained in:
@@ -79,7 +79,7 @@ class SettingsHandler
|
|||||||
$data['forms'] = [];
|
$data['forms'] = [];
|
||||||
|
|
||||||
// Add CRON system details (read-only)
|
// Add CRON system details (read-only)
|
||||||
$data['cron']['cli_path'] = dirname(DIR_SYSTEM) . '/cli.php';
|
$data['cron']['cli_path'] = BP_REAL_BASE_PATH . '/cli.php';
|
||||||
$data['cron']['last_run'] = $this->getLastCronRunDate();
|
$data['cron']['last_run'] = $this->getLastCronRunDate();
|
||||||
|
|
||||||
$forms = $this->builder->newQuery()
|
$forms = $this->builder->newQuery()
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ class ScheduleListCommand extends TeleCartCommand
|
|||||||
$registry = new ScheduleJobRegistry($this->container);
|
$registry = new ScheduleJobRegistry($this->container);
|
||||||
|
|
||||||
// Load schedule config
|
// Load schedule config
|
||||||
$configFile = BP_BASE_PATH . '/configs/schedule.php';
|
$configFile = BP_PHAR_BASE_PATH . '/configs/schedule.php';
|
||||||
if (file_exists($configFile)) {
|
if (file_exists($configFile)) {
|
||||||
$scheduler = $registry; // Variable name used in config file
|
$scheduler = $registry; // Variable name used in config file
|
||||||
require $configFile;
|
require $configFile;
|
||||||
|
|||||||
@@ -17,7 +17,12 @@ use Symfony\Component\HttpFoundation\Response;
|
|||||||
// phpcs:disable PSR1.Files.SideEffects
|
// phpcs:disable PSR1.Files.SideEffects
|
||||||
if (! defined('BP_BASE_PATH')) {
|
if (! defined('BP_BASE_PATH')) {
|
||||||
$phar = Phar::running(false);
|
$phar = Phar::running(false);
|
||||||
define('BP_BASE_PATH', $phar ? "phar://$phar" : dirname(__DIR__) . '/..');
|
$realBasePath = $phar ? dirname($phar) : dirname(__DIR__) . '/..';
|
||||||
|
$pharBasePath = $phar ? "phar://$phar" : $realBasePath;
|
||||||
|
|
||||||
|
define('BP_REAL_BASE_PATH', $realBasePath);
|
||||||
|
define('BP_PHAR_BASE_PATH', $pharBasePath);
|
||||||
|
define('BP_BASE_PATH', $pharBasePath);
|
||||||
}
|
}
|
||||||
// phpcs:enable PSR1.Files.SideEffects
|
// phpcs:enable PSR1.Files.SideEffects
|
||||||
|
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ class SchedulerService
|
|||||||
|
|
||||||
// Only load config file if registry was not injected (for production use)
|
// Only load config file if registry was not injected (for production use)
|
||||||
if (! $this->registry) {
|
if (! $this->registry) {
|
||||||
$configFile = BP_BASE_PATH . '/configs/schedule.php';
|
$configFile = BP_PHAR_BASE_PATH . '/configs/schedule.php';
|
||||||
if (file_exists($configFile)) {
|
if (file_exists($configFile)) {
|
||||||
require $configFile;
|
require $configFile;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
use Openguru\OpenCartFramework\Application;
|
use Openguru\OpenCartFramework\Application;
|
||||||
use Openguru\OpenCartFramework\Config\Settings;
|
use Openguru\OpenCartFramework\Config\Settings;
|
||||||
use Openguru\OpenCartFramework\Support\Utils;
|
use Openguru\OpenCartFramework\Support\Utils;
|
||||||
use Openguru\OpenCartFramework\TeleCartPulse\TeleCartPulseService;
|
|
||||||
|
|
||||||
if (! function_exists('table')) {
|
if (! function_exists('table')) {
|
||||||
function db_table(string $name): string
|
function db_table(string $name): string
|
||||||
@@ -34,28 +33,28 @@ if (! function_exists('column')) {
|
|||||||
if (! function_exists('configs_path')) {
|
if (! function_exists('configs_path')) {
|
||||||
function configs_path(string $path = ''): string
|
function configs_path(string $path = ''): string
|
||||||
{
|
{
|
||||||
return BP_BASE_PATH . '/configs/' . $path;
|
return BP_PHAR_BASE_PATH . '/configs/' . $path;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! function_exists('resources_path')) {
|
if (! function_exists('resources_path')) {
|
||||||
function resources_path(string $path = ''): string
|
function resources_path(string $path = ''): string
|
||||||
{
|
{
|
||||||
return BP_BASE_PATH . '/resources/' . $path;
|
return BP_PHAR_BASE_PATH . '/resources/' . $path;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! function_exists('database_path')) {
|
if (! function_exists('database_path')) {
|
||||||
function database_path(string $path = ''): string
|
function database_path(string $path = ''): string
|
||||||
{
|
{
|
||||||
return BP_BASE_PATH . '/database/' . $path;
|
return BP_PHAR_BASE_PATH . '/database/' . $path;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! function_exists('base_path')) {
|
if (! function_exists('base_path')) {
|
||||||
function base_path(string $path = ''): string
|
function base_path(string $path = ''): string
|
||||||
{
|
{
|
||||||
return BP_BASE_PATH . '/' . $path;
|
return BP_PHAR_BASE_PATH . '/' . $path;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -111,7 +110,7 @@ if (! function_exists('module_version')) {
|
|||||||
return $version;
|
return $version;
|
||||||
}
|
}
|
||||||
|
|
||||||
$versionFile = BP_BASE_PATH . '/version.txt';
|
$versionFile = BP_PHAR_BASE_PATH . '/version.txt';
|
||||||
if (is_readable($versionFile)) {
|
if (is_readable($versionFile)) {
|
||||||
$raw = trim((string) file_get_contents($versionFile));
|
$raw = trim((string) file_get_contents($versionFile));
|
||||||
if ($raw !== '') {
|
if ($raw !== '') {
|
||||||
@@ -119,7 +118,7 @@ if (! function_exists('module_version')) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$composerFile = BP_BASE_PATH . '/composer.json';
|
$composerFile = BP_PHAR_BASE_PATH . '/composer.json';
|
||||||
if (is_readable($composerFile)) {
|
if (is_readable($composerFile)) {
|
||||||
$composer = json_decode((string) file_get_contents($composerFile), true);
|
$composer = json_decode((string) file_get_contents($composerFile), true);
|
||||||
if (is_array($composer) && ! empty($composer['version'])) {
|
if (is_array($composer) && ! empty($composer['version'])) {
|
||||||
|
|||||||
@@ -9,4 +9,7 @@ parameters:
|
|||||||
scanDirectories:
|
scanDirectories:
|
||||||
- stubs
|
- stubs
|
||||||
|
|
||||||
inferPrivatePropertyTypeFromConstructor: true
|
inferPrivatePropertyTypeFromConstructor: true
|
||||||
|
|
||||||
|
bootstrapFiles:
|
||||||
|
- stubs/phpstan-bootstrap.php
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
// phpstan-bootstrap.php
|
||||||
|
|
||||||
|
// Объявляем константы, чтобы PHPStan их видел
|
||||||
|
if (!defined('BP_REAL_BASE_PATH')) {
|
||||||
|
define('BP_REAL_BASE_PATH', dirname(__DIR__) . '/..');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!defined('BP_PHAR_BASE_PATH')) {
|
||||||
|
define('BP_PHAR_BASE_PATH', dirname(__DIR__) . '/..');
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user