UPSTREAM BASELINE: nextcloud/spreed v22.0.12 (без изменений)
Type checking / changes (push) Has been cancelled
Type checking / test (push) Has been cancelled
Type checking / typescript-summary (push) Has been cancelled
Node tests / changes (push) Has been cancelled
Node tests / test (push) Has been cancelled
Node tests / test-summary (push) Has been cancelled

Источник: https://github.com/nextcloud/spreed/archive/refs/tags/v22.0.12.tar.gz
С этого коммита ветка официального Nextcloud Talk отрезана (решение владельца 2026-07-06).
Все дальнейшие изменения — только наши; версии релизов: 22.0.12-f7.N.
This commit is contained in:
2026-07-06 14:07:50 +00:00
commit 01acfa3b40
1716 changed files with 613013 additions and 0 deletions
+113
View File
@@ -0,0 +1,113 @@
<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\Talk\Command\Developer;
use OC\Core\Command\Base;
use OCA\Talk\Exceptions\RoomNotFoundException;
use OCA\Talk\Manager;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\IConfig;
use OCP\IDBConnection;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
class AgeChatMessages extends Base {
public function __construct(
private readonly IConfig $config,
private readonly IDBConnection $connection,
private readonly Manager $manager,
) {
parent::__construct();
}
public function isEnabled(): bool {
return $this->config->getSystemValue('debug', false) === true;
}
#[\Override]
protected function configure(): void {
$this
->setName('talk:developer:age-chat-messages')
->setDescription('Artificially ages chat messages in the given conversation, so deletion and other things can be tested')
->addArgument(
'token',
InputArgument::REQUIRED,
'Token of the room to manipulate'
)
->addOption(
'hours',
null,
InputOption::VALUE_REQUIRED,
'Number of hours to age all chat messages',
24
)
;
}
protected function execute(InputInterface $input, OutputInterface $output): int {
$token = $input->getArgument('token');
$hours = (int)$input->getOption('hours');
if ($hours < 1) {
$output->writeln('<error>Invalid age: ' . $hours . '</error>');
return 1;
}
try {
$room = $this->manager->getRoomByToken($token);
} catch (RoomNotFoundException) {
$output->writeln('<error>Room not found: ' . $token . '</error>');
return 1;
}
$update = $this->connection->getQueryBuilder();
$update->update('comments')
->set('creation_timestamp', $update->createParameter('creation_timestamp'))
->set('expire_date', $update->createParameter('expire_date'))
->set('meta_data', $update->createParameter('meta_data'))
->where($update->expr()->eq('id', $update->createParameter('id')));
$query = $this->connection->getQueryBuilder();
$query->select('id', 'creation_timestamp', 'expire_date', 'meta_data')
->from('comments')
->where($query->expr()->eq('object_type', $query->createNamedParameter('chat')))
->andWhere($query->expr()->eq('object_id', $query->createNamedParameter($room->getId())));
$result = $query->executeQuery();
while ($row = $result->fetch()) {
$creationTimestamp = new \DateTime($row['creation_timestamp']);
$creationTimestamp->sub(new \DateInterval('PT' . $hours . 'H'));
$expireDate = null;
if ($row['expire_date']) {
$expireDate = new \DateTime($row['expire_date']);
$expireDate->sub(new \DateInterval('PT' . $hours . 'H'));
}
$metaData = 'null';
if ($row['meta_data'] !== 'null') {
$metaData = json_decode($row['meta_data'], true);
if (isset($metaData['last_edited_time'])) {
$metaData['last_edited_time'] -= $hours * 3600;
}
$metaData = json_encode($metaData);
}
$update->setParameter('id', $row['id']);
$update->setParameter('creation_timestamp', $creationTimestamp, IQueryBuilder::PARAM_DATE);
$update->setParameter('expire_date', $expireDate, IQueryBuilder::PARAM_DATE);
$update->setParameter('meta_data', $metaData);
$update->executeStatement();
}
$result->closeCursor();
return 0;
}
}
+145
View File
@@ -0,0 +1,145 @@
<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\Talk\Command\Developer;
use OC\Core\Command\Base;
use OCP\App\IAppManager;
use OCP\IConfig;
use OCP\Server;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
class UpdateDocs extends Base {
public function __construct(
private IConfig $config,
private IAppManager $appManager,
) {
parent::__construct();
}
public function isEnabled(): bool {
return $this->config->getSystemValue('debug', false) === true;
}
#[\Override]
protected function configure(): void {
$this
->setName('talk:developer:update-docs')
->setDescription('Update documentation of commands')
;
}
protected function execute(InputInterface $input, OutputInterface $output): int {
$info = $this->appManager->getAppInfo('spreed');
$documentation = "# Talk occ commands\n\n";
foreach ($info['commands'] as $namespace) {
if ($namespace === self::class
|| $namespace === AgeChatMessages::class) {
continue;
}
$command = $this->getCommand($namespace);
$documentation .= $this->getDocumentation($command) . "\n";
}
$handle = fopen(__DIR__ . '/../../../docs/occ.md', 'w');
fwrite($handle, $documentation);
fclose($handle);
return 0;
}
protected function getCommand(string $namespace): Command {
$command = Server::get($namespace);
// Clean full definition of command that have the default Symfony options
$command->setApplication($this->getApplication());
return $command;
}
protected function getDocumentation(Command $command): string {
$doc = '## ' . $command->getName() . "\n\n";
$doc .= $command->getDescription() . "\n\n";
$doc
.= '### Usage' . "\n\n"
. array_reduce(
array_merge(
[$command->getSynopsis()],
$command->getAliases(),
$command->getUsages()
),
function ($carry, $usage) {
return $carry . '* `' . $usage . '`' . "\n";
}
);
$doc .= $this->describeInputDefinition($command);
return $doc;
}
protected function describeInputDefinition(Command $command): string {
$definition = $command->getDefinition();
$text = '';
if (\count($definition->getArguments()) > 0) {
$text .= "\n";
$text .= "| Arguments | Description | Is required | Is array | Default |\n";
$text .= '|---|---|---|---|---|';
foreach ($definition->getArguments() as $argument) {
$describeInputArgument = $this->describeInputArgument($argument);
if ($describeInputArgument) {
$text .= "\n" . $describeInputArgument;
}
}
$text .= "\n";
}
if (\count($definition->getOptions()) > 0) {
$text .= "\n";
$text .= "| Options | Description | Accept value | Is value required | Is multiple | Default |\n";
$text .= '|---|---|---|---|---|---|';
foreach ($definition->getOptions() as $option) {
$describeInputOption = $this->describeInputOption($option);
if ($describeInputOption) {
$text .= "\n" . $describeInputOption;
}
}
$text .= "\n";
}
return $text;
}
protected function describeInputArgument(InputArgument $argument): string {
$description = $argument->getDescription();
return
'| `' . ($argument->getName() ?: '<none>') . '` | '
. ($description ? preg_replace('/\s*[\r\n]\s*/', ' ', $description) : '') . ' | '
. ($argument->isRequired() ? 'yes' : 'no') . ' | '
. ($argument->isArray() ? 'yes' : 'no') . ' | '
. ($argument->isRequired() ? '*Required*' : '`' . str_replace("\n", '', var_export($argument->getDefault(), true)) . '`') . ' |';
}
protected function describeInputOption(InputOption $option): string {
$name = '--' . $option->getName();
if ($option->getShortcut()) {
$name .= '\|-' . str_replace('|', '\|-', $option->getShortcut());
}
$description = $option->getDescription();
return
'| `' . $name . '` | '
. ($description ? preg_replace('/\s*[\r\n]\s*/', ' ', $description) : '') . ' | '
. ($option->acceptValue() ? 'yes' : 'no') . ' | '
. ($option->isValueRequired() ? 'yes' : 'no') . ' | '
. ($option->isArray() ? 'yes' : 'no') . ' | '
. ($option->isValueRequired() ? '*Required*' : '`' . str_replace("\n", '', var_export($option->getDefault(), true)) . '`') . ' |';
}
}