From 946a8c30ebe271713f4d16830546bc37e64ef301 Mon Sep 17 00:00:00 2001 From: Niclas Berglind Date: Sat, 22 Mar 2014 14:14:31 +0100 Subject: [PATCH] Added snapshots to Dataset class. Signed-off-by: Niclas Berglind --- src/Dataset.php | 27 +++++++++++++++++++++++++++ src/Snapshot.php | 1 - 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/Dataset.php b/src/Dataset.php index 8560f74..e161141 100644 --- a/src/Dataset.php +++ b/src/Dataset.php @@ -1,6 +1,7 @@ exec($cmd, $out, $res); + foreach ($out as $line) { + if (preg_match('/^(' . $qname . '[^\s]+)\t.*$/', $line, $res)) { + $this->snapshots[] = new OMVModuleZFSSnapshot($res[1]); + } + } } /** @@ -80,6 +97,16 @@ class OMVModuleZFSDataset { return $this->mountPoint; } + /** + * Get all Snapshots associated with the Dataset + * + * @return array $snapshots + * @access public + */ + public function getSnapshots() { + return $this->snapshots; + } + /** * Get a single property value associated with the Dataset * diff --git a/src/Snapshot.php b/src/Snapshot.php index 6e32698..54411e2 100644 --- a/src/Snapshot.php +++ b/src/Snapshot.php @@ -45,7 +45,6 @@ class OMVModuleZFSSnapshot { $this->exec($cmd, $out, $res); foreach ($out as $line) { if (preg_match('/^' . $qname . '\t.*$/', $line)) { - print("Name found!!!\n"); $this->updateAllProperties(); continue; } -- 2.39.2