Example #1
0
 /**
  * @return string
  */
 protected function _getComposerVendorDir()
 {
     $fileComposerJson = new CM_File($this->_dirRoot . 'composer.json');
     $cacheKey = CM_CacheConst::ComposerVendorDir;
     $fileCache = new CM_Cache_Storage_File();
     if (false === ($vendorDir = $fileCache->get($cacheKey)) || $fileComposerJson->getModified() > $fileCache->getCreateStamp($cacheKey)) {
         $vendorDir = rtrim($this->getComposer()->getConfig()->get('vendor-dir'), '/') . '/';
         $fileCache->set($cacheKey, $vendorDir);
     }
     return $vendorDir;
 }
Example #2
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.');
 }