Don't use limit on explode to have only 1 code path
This commit is contained in:
parent
a7d2b3b9ae
commit
5586b2db09
|
@ -1788,14 +1788,9 @@ class View {
|
||||||
protected function shouldLockFile($path) {
|
protected function shouldLockFile($path) {
|
||||||
$path = Filesystem::normalizePath($path);
|
$path = Filesystem::normalizePath($path);
|
||||||
|
|
||||||
if (substr_count($path, '/') >= 3) {
|
$pathSegments = explode('/', $path);
|
||||||
|
if (isset($pathSegments[2])) {
|
||||||
// E.g.: /username/files/path-to-file
|
// E.g.: /username/files/path-to-file
|
||||||
$pathSegments = explode('/', $path, 4);
|
|
||||||
return $pathSegments[2] === 'files';
|
|
||||||
|
|
||||||
} else if (substr_count($path, '/') === 2) {
|
|
||||||
// E.g.: /username/files
|
|
||||||
$pathSegments = explode('/', $path, 3);
|
|
||||||
return $pathSegments[2] === 'files';
|
return $pathSegments[2] === 'files';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue