mirror of
https://github.com/espocrm/espocrm.git
synced 2026-06-28 06:56:05 +00:00
command noSystemUser param
This commit is contained in:
@@ -40,7 +40,6 @@ use Exception;
|
||||
class Command implements Runner
|
||||
{
|
||||
use Cli;
|
||||
use SetupSystemUser;
|
||||
|
||||
public function __construct(private ConsoleCommandManager $commandManager)
|
||||
{}
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
namespace Espo\Core\Console;
|
||||
|
||||
use Espo\Core\ApplicationUser;
|
||||
use Espo\Core\InjectableFactory;
|
||||
use Espo\Core\Utils\Metadata;
|
||||
use Espo\Core\Utils\Util;
|
||||
@@ -44,8 +45,11 @@ class CommandManager
|
||||
private const DEFAULT_COMMAND = 'Help';
|
||||
private const DEFAULT_COMMAND_FLAG = 'help';
|
||||
|
||||
public function __construct(private InjectableFactory $injectableFactory, private Metadata $metadata)
|
||||
{}
|
||||
public function __construct(
|
||||
private InjectableFactory $injectableFactory,
|
||||
private Metadata $metadata,
|
||||
private ApplicationUser $applicationUser
|
||||
) {}
|
||||
|
||||
/**
|
||||
* @param array<int, string> $argv
|
||||
@@ -75,6 +79,8 @@ class CommandManager
|
||||
|
||||
$io = new IO();
|
||||
|
||||
$this->setupUser($command);
|
||||
|
||||
$commandObj = $this->createCommand($command);
|
||||
|
||||
if (!$commandObj instanceof Command) {
|
||||
@@ -146,4 +152,15 @@ class CommandManager
|
||||
{
|
||||
return Params::fromArgs(array_slice($argv, 1));
|
||||
}
|
||||
|
||||
private function setupUser(string $command): void
|
||||
{
|
||||
$noSystemUser = $this->metadata->get(['app', 'consoleCommands', lcfirst($command), 'noSystemUser']);
|
||||
|
||||
if ($noSystemUser) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->applicationUser->setupSystemUser();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,13 +4,16 @@
|
||||
"listed": true
|
||||
},
|
||||
"clearCache": {
|
||||
"listed": true
|
||||
"listed": true,
|
||||
"noSystemUser": true
|
||||
},
|
||||
"rebuild": {
|
||||
"listed": true
|
||||
"listed": true,
|
||||
"noSystemUser": true
|
||||
},
|
||||
"updateAppTimestamp": {
|
||||
"listed": true
|
||||
"listed": true,
|
||||
"noSystemUser": true
|
||||
},
|
||||
"appInfo": {
|
||||
"listed": true
|
||||
@@ -28,7 +31,8 @@
|
||||
"listed": true
|
||||
},
|
||||
"version": {
|
||||
"listed": true
|
||||
"listed": true,
|
||||
"noSystemUser": true
|
||||
},
|
||||
"createAdminUser": {
|
||||
"className": "Espo\\Classes\\ConsoleCommands\\CreateAdminUser",
|
||||
@@ -48,6 +52,15 @@
|
||||
},
|
||||
"checkFilePermissions": {
|
||||
"className": "Espo\\Classes\\ConsoleCommands\\CheckFilePermissions",
|
||||
"listed": true
|
||||
"listed": true,
|
||||
"noSystemUser": true
|
||||
},
|
||||
"migrate": {
|
||||
"listed": true,
|
||||
"noSystemUser": true
|
||||
},
|
||||
"migrationVersionStep": {
|
||||
"listed": false,
|
||||
"noSystemUser": true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,10 @@
|
||||
"listed": {
|
||||
"type": "boolean",
|
||||
"description": "Whether the command is listed when running bin/command."
|
||||
},
|
||||
"noSystemUser": {
|
||||
"type": "boolean",
|
||||
"description": "Do not load the system user."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user