From 30aed8168d188649ecb17219ff0de41b2345e673 Mon Sep 17 00:00:00 2001 From: Nghiem Date: Mon, 2 Oct 2023 17:16:37 +0900 Subject: [PATCH 1/3] 2773-basics --- __assets/plugins/baser-core/src/basics.php | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/__assets/plugins/baser-core/src/basics.php b/__assets/plugins/baser-core/src/basics.php index cb98dcb660..f9dd1f84d5 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[1] 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(); } /** From 9cf0c9d004311fb789563d892665e636bca61f2e Mon Sep 17 00:00:00 2001 From: nghiem-mb Date: Tue, 3 Oct 2023 12:51:39 +0900 Subject: [PATCH 2/3] fix --- __assets/plugins/baser-core/src/basics.php | 2 +- .../tests/TestCase/BcBasicsTest.php | 24 ++++++++++--------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/__assets/plugins/baser-core/src/basics.php b/__assets/plugins/baser-core/src/basics.php index f9dd1f84d5..fdad14dcaa 100644 --- a/__assets/plugins/baser-core/src/basics.php +++ b/__assets/plugins/baser-core/src/basics.php @@ -184,7 +184,7 @@ function clearViewCache($url = null, $ext = '.php') } else { $folder = new BcFolder(CACHE . 'views' . DS); $files = $folder->getFiles(); - foreach ($files[1] as $file) { + foreach ($files as $file) { if ($file != 'empty') { @unlink(CACHE . 'views' . DS . $file); } diff --git a/__assets/plugins/baser-core/tests/TestCase/BcBasicsTest.php b/__assets/plugins/baser-core/tests/TestCase/BcBasicsTest.php index 78677772f7..c130570fae 100644 --- a/__assets/plugins/baser-core/tests/TestCase/BcBasicsTest.php +++ b/__assets/plugins/baser-core/tests/TestCase/BcBasicsTest.php @@ -1,5 +1,7 @@ Date: Fri, 6 Oct 2023 09:07:58 +0900 Subject: [PATCH 3/3] fix bug --- .../baser-core/tests/TestCase/BcBasicsTest.php | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/__assets/plugins/baser-core/tests/TestCase/BcBasicsTest.php b/__assets/plugins/baser-core/tests/TestCase/BcBasicsTest.php index c130570fae..3988e81b5a 100644 --- a/__assets/plugins/baser-core/tests/TestCase/BcBasicsTest.php +++ b/__assets/plugins/baser-core/tests/TestCase/BcBasicsTest.php @@ -251,17 +251,11 @@ public function testClearAllCache() // キャッシュ削除 BcUtil::clearAllCache(); - $this->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())); } /**