Add chmodDir/chmodFile from config to smarty.
Check if cache dir is existing when clearing the smarty cache to prevent smarty error