Skip to content

Commit

Permalink
- fixed Bug #5874 : Fails generation on missing "notes" element witho…
Browse files Browse the repository at this point in the history
…ut error message.

- problem may occurs also with "package", "summary", "description", "version", "state", "license" elements.


git-svn-id: http://svn.php.net/repository/pear/packages/PEAR_PackageFileManager/trunk@206603 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information
Laurent Laville committed Feb 6, 2006
1 parent a1912f8 commit 7e016b9
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions PackageFileManager.php
Expand Up @@ -56,6 +56,8 @@
define('PEAR_PACKAGEFILEMANAGER_PHP_NOT_PACKAGE', 25);
define('PEAR_PACKAGEFILEMANAGER_CVS_PACKAGED', 26);
define('PEAR_PACKAGEFILEMANAGER_NO_PHPCOMPATINFO', 27);
define('PEAR_PACKAGEFILEMANAGER_NONOTES', 28);
define('PEAR_PACKAGEFILEMANAGER_NOLICENSE', 29);
/**#@-*/
/**
* Error messages
Expand Down Expand Up @@ -124,6 +126,10 @@
'path "%path%" contains CVS directory',
PEAR_PACKAGEFILEMANAGER_NO_PHPCOMPATINFO =>
'PHP_Compat is not installed, cannot detect dependencies',
PEAR_PACKAGEFILEMANAGER_NONOTES =>
'Release Notes (option \'notes\') must be specified in PEAR_PackageFileManager setOptions',
PEAR_PACKAGEFILEMANAGER_NOLICENSE =>
'Release License (option \'license\') must be specified in PEAR_PackageFileManager setOptions',
),
// other language translations go here
);
Expand Down Expand Up @@ -474,10 +480,10 @@ function PEAR_PackageFileManager()
function setOptions($options = array(), $internal = false)
{
if (!$internal) {
if (!isset($options['state'])) {
if (!isset($options['state']) || empty($options['state'])) {
return $this->raiseError(PEAR_PACKAGEFILEMANAGER_NOSTATE);
}
if (!isset($options['version'])) {
if (!isset($options['version']) || empty($options['version'])) {
return $this->raiseError(PEAR_PACKAGEFILEMANAGER_NOVERSION);
}
}
Expand Down Expand Up @@ -930,6 +936,12 @@ function writePackageFile($debuginterface = null)
if (!isset($this->_packageXml['maintainers']) || empty($this->_packageXml['maintainers'])) {
return $this->raiseError(PEAR_PACKAGEFILEMANAGER_ADD_MAINTAINERS);
}
if (!isset($this->_options['notes']) || empty($this->_options['notes'])) {
return $this->raiseError(PEAR_PACKAGEFILEMANAGER_NONOTES);
}
if (!isset($this->_options['license']) || empty($this->_options['license'])) {
return $this->raiseError(PEAR_PACKAGEFILEMANAGER_NOLICENSE);
}
extract($this->_options);
$date = date('Y-m-d');
if (isset($package)) {
Expand Down Expand Up @@ -1559,13 +1571,13 @@ function _getExistingPackageXML($path, $packagefile = 'package.xml')
function _generateNewPackageXML()
{
$this->_oldPackageXml = false;
if (!isset($this->_options['package'])) {
if (!isset($this->_options['package']) || empty($this->_options['package'])) {
return $this->raiseError(PEAR_PACKAGEFILEMANAGER_NOPACKAGE);
}
if (!isset($this->_options['summary'])) {
if (!isset($this->_options['summary']) || empty($this->_options['summary'])) {
return $this->raiseError(PEAR_PACKAGEFILEMANAGER_NOSUMMARY);
}
if (!isset($this->_options['description'])) {
if (!isset($this->_options['description']) || empty($this->_options['description'])) {
return $this->raiseError(PEAR_PACKAGEFILEMANAGER_NODESC);
}
$this->_packageXml = array();
Expand Down

0 comments on commit 7e016b9

Please sign in to comment.