[Pkg-owncloud-commits] [owncloud] 388/457: Don't use limit on explode to have only 1 code path

David Prévot taffit at moszumanska.debian.org
Sun Jun 28 20:06:52 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch stable8
in repository owncloud.

commit 5586b2db096f64623b4df76da560c48198c573df
Author: Joas Schilling <nickvergessen at owncloud.com>
Date:   Fri Jun 12 11:58:26 2015 +0200

    Don't use limit on explode to have only 1 code path
---
 lib/private/files/view.php | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/lib/private/files/view.php b/lib/private/files/view.php
index 492917b..a206eab 100644
--- a/lib/private/files/view.php
+++ b/lib/private/files/view.php
@@ -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';
 		}
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list