diff options
author | Vincent Petry <vincent@nextcloud.com> | 2022-04-11 10:24:20 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-11 10:24:20 +0200 |
commit | e36233dbab7995c4b2e037828ccb168005e5d76f (patch) | |
tree | 2736e5d694b6b42572e4b2a3ab62131598cbe1df | |
parent | 823ca53eeac24d9d806494e26eb5337dbe91def6 (diff) | |
parent | e08b8c47a2c265be4642d8116de7ec791b7a07d5 (diff) | |
download | nextcloud-server-e36233dbab7995c4b2e037828ccb168005e5d76f.tar.gz nextcloud-server-e36233dbab7995c4b2e037828ccb168005e5d76f.zip |
Merge pull request #31911 from nextcloud/enh/extend-migrators
Extend migrators needed for implementation of the API
-rw-r--r-- | apps/dav/lib/UserMigration/CalendarMigrator.php | 21 | ||||
-rw-r--r-- | apps/dav/lib/UserMigration/ContactsMigrator.php | 21 | ||||
-rw-r--r-- | apps/files_trashbin/lib/UserMigration/TrashbinMigrator.php | 28 | ||||
-rw-r--r-- | apps/settings/lib/UserMigration/AccountMigrator.php | 28 | ||||
-rw-r--r-- | lib/public/UserMigration/IMigrator.php | 21 |
5 files changed, 117 insertions, 2 deletions
diff --git a/apps/dav/lib/UserMigration/CalendarMigrator.php b/apps/dav/lib/UserMigration/CalendarMigrator.php index 16b21314610..f560b4853b2 100644 --- a/apps/dav/lib/UserMigration/CalendarMigrator.php +++ b/apps/dav/lib/UserMigration/CalendarMigrator.php @@ -464,4 +464,25 @@ class CalendarMigrator implements IMigrator { } } } + + /** + * {@inheritDoc} + */ + public function getId(): string { + return 'calendar'; + } + + /** + * {@inheritDoc} + */ + public function getDisplayName(): string { + return $this->l10n->t('Calendar'); + } + + /** + * {@inheritDoc} + */ + public function getDescription(): string { + return $this->l10n->t('Calendars including events, details, and attendees'); + } } diff --git a/apps/dav/lib/UserMigration/ContactsMigrator.php b/apps/dav/lib/UserMigration/ContactsMigrator.php index 66395173b7a..cfdc20bfdf3 100644 --- a/apps/dav/lib/UserMigration/ContactsMigrator.php +++ b/apps/dav/lib/UserMigration/ContactsMigrator.php @@ -363,4 +363,25 @@ class ContactsMigrator implements IMigrator { } } } + + /** + * {@inheritDoc} + */ + public function getId(): string { + return 'contacts'; + } + + /** + * {@inheritDoc} + */ + public function getDisplayName(): string { + return $this->l10n->t('Contacts'); + } + + /** + * {@inheritDoc} + */ + public function getDescription(): string { + return $this->l10n->t('Contacts and groups'); + } } diff --git a/apps/files_trashbin/lib/UserMigration/TrashbinMigrator.php b/apps/files_trashbin/lib/UserMigration/TrashbinMigrator.php index 0aa41c1954f..c7832ec5bc8 100644 --- a/apps/files_trashbin/lib/UserMigration/TrashbinMigrator.php +++ b/apps/files_trashbin/lib/UserMigration/TrashbinMigrator.php @@ -31,6 +31,7 @@ use OCP\Files\Folder; use OCP\Files\IRootFolder; use OCP\Files\NotFoundException; use OCP\IDBConnection; +use OCP\IL10N; use OCP\IUser; use OCP\UserMigration\IExportDestination; use OCP\UserMigration\IImportSource; @@ -50,12 +51,16 @@ class TrashbinMigrator implements IMigrator { protected IDBConnection $dbc; + protected IL10N $l10n; + public function __construct( IRootFolder $rootFolder, - IDBConnection $dbc + IDBConnection $dbc, + IL10N $l10n ) { $this->root = $rootFolder; $this->dbc = $dbc; + $this->l10n = $l10n; } /** @@ -134,4 +139,25 @@ class TrashbinMigrator implements IMigrator { $output->writeln("No trashbin to import…"); } } + + /** + * {@inheritDoc} + */ + public function getId(): string { + return 'trashbin'; + } + + /** + * {@inheritDoc} + */ + public function getDisplayName(): string { + return $this->l10n->t('Deleted files'); + } + + /** + * {@inheritDoc} + */ + public function getDescription(): string { + return $this->l10n->t('Deleted files and folders in the trash bin'); + } } diff --git a/apps/settings/lib/UserMigration/AccountMigrator.php b/apps/settings/lib/UserMigration/AccountMigrator.php index e50a01e515f..a39c510813f 100644 --- a/apps/settings/lib/UserMigration/AccountMigrator.php +++ b/apps/settings/lib/UserMigration/AccountMigrator.php @@ -32,6 +32,7 @@ use OC\NotSquareException; use OCA\Settings\AppInfo\Application; use OCP\Accounts\IAccountManager; use OCP\IAvatarManager; +use OCP\IL10N; use OCP\IUser; use OCP\UserMigration\IExportDestination; use OCP\UserMigration\IImportSource; @@ -49,6 +50,8 @@ class AccountMigrator implements IMigrator { private IAvatarManager $avatarManager; + private IL10N $l10n; + private const PATH_ROOT = Application::APP_ID . '/'; private const PATH_ACCOUNT_FILE = AccountMigrator::PATH_ROOT . 'account.json'; @@ -57,10 +60,12 @@ class AccountMigrator implements IMigrator { public function __construct( IAccountManager $accountManager, - IAvatarManager $avatarManager + IAvatarManager $avatarManager, + IL10N $l10n ) { $this->accountManager = $accountManager; $this->avatarManager = $avatarManager; + $this->l10n = $l10n; } /** @@ -137,4 +142,25 @@ class AccountMigrator implements IMigrator { } } } + + /** + * {@inheritDoc} + */ + public function getId(): string { + return 'account'; + } + + /** + * {@inheritDoc} + */ + public function getDisplayName(): string { + return $this->l10n->t('Profile information'); + } + + /** + * {@inheritDoc} + */ + public function getDescription(): string { + return $this->l10n->t('Profile picture, full name, email, phone number, address, website, Twitter, organisation, role, headline, biography, and whether your profile is enabled'); + } } diff --git a/lib/public/UserMigration/IMigrator.php b/lib/public/UserMigration/IMigrator.php index c97fb3c0bca..7c89e041f34 100644 --- a/lib/public/UserMigration/IMigrator.php +++ b/lib/public/UserMigration/IMigrator.php @@ -60,6 +60,27 @@ interface IMigrator { ): void; /** + * Returns the unique ID + * + * @since 24.0.0 + */ + public function getId(): string; + + /** + * Returns the display name + * + * @since 24.0.0 + */ + public function getDisplayName(): string; + + /** + * Returns the description + * + * @since 24.0.0 + */ + public function getDescription(): string; + + /** * Returns the version of the export format for this migrator * * @since 24.0.0 |