- $tmp = explode("=", $newproperty);
- $newpropertyk = $tmp[0];
- $found = false;
- for ($i=0; $i<count($this->properties); $i++) {
- $tmp = explode("=", $this->properties[$i]);
- $oldpropertyk = $tmp[0];
- if (strcmp($newpropertyk, $oldpropertyk) == 0) {
- $this->properties[$i] = $newproperty;
- $found = true;
- continue;
- }
- }
- if (!$found) {
- array_push($this->properties, $newproperty);
- }
+ $this->properties["$newpropertyk"] = $newpropertyv;
+ }
+ $this->updateAllProperties();
+ }
+
+ /**
+ * Get all Dataset properties from commandline and update object properties attribute
+ *
+ * @throws OMVModuleZFSException
+ * @access private
+ */
+ private function updateAllProperties() {
+ $cmd = "zfs get -H all " . $this->name;
+ OMVUtil::exec($cmd,$out,$res);
+ if ($res) {
+ throw new OMVModuleZFSException(implode("\n", $out));
+ }
+ unset($this->properties);
+ foreach ($out as $line) {
+ $tmpary = preg_split('/\t+/', $line);
+ $this->properties["$tmpary[1]"] = $tmpary[2];