Skip to content

Commit

Permalink
feat(php): Rerun the change groupnames for pgsql
Browse files Browse the repository at this point in the history
Rerun the change groupnames for pgsql when the control migration is to
false.

Signed-off-by: Baptiste Fotia <[email protected]>
  • Loading branch information
zak39 committed Sep 11, 2023
1 parent 59dd177 commit f7a6428
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 1 deletion.
3 changes: 2 additions & 1 deletion appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<name>Workspace</name>

<version>3.0.3</version>
<version>3.0.4-beta</version>

<licence>agpl</licence>

Expand Down Expand Up @@ -75,6 +75,7 @@ For more details, please go to the [admin documentation](https://github.com/araw
<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
45 changes: 45 additions & 0 deletions lib/Migration/ReRunChangeGroupnamesForPgSql.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php

namespace OCA\Workspace\Migration;

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

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();
}
}

0 comments on commit f7a6428

Please sign in to comment.