* create(path, &run) (when a file is created, both create and write will be emited in that order)
* create(path, &run) (when a file is created, both create and write will be emitted in that order)
* post_create(path)
* delete(path, &run)
* post_delete(path)
* rename(oldpath,newpath, &run)
* post_rename(oldpath,newpath)
* copy(oldpath,newpath, &run) (if the newpath doesn't exists yes, copy, create and write will be emited in that order)
* copy(oldpath,newpath, &run) (if the newpath doesn't exists yes, copy, create and write will be emitted in that order)
* post_rename(oldpath,newpath)
*
* the &run parameter can be set to false to prevent the operation from occuring
* the &run parameter can be set to false to prevent the operation from occurring
*/
namespace OC\Files;
@ -34,7 +34,7 @@ class Filesystem {
static private $mounts = array();
public static $loaded = false;
/**
* @var \OC\Files\Storage\Storage $defaultInstance
* @var \OC\Files\View $defaultInstance
*/
static private $defaultInstance;
@ -46,80 +46,80 @@ class Filesystem {
const CLASSNAME = 'OC_Filesystem';
/**
* signalname emited before file renaming
* signalname emitted before file renaming
*
* @param oldpath
* @param newpath
* @param string $oldpath
* @param string $newpath
*/
const signal_rename = 'rename';
/**
* signal emited after file renaming
* signal emitted after file renaming
*
* @param oldpath
* @param newpath
* @param string $oldpath
* @param string $newpath
*/
const signal_post_rename = 'post_rename';
/**
* signal emited before file/dir creation
* signal emitted before file/dir creation
*
* @param path
* @param run changing this flag to false in hook handler will cancel event
* @param string $path
* @param bool $run changing this flag to false in hook handler will cancel event
*/
const signal_create = 'create';
/**
* signal emited after file/dir creation
* signal emitted after file/dir creation
*
* @param path
* @param run changing this flag to false in hook handler will cancel event
* @param string $path
* @param bool $run changing this flag to false in hook handler will cancel event
*/
const signal_post_create = 'post_create';
/**
* signal emits before file/dir copy
*
* @param oldpath
* @param newpath
* @param run changing this flag to false in hook handler will cancel event
* @param string $oldpath
* @param string $newpath
* @param bool $run changing this flag to false in hook handler will cancel event
*/
const signal_copy = 'copy';
/**
* signal emits after file/dir copy
*
* @param oldpath
* @param newpath
* @param string $oldpath
* @param string $newpath
*/
const signal_post_copy = 'post_copy';
/**
* signal emits before file/dir save
*
* @param path
* @param run changing this flag to false in hook handler will cancel event
* @param string $path
* @param bool $run changing this flag to false in hook handler will cancel event
*/
const signal_write = 'write';
/**
* signal emits after file/dir save
*
* @param path
* @param string $path
*/
const signal_post_write = 'post_write';
/**
* signal emits when reading file/dir
*
* @param path
* @param string $path
*/
const signal_read = 'read';
/**
* signal emits when removing file/dir
*
* @param path
* @param string $path
*/
const signal_delete = 'delete';
@ -139,11 +139,11 @@ class Filesystem {
* get the mountpoint of the storage object for a path
( note: because a storage is not always mounted inside the fakeroot, the returned mountpoint is relative to the absolute root of the filesystem and doesn't take the chroot into account
* get the mountpoint of the storage object for a path
( note: because a storage is not always mounted inside the fakeroot, the returned mountpoint is relative to the absolute root of the filesystem and doesn't take the chroot into account
if ($this->fakeRoot == OC_Filesystem::getRoot()) {
OC_Hook::emit(
OC_Filesystem::CLASSNAME,
OC_Filesystem::signal_post_copy,
if ($this->fakeRoot == Filesystem::getRoot()) {
\OC_Hook::emit(
Filesystem::CLASSNAME,
Filesystem::signal_post_copy,
array(
OC_Filesystem::signal_param_oldpath => $path1,
OC_Filesystem::signal_param_newpath => $path2
Filesystem::signal_param_oldpath => $path1,
Filesystem::signal_param_newpath => $path2
)
);
if (!$exists) {
OC_Hook::emit(
OC_Filesystem::CLASSNAME,
OC_Filesystem::signal_post_create,
array(OC_Filesystem::signal_param_path => $path2)
\OC_Hook::emit(
Filesystem::CLASSNAME,
Filesystem::signal_post_create,
array(Filesystem::signal_param_path => $path2)
);
}
OC_Hook::emit(
OC_Filesystem::CLASSNAME,
OC_Filesystem::signal_post_write,
array(OC_Filesystem::signal_param_path => $path2)
\OC_Hook::emit(
Filesystem::CLASSNAME,
Filesystem::signal_post_write,
array(Filesystem::signal_param_path => $path2)
);
} else { // no real copy, file comes from somewhere else, e.g. version rollback -> just update the file cache and the webdav properties without all the other post_write actions