当前位置: 首页>>代码示例>>PHP>>正文


PHP OC_Filesystem::removeETagHook方法代码示例

本文整理汇总了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;
         }
     }
 }
开发者ID:noci2012,项目名称:owncloud,代码行数:50,代码来源:filesystemview.php

示例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;
         }
     }
 }
开发者ID:ryanshoover,项目名称:core,代码行数:64,代码来源:filesystemview.php


注:本文中的OC_Filesystem::removeETagHook方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。