You've already forked Atomcms-edit
refactor: fix PHPStan errors, remove unused code, replace shell_exec with Process
- Fix all 54 PHPStan errors (strict comparisons, unused methods, nullsafe) - Remove unused HasPermissionColumns trait, checkGitHubUpdates, getGitHubLatestCommit - Replace all 31 shell_exec calls with Process facade in Commandocentrum - Add helper methods: runCommand, fileExists, dirExists, readFile - Fix EmulatorJarService and EmulatorSqlService type issues
This commit is contained in:
@@ -1,29 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Emulator\Concerns;
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
trait HasPermissionColumns
|
||||
{
|
||||
protected function getPermissionColumnsFromSchema(): array
|
||||
{
|
||||
if (! Schema::hasTable('permissions')) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$columns = Schema::getColumns('permissions');
|
||||
|
||||
return collect($columns)->filter(function (array $column) {
|
||||
$columnName = $column['name'] ?? null;
|
||||
|
||||
if (! $columnName) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return str_starts_with($columnName, 'cmd')
|
||||
|| str_starts_with($columnName, 'acc')
|
||||
|| str_ends_with($columnName, 'cmd');
|
||||
})->values()->toArray();
|
||||
}
|
||||
}
|
||||
Regular → Executable
Regular → Executable
+5
-5
@@ -162,11 +162,11 @@ class EmulatorJarService
|
||||
$installedJarCommit = $this->settings->getOrDefault('emulator_jar_commit', null);
|
||||
|
||||
$isUpdate = false;
|
||||
if ($installedJarCommit !== null && $commitSha !== null) {
|
||||
if ($installedJarCommit !== null) {
|
||||
$isUpdate = $installedJarCommit !== $commitSha;
|
||||
} elseif ($installedDate !== null && $commitDate) {
|
||||
} elseif ($installedDate !== null && $commitDate !== null) {
|
||||
$isUpdate = (int) $installedDate < $commitDate;
|
||||
} elseif ($installedDate === null && $commitDate) {
|
||||
} elseif ($installedDate === null && $commitDate !== null) {
|
||||
$isUpdate = true;
|
||||
}
|
||||
|
||||
@@ -222,7 +222,7 @@ class EmulatorJarService
|
||||
}
|
||||
|
||||
return [
|
||||
'update_available' => $hasJarUpdates || $hasSourceUpdates,
|
||||
'update_available' => $hasJarUpdates,
|
||||
'current_version' => $this->settings->getOrDefault('emulator_version', '0.0.0'),
|
||||
'latest_version' => $jarInfo['version'],
|
||||
'release_name' => $hasSourceUpdates ? 'Source Update' : 'Direct URL',
|
||||
@@ -307,7 +307,7 @@ class EmulatorJarService
|
||||
}
|
||||
|
||||
return [
|
||||
'update_available' => $hasJarUpdates || $hasSourceUpdates,
|
||||
'update_available' => $hasJarUpdates,
|
||||
'current_version' => $this->settings->getOrDefault('emulator_version', '0.0.0'),
|
||||
'latest_version' => $hasSourceUpdates ? ($sourceInfo['latest_timestamp'] ? date('Y.m.d', $sourceInfo['latest_timestamp']) : $version) : $version,
|
||||
'release_name' => $hasSourceUpdates ? 'Source Update' : 'Latest from GitHub',
|
||||
|
||||
Reference in New Issue
Block a user