I'm not 100% sure whether my answer is correct but in PROJECT/lib/symfony/cache/sfCacheFile.class.php
there is a method: sfCacheFile::getFilePath()
that returns a path to a file. It seems that there is no any protection against limitations of ext2
filesystem.
But there is a very simple solution - override that class:
In PROJECT/apps/APP/config/factories.yml
set your own cache class:
default:
# Others factories (if any)
view_cache:
class: myOwnFileCache
param:
automatic_cleaning_factor: 0
cache_dir: %SF_TEMPLATE_CACHE_DIR%
lifetime: 86400
prefix: %SF_APP_DIR%/template
Now create that class and make sure it extends sfFileCache
and overrides getFilePath()
# PROJECT/lib/PROJECT/cache/myOwnFileCache.class.php
class myOwnFileCache extends sfFileCache {
protected getFilePath($key) {
/*
Convert from: abcdef
to: a/b/abcdef
*/
$key = substr($key, 0, 1) . DIRECTORY_SEPARATOR . substr($key, 1, 1) . DIRECTORY_SEPARATOR . $key;
return parent::getFilePath($key);
}
}
Clear cache: ./symfony cc
Now you need 32000 cache keys that starts with the exact same two letters/digits to crush your filesystem.