Horde_Pear_Remote::releaseExists PHP Method

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.
    public function releaseExists($package, $version)
    {
        return $this->_rest->releaseExists($package, $version);
    }

Usage Example

コード例 #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;
 }
All Usage Examples Of Horde_Pear_Remote::releaseExists