From 5b84da11ba9297a15fdac37f4cb9970cce8a58d9 Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Thu, 6 Sep 2018 16:29:03 -0700 Subject: [PATCH] Uses Filesystem component for WordPress copy and rename (#48) --- src/Utils/WordPressProject.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Utils/WordPressProject.php b/src/Utils/WordPressProject.php index 69a94f3..89a2388 100644 --- a/src/Utils/WordPressProject.php +++ b/src/Utils/WordPressProject.php @@ -24,6 +24,7 @@ use Symfony\Component\Console\Question\ConfirmationQuestion; use Symfony\Component\Console\Question\Question; use Symfony\Component\Console\Helper\QuestionHelper; +use Symfony\Component\Filesystem\Filesystem; class WordPressProject extends Project { @@ -45,6 +46,7 @@ public function __construct(InputInterface $input, OutputInterface $output, Ques { $this->input = $input; $this->output = $output; + $this->filesystem = new Filesystem(); $this->helper = $helper ?: new QuestionHelper(); } @@ -158,7 +160,11 @@ public function downloadWordpress($dir = 'wordpress') // set the wordpress dir $this->wordPressDir = $this->getRelativeDir($dir); - rename($tmpDir . DIRECTORY_SEPARATOR . 'wordpress', $this->wordPressDir); + $this->filesystem->rename( + $tmpDir . DIRECTORY_SEPARATOR . 'wordpress', + $this->wordPressDir, + true + ); $this->report(); } @@ -172,7 +178,7 @@ public function downloadBatcachePlugin() ); $this->report(); $this->output->writeln('Copying drop-ins...'); - copy( + $this->filesystem->copy( $dir . '/wp-content/plugins/batcache/advanced-cache.php', $dir . '/wp-content/advanced-cache.php' ); @@ -188,7 +194,7 @@ public function downloadMemcachedPlugin() ); $this->report(); $this->output->writeln('Copying drop-ins...'); - copy( + $this->filesystem->copy( $dir . '/wp-content/plugins/memcached/object-cache.php', $dir . '/wp-content/object-cache.php' );