Inpsyde\MultilingualPress\SiteDuplication\WPDBAttachmentCopier::copy_dir PHP Метод

copy_dir() приватный Метод

Copies all given files from one site to another.
private copy_dir ( array $paths, string $source_dir, string $destination_dir ) : void
$paths array List of file paths relative to the given source directory.
$source_dir string Full source directory path.
$destination_dir string Full destination directory path.
Результат void
    private function copy_dir(array $paths, $source_dir, $destination_dir)
    {
        if (!is_dir($source_dir)) {
            return;
        }
        if (!is_dir($destination_dir) && !wp_mkdir_p($destination_dir)) {
            return;
        }
        array_walk($paths, function ($path) use($source_dir, $destination_dir) {
            $source = "{$source_dir}/{$path}";
            $destination = "{$destination_dir}/{$path}";
            if (file_exists($source) && !file_exists($destination)) {
                if (copy($source, $destination)) {
                    $this->found_files = true;
                }
            }
        });
    }