Beispiel #1
0
 /**
  * Download .gitignore from a given url.
  *
  * @param  \ArrayAccess $paths
  * @return int
  */
 private function download(ArrayAccess $paths)
 {
     if (!UrlDownloader::checkSoftware()) {
         $this->io->comment('WP Starter needs cUrl installed to download files from url.');
         return $this->create($paths);
     }
     $remote = new UrlDownloader($this->config);
     if ($remote->save($this->targetPath($paths))) {
         return self::SUCCESS;
     }
     $this->error = 'Error on downloading and saving .gitignore. ' . $remote->error();
     return self::ERROR;
 }
Beispiel #2
0
 /**
  * Download dropin file from given url and save it to in wp-content folder.
  *
  * @param string $url
  * @param string $dest
  */
 private function download($url, $dest)
 {
     $remote = new UrlDownloader($url);
     $name = basename($dest);
     if (!$remote->save($dest)) {
         $this->error .= "Impossible to download and save {$name}: " . $remote->error();
     } else {
         $this->success .= "<comment>{$name}</comment> downloaded and saved successfully.";
     }
 }
Beispiel #3
0
 /**
  * Download a remote .env.example in root folder.
  *
  * @param  string       $url
  * @param  string       $dest
  * @param  \ArrayAccess $paths
  * @return int
  */
 private function download($url, $dest, ArrayAccess $paths)
 {
     if (!UrlDownloader::checkSoftware()) {
         $this->io->comment('WP Starter needs cUrl installed to download files from url.');
         return $this->copy($paths, $dest);
     }
     $remote = new UrlDownloader($url);
     if (!$remote->save($dest)) {
         $this->error = 'Error on downloading and save .env.example: ' . $remote->error() . '.';
         return self::ERROR;
     }
     return self::SUCCESS;
 }