Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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 @@ -28,6 +28,7 @@ class ConfigLexicon implements ILexicon {
public const SHARE_LINK_EXPIRE_DATE_ENFORCED = 'shareapi_enforce_expire_date';
public const USER_LANGUAGE = 'lang';
public const OCM_DISCOVERY_ENABLED = 'ocm_discovery_enabled';
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 @@ -101,6 +102,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
9 changes: 9 additions & 0 deletions lib/private/Repair/RemoveBrokenProperties.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@

namespace OC\Repair;

use OC\Core\AppInfo\ConfigLexicon;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\IAppConfig;
use OCP\IDBConnection;
use OCP\Migration\IOutput;
use OCP\Migration\IRepairStep;
Expand All @@ -18,6 +20,7 @@
class RemoveBrokenProperties implements IRepairStep {
public function __construct(
private readonly IDBConnection $db,
private readonly IAppConfig $appConfig,
) {
}

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

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

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

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