Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions core/AppInfo/ConfigLexicon.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class ConfigLexicon implements ILexicon {
public const USER_LANGUAGE = 'lang';
public const OCM_DISCOVERY_ENABLED = 'ocm_discovery_enabled';
public const OCM_INVITE_ACCEPT_DIALOG = 'ocm_invite_accept_dialog';
public const DAV_REPAIR_REMOVED_BROKEN_PROPERTIES = 'dav_repair_removed_broken_properties';

public const USER_LOCALE = 'locale';
public const USER_TIMEZONE = 'timezone';
Expand Down Expand Up @@ -103,6 +104,13 @@ public function getAppConfigs(): array {
defaultRaw: true,
definition: 'Whether on demand preview migration is enabled.'
),
new Entry(
key: self::DAV_REPAIR_REMOVED_BROKEN_PROPERTIES,
type: ValueType::BOOL,
defaultRaw: false,
definition: 'Whether the RemoveBrokenProperties repair step has already been run.',
lazy: true,
),
];
}

Expand Down
10 changes: 10 additions & 0 deletions lib/private/Repair/RemoveBrokenProperties.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,18 @@
namespace OC\Repair;

use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\IAppConfig;
use OCP\IDBConnection;
use OCP\Migration\IOutput;
use OCP\Migration\IRepairStep;
use Override;

class RemoveBrokenProperties implements IRepairStep {
public const GUARD_CONFIG_KEY = 'dav_repair_removed_broken_properties';
Comment thread
kyteinsky marked this conversation as resolved.
Outdated

public function __construct(
private readonly IDBConnection $db,
private readonly IAppConfig $appConfig,
) {
}

Expand All @@ -28,6 +32,10 @@ public function getName(): string {

#[Override]
public function run(IOutput $output): void {
if ($this->appConfig->getValueBool('core', self::GUARD_CONFIG_KEY, lazy: true)) {
return;
}

// retrieve all object properties
$qb = $this->db->getQueryBuilder();
$qb->select('id', 'propertyvalue')
Expand Down Expand Up @@ -56,6 +64,8 @@ public function run(IOutput $output): void {
$qb->executeStatement();
}
$total = count($brokenIds);

$this->appConfig->setValueBool('core', self::GUARD_CONFIG_KEY, true, lazy: true);
$output->info("$total broken object properties removed");
}
}