public function riseFixture() { if (is_null($this->cachePath)) { return; } $targetPath = rtrim($this->fullCachePath, '\\/'); $sourcePath = rtrim($this->sourceFilesDir, '\\/'); directoryClear($targetPath); directoryCopy($sourcePath, $targetPath); }
function directoryCopy($source, $destination) { $dir = opendir($source); if (!is_dir($destination)) { mkdir($destination); } while (false !== ($file = readdir($dir))) { if ($file != '.' && $file != '..') { if (is_dir($source . '/' . $file)) { directoryCopy($source . '/' . $file, $destination . '/' . $file); } else { copy($source . '/' . $file, $destination . '/' . $file); } } } closedir($dir); }