diff --git a/__assets/plugins/baser-core/src/basics.php b/__assets/plugins/baser-core/src/basics.php index cb98dcb660..fdad14dcaa 100644 --- a/__assets/plugins/baser-core/src/basics.php +++ b/__assets/plugins/baser-core/src/basics.php @@ -15,8 +15,7 @@ // App::uses('CakeText', 'Utility'); use Cake\Cache\Cache; use Cake\Utility\Text; -use Cake\Filesystem\File; -use Cake\Filesystem\Folder; +use BaserCore\Utility\BcFolder; use Cake\Utility\Inflector; use BaserCore\Utility\BcUtil; @@ -183,9 +182,9 @@ function clearViewCache($url = null, $ext = '.php') clearCache(strtolower(Text::slug($url)), 'views', $ext); } } else { - $folder = new Folder(CACHE . 'views' . DS); - $files = $folder->read(true, true); - foreach($files[1] as $file) { + $folder = new BcFolder(CACHE . 'views' . DS); + $files = $folder->getFiles(); + foreach ($files as $file) { if ($file != 'empty') { @unlink(CACHE . 'views' . DS . $file); } @@ -200,16 +199,13 @@ function clearDataCache() { App::import('Core', 'Folder'); - $folder = new Folder(CACHE . 'datas' . DS); + $folder = new BcFolder(CACHE . 'datas' . DS); - $files = $folder->read(true, true, true); - foreach($files[1] as $file) { + $files = $folder->getFiles(); + foreach ($files as $file) { @unlink($file); } - $Folder = new Folder(); - foreach($files[0] as $folder) { - $Folder->delete($folder); - } + $folder->delete(); } /** diff --git a/__assets/plugins/baser-core/tests/TestCase/BcBasicsTest.php b/__assets/plugins/baser-core/tests/TestCase/BcBasicsTest.php index 78677772f7..3988e81b5a 100644 --- a/__assets/plugins/baser-core/tests/TestCase/BcBasicsTest.php +++ b/__assets/plugins/baser-core/tests/TestCase/BcBasicsTest.php @@ -1,5 +1,7 @@ assertFalse($coreCache->exists()); - $this->assertFalse($modelCache->exists()); - $this->assertFalse($envCache->exists()); - $this->assertFalse($viewCache->exists()); - $this->assertFalse($dataCache->exists()); - - $coreCache->close(); - $modelCache->close(); - $envCache->close(); - $viewCache->close(); - $dataCache->close(); + $this->assertFalse(is_file($coreCache->getPath())); + $this->assertFalse(is_file($modelCache->getPath())); + $this->assertFalse(is_file($envCache->getPath())); + $this->assertFalse(is_file($viewCache->getPath())); + $this->assertFalse(is_file($dataCache->getPath())); } /**