mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-02-10 19:49:35 +00:00
Fixed phpstan issues
This commit is contained in:
parent
a755287c3b
commit
cad5261aba
6 changed files with 11 additions and 10 deletions
|
|
@ -6,6 +6,9 @@ parameters:
|
|||
- src
|
||||
# - tests
|
||||
|
||||
banned_code:
|
||||
non_ignorable: false # Allow to ignore some banned code
|
||||
|
||||
excludePaths:
|
||||
- src/DataTables/Adapter/*
|
||||
- src/Configuration/*
|
||||
|
|
@ -61,3 +64,6 @@ parameters:
|
|||
|
||||
# Ignore error of unused WithPermPresetsTrait, as it is used in the migrations which are not analyzed by Phpstan
|
||||
- '#Trait App\\Migration\\WithPermPresetsTrait is used zero times and is not analysed#'
|
||||
-
|
||||
message: '#Should not use function "shell_exec"#'
|
||||
path: src/Services/System/UpdateExecutor.php
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ class MaintenanceModeCommand extends Command
|
|||
|
||||
if ($enable) {
|
||||
// Use provided message or fallback to a default English message
|
||||
$reason = is_string($message) && $message !== ''
|
||||
$reason = is_string($message)
|
||||
? $message
|
||||
: 'The system is temporarily unavailable due to maintenance.';
|
||||
|
||||
|
|
|
|||
|
|
@ -28,8 +28,6 @@ use Symfony\Component\Process\Process;
|
|||
|
||||
class CommandRunHelper
|
||||
{
|
||||
private UpdateExecutor $updateExecutor;
|
||||
|
||||
public function __construct(
|
||||
#[Autowire(param: 'kernel.project_dir')] private readonly string $project_dir
|
||||
)
|
||||
|
|
|
|||
|
|
@ -33,8 +33,6 @@ use Version\Version;
|
|||
*/
|
||||
class UpdateAvailableFacade
|
||||
{
|
||||
|
||||
private const API_URL = 'https://api.github.com/repos/Part-DB/Part-DB-server/releases/latest';
|
||||
private const CACHE_KEY = 'uam_latest_version';
|
||||
private const CACHE_TTL = 60 * 60 * 24 * 2; // 2 day
|
||||
|
||||
|
|
|
|||
|
|
@ -145,15 +145,12 @@ class UpdateChecker
|
|||
/**
|
||||
* Get all available releases from GitHub (cached).
|
||||
*
|
||||
* @return array<array{version: string, tag: string, name: string, url: string, published_at: string, body: string, prerelease: bool, assets: array}>
|
||||
* @return array<array{version: string, tag: string, name: string, url: string, published_at: string, body: string, prerelease: bool, draft:bool, assets: array, tarball_url: ?string, zipball_url: ?string}>
|
||||
*/
|
||||
public function getAvailableReleases(int $limit = 10): array
|
||||
{
|
||||
if (!$this->privacySettings->checkForUpdates) {
|
||||
return [ //If we don't want to check for updates, we can return dummy data
|
||||
'version' => '0.0.1',
|
||||
'url' => 'update-checking-disabled'
|
||||
];
|
||||
return [];
|
||||
}
|
||||
|
||||
return $this->updateCache->get(self::CACHE_KEY_RELEASES, function (ItemInterface $item) use ($limit) {
|
||||
|
|
|
|||
|
|
@ -863,6 +863,8 @@ class UpdateExecutor
|
|||
|
||||
// Execute in background using shell_exec for proper detachment
|
||||
// shell_exec with & runs the command in background
|
||||
|
||||
//@php-ignore-next-line We really need to use shell_exec here
|
||||
$output = shell_exec($command);
|
||||
|
||||
// Give it a moment to start
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue