X-Git-Url: http://git.datanom.net/omvzfs.git/blobdiff_plain/5627dfd7773fc58ee6615ea7d6bb93dfbc28ab02..2d44d88394aa1d612c8324ceaab7b8fb0fbe8357:/src/Utils.php diff --git a/src/Utils.php b/src/Utils.php index f997041..579d53c 100644 --- a/src/Utils.php +++ b/src/Utils.php @@ -8,6 +8,40 @@ require_once("Dataset.php"); */ class OMVModuleZFSUtil { + /** + * Deletes all shared folders pointing to the specifc path + * + */ + public static function deleteShares($name) { + global $xmlConfig; + $tmp = new OMVModuleZFSDataset($name); + $reldirpath = OMVModuleZFSUtil::getReldirpath($tmp->getMountPoint()); + $poolname = OMVModuleZFSUtil::getPoolname($name); + $pooluuid = OMVModuleZFSUtil::getUUIDbyName($poolname); + $xpath = "//system/fstab/mntent[fsname='" . $pooluuid . "']"; + $mountpoint = $xmlConfig->get($xpath); + $mntentuuid = $mountpoint['uuid']; + $xpath = "//system/shares/sharedfolder[mntentref='" . $mntentuuid . "' and reldirpath='" . $reldirpath . "']"; + $xmlConfig->delete($xpath); + $dispatcher = &OMVNotifyDispatcher::getInstance(); + $dispatcher->notify(OMV_NOTIFY_CREATE,"org.openmediavault.system.shares.sharedfolder"); + } + + /** + * Get the relative path by complete path + * + * @return string Relative path of the complet path + */ + public static function getReldirpath($path) { + $subdirs = preg_split('/\//',$path); + $reldirpath = ""; + for ($i=2;$iget($xpath); if (is_null($mountpoint)) { $uuid = OMVUtil::uuid(); @@ -77,9 +111,9 @@ class OMVModuleZFSUtil { "fsname" => $pooluuid, "dir" => $dir, "type" => "zfs", - "opts" => "rw,relatime,xattr", + "opts" => "rw,relatime,xattr,noacl", "freq" => "0", - "passno" => "2" + "passno" => "0" ); $xmlConfig->set("//system/fstab",array("mntent" => $object)); $dispatcher = &OMVNotifyDispatcher::getInstance();