beginTransaction(); try { $result = $fn(); $db->commit(); return $result; } catch (Throwable $e) { $db->rollBack(); throw $e; } } /** * Wrapper around atomic() to retry after a retryable exception occurred * * Certain transactions might need to be retried. This is especially useful * in highly concurrent requests where a deadlocks is thrown by the database * without waiting for the lock to be freed (e.g. due to MySQL/MariaDB deadlock * detection) * * @template T * @param callable $fn * @psalm-param callable():T $fn * @param IDBConnection $db * @param int $maxRetries * * @return mixed the result of the passed callable * @psalm-return T * * @throws Exception for possible errors of commit or rollback or the custom operations within the closure * @throws Throwable any other error caused by the closure * * @since 27.0.0 */ protected function atomicRetry(callable $fn, IDBConnection $db, int $maxRetries = 3): mixed { for ($i = 0; $i < $maxRetries; $i++) { try { return $this->atomic($fn, $db); } catch (DbalException $e) { if (!$e->isRetryable() || $i === ($maxRetries - 1)) { throw $e; } logger('core')->warning('Retrying operation after retryable exception.', [ 'exception' => $e ]); } } } } n value='add-VersionCreatedEvent'>add-VersionCreatedEvent Nextcloud server, a safe home for all your data: https://github.com/nextcloud/serverwww-data
aboutsummaryrefslogtreecommitdiffstats
path: root/psalm.xml
blob: dac8635b5be4aba5148725d41dbf5504856dea55 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<?xml version="1.0"?>
<psalm
	errorLevel="4"
	resolveFromConfigFile="true"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns="https://getpsalm.org/schema/config"
	xsi:schemaLocation="https://getpsalm.org/schema/config"
    errorBaseline="build/psalm-baseline.xml"
>
	<plugins>
		<plugin filename="build/psalm/AppFrameworkTainter.php" />
	</plugins>
	<projectFiles>
		<directory name="apps/admin_audit"/>
		<directory name="apps/cloud_federation_api"/>
		<directory name="apps/comments"/>
		<directory name="apps/contactsinteraction"/>
		<directory name="apps/dashboard"/>
		<directory name="apps/dav"/>
		<directory name="apps/encryption"/>
		<directory name="apps/federatedfilesharing"/>
		<directory name="apps/federation"/>
		<directory name="apps/files"/>
		<directory name="apps/files_external"/>
		<directory name="apps/files_sharing"/>
		<directory name="apps/files_trashbin"/>
		<directory name="apps/files_versions"/>
		<directory name="apps/lookup_server_connector"/>
		<directory name="apps/oauth2"/>
		<directory name="apps/provisioning_api"/>
		<directory name="apps/settings"/>
		<directory name="apps/sharebymail"/>
		<directory name="apps/systemtags"/>
		<directory name="apps/testing"/>
		<directory name="apps/theming"/>
		<directory name="apps/twofactor_backupcodes"/>
		<directory name="apps/updatenotification"/>
		<directory name="apps/user_ldap"/>
		<directory name="apps/user_status"/>
		<directory name="apps/weather_status"/>
		<directory name="apps/workflowengine"/>
		<directory name="core"/>
		<directory name="lib"/>
		<directory name="ocm-provider"/>
		<directory name="ocs"/>
		<directory name="ocs-provider"/>
		<file name="index.php"/>
		<file name="public.php"/>
		<file name="remote.php"/>
		<file name="status.php"/>
		<file name="version.php"/>
		<ignoreFiles>
			<directory name="apps/**/composer"/>
			<directory name="apps/**/tests"/>
			<directory name="apps/files_external/3rdparty"/>
			<directory name="lib/composer"/>
			<directory name="lib/l10n"/>
		</ignoreFiles>
	</projectFiles>
	<extraFiles>
		<directory name="3rdparty"/>
		<directory name="apps/files_external/3rdparty"/>
	</extraFiles>
	<stubs>
		<file name="build/stubs/apcu.php"/>
		<file name="build/stubs/gd.php"/>
		<file name="build/stubs/imagick.php"/>
		<file name="build/stubs/intl.php"/>
		<file name="build/stubs/IntlChar.php"/>
		<file name="build/stubs/ldap.php"/>
		<file name="build/stubs/memcached.php"/>
		<file name="build/stubs/redis.php"/>
		<file name="build/stubs/redis_cluster.php"/>
		<file name="build/stubs/sftp.php"/>
		<file name="build/stubs/ssh2.php"/>
		<file name="build/stubs/xsl.php"/>
		<file name="build/stubs/ftp.php"/>
		<file name="build/stubs/pcntl.php"/>
		<file name="build/stubs/zip.php"/>
	</stubs>
	<issueHandlers>
		<UndefinedClass>
			<errorLevel type="suppress">
				<referencedClass name="OCA\GroupFolders\Mount\GroupFolderStorage"/>
				<referencedClass name="OCA\TwoFactorNextcloudNotification\Controller\APIController"/>
			</errorLevel>
		</UndefinedClass>
		<UndefinedFunction>
			<errorLevel type="suppress">
				<!-- template functions: https://github.com/nextcloud/server/blob/6e8e34fef920a073118c22111f0f31eb3b3a91dc/lib/private/legacy/template/functions.php -->
				<referencedFunction name="p"/>
				<referencedFunction name="emit_css_tag"/>
				<referencedFunction name="emit_css_loading_tags"/>
				<referencedFunction name="emit_script_tag"/>
				<referencedFunction name="emit_script_loading_tags"/>
				<referencedFunction name="print_unescaped"/>
				<referencedFunction name="script"/>
				<referencedFunction name="vendor_script"/>
				<referencedFunction name="style"/>
				<referencedFunction name="vendor_style"/>
				<referencedFunction name="translation"/>
				<referencedFunction name="component"/>
				<referencedFunction name="link_to"/>
				<referencedFunction name="link_to_docs"/>
				<referencedFunction name="image_path"/>
				<referencedFunction name="mimetype_icon"/>
				<referencedFunction name="preview_icon"/>
				<referencedFunction name="publicPreview_icon"/>
				<referencedFunction name="human_file_size"/>
				<referencedFunction name="strip_time"/>
				<referencedFunction name="relative_modified_date"/>
				<referencedFunction name="html_select_options"/>
			</errorLevel>
		</UndefinedFunction>
		<UndefinedGlobalVariable>
			<errorLevel type="suppress">
				<referencedVariable name="$_"/>
				<referencedVariable name="$l"/>
				<referencedVariable name="$theme"/>
				<!-- false positive: https://github.com/nextcloud/server/blob/cb057829f72c70e819f456edfadbb29d72dba832/lib/private/Console/Application.php#L92 -->
				<file name="core/register_command.php" />
			</errorLevel>
		</UndefinedGlobalVariable>
		<UndefinedDocblockClass>
			<errorLevel type="suppress">
				<!-- Helper classes for sharing API integration from other apps -->
				<referencedClass name="OCA\Deck\Sharing\ShareAPIHelper" />
				<referencedClass name="OCA\Talk\Share\Helper\DeletedShareAPIController" />
			</errorLevel>
		</UndefinedDocblockClass>
	</issueHandlers>
</psalm>