Skip to content
Snippets Groups Projects
Commit 3883ff71 authored by efalcy's avatar efalcy
Browse files

Merge branch...

Merge branch 'hotline#197682_impossible_de_creer_un_dossier_cache_bokeh_ou_de_le_renommer' into 'master'

Cache not deleted on file system

See merge request !4971
parents d968ad45 4d1686d2
Branches
Tags
1 merge request!4971Cache not deleted on file system
Pipeline #32142 passed with stage
in 20 minutes and 9 seconds
- correctif #197682 : Administration : correction du sytème de mise en cache de l'explorateur de fichiers qui empéchait la création de dossier.
\ No newline at end of file
......@@ -243,8 +243,9 @@ class Class_FileManager_FileSystem {
public function clearCache() {
$cache = new Storm_Cache;
foreach($this->_cached_paths as $path)
$cache->remove($path);
foreach($this->_cached_paths as $key =>$path)
$cache->remove($key);
return true;
}
......@@ -347,7 +348,7 @@ class Class_FileManager_FileSystem {
protected function _glob($path, $cache = true) {
$this->_cached_paths[] = $path;
$this->_cached_paths[json_encode($path)] = 1;
$closure = function() use ($path)
{
......@@ -372,7 +373,6 @@ class Class_FileManager_FileSystem {
sort($paths, SORT_NATURAL);
return $paths;
};
if($cache)
return (new Storm_Cache())
->memoize(json_encode($path), $closure);
......@@ -384,8 +384,8 @@ class Class_FileManager_FileSystem {
public function search($term, $path) {
if(!$term)
return [];
$this->_cached_paths[] = $term . $path;
$cache_key = json_encode([$term . $path]);
$this->_cached_paths[$cache_key] = 1;
$closure = function() use ($term, $path) {
$cmd = sprintf('find %s -iname "*%s*"',
......@@ -407,8 +407,9 @@ class Class_FileManager_FileSystem {
return array_filter(array_map([Class_FileManager::class, 'find'], $found));
};
return (new Storm_Cache())
->memoize(json_encode([$term . $path]), $closure);
->memoize( $cache_key, $closure);
}
......
......@@ -35,3 +35,27 @@ class Class_FileManager_FileSystemTest extends ModelTestCase {
parent::tearDown();
}
}
class FileSystemCacheTest extends AbstractControllerTestCase {
public function setUp() {
parent::setUp();
Storm_Cache::beVolatile();
Class_FileManager::beOpenBar();
}
/** @test */
public function pageShouldContainsFichiersDirectory() {
$this->dispatch('/admin/file-manager/index');
$this->assertFalse( (new \Storm_Cache)->load(json_encode("userfiles")));
}
public function tearDown() {
Class_FileManager::reset();
parent::tearDown();
}
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment