Code Duplication    Length = 5-5 lines in 3 locations

lib/private/files/view.php 3 locations

@@ 1027-1031 (lines=5) @@
1024
						$result = $storage->$operation($internalPath);
1025
					}
1026
				} catch (\Exception $e) {
1027
					if (in_array('write', $hooks) || in_array('delete', $hooks)) {
1028
						$this->unlockFile($path, ILockingProvider::LOCK_EXCLUSIVE);
1029
					} else if (in_array('read', $hooks)) {
1030
						$this->unlockFile($path, ILockingProvider::LOCK_SHARED);
1031
					}
1032
					throw $e;
1033
				}
1034
@@ 1053-1057 (lines=5) @@
1050
				if ($this->lockingEnabled && $operation === 'fopen' && is_resource($result)) {
1051
					$unlockLater = true;
1052
					$result = CallbackWrapper::wrap($result, null, null, function () use ($hooks, $path) {
1053
						if (in_array('write', $hooks)) {
1054
							$this->unlockFile($path, ILockingProvider::LOCK_EXCLUSIVE);
1055
						} else if (in_array('read', $hooks)) {
1056
							$this->unlockFile($path, ILockingProvider::LOCK_SHARED);
1057
						}
1058
					});
1059
				}
1060
@@ 1067-1071 (lines=5) @@
1064
					}
1065
				}
1066
1067
				if (!$unlockLater
1068
					&& (in_array('write', $hooks) || in_array('delete', $hooks) || in_array('read', $hooks))
1069
				) {
1070
					$this->unlockFile($path, ILockingProvider::LOCK_SHARED);
1071
				}
1072
				return $result;
1073
			} else {
1074
				$this->unlockFile($path, ILockingProvider::LOCK_SHARED);