Permalink
Browse files

Fixing the ocs remote sharing functionality

  • Loading branch information...
1 parent c67a76e commit d59c9019c9ce235903ece899ca9d22cc59c0dec0 @ghecquet ghecquet committed Jun 28, 2016
@@ -95,6 +95,19 @@ public static function convertPath($node) {
$basePath = ltrim($repository->getContextOption($ctx, "PATH"), "/");
$path = $node->getPath();
+ $contentFilters = $node->getRepository()->getContentFilter();
+
+ if (isset($contentFilters)) {
+ $contentFilters = $contentFilters->filters;
+
+ foreach ($contentFilters as $key => $value) {
+ if ($value == $path || empty($path)) {
+ $path = $key;
+ break;
+ }
+ }
+ }
+
if (isset($path)) {
return "/" . $basePath . $path;
}
@@ -95,6 +95,7 @@ public function onComplete(CompleteEvent $event)
$body = $response->getBody();
$contents = $body->getContents();
+
$contents = preg_replace("/xmlns(:[A-Za-z0-9_]*)?=(\"|\')DAV:(\\2)/","xmlns\\1=\\2urn:DAV\\2",$contents);
$contents = preg_replace("/\n/","",$contents);
@@ -40,6 +40,12 @@
*/
class CoreAccessHandler extends Plugin
{
+ public function init(ContextInterface $ctx, $options = [])
+ {
+ parent::init($ctx, $options); // TODO: Change the autogenerated stub
+ MetaStreamWrapper::register();
+ }
+
/**
* @param ServerRequestInterface $requestInterface
* @param ResponseInterface $responseInterface
@@ -25,6 +25,9 @@ class MetadataCachingStream implements StreamInterface
/** @var string uri */
private $uri;
+ /** @var array contentFilters */
+ private $contentFilters;
+
/** @var string path */
private $path;
@@ -41,6 +44,7 @@ public function __construct(
StreamInterface $target = null
) {
$this->uri = $node->getUrl();
+ $this->contentFilters = $node->getRepository()->getContentFilter()->filters;
$this->path = parse_url($this->uri, PHP_URL_PATH);
$this->stream = $stream;
@@ -96,8 +100,13 @@ public function stat() {
// So storing them in a local cache
if (is_array($stats[0])) {
foreach ($stats as $stat) {
- $path = $stat["name"];
- $key = rtrim($this->uri . "/" . $path, "/");
+ $path = "/" . $stat["name"];
+
+ if (isset($this->contentFilters[$path])) {
+ $path = $this->contentFilters[$path];
+ }
+
+ $key = rtrim($this->uri . $path, "/");
self::$stat[$key] = $stat;
}
} else {
@@ -21,6 +21,7 @@
namespace Pydio\Cache\Core;
+use Pydio\Access\Core\Model\AJXP_Node;
use Pydio\Access\Core\SchemeTranslatorWrapper;
use Pydio\Core\Services\CacheService;
@@ -30,12 +31,10 @@
class CacheStreamLayer extends SchemeTranslatorWrapper
{
public static function clearStatCache($path){
- $scheme = parse_url($path, PHP_URL_SCHEME);
- CacheService::delete(AJXP_CACHE_SERVICE_NS_NODES, str_replace($scheme . "://", "stat://", $path));
+ CacheService::delete(AJXP_CACHE_SERVICE_NS_NODES, self::computeCacheId($path, "stat"));
}
public static function clearDirCache($path){
- $scheme = parse_url($path, PHP_URL_SCHEME);
- CacheService::delete(AJXP_CACHE_SERVICE_NS_NODES, str_replace($scheme . "://", "list://", $path));
+ CacheService::delete(AJXP_CACHE_SERVICE_NS_NODES, self::computeCacheId($path, "list"));
}
private $currentListingOrig = null;
@@ -49,16 +48,16 @@ public static function clearDirCache($path){
* @param $type
* @return string
*/
- protected function computeCacheId($path, $type){
+ protected static function computeCacheId($path, $type){
+
+ return AbstractCacheDriver::computeIdForNode(new AJXP_Node($path), $type);
- return AbstractCacheDriver::computeIdForNode(new \Pydio\Access\Core\Model\AJXP_Node($path), $type);
-
}
// Keep listing in cache
public function dir_opendir($path, $options)
{
- $id = $this->computeCacheId($path, "list");
+ $id = self::computeCacheId($path, "list");
if(CacheService::contains(AJXP_CACHE_SERVICE_NS_NODES, $id)){
$this->currentListingRead = $this->currentListingOrig = CacheService::fetch(AJXP_CACHE_SERVICE_NS_NODES, $id);
return true;
@@ -107,7 +106,7 @@ public function dir_rewinddir()
public function url_stat($path, $flags)
{
- $id = $this->computeCacheId($path, "stat");
+ $id = self::computeCacheId($path, "stat");
if(CacheService::contains(AJXP_CACHE_SERVICE_NS_NODES, $id)){
$stat = CacheService::fetch(AJXP_CACHE_SERVICE_NS_NODES, $id);
if(is_array($stat)) return $stat;
@@ -69,7 +69,7 @@ public function getImplementation($pluginsService = null)
}
self::$cacheInstance = $pluginInstance;
if($pluginInstance !== null && $pluginInstance instanceof AbstractCacheDriver && $pluginInstance->supportsPatternDelete(AJXP_CACHE_SERVICE_NS_NODES)){
- MetaStreamWrapper::appendMetaWrapper("pydio.cache", "\\Pydio\\Cache\\Core\\CacheStreamLayer");
+ //MetaStreamWrapper::appendMetaWrapper("pydio.cache", "\\Pydio\\Cache\\Core\\CacheStreamLayer");
}
}
Oops, something went wrong.

0 comments on commit d59c901

Please sign in to comment.