зеркало из https://github.com/nextcloud/spreed.git
Fix help command handling on Oracle
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Родитель
fb0ee51bd9
Коммит
138221f0a8
|
@ -44,13 +44,21 @@ class CreateHelpCommand implements IRepairStep {
|
|||
|
||||
public function run(IOutput $output): void {
|
||||
try {
|
||||
$this->service->find('', 'help');
|
||||
$command = $this->service->find('', 'help');
|
||||
$this->service->update(
|
||||
$command->getId(),
|
||||
'help',
|
||||
'talk',
|
||||
'help',
|
||||
Command::RESPONSE_USER,
|
||||
Command::ENABLED_ALL
|
||||
);
|
||||
} catch (DoesNotExistException $e) {
|
||||
$this->service->create(
|
||||
'',
|
||||
'help',
|
||||
'talk',
|
||||
'',
|
||||
'help',
|
||||
Command::RESPONSE_USER,
|
||||
Command::ENABLED_ALL
|
||||
);
|
||||
|
|
|
@ -85,8 +85,13 @@ class CommandMapper extends QBMapper {
|
|||
$query = $this->db->getQueryBuilder();
|
||||
$query->select('*')
|
||||
->from($this->getTableName())
|
||||
->where($query->expr()->eq('app', $query->createNamedParameter($app)))
|
||||
->andWhere($query->expr()->eq('command', $query->createNamedParameter($cmd)));
|
||||
->where($query->expr()->eq('command', $query->createNamedParameter($cmd)));
|
||||
|
||||
if ($app === '') {
|
||||
$query->andWhere($query->expr()->emptyString('app'));
|
||||
} else {
|
||||
$query->andWhere($query->expr()->eq('app', $query->createNamedParameter($app)));
|
||||
}
|
||||
|
||||
return $this->findEntity($query);
|
||||
}
|
||||
|
|
|
@ -97,9 +97,6 @@ class CommandService {
|
|||
*/
|
||||
public function update(int $id, string $cmd, string $name, string $script, int $response, int $enabled): Command {
|
||||
$command = $this->mapper->findById($id);
|
||||
if ($command->getApp() !== '' || $command->getCommand() === 'help') {
|
||||
throw new \InvalidArgumentException('app', 0);
|
||||
}
|
||||
|
||||
$command->setName($name);
|
||||
$command->setScript($script);
|
||||
|
@ -141,7 +138,7 @@ class CommandService {
|
|||
} catch (DoesNotExistException $e) {
|
||||
throw new \InvalidArgumentException('script', 3);
|
||||
}
|
||||
} else {
|
||||
} elseif ($script !== 'help') {
|
||||
if (preg_match('/[`\'"]{(?:ARGUMENTS|ROOM|USER)}[`\'"]/i', $script)) {
|
||||
throw new \InvalidArgumentException('script-parameters', 6);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче