Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repair the SQL request when upgrading #898

Open
wants to merge 5 commits into
base: stable3.0
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ For this version, you should refresh your browser from the Workspace app with `C
<pre-migration>
<step>OCA\Workspace\Migration\ChangeGroupnamesV300</step>
<step>OCA\Workspace\Migration\FixMigrationToV300</step>
<step>OCA\Workspace\Migration\ReRunChangeGroupnamesForPgSql</step>
</pre-migration>
<install>
<step>OCA\Workspace\Migration\RegisterWorkspaceUsersGroup</step>
Expand Down
7 changes: 5 additions & 2 deletions lib/Db/GroupFoldersGroupsMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,11 @@ public function getSpacenamesGroupIds() {
'gf_groups.folder_id'
)
)
->where('group_id not like "SPACE-GE%"')
->andWhere('group_id not like "SPACE-U%"');
->where('group_id not like :managerGroup')
->andWhere('group_id not like :userGroup')
->setParameter('managerGroup', 'SPACE-GE%')
->setParameter('userGroup', 'SPACE-U%')
;

return $qb->executeQuery()->fetchAll();
}
Expand Down
39 changes: 39 additions & 0 deletions lib/Migration/ReRunChangeGroupnamesForPgSql.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

namespace OCA\Workspace\Migration;

use OCA\Workspace\Upgrade\Upgrade;
use OCA\Workspace\Upgrade\UpgradeV300;
use OCP\AppFramework\Services\IAppConfig;
use OCP\IConfig;
use OCP\Migration\IOutput;
use OCP\Migration\IRepairStep;

class ReRunChangeGroupnamesForPgSql implements IRepairStep {
public function __construct(
private IConfig $config,
private IAppConfig $appConfig,
private UpgradeV300 $upgrade,
) {
}

public function getName(): string {
return 'Rerun the change groupnames repair step for a Nextcloud instance using PostgreSQL.';
}

public function run(IOutput $output): void {
$sgbdName = $this->config->getSystemValue('dbtype');

if ($sgbdName !== 'pgsql') {
return;
}

$statusMigration = boolval($this->appConfig->getAppValue(Upgrade::CONTROL_MIGRATION_V3, '1'));

if ($statusMigration === true) {
return;
}

$this->upgrade->upgrade();
}
}
Loading