mirror of
https://github.com/nextcloud/server.git
synced 2026-06-11 01:30:50 -04:00
Merge pull request #36781 from nextcloud/bugfix/noid/run-repairsteps-against-oracle
fix(CI): Run repair steps against Oracle DB
This commit is contained in:
commit
fbbdc64167
5 changed files with 14 additions and 4 deletions
4
.github/workflows/oci.yml
vendored
4
.github/workflows/oci.yml
vendored
|
|
@ -50,6 +50,10 @@ jobs:
|
|||
working-directory: tests
|
||||
run: phpunit --configuration phpunit-autotest.xml --group DB,SLOWDB
|
||||
|
||||
- name: Run repair steps
|
||||
run: |
|
||||
./occ maintenance:repair --include-expensive
|
||||
|
||||
summary:
|
||||
permissions:
|
||||
contents: none
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ class RemoveObjectProperties implements IRepairStep {
|
|||
$query = $this->connection->getQueryBuilder();
|
||||
$updated = $query->delete('properties')
|
||||
->where($query->expr()->in('propertyname', $query->createNamedParameter([self::RESOURCE_TYPE_PROPERTY, self::ME_CARD_PROPERTY, self::CALENDAR_TRANSP_PROPERTY], IQueryBuilder::PARAM_STR_ARRAY)))
|
||||
->andWhere($query->expr()->eq('propertyvalue', $query->createNamedParameter('Object')))
|
||||
->andWhere($query->expr()->eq('propertyvalue', $query->createNamedParameter('Object'), IQueryBuilder::PARAM_STR))
|
||||
->executeStatement();
|
||||
|
||||
$output->info("$updated invalid object properties removed.");
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ class Repair extends Command {
|
|||
private ProgressBar $progress;
|
||||
private OutputInterface $output;
|
||||
private IAppManager $appManager;
|
||||
protected bool $errored = false;
|
||||
|
||||
public function __construct(\OC\Repair $repair, IConfig $config, IEventDispatcher $dispatcher, IAppManager $appManager) {
|
||||
$this->repair = $repair;
|
||||
|
|
@ -104,6 +105,8 @@ class Repair extends Command {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
$maintenanceMode = $this->config->getSystemValueBool('maintenance');
|
||||
$this->config->setSystemValue('maintenance', true);
|
||||
|
||||
|
|
@ -120,7 +123,7 @@ class Repair extends Command {
|
|||
$this->repair->run();
|
||||
|
||||
$this->config->setSystemValue('maintenance', $maintenanceMode);
|
||||
return 0;
|
||||
return $this->errored ? 1 : 0;
|
||||
}
|
||||
|
||||
public function handleRepairFeedBack(Event $event): void {
|
||||
|
|
@ -139,6 +142,7 @@ class Repair extends Command {
|
|||
$this->output->writeln('<comment> - WARNING: ' . $event->getMessage() . '</comment>');
|
||||
} elseif ($event instanceof RepairErrorEvent) {
|
||||
$this->output->writeln('<error> - ERROR: ' . $event->getMessage() . '</error>');
|
||||
$this->errored = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ namespace OC;
|
|||
|
||||
use OC\DB\Connection;
|
||||
use OC\DB\OracleConnection;
|
||||
use OCP\DB\QueryBuilder\IQueryBuilder;
|
||||
use OCP\IAppConfig;
|
||||
use OCP\IConfig;
|
||||
|
||||
|
|
@ -298,7 +299,7 @@ class AppConfig implements IAppConfig {
|
|||
$sql->andWhere(
|
||||
$sql->expr()->orX(
|
||||
$sql->expr()->isNull('configvalue'),
|
||||
$sql->expr()->neq('configvalue', $sql->createNamedParameter($value))
|
||||
$sql->expr()->neq('configvalue', $sql->createNamedParameter($value), IQueryBuilder::PARAM_STR)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,7 +55,8 @@ class ValidatePhoneNumber implements IRepairStep {
|
|||
|
||||
public function run(IOutput $output): void {
|
||||
if ($this->config->getSystemValueString('default_phone_region', '') === '') {
|
||||
throw new \Exception('Can not validate phone numbers without `default_phone_region` being set in the config file');
|
||||
$output->warning('Can not validate phone numbers without `default_phone_region` being set in the config file');
|
||||
return;
|
||||
}
|
||||
|
||||
$numUpdated = 0;
|
||||
|
|
|
|||
Loading…
Reference in a new issue