diff --git a/apps/dav/appinfo/application.php b/apps/dav/appinfo/application.php index d06daf97f5..1f56193e4b 100644 --- a/apps/dav/appinfo/application.php +++ b/apps/dav/appinfo/application.php @@ -32,6 +32,7 @@ use OCA\Dav\Migration\AddressBookAdapter; use OCA\Dav\Migration\CalendarAdapter; use OCA\Dav\Migration\MigrateAddressbooks; use OCA\Dav\Migration\MigrateCalendars; +use OCA\Dav\Migration\NothingToDoException; use \OCP\AppFramework\App; use OCP\AppFramework\IAppContainer; use OCP\Contacts\IManager; @@ -190,6 +191,8 @@ class Application extends App { /** @var IUser $user */ $migration->migrateForUser($user->getUID()); }); + } catch (NothingToDoException $ex) { + // nothing to do, yay! } catch (\Exception $ex) { $this->getContainer()->getServer()->getLogger()->logException($ex); } @@ -206,6 +209,8 @@ class Application extends App { /** @var IUser $user */ $migration->migrateForUser($user->getUID()); }); + } catch (NothingToDoException $ex) { + // nothing to do, yay! } catch (\Exception $ex) { $this->getContainer()->getServer()->getLogger()->logException($ex); } diff --git a/apps/dav/lib/migration/addressbookadapter.php b/apps/dav/lib/migration/addressbookadapter.php index 5264747a00..ea9982f406 100644 --- a/apps/dav/lib/migration/addressbookadapter.php +++ b/apps/dav/lib/migration/addressbookadapter.php @@ -69,7 +69,7 @@ class AddressBookAdapter { public function setup() { if (!$this->dbConnection->tableExists($this->sourceBookTable)) { - throw new \DomainException('Contacts tables are missing. Nothing to do.'); + throw new NothingToDoException('Contacts tables are missing'); } } diff --git a/apps/dav/lib/migration/calendaradapter.php b/apps/dav/lib/migration/calendaradapter.php index d02f2256c3..952c9a212f 100644 --- a/apps/dav/lib/migration/calendaradapter.php +++ b/apps/dav/lib/migration/calendaradapter.php @@ -65,7 +65,7 @@ class CalendarAdapter { public function setup() { if (!$this->dbConnection->tableExists($this->sourceCalendarTable)) { - throw new \DomainException('Calendar tables are missing. Nothing to do.'); + throw new NothingToDoException('Calendar tables are missing'); } } diff --git a/apps/dav/lib/migration/nothingtodoexception.php b/apps/dav/lib/migration/nothingtodoexception.php new file mode 100644 index 0000000000..d85d3c92d7 --- /dev/null +++ b/apps/dav/lib/migration/nothingtodoexception.php @@ -0,0 +1,27 @@ + + * + * @copyright Copyright (c) 2016, ownCloud, Inc. + * @license AGPL-3.0 + * + * This code is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License, version 3, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License, version 3, + * along with this program. If not, see + * + */ + +namespace OCA\Dav\Migration; + +/** + * Exception if no migration needs to be done + */ +class NothingToDoException extends \DomainException {}