*/
const signal_post_write = 'post_write';
+ /**
+ * signal emitted before file/dir update
+ *
+ * @param string $path
+ * @param bool $run changing this flag to false in hook handler will cancel event
+ */
+ const signal_update = 'update';
+
+ /**
+ * signal emitted after file/dir update
+ *
+ * @param string $path
+ * @param bool $run changing this flag to false in hook handler will cancel event
+ */
+ const signal_post_update = 'post_update';
+
/**
* signal emits when reading file/dir
*
Filesystem::signal_param_run => &$run
)
);
+ } else {
+ \OC_Hook::emit(
+ Filesystem::CLASSNAME,
+ Filesystem::signal_update,
+ array(
+ Filesystem::signal_param_path => $this->getHookPath($path),
+ Filesystem::signal_param_run => &$run,
+ )
+ );
}
\OC_Hook::emit(
Filesystem::CLASSNAME,
Filesystem::signal_post_create,
array(Filesystem::signal_param_path => $this->getHookPath($path))
);
+ } else {
+ \OC_Hook::emit(
+ Filesystem::CLASSNAME,
+ Filesystem::signal_post_update,
+ array(Filesystem::signal_param_path => $this->getHookPath($path))
+ );
}
\OC_Hook::emit(
Filesystem::CLASSNAME,
return false;
}
} else {
- $hooks = ($this->file_exists($path)) ? array('write') : array('create', 'write');
+ $hooks = ($this->file_exists($path)) ? array('update', 'write') : array('create', 'write');
return $this->basicOperation('file_put_contents', $path, $hooks, $data);
}
}
Filesystem::signal_param_run => &$run
)
);
+ } elseif ($run) {
+ \OC_Hook::emit(
+ Filesystem::CLASSNAME,
+ Filesystem::signal_update,
+ array(
+ Filesystem::signal_param_path => $this->getHookPath($path2),
+ Filesystem::signal_param_run => &$run,
+ )
+ );
}
if ($run) {
\OC_Hook::emit(
Filesystem::signal_post_create,
array(Filesystem::signal_param_path => $this->getHookPath($path2))
);
+ } else {
+ \OC_Hook::emit(
+ Filesystem::CLASSNAME,
+ Filesystem::signal_post_update,
+ array(Filesystem::signal_param_path => $this->getHookPath($path2))
+ );
}
\OC_Hook::emit(
Filesystem::CLASSNAME,