Skip to content
Merged
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
6 changes: 3 additions & 3 deletions lib/Db/EventWrapperRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

namespace OCA\Circles\Db;

use OC\DB\Exceptions\DbalException;
use OCA\Circles\Model\Federated\EventWrapper;
use OCP\DB\Exception;
use Psr\Log\LoggerInterface;

/**
Expand Down Expand Up @@ -42,8 +42,8 @@ public function save(EventWrapper $wrapper): void {

try {
$qb->executeStatement();
} catch (DbalException $e) {
if ($e->getReason() !== DbalException::REASON_UNIQUE_CONSTRAINT_VIOLATION) {
} catch (Exception $e) {
if ($e->getReason() !== Exception::REASON_UNIQUE_CONSTRAINT_VIOLATION) {
throw $e;
}

Expand Down
6 changes: 3 additions & 3 deletions lib/Db/TokensRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@

namespace OCA\Circles\Db;

use OC\DB\Exceptions\DbalException;
use OCA\Circles\Exceptions\TokenDoesNotExistException;
use OCA\Circles\Model\DeprecatedMember;
use OCA\Circles\Model\SharesToken;
use OCP\DB\Exception;
use OCP\Security\IHasher;
use OCP\Server;

Expand Down Expand Up @@ -116,8 +116,8 @@ public function generateTokenForMember(DeprecatedMember $member, int $shareId, s

$qb->execute();
$qb->executeStatement();
} catch (DbalException $e) {
if ($e->getReason() !== DbalException::REASON_UNIQUE_CONSTRAINT_VIOLATION) {
} catch (Exception $e) {
if ($e->getReason() !== Exception::REASON_UNIQUE_CONSTRAINT_VIOLATION) {
throw $e;
}
}
Expand Down
13 changes: 6 additions & 7 deletions lib/MountManager/CircleMountProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

namespace OCA\Circles\MountManager;

use Exception;
use OC\DB\Exceptions\DbalException;
use OCA\Circles\Db\MountPointRequest;
use OCA\Circles\Db\MountRequest;
use OCA\Circles\Exceptions\FederatedUserException;
Expand All @@ -28,6 +26,7 @@
use OCA\Circles\Service\FederatedUserService;
use OCA\Circles\Tools\Traits\TArrayTools;
use OCA\Files_Sharing\External\Storage as ExternalStorage;
use OCP\DB\Exception;
use OCP\Federation\ICloudIdManager;
use OCP\Files\Config\IMountProvider;
use OCP\Files\Folder;
Expand Down Expand Up @@ -77,7 +76,7 @@ public function getMountsForUser(IUser $user, IStorageFactory $loader): array {
try {
$this->fixDuplicateFile($user->getUID(), $item);
$mounts[] = $this->generateCircleMount($item, $loader);
} catch (Exception $e) {
} catch (\Exception $e) {
$this->logger->warning('issue with teams\' mounts', ['exception' => $e]);
}
}
Expand Down Expand Up @@ -204,9 +203,9 @@ private function fixDuplicateFile(string $userId, Mount $mount): void {
try {
$this->mountPointRequest->insert($mountPoint);
return;
} catch (DbalException $e) {
} catch (Exception $e) {
// meaning a duplicate mountpoint already exists, we need to set a new filename
if ($e->getReason() !== DbalException::REASON_UNIQUE_CONSTRAINT_VIOLATION) {
if ($e->getReason() !== Exception::REASON_UNIQUE_CONSTRAINT_VIOLATION) {
throw $e;
}
}
Expand Down Expand Up @@ -237,9 +236,9 @@ private function generateIncrementedMountpoint(Folder $fs, Mount $mount, IFedera
$this->mountPointRequest->insert($mountPoint);
}
return;
} catch (DbalException $e) {
} catch (Exception $e) {
// meaning path is already used by another share for this user, we keep incrementing
if ($e->getReason() !== DbalException::REASON_UNIQUE_CONSTRAINT_VIOLATION) {
if ($e->getReason() !== Exception::REASON_UNIQUE_CONSTRAINT_VIOLATION) {
throw $e;
}
}
Expand Down
1 change: 0 additions & 1 deletion psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
<file name="tests/stubs/oc_core_command_base.php" />
<file name="tests/stubs/oc_db_connection.php" />
<file name="tests/stubs/oc_db_connectionadapter.php" />
<file name="tests/stubs/oc_db_exceptions_dbalexception.php" />
<file name="tests/stubs/oc_db_querybuilder_querybuilder.php" />
<file name="tests/stubs/oc_db_schemawrapper.php" />
<file name="tests/stubs/oc_files_cache_cache.php" />
Expand Down
1 change: 0 additions & 1 deletion tests/stubs/oc_db_connectionadapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
use Doctrine\DBAL\Exception;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Schema\Schema;
use OC\DB\Exceptions\DbalException;
use OC\DB\QueryBuilder\Sharded\CrossShardMoveHelper;
use OC\DB\QueryBuilder\Sharded\ShardDefinition;
use OCP\DB\IPreparedStatement;
Expand Down
47 changes: 0 additions & 47 deletions tests/stubs/oc_db_exceptions_dbalexception.php

This file was deleted.

1 change: 0 additions & 1 deletion tests/stubs/oc_db_querybuilder_querybuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

use Doctrine\DBAL\Query\QueryException;
use OC\DB\ConnectionAdapter;
use OC\DB\Exceptions\DbalException;
use OC\DB\QueryBuilder\ExpressionBuilder\MySqlExpressionBuilder;
use OC\DB\QueryBuilder\ExpressionBuilder\OCIExpressionBuilder;
use OC\DB\QueryBuilder\ExpressionBuilder\PgSqlExpressionBuilder;
Expand Down
1 change: 0 additions & 1 deletion tests/stubs/oc_files_cache_cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
namespace OC\Files\Cache;

use Doctrine\DBAL\Exception\UniqueConstraintViolationException;
use OC\DB\Exceptions\DbalException;
use OC\DB\QueryBuilder\Sharded\ShardDefinition;
use OC\Files\Search\SearchComparison;
use OC\Files\Search\SearchQuery;
Expand Down
Loading