Skip to content
This repository was archived by the owner on Nov 25, 2020. It is now read-only.

Commit 6de418e

Browse files
committed
Better way to detect mount status
1 parent cc56f16 commit 6de418e

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

core/src/plugins/meta.mount/class.FilesystemMounter.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,15 @@ protected function isAlreadyMounted()
102102
{
103103
list($user, $password) = $this->getCredentials();
104104
$MOUNT_POINT = $this->getOption("MOUNT_POINT", $user, $password);
105-
return is_file($MOUNT_POINT."/.ajxp_mount");
105+
if( is_dir($MOUNT_POINT) ){
106+
if( stat(dirname($MOUNT_POINT))[0] == stat($MOUNT_POINT)[0] ){
107+
return false;
108+
}else{
109+
return true;
110+
}
111+
}else{
112+
return false;
113+
}
106114
}
107115

108116
public function mountFS()
@@ -178,7 +186,7 @@ public function umountFS()
178186
$MOUNT_SUDO = $this->options["MOUNT_SUDO"];
179187

180188
system(($MOUNT_SUDO?"sudo":"")." umount ".escapeshellarg($MOUNT_POINT), $res);
181-
if($this->getOption("REMOVE_MOUNTPOINT_ON_UNMOUNT") == true && $res == 0 && !is_file($MOUNT_POINT."/.ajxp_mount")){
189+
if($this->getOption("REMOVE_MOUNTPOINT_ON_UNMOUNT") == true && $res == 0 && !$this->isAlreadyMounted() ){
182190
// Remove mount point
183191
$testRm = @rmdir($MOUNT_POINT);
184192
if($testRm === false){

0 commit comments

Comments
 (0)