Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
Cache was broken by namespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
cdujeu committed May 18, 2016
1 parent a863f66 commit defdc59
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 19 deletions.
9 changes: 7 additions & 2 deletions core/src/plugins/cache.doctrine/doctrine/composer.json
@@ -1,5 +1,10 @@
{
"require": {
"doctrine/cache": "*"
"require": {
"doctrine/cache": "*"
},
"autoload": {
"psr-4": {
"Pydio\\Plugins\\Cache\\Doctrine\\Ext\\": "../ext"
}
}
}
@@ -1,5 +1,5 @@

Copyright (c) 2015 Nils Adermann, Jordi Boggiano
Copyright (c) 2016 Nils Adermann, Jordi Boggiano

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
Expand Up @@ -6,4 +6,33 @@
$baseDir = dirname($vendorDir);

return array(
'Doctrine\\Common\\Cache\\ApcCache' => $vendorDir . '/doctrine/cache/lib/Doctrine/Common/Cache/ApcCache.php',
'Doctrine\\Common\\Cache\\ApcuCache' => $vendorDir . '/doctrine/cache/lib/Doctrine/Common/Cache/ApcuCache.php',
'Doctrine\\Common\\Cache\\ArrayCache' => $vendorDir . '/doctrine/cache/lib/Doctrine/Common/Cache/ArrayCache.php',
'Doctrine\\Common\\Cache\\Cache' => $vendorDir . '/doctrine/cache/lib/Doctrine/Common/Cache/Cache.php',
'Doctrine\\Common\\Cache\\CacheProvider' => $vendorDir . '/doctrine/cache/lib/Doctrine/Common/Cache/CacheProvider.php',
'Doctrine\\Common\\Cache\\ChainCache' => $vendorDir . '/doctrine/cache/lib/Doctrine/Common/Cache/ChainCache.php',
'Doctrine\\Common\\Cache\\ClearableCache' => $vendorDir . '/doctrine/cache/lib/Doctrine/Common/Cache/ClearableCache.php',
'Doctrine\\Common\\Cache\\CouchbaseCache' => $vendorDir . '/doctrine/cache/lib/Doctrine/Common/Cache/CouchbaseCache.php',
'Doctrine\\Common\\Cache\\FileCache' => $vendorDir . '/doctrine/cache/lib/Doctrine/Common/Cache/FileCache.php',
'Doctrine\\Common\\Cache\\FilesystemCache' => $vendorDir . '/doctrine/cache/lib/Doctrine/Common/Cache/FilesystemCache.php',
'Doctrine\\Common\\Cache\\FlushableCache' => $vendorDir . '/doctrine/cache/lib/Doctrine/Common/Cache/FlushableCache.php',
'Doctrine\\Common\\Cache\\MemcacheCache' => $vendorDir . '/doctrine/cache/lib/Doctrine/Common/Cache/MemcacheCache.php',
'Doctrine\\Common\\Cache\\MemcachedCache' => $vendorDir . '/doctrine/cache/lib/Doctrine/Common/Cache/MemcachedCache.php',
'Doctrine\\Common\\Cache\\MongoDBCache' => $vendorDir . '/doctrine/cache/lib/Doctrine/Common/Cache/MongoDBCache.php',
'Doctrine\\Common\\Cache\\MultiGetCache' => $vendorDir . '/doctrine/cache/lib/Doctrine/Common/Cache/MultiGetCache.php',
'Doctrine\\Common\\Cache\\MultiPutCache' => $vendorDir . '/doctrine/cache/lib/Doctrine/Common/Cache/MultiPutCache.php',
'Doctrine\\Common\\Cache\\PhpFileCache' => $vendorDir . '/doctrine/cache/lib/Doctrine/Common/Cache/PhpFileCache.php',
'Doctrine\\Common\\Cache\\PredisCache' => $vendorDir . '/doctrine/cache/lib/Doctrine/Common/Cache/PredisCache.php',
'Doctrine\\Common\\Cache\\RedisCache' => $vendorDir . '/doctrine/cache/lib/Doctrine/Common/Cache/RedisCache.php',
'Doctrine\\Common\\Cache\\RiakCache' => $vendorDir . '/doctrine/cache/lib/Doctrine/Common/Cache/RiakCache.php',
'Doctrine\\Common\\Cache\\SQLite3Cache' => $vendorDir . '/doctrine/cache/lib/Doctrine/Common/Cache/SQLite3Cache.php',
'Doctrine\\Common\\Cache\\Version' => $vendorDir . '/doctrine/cache/lib/Doctrine/Common/Cache/Version.php',
'Doctrine\\Common\\Cache\\VoidCache' => $vendorDir . '/doctrine/cache/lib/Doctrine/Common/Cache/VoidCache.php',
'Doctrine\\Common\\Cache\\WinCacheCache' => $vendorDir . '/doctrine/cache/lib/Doctrine/Common/Cache/WinCacheCache.php',
'Doctrine\\Common\\Cache\\XcacheCache' => $vendorDir . '/doctrine/cache/lib/Doctrine/Common/Cache/XcacheCache.php',
'Doctrine\\Common\\Cache\\ZendDataCache' => $vendorDir . '/doctrine/cache/lib/Doctrine/Common/Cache/ZendDataCache.php',
'Pydio\\Plugins\\Cache\\Doctrine\\Ext\\PatternClearableCache' => $baseDir . '/../ext/PatternClearableCache.php',
'Pydio\\Plugins\\Cache\\Doctrine\\Ext\\PydioApcuCache' => $baseDir . '/../ext/PydioApcuCache.php',
'Pydio\\Plugins\\Cache\\Doctrine\\Ext\\PydioRedisCache' => $baseDir . '/../ext/PydioRedisCache.php',
);
Expand Up @@ -6,5 +6,6 @@
$baseDir = dirname($vendorDir);

return array(
'Pydio\\Plugins\\Cache\\Doctrine\\Ext\\' => array($baseDir . '/../ext'),
'Doctrine\\Common\\Cache\\' => array($vendorDir . '/doctrine/cache/lib/Doctrine/Common/Cache'),
);
Expand Up @@ -23,19 +23,26 @@ public static function getLoader()
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInit4bc137430010115d1364cb6bdd1d28d7', 'loadClassLoader'));

$map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) {
$loader->set($namespace, $path);
}

$map = require __DIR__ . '/autoload_psr4.php';
foreach ($map as $namespace => $path) {
$loader->setPsr4($namespace, $path);
}

$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
$loader->addClassMap($classMap);
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION');
if ($useStaticLoader) {
require_once __DIR__ . '/autoload_static.php';

call_user_func(\Composer\Autoload\ComposerStaticInit4bc137430010115d1364cb6bdd1d28d7::getInitializer($loader));
} else {
$map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) {
$loader->set($namespace, $path);
}

$map = require __DIR__ . '/autoload_psr4.php';
foreach ($map as $namespace => $path) {
$loader->setPsr4($namespace, $path);
}

$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
$loader->addClassMap($classMap);
}
}

$loader->register(true);
Expand Down
5 changes: 3 additions & 2 deletions core/src/plugins/core.cache/class.AbstractCacheDriver.php
Expand Up @@ -29,6 +29,7 @@
use Pydio\Access\Core\Model\AJXP_Node;
use Pydio\Core\Services\AuthService;
use Pydio\Core\PluginFramework\Plugin;
use Pydio\Plugins\Cache\Doctrine\Ext\PatternClearableCache;

/**
* @package AjaXplorer_Plugins
Expand Down Expand Up @@ -92,7 +93,7 @@ public static function computeIdForNode($node, $cacheType, $details = ''){
public function supportsPatternDelete($namespace)
{
$cacheDriver = $this->getCacheDriver($namespace);
return $cacheDriver instanceof Pydio\Plugins\Cache\Doctrine\Ext\PatternClearableCache;
return $cacheDriver instanceof PatternClearableCache;
}

/**
Expand All @@ -102,7 +103,7 @@ public function supportsPatternDelete($namespace)
*/
public function deleteKeyStartingWith($namespace, $id){
$cacheDriver = $this->getCacheDriver($namespace);
if(!($cacheDriver instanceof Pydio\Plugins\Cache\Doctrine\Ext\PatternClearableCache)){
if(!($cacheDriver instanceof PatternClearableCache)){
return false;
}
return $cacheDriver->deleteKeysStartingWith($id);
Expand Down
2 changes: 1 addition & 1 deletion core/src/plugins/core.cache/class.CoreCacheLoader.php
Expand Up @@ -58,7 +58,7 @@ public function getCacheImpl()
}
self::$cacheInstance = $pluginInstance;
if($pluginInstance !== null && $pluginInstance instanceof AbstractCacheDriver && $pluginInstance->supportsPatternDelete(AJXP_CACHE_SERVICE_NS_NODES)){
AJXP_MetaStreamWrapper::appendMetaWrapper("pydio.cache", "CacheStreamLayer");
AJXP_MetaStreamWrapper::appendMetaWrapper("pydio.cache", "\\Pydio\\Cache\\Core\\CacheStreamLayer");
}
}

Expand Down

0 comments on commit defdc59

Please sign in to comment.