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


PHP OC_FileProxy::runPostProxies方法代码示例

本文整理汇总了PHP中OC_FileProxy::runPostProxies方法的典型用法代码示例。如果您正苦于以下问题:PHP OC_FileProxy::runPostProxies方法的具体用法?PHP OC_FileProxy::runPostProxies怎么用?PHP OC_FileProxy::runPostProxies使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OC_FileProxy的用法示例。


在下文中一共展示了OC_FileProxy::runPostProxies方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: file_assemble

 public function file_assemble($path)
 {
     $absolutePath = OC_Filesystem::normalizePath(OC_Filesystem::getView()->getAbsolutePath($path));
     $data = '';
     // use file_put_contents as method because that best matches what this function does
     if (OC_FileProxy::runPreProxies('file_put_contents', $absolutePath, $data) && OC_Filesystem::isValidPath($path)) {
         $path = OC_Filesystem::getView()->getRelativePath($absolutePath);
         $exists = OC_Filesystem::file_exists($path);
         $run = true;
         if (!$exists) {
             OC_Hook::emit(OC_Filesystem::CLASSNAME, OC_Filesystem::signal_create, array(OC_Filesystem::signal_param_path => $path, OC_Filesystem::signal_param_run => &$run));
         }
         OC_Hook::emit(OC_Filesystem::CLASSNAME, OC_Filesystem::signal_write, array(OC_Filesystem::signal_param_path => $path, OC_Filesystem::signal_param_run => &$run));
         if (!$run) {
             return false;
         }
         $target = OC_Filesystem::fopen($path, 'w');
         if ($target) {
             $count = $this->assemble($target);
             fclose($target);
             if (!$exists) {
                 OC_Hook::emit(OC_Filesystem::CLASSNAME, OC_Filesystem::signal_post_create, array(OC_Filesystem::signal_param_path => $path));
             }
             OC_Hook::emit(OC_Filesystem::CLASSNAME, OC_Filesystem::signal_post_write, array(OC_Filesystem::signal_param_path => $path));
             OC_FileProxy::runPostProxies('file_put_contents', $absolutePath, $count);
             return $count > 0;
         } else {
             return false;
         }
     }
 }
开发者ID:noci2012,项目名称:owncloud,代码行数:31,代码来源:filechunking.php

示例2: basicOperation

 /**
  * abstraction for running most basic operations
  * @param string $operation
  * @param string #path
  * @param array (optional) hooks
  * @param mixed (optional) $extraParam
  * @return mixed
  */
 private function basicOperation($operation, $path, $hooks = array(), $extraParam = null)
 {
     $absolutePath = $this->getAbsolutePath($path);
     if (OC_FileProxy::runPreProxies($operation, $absolutePath, $extraParam) and OC_Filesystem::isValidPath($path)) {
         $path = $this->getRelativePath($absolutePath);
         if ($path == null) {
             return false;
         }
         $internalPath = $this->getInternalPath($path);
         $run = true;
         if (OC_Filesystem::$loaded and $this->fakeRoot == OC_Filesystem::getRoot()) {
             foreach ($hooks as $hook) {
                 if ($hook != 'read') {
                     OC_Hook::emit(OC_Filesystem::CLASSNAME, $hook, array(OC_Filesystem::signal_param_path => $path, OC_Filesystem::signal_param_run => &$run));
                 } else {
                     OC_Hook::emit(OC_Filesystem::CLASSNAME, $hook, array(OC_Filesystem::signal_param_path => $path));
                 }
             }
         }
         if ($run and $storage = $this->getStorage($path)) {
             if (!is_null($extraParam)) {
                 $result = $storage->{$operation}($internalPath, $extraParam);
             } else {
                 $result = $storage->{$operation}($internalPath);
             }
             $result = OC_FileProxy::runPostProxies($operation, $this->getAbsolutePath($path), $result);
             if (OC_Filesystem::$loaded and $this->fakeRoot == OC_Filesystem::getRoot()) {
                 if ($operation != 'fopen') {
                     //no post hooks for fopen, the file stream is still open
                     foreach ($hooks as $hook) {
                         if ($hook != 'read') {
                             OC_Hook::emit(OC_Filesystem::CLASSNAME, 'post_' . $hook, array(OC_Filesystem::signal_param_path => $path));
                         }
                     }
                 }
             }
             return $result;
         }
     }
     return null;
 }
开发者ID:noci2012,项目名称:owncloud,代码行数:49,代码来源:filesystemview.php

示例3: getFileInfo

 /**
  * get the filesystem info
  *
  * @param string $path
  * @param boolean|string $includeMountPoints true to add mountpoint sizes,
  * 'ext' to add only ext storage mount point sizes. Defaults to true.
  * defaults to true
  * @return \OC\Files\FileInfo|false
  */
 public function getFileInfo($path, $includeMountPoints = true)
 {
     $this->assertPathLength($path);
     $data = array();
     if (!Filesystem::isValidPath($path)) {
         return $data;
     }
     if (Cache\Scanner::isPartialFile($path)) {
         return $this->getPartFileInfo($path);
     }
     $path = Filesystem::normalizePath($this->fakeRoot . '/' . $path);
     $mount = Filesystem::getMountManager()->find($path);
     $storage = $mount->getStorage();
     $internalPath = $mount->getInternalPath($path);
     $data = null;
     if ($storage) {
         $cache = $storage->getCache($internalPath);
         $data = $cache->get($internalPath);
         $watcher = $storage->getWatcher($internalPath);
         // if the file is not in the cache or needs to be updated, trigger the scanner and reload the data
         if (!$data) {
             if (!$storage->file_exists($internalPath)) {
                 return false;
             }
             $scanner = $storage->getScanner($internalPath);
             $scanner->scan($internalPath, Cache\Scanner::SCAN_SHALLOW);
             $data = $cache->get($internalPath);
         } else {
             if (!Cache\Scanner::isPartialFile($internalPath) && $watcher->checkUpdate($internalPath, $data)) {
                 $this->updater->propagate($path);
                 $data = $cache->get($internalPath);
             }
         }
         if ($data and isset($data['fileid'])) {
             // upgrades from oc6 or lower might not have the permissions set in the file cache
             if ($data['permissions'] === 0) {
                 $data['permissions'] = $storage->getPermissions($data['path']);
                 $cache->update($data['fileid'], array('permissions' => $data['permissions']));
             }
             if ($includeMountPoints and $data['mimetype'] === 'httpd/unix-directory') {
                 //add the sizes of other mount points to the folder
                 $extOnly = $includeMountPoints === 'ext';
                 $mountPoints = Filesystem::getMountPoints($path);
                 foreach ($mountPoints as $mountPoint) {
                     $subStorage = Filesystem::getStorage($mountPoint);
                     if ($subStorage) {
                         // exclude shared storage ?
                         if ($extOnly && $subStorage instanceof \OC\Files\Storage\Shared) {
                             continue;
                         }
                         $subCache = $subStorage->getCache('');
                         $rootEntry = $subCache->get('');
                         $data['size'] += isset($rootEntry['size']) ? $rootEntry['size'] : 0;
                     }
                 }
             }
         }
     }
     if (!$data) {
         return false;
     }
     if ($mount instanceof MoveableMount && $internalPath === '') {
         $data['permissions'] |= \OCP\Constants::PERMISSION_DELETE;
     }
     $data = \OC_FileProxy::runPostProxies('getFileInfo', $path, $data);
     return new FileInfo($path, $storage, $internalPath, $data, $mount);
 }
开发者ID:kebenxiaoming,项目名称:owncloudRedis,代码行数:76,代码来源:view.php

示例4: getFileInfo

 /**
  * get the filesystem info
  *
  * @param string $path
  * @param boolean $includeMountPoints whether to add mountpoint sizes,
  * defaults to true
  * @return array
  *
  * returns an associative array with the following keys:
  * - size
  * - mtime
  * - mimetype
  * - encrypted
  * - versioned
  */
 public function getFileInfo($path, $includeMountPoints = true)
 {
     $data = array();
     if (!Filesystem::isValidPath($path)) {
         return $data;
     }
     $path = Filesystem::normalizePath($this->fakeRoot . '/' . $path);
     /**
      * @var \OC\Files\Storage\Storage $storage
      * @var string $internalPath
      */
     list($storage, $internalPath) = Filesystem::resolvePath($path);
     if ($storage) {
         $cache = $storage->getCache($internalPath);
         $permissionsCache = $storage->getPermissionsCache($internalPath);
         $user = \OC_User::getUser();
         if (!$cache->inCache($internalPath)) {
             $scanner = $storage->getScanner($internalPath);
             $scanner->scan($internalPath, Cache\Scanner::SCAN_SHALLOW);
         } else {
             $watcher = $storage->getWatcher($internalPath);
             $watcher->checkUpdate($internalPath);
         }
         $data = $cache->get($internalPath);
         if ($data and $data['fileid']) {
             if ($includeMountPoints and $data['mimetype'] === 'httpd/unix-directory') {
                 //add the sizes of other mountpoints to the folder
                 $mountPoints = Filesystem::getMountPoints($path);
                 foreach ($mountPoints as $mountPoint) {
                     $subStorage = Filesystem::getStorage($mountPoint);
                     if ($subStorage) {
                         $subCache = $subStorage->getCache('');
                         $rootEntry = $subCache->get('');
                         $data['size'] += isset($rootEntry['size']) ? $rootEntry['size'] : 0;
                     }
                 }
             }
             $permissions = $permissionsCache->get($data['fileid'], $user);
             if ($permissions === -1) {
                 $permissions = $storage->getPermissions($internalPath);
                 $permissionsCache->set($data['fileid'], $user, $permissions);
             }
             $data['permissions'] = $permissions;
         }
     }
     $data = \OC_FileProxy::runPostProxies('getFileInfo', $path, $data);
     return $data;
 }
开发者ID:hjimmy,项目名称:owncloud,代码行数:63,代码来源:view.php

示例5: basicOperation

 /**
  * abstraction for running most basic operations
  * @param string $operation
  * @param string #path
  * @param array (optional) hooks
  * @param mixed (optional) $extraParam
  * @return mixed
  */
 private static function basicOperation($operation, $path, $hooks = array(), $extraParam = null)
 {
     if (OC_FileProxy::runPreProxies($operation, $path, $extraParam) and self::canRead($path) and $storage = self::getStorage($path)) {
         $interalPath = self::getInternalPath($path);
         $run = true;
         foreach ($hooks as $hook) {
             if ($hook != 'read') {
                 OC_Hook::emit('OC_Filesystem', $hook, array('path' => $path, 'run' => &$run));
             } else {
                 OC_Hook::emit('OC_Filesystem', $hook, array('path' => $path));
             }
         }
         if ($run) {
             if ($extraParam) {
                 $result = $storage->{$operation}($interalPath, $extraParam);
             } else {
                 $result = $storage->{$operation}($interalPath);
             }
             $result = OC_FileProxy::runPostProxies($operation, $path, $result);
             foreach ($hooks as $hook) {
                 if ($hook != 'read') {
                     OC_Hook::emit('OC_Filesystem', 'post_' . $hook, array('path' => $path));
                 }
             }
             return $result;
         }
     }
     return null;
 }
开发者ID:Teino1978-Corp,项目名称:Teino1978-Corp-owncloud_.htaccess-,代码行数:37,代码来源:owncloud_lib_filesystem.php

示例6: basicOperation

 /**
  * @brief abstraction layer for basic filesystem functions: wrapper for OC_Filestorage
  * @param string $operation
  * @param string #path
  * @param array (optional) hooks
  * @param mixed (optional) $extraParam
  * @return mixed
  *
  * This method takes requests for basic filesystem functions (e.g. reading & writing
  * files), processes hooks and proxies, sanitises paths, and finally passes them on to
  * OC_Filestorage for delegation to a storage backend for execution
  */
 private function basicOperation($operation, $path, $hooks = array(), $extraParam = null)
 {
     $postFix = substr($path, -1, 1) === '/' ? '/' : '';
     $absolutePath = OC_Filesystem::normalizePath($this->getAbsolutePath($path));
     if (OC_FileProxy::runPreProxies($operation, $absolutePath, $extraParam) and OC_Filesystem::isValidPath($path)) {
         $path = $this->getRelativePath($absolutePath);
         if ($path == null) {
             return false;
         }
         $internalPath = $this->getInternalPath($path . $postFix);
         $run = $this->runHooks($hooks, $path);
         if ($run and $storage = $this->getStorage($path . $postFix)) {
             if (!is_null($extraParam)) {
                 $result = $storage->{$operation}($internalPath, $extraParam);
             } else {
                 $result = $storage->{$operation}($internalPath);
             }
             $result = OC_FileProxy::runPostProxies($operation, $this->getAbsolutePath($path), $result);
             if (OC_Filesystem::$loaded and $this->fakeRoot == OC_Filesystem::getRoot()) {
                 if ($operation != 'fopen') {
                     //no post hooks for fopen, the file stream is still open
                     $this->runHooks($hooks, $path, true);
                 }
             }
             return $result;
         }
     }
     return null;
 }
开发者ID:noci2012,项目名称:owncloud,代码行数:41,代码来源:filesystemview.php


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