Example #1
0
 public function execute()
 {
     $stableVersions = PhpSource::getStableVersions($this->options->old);
     // aggregate by minor versions
     $stableVersionsByMinorNumber = array();
     foreach ($stableVersions as $version => $arg) {
         if (preg_match('#php-(5\\.\\d+)#', $version, $regs)) {
             $stableVersionsByMinorNumber[$regs[1]][] = str_replace('php-', '', $version);
         }
     }
     echo "Available stable versions:\n";
     foreach ($stableVersionsByMinorNumber as $minorVersion => $versions) {
         if (!$this->options->more) {
             array_splice($versions, 8);
         }
         echo $this->formatter->format("{$minorVersion}+\t", 'yellow'), join(', ', $versions), "\n";
     }
     if ($this->options->svn) {
         $svnVersions = \PhpBrew\PhpSource::getSvnVersions();
         echo $this->formatter->format("Available svn versions:\n", 'yellow');
         foreach ($svnVersions as $version => $arg) {
             echo "  " . $version . "\n";
         }
     }
     $managers = PhpSource::getReleaseManagers();
     foreach ($managers as $id => $fullName) {
         if ($this->options->{$id}) {
             $versions = \PhpBrew\PhpSource::getReleaseManagerVersions($id);
             echo $this->formatter->format("Available versions from PHP Release Manager: {$fullName}\n", 'yellow');
             foreach ($versions as $version => $arg) {
                 echo "  " . $version . "\n";
             }
         }
     }
 }
Example #2
0
 public function downloadByVersionString($version, $old = false, $force = false)
 {
     $info = PhpSource::getVersionInfo($version, $old);
     $targetDir = null;
     if (isset($info['url'])) {
         $targetDir = $this->downloadByUrl($info['url'], $force);
     } elseif (isset($info['svn'])) {
         $targetDir = $this->downloadFromSvn($info['svn']);
     }
     return $targetDir;
 }
Example #3
0
 public function execute($version)
 {
     if (!preg_match('/^php-/', $version)) {
         $version = 'php-' . $version;
     }
     $info = PhpSource::getVersionInfo($version, $this->options->old);
     if (!$info) {
         throw new Exception("Version {$version} not found.");
     }
     $clean = new CleanTask($this->logger);
     if ($clean->cleanByVersion($version)) {
         $this->logger->info("Distribution is cleaned up. Woof! ");
     }
 }
Example #4
0
 public function execute()
 {
     $managers = PhpSource::getReleaseManagers();
     foreach ($managers as $id => $fullName) {
         $versions = \PhpBrew\PhpSource::getReleaseManagerVersions($id);
         echo $this->formatter->format("From {$fullName} --{$id}:\n", 'yellow');
         $cell = 1;
         foreach ($versions as $version => $arg) {
             if (preg_match('/RC|alpha|beta/', $version)) {
                 if ($cell++ == 4 && ($cell = 1)) {
                     echo "\n";
                 }
                 echo str_replace('php-', '', $version), "\t";
             }
         }
         echo "\n";
     }
 }
Example #5
0
 public function execute($version)
 {
     if (!preg_match('/^php-/', $version)) {
         $version = 'php-' . $version;
     }
     $info = PhpSource::getVersionInfo($version, $this->options->old);
     if (!$info) {
         throw new Exception("Version {$version} not found.");
     }
     $prepare = new PrepareDirectoryTask($this->logger);
     $prepare->prepareForVersion($version);
     $buildDir = Config::getBuildDir();
     $dw = new DirectorySwitch();
     $dw->cd($buildDir);
     $download = new DownloadTask($this->logger);
     $targetDir = $download->downloadByVersionString($version, $this->options->old, $this->options->force);
     if (!file_exists($targetDir)) {
         throw new Exception("Download failed.");
     }
     $this->logger->info("Done, please look at: {$buildDir}/{$targetDir}");
     $dw->back();
 }
Example #6
0
 private function getLatestMinorVersion($majorVersion, $includeOld)
 {
     $latestMinorVersion = '';
     foreach (array_keys(PhpSource::getAllVersions($includeOld)) as $version) {
         if (strpos($version, $majorVersion) === 0) {
             $latestMinorVersion = $version;
             break;
         }
     }
     return $latestMinorVersion;
 }