PhpBrew\Config::getDistFileDir PHP Method

getDistFileDir() public static method

public static getDistFileDir ( )
    public static function getDistFileDir()
    {
        $dir = self::getRoot() . DIRECTORY_SEPARATOR . 'distfiles';
        if (!file_exists($dir)) {
            mkdir($dir, 0755, true);
        }
        return $dir;
    }

Usage Example

Example #1
0
 public function execute($version)
 {
     $version = preg_replace('/^php-/', '', $version);
     $releaseList = ReleaseList::getReadyInstance($this->options);
     $releases = $releaseList->getReleases();
     $versionInfo = $releaseList->getVersion($version);
     if (!$versionInfo) {
         throw new Exception("Version {$version} not found.");
     }
     $version = $versionInfo['version'];
     $distUrl = 'http://www.php.net/get/' . $versionInfo['filename'] . '/from/this/mirror';
     if ($mirrorSite = $this->options->mirror) {
         // http://tw1.php.net/distributions/php-5.3.29.tar.bz2
         $distUrl = $mirrorSite . '/distributions/' . $versionInfo['filename'];
     }
     $prepare = new PrepareDirectoryTask($this->logger, $this->options);
     $prepare->run();
     $distFileDir = Config::getDistFileDir();
     $download = new DownloadTask($this->logger, $this->options);
     $targetDir = $download->download($distUrl, $distFileDir, $versionInfo['md5']);
     if (!file_exists($targetDir)) {
         throw new Exception('Download failed.');
     }
     $this->logger->info("Done, please look at: {$targetDir}");
 }
All Usage Examples Of PhpBrew\Config::getDistFileDir