Skip to content

Commit a342561

Browse files
committed
Drop account export and import
Signed-off-by: Christopher Ng <[email protected]>
1 parent e05cad8 commit a342561

File tree

1 file changed

+4
-37
lines changed

1 file changed

+4
-37
lines changed

lib/Service/UserMigrationService.php

Lines changed: 4 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@
2727

2828
namespace OCA\UserMigration\Service;
2929

30+
use OC\Accounts\AccountMigrator;
3031
use OCA\UserMigration\Exception\UserMigrationException;
3132
use OCA\UserMigration\ExportDestination;
3233
use OCA\UserMigration\ImportSource;
33-
use OCP\Accounts\IAccountManager;
3434
use OCP\Files\IRootFolder;
3535
use OCP\IConfig;
3636
use OCP\ITempManager;
@@ -53,8 +53,6 @@ class UserMigrationService {
5353

5454
protected IConfig $config;
5555

56-
protected IAccountManager $accountManager;
57-
5856
protected ITempManager $tempManager;
5957

6058
protected IUserManager $userManager;
@@ -67,15 +65,13 @@ class UserMigrationService {
6765
public function __construct(
6866
IRootFolder $rootFolder,
6967
IConfig $config,
70-
IAccountManager $accountManager,
7168
ITempManager $tempManager,
7269
IUserManager $userManager,
7370
ContainerInterface $container,
7471
Coordinator $coordinator
7572
) {
7673
$this->root = $rootFolder;
7774
$this->config = $config;
78-
$this->accountManager = $accountManager;
7975
$this->tempManager = $tempManager;
8076
$this->userManager = $userManager;
8177
$this->container = $container;
@@ -106,12 +102,6 @@ public function export(IUser $user, ?OutputInterface $output = null): string {
106102
$output
107103
);
108104

109-
$this->exportAccountInformation(
110-
$user,
111-
$exportDestination,
112-
$output
113-
);
114-
115105
$this->exportAppsSettings(
116106
$uid,
117107
$exportDestination,
@@ -124,16 +114,18 @@ public function export(IUser $user, ?OutputInterface $output = null): string {
124114
$output
125115
);
126116

127-
// Run exports of registered migrators
128117
$migratorVersions = [
129118
static::class => $this->getVersion(),
130119
];
120+
121+
// Run exports of registered migrators
131122
foreach ($context->getUserMigrators() as $migratorRegistration) {
132123
/** @var IMigrator $migrator */
133124
$migrator = $this->container->get($migratorRegistration->getService());
134125
$migrator->export($user, $exportDestination, $output);
135126
$migratorVersions[get_class($migrator)] = $migrator->getVersion();
136127
}
128+
137129
if ($exportDestination->setMigratorVersions($migratorVersions) === false) {
138130
throw new UserMigrationException("Could not export user information.");
139131
}
@@ -171,7 +163,6 @@ public function import(string $path, ?OutputInterface $output = null): void {
171163
}
172164

173165
$user = $this->importUser($importSource, $output);
174-
$this->importAccountInformation($user, $importSource, $output);
175166
$this->importAppsSettings($user, $importSource, $output);
176167

177168
// Run imports of registered migrators
@@ -230,30 +221,6 @@ protected function importUser(IImportSource $importSource,
230221
return $user;
231222
}
232223

233-
/**
234-
* @throws UserMigrationException
235-
*/
236-
protected function exportAccountInformation(IUser $user,
237-
IExportDestination $exportDestination,
238-
OutputInterface $output): void {
239-
$output->writeln("Exporting account information in account.json…");
240-
241-
if ($exportDestination->addFileContents("account.json", json_encode($this->accountManager->getAccount($user))) === false) {
242-
throw new UserMigrationException("Could not export account information.");
243-
}
244-
}
245-
246-
/**
247-
* @throws UserMigrationException
248-
*/
249-
protected function importAccountInformation(IUser $user,
250-
IImportSource $importSource,
251-
OutputInterface $output): void {
252-
$output->writeln("Importing account information from account.json…?");
253-
254-
// TODO Import account information
255-
}
256-
257224
/**
258225
* @throws UserMigrationException
259226
*/

0 commit comments

Comments
 (0)