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

Commit

Permalink
Meta.mount : check command result instead of re-running a second moun…
Browse files Browse the repository at this point in the history
…t cmd.
  • Loading branch information
cdujeu committed May 17, 2014
1 parent d065bd7 commit 105b533
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions core/src/plugins/meta.mount/class.FilesystemMounter.php
Expand Up @@ -140,12 +140,19 @@ public function mountFS()
$MOUNT_OPTIONS = $this->getOption("MOUNT_OPTIONS", $user, $password);

$cmd = ($MOUNT_SUDO? "sudo ": ""). "mount -t " .$MOUNT_TYPE. (empty( $MOUNT_OPTIONS )? " " : " -o " .$MOUNT_OPTIONS. " " ) .$UNC_PATH. " " .$MOUNT_POINT;
shell_exec($cmd);
// Check it is correctly mounted now!
$cmd = ($MOUNT_SUDO?"sudo":"")." mount | grep ".escapeshellarg($MOUNT_POINT);
$output = shell_exec($cmd);
if ($output == null || trim($output) == "") {
throw new Exception("Error while mounting file system - Test was ".$cmd);
$res = null;
system($cmd, $res);
if($res === null){
// Check it is correctly mounted now!
// Could not get the output return code
$cmd1 = ($MOUNT_SUDO?"sudo":"")." mount | grep ".escapeshellarg($MOUNT_POINT);
$output = shell_exec($cmd1);
$success = !empty($output);
}else{
$success = ($res == 0);
}
if (!$success) {
throw new Exception("Error while mounting file system!");
} else {
if (!is_file($MOUNT_POINT."/.ajxp_mount")) {
@file_put_contents($MOUNT_POINT."/.ajxp_mount", "");
Expand Down

0 comments on commit 105b533

Please sign in to comment.