diff --git a/src/Methods/CopyMethod.php b/src/Methods/CopyMethod.php index c38d05a..ce6e510 100644 --- a/src/Methods/CopyMethod.php +++ b/src/Methods/CopyMethod.php @@ -6,6 +6,7 @@ use RecursiveDirectoryIterator; use RecursiveIteratorIterator; use RuntimeException; +use SilverStripe\Dev\Deprecation; /** * Expose the vendor module resources via a file copy @@ -30,7 +31,7 @@ public function exposeDirectory($source, $target) $this->filesystem->removeDirectory($target); // Copy to destination - if (!$this->copy($source, $target)) { + if (!$this->filesystem->copy($source, $target)) { throw new RuntimeException("Could not write to directory $target"); } } @@ -38,14 +39,16 @@ public function exposeDirectory($source, $target) /** * Copies a file or directory from $source to $target. * - * @todo Replace with `$this->filesystem->copy() once composer 1.6.0 is released * * @param string $source * @param string $target + * @deprecated 5.2 Use Filesystem::copy instead * @return bool */ public function copy($source, $target) { + Deprecation::notice('5.2', 'Use Filesystem::copy instead', Deprecation::SCOPE_METHOD); + if (!is_dir($source ?? '')) { return copy($source ?? '', $target ?? ''); }