Don't use limit on explode to have only 1 code path

This commit is contained in:
Joas Schilling 2015-06-12 11:58:26 +02:00
parent a7d2b3b9ae
commit 5586b2db09
1 changed files with 2 additions and 7 deletions

View File

@ -1788,14 +1788,9 @@ class View {
protected function shouldLockFile($path) {
$path = Filesystem::normalizePath($path);
if (substr_count($path, '/') >= 3) {
$pathSegments = explode('/', $path);
if (isset($pathSegments[2])) {
// 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';
}