本文整理汇总了PHP中OC_Filesystem::removeETagHook方法的典型用法代码示例。如果您正苦于以下问题:PHP OC_Filesystem::removeETagHook方法的具体用法?PHP OC_Filesystem::removeETagHook怎么用?PHP OC_Filesystem::removeETagHook使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OC_Filesystem
的用法示例。
在下文中一共展示了OC_Filesystem::removeETagHook方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: copy
public function copy($path1, $path2)
{
$postFix1 = substr($path1, -1, 1) === '/' ? '/' : '';
$postFix2 = substr($path2, -1, 1) === '/' ? '/' : '';
$absolutePath1 = OC_Filesystem::normalizePath($this->getAbsolutePath($path1));
$absolutePath2 = OC_Filesystem::normalizePath($this->getAbsolutePath($path2));
if (OC_FileProxy::runPreProxies('copy', $absolutePath1, $absolutePath2) and OC_Filesystem::isValidPath($path2)) {
$path1 = $this->getRelativePath($absolutePath1);
$path2 = $this->getRelativePath($absolutePath2);
if ($path1 == null or $path2 == null) {
return false;
}
$run = true;
if ($this->fakeRoot == OC_Filesystem::getRoot()) {
OC_Hook::emit(OC_Filesystem::CLASSNAME, OC_Filesystem::signal_copy, array(OC_Filesystem::signal_param_oldpath => $path1, OC_Filesystem::signal_param_newpath => $path2, OC_Filesystem::signal_param_run => &$run));
$exists = $this->file_exists($path2);
if ($run and !$exists) {
OC_Hook::emit(OC_Filesystem::CLASSNAME, OC_Filesystem::signal_create, array(OC_Filesystem::signal_param_path => $path2, OC_Filesystem::signal_param_run => &$run));
}
if ($run) {
OC_Hook::emit(OC_Filesystem::CLASSNAME, OC_Filesystem::signal_write, array(OC_Filesystem::signal_param_path => $path2, OC_Filesystem::signal_param_run => &$run));
}
}
if ($run) {
$mp1 = $this->getMountPoint($path1 . $postFix1);
$mp2 = $this->getMountPoint($path2 . $postFix2);
if ($mp1 == $mp2) {
if ($storage = $this->getStorage($path1 . $postFix1)) {
$result = $storage->copy($this->getInternalPath($path1 . $postFix1), $this->getInternalPath($path2 . $postFix2));
}
} else {
$source = $this->fopen($path1 . $postFix1, 'r');
$target = $this->fopen($path2 . $postFix2, 'w');
$result = OC_Helper::streamCopy($source, $target);
}
if ($this->fakeRoot == OC_Filesystem::getRoot()) {
OC_Hook::emit(OC_Filesystem::CLASSNAME, OC_Filesystem::signal_post_copy, array(OC_Filesystem::signal_param_oldpath => $path1, OC_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(OC_Filesystem::CLASSNAME, OC_Filesystem::signal_post_write, array(OC_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
OC_FileCache_Update::update($path2, $this->fakeRoot);
OC_Filesystem::removeETagHook(array("path" => $path2), $this->fakeRoot);
}
return $result;
}
}
}
示例2: copy
public function copy($path1, $path2)
{
$postFix1 = substr($path1, -1, 1) === '/' ? '/' : '';
$postFix2 = substr($path2, -1, 1) === '/' ? '/' : '';
$absolutePath1 = OC_Filesystem::normalizePath($this->getAbsolutePath($path1));
$absolutePath2 = OC_Filesystem::normalizePath($this->getAbsolutePath($path2));
if (OC_FileProxy::runPreProxies('copy', $absolutePath1, $absolutePath2) and OC_Filesystem::isValidPath($path2)) {
$path1 = $this->getRelativePath($absolutePath1);
$path2 = $this->getRelativePath($absolutePath2);
if ($path1 == null or $path2 == null) {
return false;
}
$run = true;
if ($this->fakeRoot == OC_Filesystem::getRoot()) {
OC_Hook::emit(OC_Filesystem::CLASSNAME, OC_Filesystem::signal_copy, array(OC_Filesystem::signal_param_oldpath => $path1, OC_Filesystem::signal_param_newpath => $path2, OC_Filesystem::signal_param_run => &$run));
$exists = $this->file_exists($path2);
if ($run and !$exists) {
OC_Hook::emit(OC_Filesystem::CLASSNAME, OC_Filesystem::signal_create, array(OC_Filesystem::signal_param_path => $path2, OC_Filesystem::signal_param_run => &$run));
}
if ($run) {
OC_Hook::emit(OC_Filesystem::CLASSNAME, OC_Filesystem::signal_write, array(OC_Filesystem::signal_param_path => $path2, OC_Filesystem::signal_param_run => &$run));
}
}
if ($run) {
$mp1 = $this->getMountPoint($path1 . $postFix1);
$mp2 = $this->getMountPoint($path2 . $postFix2);
if ($mp1 == $mp2) {
if ($storage = $this->getStorage($path1 . $postFix1)) {
$result = $storage->copy($this->getInternalPath($path1 . $postFix1), $this->getInternalPath($path2 . $postFix2));
}
} else {
$source = $this->fopen($path1 . $postFix1, 'r');
$target = $this->fopen($path2 . $postFix2, 'w');
$result = OC_Helper::streamCopy($source, $target);
}
if ($this->fakeRoot == OC_Filesystem::getRoot()) {
// If the file to be copied originates within
// the user's data directory
OC_Hook::emit(OC_Filesystem::CLASSNAME, OC_Filesystem::signal_post_copy, array(OC_Filesystem::signal_param_oldpath => $path1, OC_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(OC_Filesystem::CLASSNAME, OC_Filesystem::signal_post_write, array(OC_Filesystem::signal_param_path => $path2));
} else {
// If this is not a normal file copy operation
// and the file originates somewhere else
// (e.g. a version rollback operation), do not
// perform all the other post_write actions
// Update webdav properties
OC_Filesystem::removeETagHook(array("path" => $path2), $this->fakeRoot);
$splitPath2 = explode('/', $path2);
// Only cache information about files
// that are being copied from within
// the user files directory. Caching
// other files, like VCS backup files,
// serves no purpose
if ($splitPath2[1] == 'files') {
OC_FileCache_Update::update($path2, $this->fakeRoot);
}
}
return $result;
}
}
}