本文整理汇总了PHP中OC_FileProxy::runPreProxies方法的典型用法代码示例。如果您正苦于以下问题:PHP OC_FileProxy::runPreProxies方法的具体用法?PHP OC_FileProxy::runPreProxies怎么用?PHP OC_FileProxy::runPreProxies使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OC_FileProxy
的用法示例。
在下文中一共展示了OC_FileProxy::runPreProxies方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
}
}
示例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;
}
示例3: 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
示例4: basicOperation
/**
* abstraction layer for basic filesystem functions: wrapper for \OC\Files\Storage\Storage
*
* @param string $operation
* @param string $path
* @param array $hooks (optional)
* @param mixed $extraParam (optional)
* @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\Files\Storage\Storage for delegation to a storage backend for execution
*/
private function basicOperation($operation, $path, $hooks = array(), $extraParam = null)
{
$postFix = substr($path, -1, 1) === '/' ? '/' : '';
$absolutePath = Filesystem::normalizePath($this->getAbsolutePath($path));
if (\OC_FileProxy::runPreProxies($operation, $absolutePath, $extraParam) and Filesystem::isValidPath($path) and !Filesystem::isFileBlacklisted($path)) {
$path = $this->getRelativePath($absolutePath);
if ($path == null) {
return false;
}
$run = $this->runHooks($hooks, $path);
list($storage, $internalPath) = Filesystem::resolvePath($absolutePath . $postFix);
if ($run and $storage) {
if (!is_null($extraParam)) {
$result = $storage->{$operation}($internalPath, $extraParam);
} else {
$result = $storage->{$operation}($internalPath);
}
$result = \OC_FileProxy::runPostProxies($operation, $this->getAbsolutePath($path), $result);
if (in_array('delete', $hooks) and $result) {
$this->updater->remove($path);
}
if (in_array('write', $hooks)) {
$this->updater->update($path);
}
if (in_array('touch', $hooks)) {
$this->updater->update($path, $extraParam);
}
if ($this->shouldEmitHooks($path) && $result !== false) {
if ($operation != 'fopen') {
//no post hooks for fopen, the file stream is still open
$this->runHooks($hooks, $path, true);
}
}
return $result;
}
}
return null;
}
示例5: 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;
}