Subversion Repositories Applications.gtt

Rev

Rev 94 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 94 Rev 187
1
<?php
1
<?php
2
/**
2
/**
3
 * Channel Validator for the pecl.php.net channel
3
 * Channel Validator for the pecl.php.net channel
4
 *
4
 *
5
 * PHP 4 and PHP 5
5
 * PHP 4 and PHP 5
6
 *
6
 *
7
 * @category   pear
7
 * @category   pear
8
 * @package    PEAR
8
 * @package    PEAR
9
 * @author     Greg Beaver <cellog@php.net>
9
 * @author     Greg Beaver <cellog@php.net>
10
 * @copyright  1997-2006 The PHP Group
10
 * @copyright  1997-2006 The PHP Group
11
 * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
11
 * @license    http://opensource.org/licenses/bsd-license.php New BSD License
12
 * @version    CVS: $Id: PECL.php,v 1.8 2006/05/12 02:38:58 cellog Exp $
-
 
13
 * @link       http://pear.php.net/package/PEAR
12
 * @link       http://pear.php.net/package/PEAR
14
 * @since      File available since Release 1.4.0a5
13
 * @since      File available since Release 1.4.0a5
15
 */
14
 */
16
/**
15
/**
17
 * This is the parent class for all validators
16
 * This is the parent class for all validators
18
 */
17
 */
19
require_once 'PEAR/Validate.php';
18
require_once 'PEAR/Validate.php';
20
/**
19
/**
21
 * Channel Validator for the pecl.php.net channel
20
 * Channel Validator for the pecl.php.net channel
22
 * @category   pear
21
 * @category   pear
23
 * @package    PEAR
22
 * @package    PEAR
24
 * @author     Greg Beaver <cellog@php.net>
23
 * @author     Greg Beaver <cellog@php.net>
25
 * @copyright  1997-2006 The PHP Group
24
 * @copyright  1997-2009 The Authors
26
 * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
25
 * @license    http://opensource.org/licenses/bsd-license.php New BSD License
27
 * @version    Release: 1.5.1
26
 * @version    Release: 1.10.1
28
 * @link       http://pear.php.net/package/PEAR
27
 * @link       http://pear.php.net/package/PEAR
29
 * @since      Class available since Release 1.4.0a5
28
 * @since      Class available since Release 1.4.0a5
30
 */
29
 */
31
class PEAR_Validator_PECL extends PEAR_Validate
30
class PEAR_Validator_PECL extends PEAR_Validate
32
{
31
{
33
    function validateVersion()
32
    function validateVersion()
34
    {
33
    {
35
        if ($this->_state == PEAR_VALIDATE_PACKAGING) {
34
        if ($this->_state == PEAR_VALIDATE_PACKAGING) {
36
            $version = $this->_packagexml->getVersion();
35
            $version = $this->_packagexml->getVersion();
37
            $versioncomponents = explode('.', $version);
36
            $versioncomponents = explode('.', $version);
38
            $last = array_pop($versioncomponents);
37
            $last = array_pop($versioncomponents);
39
            if (substr($last, 1, 2) == 'rc') {
38
            if (substr($last, 1, 2) == 'rc') {
40
                $this->_addFailure('version', 'Release Candidate versions must have ' .
39
                $this->_addFailure('version', 'Release Candidate versions must have ' .
41
                'upper-case RC, not lower-case rc');
40
                'upper-case RC, not lower-case rc');
42
                return false;
41
                return false;
43
            }
42
            }
44
        }
43
        }
45
        return true;
44
        return true;
46
    }
45
    }
47
 
46
 
48
    function validatePackageName()
47
    function validatePackageName()
49
    {
48
    {
50
        $ret = parent::validatePackageName();
49
        $ret = parent::validatePackageName();
51
        if ($this->_packagexml->getPackageType() == 'extsrc' ||
50
        if ($this->_packagexml->getPackageType() == 'extsrc' ||
52
              $this->_packagexml->getPackageType() == 'zendextsrc') {
51
              $this->_packagexml->getPackageType() == 'zendextsrc') {
53
            if (strtolower($this->_packagexml->getPackage()) !=
52
            if (strtolower($this->_packagexml->getPackage()) !=
54
                  strtolower($this->_packagexml->getProvidesExtension())) {
53
                  strtolower($this->_packagexml->getProvidesExtension())) {
55
                $this->_addWarning('providesextension', 'package name "' .
54
                $this->_addWarning('providesextension', 'package name "' .
56
                    $this->_packagexml->getPackage() . '" is different from extension name "' .
55
                    $this->_packagexml->getPackage() . '" is different from extension name "' .
57
                    $this->_packagexml->getProvidesExtension() . '"');
56
                    $this->_packagexml->getProvidesExtension() . '"');
58
            }
57
            }
59
        }
58
        }
60
        return $ret;
59
        return $ret;
61
    }
60
    }
62
}
61
}
63
?>
62
?>