]>
git.datanom.net - omvzfs.git/blob - src/NotifyListener.php
2 require_once('openmediavault/object.inc');
3 require_once('openmediavault/module.inc');
4 require_once("Exception.php");
7 * Class containing information about the pool
9 * @author Michael Rasmussen
11 * @copyright Michael Rasmussen <mir@datanom.net>
13 class OMVModuleZFS
extends OMVModuleAbstract
14 implements OMVINotifyListener
{
18 public function __construct() {
19 $this->pools
= array();
23 public function getName() {
27 public function bindListeners(OMVNotifyDispatcher
$dispatcher) {
28 // Update service if configuration has been modified
29 $dispatcher->addListener(
31 "org.openmediavault.services.nfs",
32 array($this, "onUpdateNFSService"));
33 $dispatcher->addListener(
35 "org.openmediavault.services.nfs.shares.share",
36 array($this, "onCreateNFSShare"));
37 $dispatcher->addListener(
39 "org.openmediavault.services.nfs.shares.share",
40 array($this, "onDeleteNFSShare"));
41 $dispatcher->addListener(
43 "org.openmediavault.services.nfs.shares.share",
44 array($this, "onUpdateNFSShare"));
49 * org.openmediavault.services.nfs
54 public function onUpdateNFSService($args) {
55 $this->debug(sprintf("onUpdateNFSService args=%s", var_export($args, true)));
60 * org.openmediavault.services.nfs.shares.share
65 public function onCreateNFSShare($args) {
66 $this->debug(sprintf("onCreateNFSShare args=%s", var_export($args, true)));
71 * org.openmediavault.services.nfs.shares.share
76 public function onDeleteNFSShare($args) {
77 $this->debug(sprintf("onDeleteNFSShare args=%s", var_export($args, true)));
82 * org.openmediavault.services.nfs.shares.share
87 public function onUpdateNFSShare($args) {
88 $this->debug(sprintf("onUpdateNFSShare args=%s", var_export($args, true)));
92 * Helper function to execute a command and throw an exception on error
93 * (requires stderr redirected to stdout for proper exception message).
95 * @param string $cmd Command to execute
96 * @param array &$out If provided will contain output in an array
97 * @param int &$res If provided will contain Exit status of the command
98 * @return string Last line of output when executing the command
99 * @throws OMVModuleZFSException
102 private function exec($cmd, &$out = null, &$res = null) {
103 $tmp = OMVUtil
::exec($cmd, $out, $res);
105 throw new OMVModuleZFSException(implode("\n", $out));
110 private function updatePools() {
116 $moduleMgr = &OMVModuleMgr
::getInstance();
117 $moduleMgr->registerModule(new OMVModuleZFS());
This page took 0.370826 seconds and 6 git commands to generate.