remove double loop for detecting changed mounts
Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
parent
1769029910
commit
67ae310693
|
@ -136,16 +136,19 @@ class UserMountCache implements IUserMountCache {
|
||||||
* @return ICachedMountInfo[]
|
* @return ICachedMountInfo[]
|
||||||
*/
|
*/
|
||||||
private function findChangedMounts(array $newMounts, array $cachedMounts) {
|
private function findChangedMounts(array $newMounts, array $cachedMounts) {
|
||||||
|
$new = [];
|
||||||
|
foreach ($newMounts as $mount) {
|
||||||
|
$new[$mount->getRootId()] = $mount;
|
||||||
|
}
|
||||||
$changed = [];
|
$changed = [];
|
||||||
foreach ($newMounts as $newMount) {
|
|
||||||
foreach ($cachedMounts as $cachedMount) {
|
foreach ($cachedMounts as $cachedMount) {
|
||||||
|
$rootId = $cachedMount->getRootId();
|
||||||
|
if (isset($new[$rootId])) {
|
||||||
|
$newMount = $new[$rootId];
|
||||||
if (
|
if (
|
||||||
$newMount->getRootId() === $cachedMount->getRootId() &&
|
|
||||||
(
|
|
||||||
$newMount->getMountPoint() !== $cachedMount->getMountPoint() ||
|
$newMount->getMountPoint() !== $cachedMount->getMountPoint() ||
|
||||||
$newMount->getStorageId() !== $cachedMount->getStorageId() ||
|
$newMount->getStorageId() !== $cachedMount->getStorageId() ||
|
||||||
$newMount->getMountId() !== $cachedMount->getMountId()
|
$newMount->getMountId() !== $cachedMount->getMountId()
|
||||||
)
|
|
||||||
) {
|
) {
|
||||||
$changed[] = $newMount;
|
$changed[] = $newMount;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue