releaseExists() public method

Test if the specified release exists.
public releaseExists ( string $package, string $version ) : boolean
$package string The name of the package.
$version string The version of the release.
return boolean True if the release exists.
コード例 #1
0
ファイル: Package.php プロジェクト: raz0rsdge/horde
 /**
  * Validate the preconditions required for this release task.
  *
  * @param array $options Additional options.
  *
  * @return array An empty array if all preconditions are met and a list of
  *               error messages otherwise.
  */
 public function validate($options)
 {
     $errors = array();
     $testpkg = Horde_Util::getTempFile();
     $archive = new Archive_Tar($testpkg, 'gz');
     $archive->addString('a', 'a');
     $archive->addString('b', 'b');
     $results = exec('tar tzvf ' . $testpkg . ' 2>&1');
     // MacOS tar doesn't error out, but only returns the first string (ending in 'a');
     if (strpos($results, 'lone zero block') !== false || substr($results, -1, 1) == 'a') {
         $errors[] = 'Broken Archive_Tar, upgrade first.';
     }
     $remote = new Horde_Pear_Remote();
     try {
         $exists = $remote->releaseExists($this->getComponent()->getName(), $this->getComponent()->getVersion());
         if ($exists) {
             $errors[] = sprintf('The remote server already has version "%s" for component "%s".', $this->getComponent()->getVersion(), $this->getComponent()->getName());
         }
     } catch (Horde_Http_Exception $e) {
         $errors[] = 'Failed accessing the remote PEAR server.';
     }
     try {
         Components_Helper_Version::validateReleaseStability($this->getComponent()->getVersion(), $this->getComponent()->getState('release'));
     } catch (Components_Exception $e) {
         $errors[] = $e->getMessage();
     }
     try {
         Components_Helper_Version::validateApiStability($this->getComponent()->getVersion(), $this->getComponent()->getState('api'));
     } catch (Components_Exception $e) {
         $errors[] = $e->getMessage();
     }
     if (empty($options['releaseserver'])) {
         $errors[] = 'The "releaseserver" option has no value. Where should the release be uploaded?';
     }
     if (empty($options['releasedir'])) {
         $errors[] = 'The "releasedir" option has no value. Where is the remote pirum install located?';
     }
     return $errors;
 }
コード例 #2
0
ファイル: remote.php プロジェクト: jubinpatel/horde
 *
 * @category Horde
 * @package  Horde_Pear
 * @author   Gunnar Wrobel <*****@*****.**>
 * @license  http://www.horde.org/licenses/lgpl21 LGPL 2.1
 * @link     http://www.horde.org/libraries/Horde_Pear
 */
/**
 * The Autoloader allows us to omit "require/include" statements.
 */
require_once 'Horde/Autoloader/Default.php';
$pear = new Horde_Pear_Remote();
print $pear->getChannel();
print "\n\n";
print join("\n", $pear->listPackages());
print "\n\n";
print $pear->getLatestRelease('Horde_Core');
print "\n\n";
print $pear->getLatestDownloadUri('Horde_Core');
print "\n\n";
print_r($pear->getLatestDetails('Horde_Core'));
print "\n\n";
print $pear->releaseExists('Horde_Core', '1.7.0');
print "\n\n";
print count($pear->getDependencies('Horde_Exception', '1.0.0'));
print "\n\n";
print $pear->getPackageXml('Horde_Exception', '1.0.0')->getName();
print "\n\n";
$pear = new Horde_Pear_Remote('pear.phpunit.de');
print join("\n", $pear->listPackages());
print "\n\n";