Esempio n. 1
0
 /**
  * @param CM_File $file
  * @param string  $url
  * @throws CM_Exception
  * @codeCoverageIgnore
  */
 private function _download(CM_File $file, $url)
 {
     $url = (string) $url;
     if ($file->exists()) {
         $modificationTime = $file->getModified();
         if (time() - $modificationTime > self::CACHE_LIFETIME) {
             $file->delete();
         }
     }
     if (!$file->exists()) {
         $path = $file->getPathOnLocalFilesystem();
         $client = new \GuzzleHttp\Client();
         $client->get($url, ['timeout' => 600, 'save_to' => $path]);
     }
     $this->_streamOutput->writeln('Download completed.');
 }