/** * @return string|boolean */ public function downloadFile() { $destination = $this->getDestination(); if (!($release_url = $this->getDownloadLink())) { return false; } // If our directory already exists, we can just return the path to this cached version $whiteList = array('.', '..', 'CVS', '.svn', '.git'); if (file_exists($destination) && count(HackedFileGroup::scanDirectory($destination, '/.*/', $whiteList))) { return $destination; } // Build the destination folder tree if it doesn't already exists. if (!is_dir($destination)) { mkdir($destination, 0775, true); } if (!($local_file = $this->getFile($release_url))) { return false; } try { $this->extractArchive($local_file, $destination); } catch (\Exception $e) { echo $e->getMessage() . "\n"; return false; } return true; }
/** * @param string $storage * @param string $file * * @return string|false */ public function getFileLocation($storage = 'local', $file) { switch ($storage) { case 'remote': $this->downloadRemoteProject(); return $this->remote_files->getFileLocation($file); case 'local': $this->hashLocalProject(); return $this->local_files->getFileLocation($file); } return false; }