summaryrefslogtreecommitdiffstats
path: root/lib/private/Files/Mount
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2018-03-26 16:47:46 +0200
committerRoeland Jago Douma <roeland@famdouma.nl>2018-04-04 12:44:28 +0200
commite48d4c4aad1216a64d52ad5d87b0478944ce577f (patch)
treeb801cd6571cc97017c0230494a55508f1c490ced /lib/private/Files/Mount
parent003c624596dca50662e3ab38a809fab64bf849f5 (diff)
downloadnextcloud-server-e48d4c4aad1216a64d52ad5d87b0478944ce577f.tar.gz
nextcloud-server-e48d4c4aad1216a64d52ad5d87b0478944ce577f.zip
Cache the $foundMountPointLength
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'lib/private/Files/Mount')
-rw-r--r--lib/private/Files/Mount/Manager.php4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/private/Files/Mount/Manager.php b/lib/private/Files/Mount/Manager.php
index eb5d4c4a458..7f21a1e7f99 100644
--- a/lib/private/Files/Mount/Manager.php
+++ b/lib/private/Files/Mount/Manager.php
@@ -79,9 +79,11 @@ class Manager implements IMountManager {
\OC_Hook::emit('OC_Filesystem', 'get_mountpoint', ['path' => $path]);
$foundMountPoint = '';
$mountPoints = array_keys($this->mounts);
+ $foundMountPointLength = 0;
foreach ($mountPoints as $mountpoint) {
- if (strpos($path, $mountpoint) === 0 && \strlen($mountpoint) > \strlen($foundMountPoint)) {
+ if (strpos($path, $mountpoint) === 0 && \strlen($mountpoint) > $foundMountPointLength) {
$foundMountPoint = $mountpoint;
+ $foundMountPointLength = \strlen($foundMountPoint);
}
}