Exemplo n.º 1
0
 /**
  * Saves a local copy of a remote file. Returns false if the remote file can't be fetched, mostly
  * if the requests 404s, meaning we've reached the end of data files.
  *
  * @param string $url
  * @param string $output
  *
  * @return bool
  */
 protected function fetchAndSaveFile($url, $output)
 {
     if (file_exists($output) && !$this->command->config->get('general', 'force')) {
         $this->command->out("Skipped because it already exists");
         return true;
     }
     $remote = @fopen($url, 'r');
     // Not pretty, could use curl but it's not always available
     if ($remote) {
         file_put_contents($output, $remote);
         $this->downloaded++;
         return true;
     } else {
         return false;
     }
 }
Exemplo n.º 2
0
 /**
  * @param string $message
  */
 public function out($message)
 {
     $this->command->out($message);
 }