├── CODING_STANDARDS ├── INSTALL ├── LICENSE ├── Makefile.frag ├── OS └── Guess.php ├── PEAR.php ├── PEAR ├── Builder.php ├── ChannelFile.php ├── ChannelFile │ └── Parser.php ├── Command.php ├── Command │ ├── Auth.php │ ├── Auth.xml │ ├── Build.php │ ├── Build.xml │ ├── Channels.php │ ├── Channels.xml │ ├── Common.php │ ├── Config.php │ ├── Config.xml │ ├── Install.php │ ├── Install.xml │ ├── Mirror.php │ ├── Mirror.xml │ ├── Package.php │ ├── Package.xml │ ├── Pickle.php │ ├── Pickle.xml │ ├── Registry.php │ ├── Registry.xml │ ├── Remote.php │ ├── Remote.xml │ ├── Test.php │ └── Test.xml ├── Common.php ├── Config.php ├── Dependency2.php ├── DependencyDB.php ├── Downloader.php ├── Downloader │ └── Package.php ├── ErrorStack.php ├── Exception.php ├── Frontend.php ├── Frontend │ └── CLI.php ├── Installer.php ├── Installer │ ├── Role.php │ └── Role │ │ ├── Cfg.php │ │ ├── Cfg.xml │ │ ├── Common.php │ │ ├── Data.php │ │ ├── Data.xml │ │ ├── Doc.php │ │ ├── Doc.xml │ │ ├── Ext.php │ │ ├── Ext.xml │ │ ├── Man.php │ │ ├── Man.xml │ │ ├── Php.php │ │ ├── Php.xml │ │ ├── Script.php │ │ ├── Script.xml │ │ ├── Src.php │ │ ├── Src.xml │ │ ├── Test.php │ │ ├── Test.xml │ │ ├── Www.php │ │ └── Www.xml ├── PackageFile.php ├── PackageFile │ ├── Generator │ │ ├── v1.php │ │ └── v2.php │ ├── Parser │ │ ├── v1.php │ │ └── v2.php │ ├── v1.php │ ├── v2.php │ └── v2 │ │ ├── Validator.php │ │ └── rw.php ├── Packager.php ├── Proxy.php ├── REST.php ├── REST │ ├── 10.php │ ├── 11.php │ ├── 13.php │ └── 14.php ├── Registry.php ├── RunTest.php ├── Start.php ├── Start │ └── CLI.php ├── Task │ ├── Common.php │ ├── Postinstallscript.php │ ├── Postinstallscript │ │ └── rw.php │ ├── Replace.php │ ├── Replace │ │ └── rw.php │ ├── Unixeol.php │ ├── Unixeol │ │ └── rw.php │ ├── Windowseol.php │ └── Windowseol │ │ └── rw.php ├── Validate.php ├── Validator │ └── PECL.php ├── Warning.php └── XMLParser.php ├── README.CONTRIBUTING ├── README.rst ├── System.php ├── build-release.sh ├── catalog ├── composer.json ├── docs ├── Archive_Tar.txt ├── rfc01_PEAR_pecl-binaries.txt └── rfc01_PEAR_subpackages.txt ├── man1 ├── pear.1 ├── peardev.1 └── pecl.1 ├── man5 └── pear.conf.5 ├── package-ErrorStack.xml ├── package-manpages.xml ├── package.dtd ├── package2.xml ├── scripts ├── go-pear.bat ├── pear.bat ├── pear.sh ├── pearcmd.php ├── peardev.bat ├── peardev.sh ├── pecl.bat ├── pecl.sh └── peclcmd.php ├── template.spec └── test-modified.php /CODING_STANDARDS: -------------------------------------------------------------------------------- 1 | =========================================================================== 2 | | PEAR Coding Standards | 3 | =========================================================================== 4 | 5 | This document is no longer maintained, see 6 | http://pear.php.net/manual/en/standards.php instead. 7 | -------------------------------------------------------------------------------- /INSTALL: -------------------------------------------------------------------------------- 1 | PEAR - The PEAR Installer 2 | ========================= 3 | Installing the PEAR Installer. 4 | 5 | You should install PEAR on a local development machine first. Installing 6 | PEAR on a remote production machine should only be done after you are 7 | familiar with PEAR and have tested code using PEAR on your development 8 | machine. 9 | 10 | There are two methods of installing PEAR 11 | - PEAR bundled in PHP 12 | - go-pear 13 | 14 | We will first examine how to install PEAR that is bundled with PHP. 15 | 16 | Microsoft Windows 17 | ================= 18 | If you are running PHP 5.2.0 or newer, simply download and 19 | run the windows installer (.msi) and PEAR can be automatically 20 | installed. 21 | 22 | Otherwise, for older PHP versions, download the .zip of windows, 23 | there is a script included with your PHP distribution that is called 24 | "go-pear". You must open a command box in order to run it. Click 25 | "start" then click "Run..." and type "cmd.exe" to open a command box. 26 | Use "cd" to change directory to the location of PHP where you unzipped it, 27 | and run the go-pear command. 28 | 29 | Unix 30 | ==== 31 | When compiling PHP from source, you simply need to include the 32 | --with-pear directive on the "./configure" command. This is "on" 33 | by default in most PHP versions, but it doesn't hurt to list it 34 | explicitly. You should also consider enabling the zlib extension via 35 | --enable-zlib, so that the PEAR installer will be able to handle gzipped 36 | files (i.e. smaller package files for faster downloads). Later, when you 37 | run "make install" to install PHP itself, part of the process will be 38 | prompts that ask you where you want PEAR to be installed. 39 | 40 | go-pear 41 | ======= 42 | For users who cannot perform the above steps, or who wish to obtain the 43 | latest PEAR with a slightly higher risk of failure, use go-pear. go-pear 44 | is obtained by downloading http://pear.php.net/go-pear and saving it as go-pear.php. 45 | After downloading, simply run "php go-pear.php" or open it in a web browser 46 | (windows only) to download and install PEAR. 47 | 48 | You can always ask general installation questions on pear-general@lists.php.net, 49 | a public mailing list devoted to support for PEAR packages and installation- 50 | related issues. 51 | 52 | Happy PHPing, we hope PEAR will be a great tool for your development work! 53 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 1997-2009, 2 | Stig Bakken , 3 | Gregory Beaver , 4 | Helgi Þormar Þorbjörnsson , 5 | Tomas V.V.Cox , 6 | Martin Jansen . 7 | All rights reserved. 8 | 9 | Redistribution and use in source and binary forms, with or without 10 | modification, are permitted provided that the following conditions are met: 11 | 12 | * Redistributions of source code must retain the above copyright notice, 13 | this list of conditions and the following disclaimer. 14 | * Redistributions in binary form must reproduce the above copyright 15 | notice, this list of conditions and the following disclaimer in the 16 | documentation and/or other materials provided with the distribution. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /Makefile.frag: -------------------------------------------------------------------------------- 1 | # -*- makefile -*- 2 | 3 | peardir=$(PEAR_INSTALLDIR) 4 | 5 | # Skip all php.ini files altogether 6 | PEAR_INSTALL_FLAGS = -n -dshort_open_tag=0 -dsafe_mode=0 7 | 8 | install-pear-installer: $(top_builddir)/sapi/cli/php 9 | @$(top_builddir)/sapi/cli/php $(PEAR_INSTALL_FLAGS) $(srcdir)/install-pear.php -d "$(peardir)" -b "$(bindir)" $(srcdir)/package-*.xml 10 | 11 | install-pear-packages: $(top_builddir)/sapi/cli/php 12 | @$(top_builddir)/sapi/cli/php $(PEAR_INSTALL_FLAGS) $(srcdir)/install-pear.php -d "$(peardir)" -b "$(bindir)" $(srcdir)/packages/*.tar 13 | 14 | install-pear: 15 | @echo "Installing PEAR environment: $(INSTALL_ROOT)$(peardir)/" 16 | @if $(mkinstalldirs) $(INSTALL_ROOT)$(peardir); then \ 17 | $(MAKE) -s install-pear-installer install-pear-packages; \ 18 | else \ 19 | cat $(srcdir)/install-pear.txt; \ 20 | exit 5; \ 21 | fi 22 | 23 | -------------------------------------------------------------------------------- /PEAR/ChannelFile/Parser.php: -------------------------------------------------------------------------------- 1 | 10 | * @copyright 1997-2009 The Authors 11 | * @license http://opensource.org/licenses/bsd-license.php New BSD License 12 | * @link http://pear.php.net/package/PEAR 13 | * @since File available since Release 1.4.0a1 14 | */ 15 | 16 | /** 17 | * base xml parser class 18 | */ 19 | require_once 'PEAR/XMLParser.php'; 20 | require_once 'PEAR/ChannelFile.php'; 21 | /** 22 | * Parser for channel.xml 23 | * @category pear 24 | * @package PEAR 25 | * @author Greg Beaver 26 | * @copyright 1997-2009 The Authors 27 | * @license http://opensource.org/licenses/bsd-license.php New BSD License 28 | * @version Release: @package_version@ 29 | * @link http://pear.php.net/package/PEAR 30 | * @since Class available since Release 1.4.0a1 31 | */ 32 | class PEAR_ChannelFile_Parser extends PEAR_XMLParser 33 | { 34 | var $_config; 35 | var $_logger; 36 | var $_registry; 37 | 38 | function setConfig(&$c) 39 | { 40 | $this->_config = &$c; 41 | $this->_registry = &$c->getRegistry(); 42 | } 43 | 44 | function setLogger(&$l) 45 | { 46 | $this->_logger = &$l; 47 | } 48 | 49 | function parse($data, $file) 50 | { 51 | if (PEAR::isError($err = parent::parse($data, $file))) { 52 | return $err; 53 | } 54 | 55 | $ret = new PEAR_ChannelFile; 56 | $ret->setConfig($this->_config); 57 | if (isset($this->_logger)) { 58 | $ret->setLogger($this->_logger); 59 | } 60 | 61 | $ret->fromArray($this->_unserializedData); 62 | // make sure the filelist is in the easy to read format needed 63 | $ret->flattenFilelist(); 64 | $ret->setPackagefile($file, $archive); 65 | return $ret; 66 | } 67 | } -------------------------------------------------------------------------------- /PEAR/Command/Auth.php: -------------------------------------------------------------------------------- 1 | 10 | * @author Greg Beaver 11 | * @copyright 1997-2009 The Authors 12 | * @license http://opensource.org/licenses/bsd-license.php New BSD License 13 | * @link http://pear.php.net/package/PEAR 14 | * @since File available since Release 0.1 15 | * @deprecated since 1.8.0alpha1 16 | */ 17 | 18 | /** 19 | * base class 20 | */ 21 | require_once 'PEAR/Command/Channels.php'; 22 | 23 | /** 24 | * PEAR commands for login/logout 25 | * 26 | * @category pear 27 | * @package PEAR 28 | * @author Stig Bakken 29 | * @author Greg Beaver 30 | * @copyright 1997-2009 The Authors 31 | * @license http://opensource.org/licenses/bsd-license.php New BSD License 32 | * @version Release: @package_version@ 33 | * @link http://pear.php.net/package/PEAR 34 | * @since Class available since Release 0.1 35 | * @deprecated since 1.8.0alpha1 36 | */ 37 | class PEAR_Command_Auth extends PEAR_Command_Channels 38 | { 39 | var $commands = array( 40 | 'login' => array( 41 | 'summary' => 'Connects and authenticates to remote server [Deprecated in favor of channel-login]', 42 | 'shortcut' => 'li', 43 | 'function' => 'doLogin', 44 | 'options' => array(), 45 | 'doc' => ' 46 | WARNING: This function is deprecated in favor of using channel-login 47 | 48 | Log in to a remote channel server. If is not supplied, 49 | the default channel is used. To use remote functions in the installer 50 | that require any kind of privileges, you need to log in first. The 51 | username and password you enter here will be stored in your per-user 52 | PEAR configuration (~/.pearrc on Unix-like systems). After logging 53 | in, your username and password will be sent along in subsequent 54 | operations on the remote server.', 55 | ), 56 | 'logout' => array( 57 | 'summary' => 'Logs out from the remote server [Deprecated in favor of channel-logout]', 58 | 'shortcut' => 'lo', 59 | 'function' => 'doLogout', 60 | 'options' => array(), 61 | 'doc' => ' 62 | WARNING: This function is deprecated in favor of using channel-logout 63 | 64 | Logs out from the remote server. This command does not actually 65 | connect to the remote server, it only deletes the stored username and 66 | password from your user configuration.', 67 | ) 68 | 69 | ); 70 | 71 | /** 72 | * PEAR_Command_Auth constructor. 73 | * 74 | * @access public 75 | */ 76 | function __construct(&$ui, &$config) 77 | { 78 | parent::__construct($ui, $config); 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /PEAR/Command/Auth.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Connects and authenticates to remote server [Deprecated in favor of channel-login] 4 | doLogin 5 | li 6 | 7 | <channel name> 8 | WARNING: This function is deprecated in favor of using channel-login 9 | 10 | Log in to a remote channel server. If <channel name> is not supplied, 11 | the default channel is used. To use remote functions in the installer 12 | that require any kind of privileges, you need to log in first. The 13 | username and password you enter here will be stored in your per-user 14 | PEAR configuration (~/.pearrc on Unix-like systems). After logging 15 | in, your username and password will be sent along in subsequent 16 | operations on the remote server. 17 | 18 | 19 | Logs out from the remote server [Deprecated in favor of channel-logout] 20 | doLogout 21 | lo 22 | 23 | 24 | WARNING: This function is deprecated in favor of using channel-logout 25 | 26 | Logs out from the remote server. This command does not actually 27 | connect to the remote server, it only deletes the stored username and 28 | password from your user configuration. 29 | 30 | -------------------------------------------------------------------------------- /PEAR/Command/Build.php: -------------------------------------------------------------------------------- 1 | 10 | * @author Tomas V.V.Cox 11 | * @author Greg Beaver 12 | * @copyright 1997-2009 The Authors 13 | * @license http://opensource.org/licenses/bsd-license.php New BSD License 14 | * @link http://pear.php.net/package/PEAR 15 | * @since File available since Release 0.1 16 | */ 17 | 18 | /** 19 | * base class 20 | */ 21 | require_once 'PEAR/Command/Common.php'; 22 | 23 | /** 24 | * PEAR commands for building extensions. 25 | * 26 | * @category pear 27 | * @package PEAR 28 | * @author Stig Bakken 29 | * @author Tomas V.V.Cox 30 | * @author Greg Beaver 31 | * @copyright 1997-2009 The Authors 32 | * @license http://opensource.org/licenses/bsd-license.php New BSD License 33 | * @version Release: @package_version@ 34 | * @link http://pear.php.net/package/PEAR 35 | * @since Class available since Release 0.1 36 | */ 37 | class PEAR_Command_Build extends PEAR_Command_Common 38 | { 39 | var $commands = array( 40 | 'build' => array( 41 | 'summary' => 'Build an Extension From C Source', 42 | 'function' => 'doBuild', 43 | 'shortcut' => 'b', 44 | 'options' => array( 45 | 'configureoptions' => array( 46 | 'shortopt' => 'D', 47 | 'arg' => 'OPTION1=VALUE[ OPTION2=VALUE]', 48 | 'doc' => 'space-delimited list of configure options', 49 | ), 50 | ), 51 | 'doc' => '[package.xml] 52 | Builds one or more extensions contained in a package.' 53 | ), 54 | ); 55 | 56 | /** 57 | * PEAR_Command_Build constructor. 58 | * 59 | * @access public 60 | */ 61 | function __construct(&$ui, &$config) 62 | { 63 | parent::__construct($ui, $config); 64 | } 65 | 66 | function doBuild($command, $options, $params) 67 | { 68 | require_once 'PEAR/Builder.php'; 69 | if (sizeof($params) < 1) { 70 | $params[0] = 'package.xml'; 71 | } 72 | 73 | $configureoptions = empty($options['configureoptions']) ? '' : $options['configureoptions']; 74 | $builder = new PEAR_Builder($configureoptions, $this->ui); 75 | $this->debug = $this->config->get('verbose'); 76 | $err = $builder->build($params[0], array(&$this, 'buildCallback')); 77 | if (PEAR::isError($err)) { 78 | return $err; 79 | } 80 | 81 | return true; 82 | } 83 | 84 | function buildCallback($what, $data) 85 | { 86 | if (($what == 'cmdoutput' && $this->debug > 1) || 87 | ($what == 'output' && $this->debug > 0)) { 88 | $this->ui->outputData(rtrim($data), 'build'); 89 | } 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /PEAR/Command/Build.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Build an Extension From C Source 4 | doBuild 5 | b 6 | 7 | 8 | D 9 | OPTION1=VALUE[ OPTION2=VALUE] 10 | 11 | 12 | [package.xml] 13 | Builds one or more extensions contained in a package. 14 | 15 | -------------------------------------------------------------------------------- /PEAR/Command/Channels.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | List Available Channels 4 | doList 5 | lc 6 | 7 | 8 | List all available channels for installation. 9 | 10 | 11 | 12 | Update the Channel List 13 | doUpdateAll 14 | uc 15 | 16 | 17 | List all installed packages in all channels. 18 | 19 | 20 | 21 | Remove a Channel From the List 22 | doDelete 23 | cde 24 | 25 | <channel name> 26 | Delete a channel from the registry. You may not 27 | remove any channel that has installed packages. 28 | 29 | 30 | 31 | Add a Channel 32 | doAdd 33 | ca 34 | 35 | <channel.xml> 36 | Add a private channel to the channel list. Note that all 37 | public channels should be synced using "update-channels". 38 | Parameter may be either a local file or remote URL to a 39 | channel.xml. 40 | 41 | 42 | 43 | Update an Existing Channel 44 | doUpdate 45 | cu 46 | 47 | 48 | f 49 | will force download of new channel.xml if an existing channel name is used 50 | 51 | 52 | c 53 | will force download of new channel.xml if an existing channel name is used 54 | CHANNEL 55 | 56 | 57 | [<channel.xml>|<channel name>] 58 | Update a channel in the channel list directly. Note that all 59 | public channels can be synced using "update-channels". 60 | Parameter may be a local or remote channel.xml, or the name of 61 | an existing channel. 62 | 63 | 64 | 65 | Retrieve Information on a Channel 66 | doInfo 67 | ci 68 | 69 | <package> 70 | List the files in an installed package. 71 | 72 | 73 | 74 | Specify an alias to a channel name 75 | doAlias 76 | cha 77 | 78 | <channel> <alias> 79 | Specify a specific alias to use for a channel name. 80 | The alias may not be an existing channel name or 81 | alias. 82 | 83 | 84 | 85 | Initialize a Channel from its server 86 | doDiscover 87 | di 88 | 89 | [<channel.xml>|<channel name>] 90 | Initialize a channel from its server and create a local channel.xml. 91 | If <channel name> is in the format "<username>:<password>@<channel>" then 92 | <username> and <password> will be set as the login username/password for 93 | <channel>. Use caution when passing the username/password in this way, as 94 | it may allow other users on your computer to briefly view your username/ 95 | password via the system's process list. 96 | 97 | 98 | 99 | Connects and authenticates to remote channel server 100 | doLogin 101 | cli 102 | 103 | <channel name> 104 | Log in to a remote channel server. If <channel name> is not supplied, 105 | the default channel is used. To use remote functions in the installer 106 | that require any kind of privileges, you need to log in first. The 107 | username and password you enter here will be stored in your per-user 108 | PEAR configuration (~/.pearrc on Unix-like systems). After logging 109 | in, your username and password will be sent along in subsequent 110 | operations on the remote server. 111 | 112 | 113 | Logs out from the remote channel server 114 | doLogout 115 | clo 116 | 117 | <channel name> 118 | Logs out from a remote channel server. If <channel name> is not supplied, 119 | the default channel is used. This command does not actually connect to the 120 | remote server, it only deletes the stored username and password from your user 121 | configuration. 122 | 123 | -------------------------------------------------------------------------------- /PEAR/Command/Common.php: -------------------------------------------------------------------------------- 1 | 10 | * @author Greg Beaver 11 | * @copyright 1997-2009 The Authors 12 | * @license http://opensource.org/licenses/bsd-license.php New BSD License 13 | * @link http://pear.php.net/package/PEAR 14 | * @since File available since Release 0.1 15 | */ 16 | 17 | /** 18 | * base class 19 | */ 20 | require_once 'PEAR.php'; 21 | 22 | /** 23 | * PEAR commands base class 24 | * 25 | * @category pear 26 | * @package PEAR 27 | * @author Stig Bakken 28 | * @author Greg Beaver 29 | * @copyright 1997-2009 The Authors 30 | * @license http://opensource.org/licenses/bsd-license.php New BSD License 31 | * @version Release: @package_version@ 32 | * @link http://pear.php.net/package/PEAR 33 | * @since Class available since Release 0.1 34 | */ 35 | class PEAR_Command_Common extends PEAR 36 | { 37 | /** 38 | * PEAR_Config object used to pass user system and configuration 39 | * on when executing commands 40 | * 41 | * @var PEAR_Config 42 | */ 43 | var $config; 44 | /** 45 | * @var PEAR_Registry 46 | * @access protected 47 | */ 48 | var $_registry; 49 | 50 | /** 51 | * User Interface object, for all interaction with the user. 52 | * @var object 53 | */ 54 | var $ui; 55 | 56 | var $_deps_rel_trans = array( 57 | 'lt' => '<', 58 | 'le' => '<=', 59 | 'eq' => '=', 60 | 'ne' => '!=', 61 | 'gt' => '>', 62 | 'ge' => '>=', 63 | 'has' => '==' 64 | ); 65 | 66 | var $_deps_type_trans = array( 67 | 'pkg' => 'package', 68 | 'ext' => 'extension', 69 | 'php' => 'PHP', 70 | 'prog' => 'external program', 71 | 'ldlib' => 'external library for linking', 72 | 'rtlib' => 'external runtime library', 73 | 'os' => 'operating system', 74 | 'websrv' => 'web server', 75 | 'sapi' => 'SAPI backend' 76 | ); 77 | 78 | /** 79 | * PEAR_Command_Common constructor. 80 | * 81 | * @access public 82 | */ 83 | function __construct(&$ui, &$config) 84 | { 85 | parent::__construct(); 86 | $this->config = &$config; 87 | $this->ui = &$ui; 88 | } 89 | 90 | /** 91 | * Return a list of all the commands defined by this class. 92 | * @return array list of commands 93 | * @access public 94 | */ 95 | function getCommands() 96 | { 97 | $ret = array(); 98 | foreach (array_keys($this->commands) as $command) { 99 | $ret[$command] = $this->commands[$command]['summary']; 100 | } 101 | 102 | return $ret; 103 | } 104 | 105 | /** 106 | * Return a list of all the command shortcuts defined by this class. 107 | * @return array shortcut => command 108 | * @access public 109 | */ 110 | function getShortcuts() 111 | { 112 | $ret = array(); 113 | foreach (array_keys($this->commands) as $command) { 114 | if (isset($this->commands[$command]['shortcut'])) { 115 | $ret[$this->commands[$command]['shortcut']] = $command; 116 | } 117 | } 118 | 119 | return $ret; 120 | } 121 | 122 | function getOptions($command) 123 | { 124 | $shortcuts = $this->getShortcuts(); 125 | if (isset($shortcuts[$command])) { 126 | $command = $shortcuts[$command]; 127 | } 128 | 129 | if (isset($this->commands[$command]) && 130 | isset($this->commands[$command]['options'])) { 131 | return $this->commands[$command]['options']; 132 | } 133 | 134 | return null; 135 | } 136 | 137 | function getGetoptArgs($command, &$short_args, &$long_args) 138 | { 139 | $short_args = ''; 140 | $long_args = array(); 141 | if (empty($this->commands[$command]) || empty($this->commands[$command]['options'])) { 142 | return; 143 | } 144 | 145 | reset($this->commands[$command]['options']); 146 | foreach ($this->commands[$command]['options'] as $option => $info) { 147 | $larg = $sarg = ''; 148 | if (isset($info['arg'])) { 149 | if ($info['arg'][0] == '(') { 150 | $larg = '=='; 151 | $sarg = '::'; 152 | $arg = substr($info['arg'], 1, -1); 153 | } else { 154 | $larg = '='; 155 | $sarg = ':'; 156 | $arg = $info['arg']; 157 | } 158 | } 159 | 160 | if (isset($info['shortopt'])) { 161 | $short_args .= $info['shortopt'] . $sarg; 162 | } 163 | 164 | $long_args[] = $option . $larg; 165 | } 166 | } 167 | 168 | /** 169 | * Returns the help message for the given command 170 | * 171 | * @param string $command The command 172 | * @return mixed A fail string if the command does not have help or 173 | * a two elements array containing [0]=>help string, 174 | * [1]=> help string for the accepted cmd args 175 | */ 176 | function getHelp($command) 177 | { 178 | $config = &PEAR_Config::singleton(); 179 | if (!isset($this->commands[$command])) { 180 | return "No such command \"$command\""; 181 | } 182 | 183 | $help = null; 184 | if (isset($this->commands[$command]['doc'])) { 185 | $help = $this->commands[$command]['doc']; 186 | } 187 | 188 | if (empty($help)) { 189 | // XXX (cox) Fallback to summary if there is no doc (show both?) 190 | if (!isset($this->commands[$command]['summary'])) { 191 | return "No help for command \"$command\""; 192 | } 193 | $help = $this->commands[$command]['summary']; 194 | } 195 | 196 | if (preg_match_all('/{config\s+([^\}]+)}/', $help, $matches)) { 197 | foreach($matches[0] as $k => $v) { 198 | $help = preg_replace("/$v/", $config->get($matches[1][$k]), $help); 199 | } 200 | } 201 | 202 | return array($help, $this->getHelpArgs($command)); 203 | } 204 | 205 | /** 206 | * Returns the help for the accepted arguments of a command 207 | * 208 | * @param string $command 209 | * @return string The help string 210 | */ 211 | function getHelpArgs($command) 212 | { 213 | if (isset($this->commands[$command]['options']) && 214 | count($this->commands[$command]['options'])) 215 | { 216 | $help = "Options:\n"; 217 | foreach ($this->commands[$command]['options'] as $k => $v) { 218 | if (isset($v['arg'])) { 219 | if ($v['arg'][0] == '(') { 220 | $arg = substr($v['arg'], 1, -1); 221 | $sapp = " [$arg]"; 222 | $lapp = "[=$arg]"; 223 | } else { 224 | $sapp = " $v[arg]"; 225 | $lapp = "=$v[arg]"; 226 | } 227 | } else { 228 | $sapp = $lapp = ""; 229 | } 230 | 231 | if (isset($v['shortopt'])) { 232 | $s = $v['shortopt']; 233 | $help .= " -$s$sapp, --$k$lapp\n"; 234 | } else { 235 | $help .= " --$k$lapp\n"; 236 | } 237 | 238 | $p = " "; 239 | $doc = rtrim(str_replace("\n", "\n$p", $v['doc'])); 240 | $help .= " $doc\n"; 241 | } 242 | 243 | return $help; 244 | } 245 | 246 | return null; 247 | } 248 | 249 | function run($command, $options, $params) 250 | { 251 | if (empty($this->commands[$command]['function'])) { 252 | // look for shortcuts 253 | foreach (array_keys($this->commands) as $cmd) { 254 | if (isset($this->commands[$cmd]['shortcut']) && $this->commands[$cmd]['shortcut'] == $command) { 255 | if (empty($this->commands[$cmd]['function'])) { 256 | return $this->raiseError("unknown command `$command'"); 257 | } else { 258 | $func = $this->commands[$cmd]['function']; 259 | } 260 | $command = $cmd; 261 | 262 | //$command = $this->commands[$cmd]['function']; 263 | break; 264 | } 265 | } 266 | } else { 267 | $func = $this->commands[$command]['function']; 268 | } 269 | 270 | return $this->$func($command, $options, $params); 271 | } 272 | } 273 | -------------------------------------------------------------------------------- /PEAR/Command/Config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Show All Settings 4 | doConfigShow 5 | csh 6 | 7 | 8 | c 9 | show configuration variables for another channel 10 | CHAN 11 | 12 | 13 | [layer] 14 | Displays all configuration values. An optional argument 15 | may be used to tell which configuration layer to display. Valid 16 | configuration layers are "user", "system" and "default". To display 17 | configurations for different channels, set the default_channel 18 | configuration variable and run config-show again. 19 | 20 | 21 | 22 | Show One Setting 23 | doConfigGet 24 | cg 25 | 26 | 27 | c 28 | show configuration variables for another channel 29 | CHAN 30 | 31 | 32 | <parameter> [layer] 33 | Displays the value of one configuration parameter. The 34 | first argument is the name of the parameter, an optional second argument 35 | may be used to tell which configuration layer to look in. Valid configuration 36 | layers are "user", "system" and "default". If no layer is specified, a value 37 | will be picked from the first layer that defines the parameter, in the order 38 | just specified. The configuration value will be retrieved for the channel 39 | specified by the default_channel configuration variable. 40 | 41 | 42 | 43 | Change Setting 44 | doConfigSet 45 | cs 46 | 47 | 48 | c 49 | show configuration variables for another channel 50 | CHAN 51 | 52 | 53 | <parameter> <value> [layer] 54 | Sets the value of one configuration parameter. The first argument is 55 | the name of the parameter, the second argument is the new value. Some 56 | parameters are subject to validation, and the command will fail with 57 | an error message if the new value does not make sense. An optional 58 | third argument may be used to specify in which layer to set the 59 | configuration parameter. The default layer is "user". The 60 | configuration value will be set for the current channel, which 61 | is controlled by the default_channel configuration variable. 62 | 63 | 64 | 65 | Show Information About Setting 66 | doConfigHelp 67 | ch 68 | 69 | [parameter] 70 | Displays help for a configuration parameter. Without arguments it 71 | displays help for all configuration parameters. 72 | 73 | 74 | 75 | Create a Default configuration file 76 | doConfigCreate 77 | coc 78 | 79 | 80 | w 81 | create a config file for a windows install 82 | 83 | 84 | <root path> <filename> 85 | Create a default configuration file with all directory configuration 86 | variables set to subdirectories of <root path>, and save it as <filename>. 87 | This is useful especially for creating a configuration file for a remote 88 | PEAR installation (using the --remoteconfig option of install, upgrade, 89 | and uninstall). 90 | 91 | 92 | -------------------------------------------------------------------------------- /PEAR/Command/Mirror.php: -------------------------------------------------------------------------------- 1 | 10 | * @copyright 1997-2009 The Authors 11 | * @license http://opensource.org/licenses/bsd-license.php New BSD License 12 | * @link http://pear.php.net/package/PEAR 13 | * @since File available since Release 1.2.0 14 | */ 15 | 16 | /** 17 | * base class 18 | */ 19 | require_once 'PEAR/Command/Common.php'; 20 | 21 | /** 22 | * PEAR commands for providing file mirrors 23 | * 24 | * @category pear 25 | * @package PEAR 26 | * @author Alexander Merz 27 | * @copyright 1997-2009 The Authors 28 | * @license http://opensource.org/licenses/bsd-license.php New BSD License 29 | * @version Release: @package_version@ 30 | * @link http://pear.php.net/package/PEAR 31 | * @since Class available since Release 1.2.0 32 | */ 33 | class PEAR_Command_Mirror extends PEAR_Command_Common 34 | { 35 | var $commands = array( 36 | 'download-all' => array( 37 | 'summary' => 'Downloads each available package from the default channel', 38 | 'function' => 'doDownloadAll', 39 | 'shortcut' => 'da', 40 | 'options' => array( 41 | 'channel' => 42 | array( 43 | 'shortopt' => 'c', 44 | 'doc' => 'specify a channel other than the default channel', 45 | 'arg' => 'CHAN', 46 | ), 47 | ), 48 | 'doc' => ' 49 | Requests a list of available packages from the default channel ({config default_channel}) 50 | and downloads them to current working directory. Note: only 51 | packages within preferred_state ({config preferred_state}) will be downloaded' 52 | ), 53 | ); 54 | 55 | /** 56 | * PEAR_Command_Mirror constructor. 57 | * 58 | * @access public 59 | * @param object PEAR_Frontend a reference to an frontend 60 | * @param object PEAR_Config a reference to the configuration data 61 | */ 62 | function __construct(&$ui, &$config) 63 | { 64 | parent::__construct($ui, $config); 65 | } 66 | 67 | /** 68 | * For unit-testing 69 | */ 70 | function &factory($a) 71 | { 72 | $a = &PEAR_Command::factory($a, $this->config); 73 | return $a; 74 | } 75 | 76 | /** 77 | * retrieves a list of avaible Packages from master server 78 | * and downloads them 79 | * 80 | * @access public 81 | * @param string $command the command 82 | * @param array $options the command options before the command 83 | * @param array $params the stuff after the command name 84 | * @return bool true if successful 85 | * @throw PEAR_Error 86 | */ 87 | function doDownloadAll($command, $options, $params) 88 | { 89 | $savechannel = $this->config->get('default_channel'); 90 | $reg = &$this->config->getRegistry(); 91 | $channel = isset($options['channel']) ? $options['channel'] : 92 | $this->config->get('default_channel'); 93 | if (!$reg->channelExists($channel)) { 94 | $this->config->set('default_channel', $savechannel); 95 | return $this->raiseError('Channel "' . $channel . '" does not exist'); 96 | } 97 | $this->config->set('default_channel', $channel); 98 | 99 | $this->ui->outputData('Using Channel ' . $this->config->get('default_channel')); 100 | $chan = $reg->getChannel($channel); 101 | if (PEAR::isError($chan)) { 102 | return $this->raiseError($chan); 103 | } 104 | 105 | if ($chan->supportsREST($this->config->get('preferred_mirror')) && 106 | $base = $chan->getBaseURL('REST1.0', $this->config->get('preferred_mirror'))) { 107 | $rest = &$this->config->getREST('1.0', array()); 108 | $remoteInfo = array_flip($rest->listPackages($base, $channel)); 109 | } 110 | 111 | if (PEAR::isError($remoteInfo)) { 112 | return $remoteInfo; 113 | } 114 | 115 | $cmd = &$this->factory("download"); 116 | if (PEAR::isError($cmd)) { 117 | return $cmd; 118 | } 119 | 120 | $this->ui->outputData('Using Preferred State of ' . 121 | $this->config->get('preferred_state')); 122 | $this->ui->outputData('Gathering release information, please wait...'); 123 | 124 | /** 125 | * Error handling not necessary, because already done by 126 | * the download command 127 | */ 128 | PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); 129 | $err = $cmd->run('download', array('downloadonly' => true), array_keys($remoteInfo)); 130 | PEAR::staticPopErrorHandling(); 131 | $this->config->set('default_channel', $savechannel); 132 | if (PEAR::isError($err)) { 133 | $this->ui->outputData($err->getMessage()); 134 | } 135 | 136 | return true; 137 | } 138 | } 139 | -------------------------------------------------------------------------------- /PEAR/Command/Mirror.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Downloads each available package from the default channel 4 | doDownloadAll 5 | da 6 | 7 | 8 | c 9 | specify a channel other than the default channel 10 | CHAN 11 | 12 | 13 | 14 | Requests a list of available packages from the default channel ({config default_channel}) 15 | and downloads them to current working directory. Note: only 16 | packages within preferred_state ({config preferred_state}) will be downloaded 17 | 18 | -------------------------------------------------------------------------------- /PEAR/Command/Package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Build Package 4 | doPackage 5 | p 6 | 7 | 8 | Z 9 | Do not gzip the package file 10 | 11 | 12 | n 13 | Print the name of the packaged file. 14 | 15 | 16 | [descfile] [descfile2] 17 | Creates a PEAR package from its description file (usually called 18 | package.xml). If a second packagefile is passed in, then 19 | the packager will check to make sure that one is a package.xml 20 | version 1.0, and the other is a package.xml version 2.0. The 21 | package.xml version 1.0 will be saved as "package.xml" in the archive, 22 | and the other as "package2.xml" in the archive" 23 | 24 | 25 | 26 | Validate Package Consistency 27 | doPackageValidate 28 | pv 29 | 30 | 31 | 32 | 33 | 34 | Run a "cvs diff" for all files in a package 35 | doCvsDiff 36 | cd 37 | 38 | 39 | q 40 | Be quiet 41 | 42 | 43 | Q 44 | Be really quiet 45 | 46 | 47 | D 48 | Diff against revision of DATE 49 | DATE 50 | 51 | 52 | R 53 | Diff against tag for package release REL 54 | REL 55 | 56 | 57 | r 58 | Diff against revision REV 59 | REV 60 | 61 | 62 | c 63 | Generate context diff 64 | 65 | 66 | u 67 | Generate unified diff 68 | 69 | 70 | i 71 | Ignore case, consider upper- and lower-case letters equivalent 72 | 73 | 74 | b 75 | Ignore changes in amount of white space 76 | 77 | 78 | B 79 | Ignore changes that insert or delete blank lines 80 | 81 | 82 | 83 | Report only whether the files differ, no details 84 | 85 | 86 | n 87 | Don't do anything, just pretend 88 | 89 | 90 | <package.xml> 91 | Compares all the files in a package. Without any options, this 92 | command will compare the current code with the last checked-in code. 93 | Using the -r or -R option you may compare the current code with that 94 | of a specific release. 95 | 96 | 97 | 98 | Set SVN Release Tag 99 | doSvnTag 100 | sv 101 | 102 | 103 | q 104 | Be quiet 105 | 106 | 107 | F 108 | Move (slide) tag if it exists 109 | 110 | 111 | d 112 | Remove tag 113 | 114 | 115 | n 116 | Don't do anything, just pretend 117 | 118 | 119 | <package.xml> [files...] 120 | Sets a SVN tag on all files in a package. Use this command after you have 121 | packaged a distribution tarball with the "package" command to tag what 122 | revisions of what files were in that release. If need to fix something 123 | after running svntag once, but before the tarball is released to the public, 124 | use the "slide" option to move the release tag. 125 | 126 | to include files (such as a second package.xml, or tests not included in the 127 | release), pass them as additional parameters. 128 | 129 | 130 | 131 | Set CVS Release Tag 132 | doCvsTag 133 | ct 134 | 135 | 136 | q 137 | Be quiet 138 | 139 | 140 | Q 141 | Be really quiet 142 | 143 | 144 | F 145 | Move (slide) tag if it exists 146 | 147 | 148 | d 149 | Remove tag 150 | 151 | 152 | n 153 | Don't do anything, just pretend 154 | 155 | 156 | <package.xml> [files...] 157 | Sets a CVS tag on all files in a package. Use this command after you have 158 | packaged a distribution tarball with the "package" command to tag what 159 | revisions of what files were in that release. If need to fix something 160 | after running cvstag once, but before the tarball is released to the public, 161 | use the "slide" option to move the release tag. 162 | 163 | to include files (such as a second package.xml, or tests not included in the 164 | release), pass them as additional parameters. 165 | 166 | 167 | 168 | Show package dependencies 169 | doPackageDependencies 170 | pd 171 | 172 | <package-file> or <package.xml> or <install-package-name> 173 | List all dependencies the package has. 174 | Can take a tgz / tar file, package.xml or a package name of an installed package. 175 | 176 | 177 | Sign a package distribution file 178 | doSign 179 | si 180 | 181 | 182 | v 183 | Display GnuPG output 184 | 185 | 186 | <package-file> 187 | Signs a package distribution (.tar or .tgz) file with GnuPG. 188 | 189 | 190 | Builds an RPM spec file from a PEAR package 191 | doMakeRPM 192 | rpm 193 | 194 | 195 | t 196 | Use FILE as RPM spec file template 197 | FILE 198 | 199 | 200 | p 201 | Use FORMAT as format string for RPM package name, %s is replaced 202 | by the PEAR package name, defaults to "PEAR::%s". 203 | FORMAT 204 | 205 | 206 | <package-file> 207 | 208 | Creates an RPM .spec file for wrapping a PEAR package inside an RPM 209 | package. Intended to be used from the SPECS directory, with the PEAR 210 | package tarball in the SOURCES directory: 211 | 212 | $ pear makerpm ../SOURCES/Net_Socket-1.0.tgz 213 | Wrote RPM spec file PEAR::Net_Geo-1.0.spec 214 | $ rpm -bb PEAR::Net_Socket-1.0.spec 215 | ... 216 | Wrote: /usr/src/redhat/RPMS/i386/PEAR::Net_Socket-1.0-1.i386.rpm 217 | 218 | 219 | 220 | Convert a package.xml 1.0 to package.xml 2.0 format 221 | doConvert 222 | c2 223 | 224 | 225 | f 226 | do not beautify the filelist. 227 | 228 | 229 | [descfile] [descfile2] 230 | Converts a package.xml in 1.0 format into a package.xml 231 | in 2.0 format. The new file will be named package2.xml by default, 232 | and package.xml will be used as the old file by default. 233 | This is not the most intelligent conversion, and should only be 234 | used for automated conversion or learning the format. 235 | 236 | 237 | -------------------------------------------------------------------------------- /PEAR/Command/Pickle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Build PECL Package 4 | doPackage 5 | pi 6 | 7 | 8 | Z 9 | Do not gzip the package file 10 | 11 | 12 | n 13 | Print the name of the packaged file. 14 | 15 | 16 | [descfile] 17 | Creates a PECL package from its package2.xml file. 18 | 19 | An automatic conversion will be made to a package.xml 1.0 and written out to 20 | disk in the current directory as "package.xml". Note that 21 | only simple package.xml 2.0 will be converted. package.xml 2.0 with: 22 | 23 | - dependency types other than required/optional PECL package/ext/php/pearinstaller 24 | - more than one extsrcrelease or zendextsrcrelease 25 | - zendextbinrelease, extbinrelease, phprelease, or bundle release type 26 | - dependency groups 27 | - ignore tags in release filelist 28 | - tasks other than replace 29 | - custom roles 30 | 31 | will cause pickle to fail, and output an error message. If your package2.xml 32 | uses any of these features, you are best off using PEAR_PackageFileManager to 33 | generate both package.xml. 34 | 35 | 36 | -------------------------------------------------------------------------------- /PEAR/Command/Registry.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | List Installed Packages In The Default Channel 4 | doList 5 | l 6 | 7 | 8 | c 9 | list installed packages from this channel 10 | CHAN 11 | 12 | 13 | a 14 | list installed packages from all channels 15 | 16 | 17 | i 18 | output fully channel-aware data, even on failure 19 | 20 | 21 | <package> 22 | If invoked without parameters, this command lists the PEAR packages 23 | installed in your php_dir ({config php_dir}). With a parameter, it 24 | lists the files in a package. 25 | 26 | 27 | 28 | List Files In Installed Package 29 | doFileList 30 | fl 31 | 32 | <package> 33 | List the files in an installed package. 34 | 35 | 36 | 37 | Shell Script Test 38 | doShellTest 39 | st 40 | 41 | <package> [[relation] version] 42 | Tests if a package is installed in the system. Will exit(1) if it is not. 43 | <relation> The version comparison operator. One of: 44 | <, lt, <=, le, >, gt, >=, ge, ==, =, eq, !=, <>, ne 45 | <version> The version to compare with 46 | 47 | 48 | 49 | Display information about a package 50 | doInfo 51 | in 52 | 53 | <package> 54 | Displays information about a package. The package argument may be a 55 | local package file, an URL to a package file, or the name of an 56 | installed package. 57 | 58 | -------------------------------------------------------------------------------- /PEAR/Command/Remote.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Information About Remote Packages 4 | doRemoteInfo 5 | ri 6 | 7 | <package> 8 | Get details on a package from the server. 9 | 10 | 11 | List Available Upgrades 12 | doListUpgrades 13 | lu 14 | 15 | 16 | i 17 | output fully channel-aware data, even on failure 18 | 19 | 20 | [preferred_state] 21 | List releases on the server of packages you have installed where 22 | a newer version is available with the same release state (stable etc.) 23 | or the state passed as the second parameter. 24 | 25 | 26 | List Remote Packages 27 | doRemoteList 28 | rl 29 | 30 | 31 | c 32 | specify a channel other than the default channel 33 | CHAN 34 | 35 | 36 | 37 | Lists the packages available on the configured server along with the 38 | latest stable release of each package. 39 | 40 | 41 | Search remote package database 42 | doSearch 43 | sp 44 | 45 | 46 | c 47 | specify a channel other than the default channel 48 | CHAN 49 | 50 | 51 | a 52 | search packages from all known channels 53 | 54 | 55 | i 56 | output fully channel-aware data, even on failure 57 | 58 | 59 | [packagename] [packageinfo] 60 | Lists all packages which match the search parameters. The first 61 | parameter is a fragment of a packagename. The default channel 62 | will be used unless explicitly overridden. The second parameter 63 | will be used to match any portion of the summary/description 64 | 65 | 66 | List All Packages 67 | doListAll 68 | la 69 | 70 | 71 | c 72 | specify a channel other than the default channel 73 | CHAN 74 | 75 | 76 | i 77 | output fully channel-aware data, even on failure 78 | 79 | 80 | 81 | Lists the packages available on the configured server along with the 82 | latest stable release of each package. 83 | 84 | 85 | Download Package 86 | doDownload 87 | d 88 | 89 | 90 | Z 91 | download an uncompressed (.tar) file 92 | 93 | 94 | <package>... 95 | Download package tarballs. The files will be named as suggested by the 96 | server, for example if you download the DB package and the latest stable 97 | version of DB is 1.6.5, the downloaded file will be DB-1.6.5.tgz. 98 | 99 | 100 | Clear Web Services Cache 101 | doClearCache 102 | cc 103 | 104 | 105 | Clear the XML-RPC/REST cache. See also the cache_ttl configuration 106 | parameter. 107 | 108 | 109 | -------------------------------------------------------------------------------- /PEAR/Command/Test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Run Regression Tests 4 | doRunTests 5 | rt 6 | 7 | 8 | r 9 | Run tests in child directories, recursively. 4 dirs deep maximum 10 | 11 | 12 | i 13 | actual string of settings to pass to php in format " -d setting=blah" 14 | SETTINGS 15 | 16 | 17 | l 18 | Log test runs/results as they are run 19 | 20 | 21 | q 22 | Only display detail for failed tests 23 | 24 | 25 | s 26 | Display simple output for all tests 27 | 28 | 29 | p 30 | Treat parameters as installed packages from which to run tests 31 | 32 | 33 | u 34 | Search parameters for AllTests.php, and use that to run phpunit-based tests 35 | If none is found, all .phpt tests will be tried instead. 36 | 37 | 38 | t 39 | Output run-tests.log in TAP-compliant format 40 | 41 | 42 | c 43 | CGI php executable (needed for tests with POST/GET section) 44 | PHPCGI 45 | 46 | 47 | x 48 | Generate a code coverage report (requires Xdebug 2.0.0+) 49 | 50 | 51 | [testfile|dir ...] 52 | Run regression tests with PHP's regression testing script (run-tests.php). 53 | 54 | -------------------------------------------------------------------------------- /PEAR/Frontend.php: -------------------------------------------------------------------------------- 1 | 10 | * @copyright 1997-2009 The Authors 11 | * @license http://opensource.org/licenses/bsd-license.php New BSD License 12 | * @link http://pear.php.net/package/PEAR 13 | * @since File available since Release 1.4.0a1 14 | */ 15 | 16 | /** 17 | * Include error handling 18 | */ 19 | //require_once 'PEAR.php'; 20 | 21 | /** 22 | * Which user interface class is being used. 23 | * @var string class name 24 | */ 25 | $GLOBALS['_PEAR_FRONTEND_CLASS'] = 'PEAR_Frontend_CLI'; 26 | 27 | /** 28 | * Instance of $_PEAR_Command_uiclass. 29 | * @var object 30 | */ 31 | $GLOBALS['_PEAR_FRONTEND_SINGLETON'] = null; 32 | 33 | /** 34 | * Singleton-based frontend for PEAR user input/output 35 | * 36 | * @category pear 37 | * @package PEAR 38 | * @author Greg Beaver 39 | * @copyright 1997-2009 The Authors 40 | * @license http://opensource.org/licenses/bsd-license.php New BSD License 41 | * @version Release: @package_version@ 42 | * @link http://pear.php.net/package/PEAR 43 | * @since Class available since Release 1.4.0a1 44 | */ 45 | class PEAR_Frontend extends PEAR 46 | { 47 | /** 48 | * Retrieve the frontend object 49 | * @return PEAR_Frontend_CLI|PEAR_Frontend_Web|PEAR_Frontend_Gtk 50 | */ 51 | public static function &singleton($type = null) 52 | { 53 | if ($type === null) { 54 | if (!isset($GLOBALS['_PEAR_FRONTEND_SINGLETON'])) { 55 | $a = false; 56 | return $a; 57 | } 58 | return $GLOBALS['_PEAR_FRONTEND_SINGLETON']; 59 | } 60 | 61 | $a = PEAR_Frontend::setFrontendClass($type); 62 | return $a; 63 | } 64 | 65 | /** 66 | * Set the frontend class that will be used by calls to {@link singleton()} 67 | * 68 | * Frontends are expected to conform to the PEAR naming standard of 69 | * _ => DIRECTORY_SEPARATOR (PEAR_Frontend_CLI is in PEAR/Frontend/CLI.php) 70 | * @param string $uiclass full class name 71 | * @return PEAR_Frontend 72 | */ 73 | public static function &setFrontendClass($uiclass) 74 | { 75 | if (is_object($GLOBALS['_PEAR_FRONTEND_SINGLETON']) && 76 | is_a($GLOBALS['_PEAR_FRONTEND_SINGLETON'], $uiclass)) { 77 | return $GLOBALS['_PEAR_FRONTEND_SINGLETON']; 78 | } 79 | 80 | if (!class_exists($uiclass)) { 81 | $file = str_replace('_', '/', $uiclass) . '.php'; 82 | if (PEAR_Frontend::isIncludeable($file)) { 83 | include_once $file; 84 | } 85 | } 86 | 87 | if (class_exists($uiclass)) { 88 | $obj = new $uiclass; 89 | // quick test to see if this class implements a few of the most 90 | // important frontend methods 91 | if (is_a($obj, 'PEAR_Frontend')) { 92 | $GLOBALS['_PEAR_FRONTEND_SINGLETON'] = &$obj; 93 | $GLOBALS['_PEAR_FRONTEND_CLASS'] = $uiclass; 94 | return $obj; 95 | } 96 | 97 | $err = PEAR::raiseError("not a frontend class: $uiclass"); 98 | return $err; 99 | } 100 | 101 | $err = PEAR::raiseError("no such class: $uiclass"); 102 | return $err; 103 | } 104 | 105 | /** 106 | * Set the frontend class that will be used by calls to {@link singleton()} 107 | * 108 | * Frontends are expected to be a descendant of PEAR_Frontend 109 | * @param PEAR_Frontend 110 | * @return PEAR_Frontend 111 | */ 112 | public static function &setFrontendObject($uiobject) 113 | { 114 | if (is_object($GLOBALS['_PEAR_FRONTEND_SINGLETON']) && 115 | is_a($GLOBALS['_PEAR_FRONTEND_SINGLETON'], get_class($uiobject))) { 116 | return $GLOBALS['_PEAR_FRONTEND_SINGLETON']; 117 | } 118 | 119 | if (!is_a($uiobject, 'PEAR_Frontend')) { 120 | $err = PEAR::raiseError('not a valid frontend class: (' . 121 | get_class($uiobject) . ')'); 122 | return $err; 123 | } 124 | 125 | $GLOBALS['_PEAR_FRONTEND_SINGLETON'] = &$uiobject; 126 | $GLOBALS['_PEAR_FRONTEND_CLASS'] = get_class($uiobject); 127 | return $uiobject; 128 | } 129 | 130 | /** 131 | * @param string $path relative or absolute include path 132 | * @return boolean 133 | */ 134 | public static function isIncludeable($path) 135 | { 136 | if (file_exists($path) && is_readable($path)) { 137 | return true; 138 | } 139 | 140 | $fp = @fopen($path, 'r', true); 141 | if ($fp) { 142 | fclose($fp); 143 | return true; 144 | } 145 | 146 | return false; 147 | } 148 | 149 | /** 150 | * @param PEAR_Config 151 | */ 152 | function setConfig(&$config) 153 | { 154 | } 155 | 156 | /** 157 | * This can be overridden to allow session-based temporary file management 158 | * 159 | * By default, all files are deleted at the end of a session. The web installer 160 | * needs to be able to sustain a list over many sessions in order to support 161 | * user interaction with install scripts 162 | */ 163 | static function addTempFile($file) 164 | { 165 | $GLOBALS['_PEAR_Common_tempfiles'][] = $file; 166 | } 167 | 168 | /** 169 | * Log an action 170 | * 171 | * @param string $msg the message to log 172 | * @param boolean $append_crlf 173 | * @return boolean true 174 | * @abstract 175 | */ 176 | function log($msg, $append_crlf = true) 177 | { 178 | } 179 | 180 | /** 181 | * Run a post-installation script 182 | * 183 | * @param array $scripts array of post-install scripts 184 | * @abstract 185 | */ 186 | function runPostinstallScripts(&$scripts) 187 | { 188 | } 189 | 190 | /** 191 | * Display human-friendly output formatted depending on the 192 | * $command parameter. 193 | * 194 | * This should be able to handle basic output data with no command 195 | * @param mixed $data data structure containing the information to display 196 | * @param string $command command from which this method was called 197 | * @abstract 198 | */ 199 | function outputData($data, $command = '_default') 200 | { 201 | } 202 | 203 | /** 204 | * Display a modal form dialog and return the given input 205 | * 206 | * A frontend that requires multiple requests to retrieve and process 207 | * data must take these needs into account, and implement the request 208 | * handling code. 209 | * @param string $command command from which this method was called 210 | * @param array $prompts associative array. keys are the input field names 211 | * and values are the description 212 | * @param array $types array of input field types (text, password, 213 | * etc.) keys have to be the same like in $prompts 214 | * @param array $defaults array of default values. again keys have 215 | * to be the same like in $prompts. Do not depend 216 | * on a default value being set. 217 | * @return array input sent by the user 218 | * @abstract 219 | */ 220 | function userDialog($command, $prompts, $types = array(), $defaults = array()) 221 | { 222 | } 223 | } 224 | -------------------------------------------------------------------------------- /PEAR/Installer/Role.php: -------------------------------------------------------------------------------- 1 | 10 | * @copyright 1997-2009 The Authors 11 | * @license http://opensource.org/licenses/bsd-license.php New BSD License 12 | * @link http://pear.php.net/package/PEAR 13 | * @since File available since Release 1.4.0a1 14 | */ 15 | 16 | /** 17 | * base class for installer roles 18 | */ 19 | require_once 'PEAR/Installer/Role/Common.php'; 20 | require_once 'PEAR/XMLParser.php'; 21 | /** 22 | * @category pear 23 | * @package PEAR 24 | * @author Greg Beaver 25 | * @copyright 1997-2009 The Authors 26 | * @license http://opensource.org/licenses/bsd-license.php New BSD License 27 | * @version Release: @package_version@ 28 | * @link http://pear.php.net/package/PEAR 29 | * @since Class available since Release 1.4.0a1 30 | */ 31 | class PEAR_Installer_Role 32 | { 33 | /** 34 | * Set up any additional configuration variables that file roles require 35 | * 36 | * Never call this directly, it is called by the PEAR_Config constructor 37 | * @param PEAR_Config 38 | */ 39 | public static function initializeConfig(&$config) 40 | { 41 | if (!isset($GLOBALS['_PEAR_INSTALLER_ROLES'])) { 42 | PEAR_Installer_Role::registerRoles(); 43 | } 44 | 45 | foreach ($GLOBALS['_PEAR_INSTALLER_ROLES'] as $class => $info) { 46 | if (!$info['config_vars']) { 47 | continue; 48 | } 49 | 50 | $config->_addConfigVars($class, $info['config_vars']); 51 | } 52 | } 53 | 54 | /** 55 | * @param PEAR_PackageFile_v2 56 | * @param string role name 57 | * @param PEAR_Config 58 | * @return PEAR_Installer_Role_Common 59 | */ 60 | public static function &factory($pkg, $role, &$config) 61 | { 62 | if (!isset($GLOBALS['_PEAR_INSTALLER_ROLES'])) { 63 | PEAR_Installer_Role::registerRoles(); 64 | } 65 | 66 | if (!in_array($role, PEAR_Installer_Role::getValidRoles($pkg->getPackageType()))) { 67 | $a = false; 68 | return $a; 69 | } 70 | 71 | $a = 'PEAR_Installer_Role_' . ucfirst($role); 72 | if (!class_exists($a)) { 73 | require_once str_replace('_', '/', $a) . '.php'; 74 | } 75 | 76 | $b = new $a($config); 77 | return $b; 78 | } 79 | 80 | /** 81 | * Get a list of file roles that are valid for the particular release type. 82 | * 83 | * For instance, src files serve no purpose in regular php releases. 84 | * @param string 85 | * @param bool clear cache 86 | * @return array 87 | */ 88 | public static function getValidRoles($release, $clear = false) 89 | { 90 | if (!isset($GLOBALS['_PEAR_INSTALLER_ROLES'])) { 91 | PEAR_Installer_Role::registerRoles(); 92 | } 93 | 94 | static $ret = array(); 95 | if ($clear) { 96 | $ret = array(); 97 | } 98 | 99 | if (isset($ret[$release])) { 100 | return $ret[$release]; 101 | } 102 | 103 | $ret[$release] = array(); 104 | foreach ($GLOBALS['_PEAR_INSTALLER_ROLES'] as $role => $okreleases) { 105 | if (in_array($release, $okreleases['releasetypes'])) { 106 | $ret[$release][] = strtolower(str_replace('PEAR_Installer_Role_', '', $role)); 107 | } 108 | } 109 | 110 | return $ret[$release]; 111 | } 112 | 113 | /** 114 | * Get a list of roles that require their files to be installed 115 | * 116 | * Most roles must be installed, but src and package roles, for instance 117 | * are pseudo-roles. src files are compiled into a new extension. Package 118 | * roles are actually fully bundled releases of a package 119 | * @param bool clear cache 120 | * @return array 121 | */ 122 | public static function getInstallableRoles($clear = false) 123 | { 124 | if (!isset($GLOBALS['_PEAR_INSTALLER_ROLES'])) { 125 | PEAR_Installer_Role::registerRoles(); 126 | } 127 | 128 | static $ret; 129 | if ($clear) { 130 | unset($ret); 131 | } 132 | 133 | if (isset($ret)) { 134 | return $ret; 135 | } 136 | 137 | $ret = array(); 138 | foreach ($GLOBALS['_PEAR_INSTALLER_ROLES'] as $role => $okreleases) { 139 | if ($okreleases['installable']) { 140 | $ret[] = strtolower(str_replace('PEAR_Installer_Role_', '', $role)); 141 | } 142 | } 143 | 144 | return $ret; 145 | } 146 | 147 | /** 148 | * Return an array of roles that are affected by the baseinstalldir attribute 149 | * 150 | * Most roles ignore this attribute, and instead install directly into: 151 | * PackageName/filepath 152 | * so a tests file tests/file.phpt is installed into PackageName/tests/filepath.php 153 | * @param bool clear cache 154 | * @return array 155 | */ 156 | public static function getBaseinstallRoles($clear = false) 157 | { 158 | if (!isset($GLOBALS['_PEAR_INSTALLER_ROLES'])) { 159 | PEAR_Installer_Role::registerRoles(); 160 | } 161 | 162 | static $ret; 163 | if ($clear) { 164 | unset($ret); 165 | } 166 | 167 | if (isset($ret)) { 168 | return $ret; 169 | } 170 | 171 | $ret = array(); 172 | foreach ($GLOBALS['_PEAR_INSTALLER_ROLES'] as $role => $okreleases) { 173 | if ($okreleases['honorsbaseinstall']) { 174 | $ret[] = strtolower(str_replace('PEAR_Installer_Role_', '', $role)); 175 | } 176 | } 177 | 178 | return $ret; 179 | } 180 | 181 | /** 182 | * Return an array of file roles that should be analyzed for PHP content at package time, 183 | * like the "php" role. 184 | * @param bool clear cache 185 | * @return array 186 | */ 187 | public static function getPhpRoles($clear = false) 188 | { 189 | if (!isset($GLOBALS['_PEAR_INSTALLER_ROLES'])) { 190 | PEAR_Installer_Role::registerRoles(); 191 | } 192 | 193 | static $ret; 194 | if ($clear) { 195 | unset($ret); 196 | } 197 | 198 | if (isset($ret)) { 199 | return $ret; 200 | } 201 | 202 | $ret = array(); 203 | foreach ($GLOBALS['_PEAR_INSTALLER_ROLES'] as $role => $okreleases) { 204 | if ($okreleases['phpfile']) { 205 | $ret[] = strtolower(str_replace('PEAR_Installer_Role_', '', $role)); 206 | } 207 | } 208 | 209 | return $ret; 210 | } 211 | 212 | /** 213 | * Scan through the Command directory looking for classes 214 | * and see what commands they implement. 215 | * @param string which directory to look for classes, defaults to 216 | * the Installer/Roles subdirectory of 217 | * the directory from where this file (__FILE__) is 218 | * included. 219 | * 220 | * @return bool TRUE on success, a PEAR error on failure 221 | */ 222 | public static function registerRoles($dir = null) 223 | { 224 | $GLOBALS['_PEAR_INSTALLER_ROLES'] = array(); 225 | $parser = new PEAR_XMLParser; 226 | if ($dir === null) { 227 | $dir = dirname(__FILE__) . '/Role'; 228 | } 229 | 230 | if (!file_exists($dir) || !is_dir($dir)) { 231 | return PEAR::raiseError("registerRoles: opendir($dir) failed: does not exist/is not directory"); 232 | } 233 | 234 | $dp = @opendir($dir); 235 | if (empty($dp)) { 236 | return PEAR::raiseError("registerRoles: opendir($dir) failed: $php_errmsg"); 237 | } 238 | 239 | while ($entry = readdir($dp)) { 240 | if ($entry[0] == '.' || substr($entry, -4) != '.xml') { 241 | continue; 242 | } 243 | 244 | $class = "PEAR_Installer_Role_".substr($entry, 0, -4); 245 | // List of roles 246 | if (!isset($GLOBALS['_PEAR_INSTALLER_ROLES'][$class])) { 247 | $file = "$dir/$entry"; 248 | $parser->parse(file_get_contents($file)); 249 | $data = $parser->getData(); 250 | if (!is_array($data['releasetypes'])) { 251 | $data['releasetypes'] = array($data['releasetypes']); 252 | } 253 | 254 | $GLOBALS['_PEAR_INSTALLER_ROLES'][$class] = $data; 255 | } 256 | } 257 | 258 | closedir($dp); 259 | ksort($GLOBALS['_PEAR_INSTALLER_ROLES']); 260 | PEAR_Installer_Role::getBaseinstallRoles(true); 261 | PEAR_Installer_Role::getInstallableRoles(true); 262 | PEAR_Installer_Role::getPhpRoles(true); 263 | PEAR_Installer_Role::getValidRoles('****', true); 264 | return true; 265 | } 266 | } -------------------------------------------------------------------------------- /PEAR/Installer/Role/Cfg.php: -------------------------------------------------------------------------------- 1 | 10 | * @copyright 2007-2009 The Authors 11 | * @license http://opensource.org/licenses/bsd-license.php New BSD License 12 | * @link http://pear.php.net/package/PEAR 13 | * @since File available since Release 1.7.0 14 | */ 15 | 16 | /** 17 | * @category pear 18 | * @package PEAR 19 | * @author Greg Beaver 20 | * @copyright 2007-2009 The Authors 21 | * @license http://opensource.org/licenses/bsd-license.php New BSD License 22 | * @version Release: @package_version@ 23 | * @link http://pear.php.net/package/PEAR 24 | * @since Class available since Release 1.7.0 25 | */ 26 | class PEAR_Installer_Role_Cfg extends PEAR_Installer_Role_Common 27 | { 28 | /** 29 | * @var PEAR_Installer 30 | */ 31 | var $installer; 32 | 33 | /** 34 | * the md5 of the original file 35 | * 36 | * @var unknown_type 37 | */ 38 | var $md5 = null; 39 | 40 | /** 41 | * Do any unusual setup here 42 | * @param PEAR_Installer 43 | * @param PEAR_PackageFile_v2 44 | * @param array file attributes 45 | * @param string file name 46 | */ 47 | function setup(&$installer, $pkg, $atts, $file) 48 | { 49 | $this->installer = &$installer; 50 | $reg = &$this->installer->config->getRegistry(); 51 | $package = $reg->getPackage($pkg->getPackage(), $pkg->getChannel()); 52 | if ($package) { 53 | $filelist = $package->getFilelist(); 54 | if (isset($filelist[$file]) && isset($filelist[$file]['md5sum'])) { 55 | $this->md5 = $filelist[$file]['md5sum']; 56 | } 57 | } 58 | } 59 | 60 | function processInstallation($pkg, $atts, $file, $tmp_path, $layer = null) 61 | { 62 | $test = parent::processInstallation($pkg, $atts, $file, $tmp_path, $layer); 63 | if (@file_exists($test[2]) && @file_exists($test[3])) { 64 | $md5 = md5_file($test[2]); 65 | // configuration has already been installed, check for mods 66 | if ($md5 !== $this->md5 && $md5 !== md5_file($test[3])) { 67 | // configuration has been modified, so save our version as 68 | // configfile-version 69 | $old = $test[2]; 70 | $test[2] .= '.new-' . $pkg->getVersion(); 71 | // backup original and re-install it 72 | PEAR::pushErrorHandling(PEAR_ERROR_RETURN); 73 | $tmpcfg = $this->config->get('temp_dir'); 74 | $newloc = System::mkdir(array('-p', $tmpcfg)); 75 | if (!$newloc) { 76 | // try temp_dir 77 | $newloc = System::mktemp(array('-d')); 78 | if (!$newloc || PEAR::isError($newloc)) { 79 | PEAR::popErrorHandling(); 80 | return PEAR::raiseError('Could not save existing configuration file '. 81 | $old . ', unable to install. Please set temp_dir ' . 82 | 'configuration variable to a writeable location and try again'); 83 | } 84 | } else { 85 | $newloc = $tmpcfg; 86 | } 87 | 88 | $temp_file = $newloc . DIRECTORY_SEPARATOR . uniqid('savefile'); 89 | if (!@copy($old, $temp_file)) { 90 | PEAR::popErrorHandling(); 91 | return PEAR::raiseError('Could not save existing configuration file '. 92 | $old . ', unable to install. Please set temp_dir ' . 93 | 'configuration variable to a writeable location and try again'); 94 | } 95 | 96 | PEAR::popErrorHandling(); 97 | $this->installer->log(0, "WARNING: configuration file $old is being installed as $test[2], you should manually merge in changes to the existing configuration file"); 98 | $this->installer->addFileOperation('rename', array($temp_file, $old, false)); 99 | $this->installer->addFileOperation('delete', array($temp_file)); 100 | } 101 | } 102 | 103 | return $test; 104 | } 105 | } -------------------------------------------------------------------------------- /PEAR/Installer/Role/Cfg.xml: -------------------------------------------------------------------------------- 1 | 2 | php 3 | extsrc 4 | extbin 5 | zendextsrc 6 | zendextbin 7 | 1 8 | cfg_dir 9 | 10 | 1 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /PEAR/Installer/Role/Common.php: -------------------------------------------------------------------------------- 1 | 10 | * @copyright 1997-2006 The PHP Group 11 | * @license http://opensource.org/licenses/bsd-license.php New BSD License 12 | * @link http://pear.php.net/package/PEAR 13 | * @since File available since Release 1.4.0a1 14 | */ 15 | /** 16 | * Base class for all installation roles. 17 | * 18 | * This class allows extensibility of file roles. Packages with complex 19 | * customization can now provide custom file roles along with the possibility of 20 | * adding configuration values to match. 21 | * @category pear 22 | * @package PEAR 23 | * @author Greg Beaver 24 | * @copyright 1997-2006 The PHP Group 25 | * @license http://opensource.org/licenses/bsd-license.php New BSD License 26 | * @version Release: @package_version@ 27 | * @link http://pear.php.net/package/PEAR 28 | * @since Class available since Release 1.4.0a1 29 | */ 30 | class PEAR_Installer_Role_Common 31 | { 32 | /** 33 | * @var PEAR_Config 34 | * @access protected 35 | */ 36 | var $config; 37 | 38 | /** 39 | * @param PEAR_Config 40 | */ 41 | function __construct(&$config) 42 | { 43 | $this->config = $config; 44 | } 45 | 46 | /** 47 | * Retrieve configuration information about a file role from its XML info 48 | * 49 | * @param string $role Role Classname, as in "PEAR_Installer_Role_Data" 50 | * @return array 51 | */ 52 | function getInfo($role) 53 | { 54 | if (empty($GLOBALS['_PEAR_INSTALLER_ROLES'][$role])) { 55 | return PEAR::raiseError('Unknown Role class: "' . $role . '"'); 56 | } 57 | return $GLOBALS['_PEAR_INSTALLER_ROLES'][$role]; 58 | } 59 | 60 | /** 61 | * This is called for each file to set up the directories and files 62 | * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2 63 | * @param array attributes from the tag 64 | * @param string file name 65 | * @return array an array consisting of: 66 | * 67 | * 1 the original, pre-baseinstalldir installation directory 68 | * 2 the final installation directory 69 | * 3 the full path to the final location of the file 70 | * 4 the location of the pre-installation file 71 | */ 72 | function processInstallation($pkg, $atts, $file, $tmp_path, $layer = null) 73 | { 74 | $roleInfo = PEAR_Installer_Role_Common::getInfo('PEAR_Installer_Role_' . 75 | ucfirst(str_replace('pear_installer_role_', '', strtolower(get_class($this))))); 76 | if (PEAR::isError($roleInfo)) { 77 | return $roleInfo; 78 | } 79 | if (!$roleInfo['locationconfig']) { 80 | return false; 81 | } 82 | if ($roleInfo['honorsbaseinstall']) { 83 | $dest_dir = $save_destdir = $this->config->get($roleInfo['locationconfig'], $layer, 84 | $pkg->getChannel()); 85 | if (!empty($atts['baseinstalldir'])) { 86 | $dest_dir .= DIRECTORY_SEPARATOR . $atts['baseinstalldir']; 87 | } 88 | } elseif ($roleInfo['unusualbaseinstall']) { 89 | $dest_dir = $save_destdir = $this->config->get($roleInfo['locationconfig'], 90 | $layer, $pkg->getChannel()) . DIRECTORY_SEPARATOR . $pkg->getPackage(); 91 | if (!empty($atts['baseinstalldir'])) { 92 | $dest_dir .= DIRECTORY_SEPARATOR . $atts['baseinstalldir']; 93 | } 94 | } else { 95 | $dest_dir = $save_destdir = $this->config->get($roleInfo['locationconfig'], 96 | $layer, $pkg->getChannel()) . DIRECTORY_SEPARATOR . $pkg->getPackage(); 97 | } 98 | if (dirname($file) != '.' && empty($atts['install-as'])) { 99 | $dest_dir .= DIRECTORY_SEPARATOR . dirname($file); 100 | } 101 | if (empty($atts['install-as'])) { 102 | $dest_file = $dest_dir . DIRECTORY_SEPARATOR . basename($file); 103 | } else { 104 | $dest_file = $dest_dir . DIRECTORY_SEPARATOR . $atts['install-as']; 105 | } 106 | $orig_file = $tmp_path . DIRECTORY_SEPARATOR . $file; 107 | 108 | // Clean up the DIRECTORY_SEPARATOR mess 109 | $ds2 = DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR; 110 | 111 | list($dest_dir, $dest_file, $orig_file) = preg_replace(array('!\\\\+!', '!/!', "!$ds2+!"), 112 | array(DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR, 113 | DIRECTORY_SEPARATOR), 114 | array($dest_dir, $dest_file, $orig_file)); 115 | return array($save_destdir, $dest_dir, $dest_file, $orig_file); 116 | } 117 | 118 | /** 119 | * Get the name of the configuration variable that specifies the location of this file 120 | * @return string|false 121 | */ 122 | function getLocationConfig() 123 | { 124 | $roleInfo = PEAR_Installer_Role_Common::getInfo('PEAR_Installer_Role_' . 125 | ucfirst(str_replace('pear_installer_role_', '', strtolower(get_class($this))))); 126 | if (PEAR::isError($roleInfo)) { 127 | return $roleInfo; 128 | } 129 | return $roleInfo['locationconfig']; 130 | } 131 | 132 | /** 133 | * Do any unusual setup here 134 | * @param PEAR_Installer 135 | * @param PEAR_PackageFile_v2 136 | * @param array file attributes 137 | * @param string file name 138 | */ 139 | function setup(&$installer, $pkg, $atts, $file) 140 | { 141 | } 142 | 143 | function isExecutable() 144 | { 145 | $roleInfo = PEAR_Installer_Role_Common::getInfo('PEAR_Installer_Role_' . 146 | ucfirst(str_replace('pear_installer_role_', '', strtolower(get_class($this))))); 147 | if (PEAR::isError($roleInfo)) { 148 | return $roleInfo; 149 | } 150 | return $roleInfo['executable']; 151 | } 152 | 153 | function isInstallable() 154 | { 155 | $roleInfo = PEAR_Installer_Role_Common::getInfo('PEAR_Installer_Role_' . 156 | ucfirst(str_replace('pear_installer_role_', '', strtolower(get_class($this))))); 157 | if (PEAR::isError($roleInfo)) { 158 | return $roleInfo; 159 | } 160 | return $roleInfo['installable']; 161 | } 162 | 163 | function isExtension() 164 | { 165 | $roleInfo = PEAR_Installer_Role_Common::getInfo('PEAR_Installer_Role_' . 166 | ucfirst(str_replace('pear_installer_role_', '', strtolower(get_class($this))))); 167 | if (PEAR::isError($roleInfo)) { 168 | return $roleInfo; 169 | } 170 | return $roleInfo['phpextension']; 171 | } 172 | } 173 | ?> 174 | -------------------------------------------------------------------------------- /PEAR/Installer/Role/Data.php: -------------------------------------------------------------------------------- 1 | 10 | * @copyright 1997-2009 The Authors 11 | * @license http://opensource.org/licenses/bsd-license.php New BSD License 12 | * @link http://pear.php.net/package/PEAR 13 | * @since File available since Release 1.4.0a1 14 | */ 15 | 16 | /** 17 | * @category pear 18 | * @package PEAR 19 | * @author Greg Beaver 20 | * @copyright 1997-2009 The Authors 21 | * @license http://opensource.org/licenses/bsd-license.php New BSD License 22 | * @version Release: @package_version@ 23 | * @link http://pear.php.net/package/PEAR 24 | * @since Class available since Release 1.4.0a1 25 | */ 26 | class PEAR_Installer_Role_Data extends PEAR_Installer_Role_Common {} 27 | ?> -------------------------------------------------------------------------------- /PEAR/Installer/Role/Data.xml: -------------------------------------------------------------------------------- 1 | 2 | php 3 | extsrc 4 | extbin 5 | zendextsrc 6 | zendextbin 7 | 1 8 | data_dir 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /PEAR/Installer/Role/Doc.php: -------------------------------------------------------------------------------- 1 | 10 | * @copyright 1997-2009 The Authors 11 | * @license http://opensource.org/licenses/bsd-license.php New BSD License 12 | * @link http://pear.php.net/package/PEAR 13 | * @since File available since Release 1.4.0a1 14 | */ 15 | 16 | /** 17 | * @category pear 18 | * @package PEAR 19 | * @author Greg Beaver 20 | * @copyright 1997-2009 The Authors 21 | * @license http://opensource.org/licenses/bsd-license.php New BSD License 22 | * @version Release: @package_version@ 23 | * @link http://pear.php.net/package/PEAR 24 | * @since Class available since Release 1.4.0a1 25 | */ 26 | class PEAR_Installer_Role_Doc extends PEAR_Installer_Role_Common {} 27 | ?> -------------------------------------------------------------------------------- /PEAR/Installer/Role/Doc.xml: -------------------------------------------------------------------------------- 1 | 2 | php 3 | extsrc 4 | extbin 5 | zendextsrc 6 | zendextbin 7 | 1 8 | doc_dir 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /PEAR/Installer/Role/Ext.php: -------------------------------------------------------------------------------- 1 | 10 | * @copyright 1997-2009 The Authors 11 | * @license http://opensource.org/licenses/bsd-license.php New BSD License 12 | * @link http://pear.php.net/package/PEAR 13 | * @since File available since Release 1.4.0a1 14 | */ 15 | 16 | /** 17 | * @category pear 18 | * @package PEAR 19 | * @author Greg Beaver 20 | * @copyright 1997-2009 The Authors 21 | * @license http://opensource.org/licenses/bsd-license.php New BSD License 22 | * @version Release: @package_version@ 23 | * @link http://pear.php.net/package/PEAR 24 | * @since Class available since Release 1.4.0a1 25 | */ 26 | class PEAR_Installer_Role_Ext extends PEAR_Installer_Role_Common {} 27 | ?> -------------------------------------------------------------------------------- /PEAR/Installer/Role/Ext.xml: -------------------------------------------------------------------------------- 1 | 2 | extbin 3 | zendextbin 4 | 1 5 | ext_dir 6 | 1 7 | 8 | 9 | 10 | 1 11 | 12 | -------------------------------------------------------------------------------- /PEAR/Installer/Role/Man.php: -------------------------------------------------------------------------------- 1 | 10 | * @copyright 2011 The Authors 11 | * @license http://opensource.org/licenses/bsd-license.php New BSD License 12 | * @version SVN: $Id: $ 13 | * @link http://pear.php.net/package/PEAR 14 | * @since File available since Release 1.10.0 15 | */ 16 | 17 | /** 18 | * @category pear 19 | * @package PEAR 20 | * @author Hannes Magnusson 21 | * @copyright 2011 The Authors 22 | * @license http://opensource.org/licenses/bsd-license.php New BSD License 23 | * @version Release: @package_version@ 24 | * @link http://pear.php.net/package/PEAR 25 | * @since Class available since Release 1.10.0 26 | */ 27 | class PEAR_Installer_Role_Man extends PEAR_Installer_Role_Common {} 28 | ?> 29 | -------------------------------------------------------------------------------- /PEAR/Installer/Role/Man.xml: -------------------------------------------------------------------------------- 1 | 2 | php 3 | extsrc 4 | extbin 5 | zendextsrc 6 | zendextbin 7 | 1 8 | man_dir 9 | 1 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /PEAR/Installer/Role/Php.php: -------------------------------------------------------------------------------- 1 | 10 | * @copyright 1997-2009 The Authors 11 | * @license http://opensource.org/licenses/bsd-license.php New BSD License 12 | * @link http://pear.php.net/package/PEAR 13 | * @since File available since Release 1.4.0a1 14 | */ 15 | 16 | /** 17 | * @category pear 18 | * @package PEAR 19 | * @author Greg Beaver 20 | * @copyright 1997-2009 The Authors 21 | * @license http://opensource.org/licenses/bsd-license.php New BSD License 22 | * @version Release: @package_version@ 23 | * @link http://pear.php.net/package/PEAR 24 | * @since Class available since Release 1.4.0a1 25 | */ 26 | class PEAR_Installer_Role_Php extends PEAR_Installer_Role_Common {} 27 | ?> -------------------------------------------------------------------------------- /PEAR/Installer/Role/Php.xml: -------------------------------------------------------------------------------- 1 | 2 | php 3 | extsrc 4 | extbin 5 | zendextsrc 6 | zendextbin 7 | 1 8 | php_dir 9 | 1 10 | 11 | 1 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /PEAR/Installer/Role/Script.php: -------------------------------------------------------------------------------- 1 | 10 | * @copyright 1997-2009 The Authors 11 | * @license http://opensource.org/licenses/bsd-license.php New BSD License 12 | * @link http://pear.php.net/package/PEAR 13 | * @since File available since Release 1.4.0a1 14 | */ 15 | 16 | /** 17 | * @category pear 18 | * @package PEAR 19 | * @author Greg Beaver 20 | * @copyright 1997-2009 The Authors 21 | * @license http://opensource.org/licenses/bsd-license.php New BSD License 22 | * @version Release: @package_version@ 23 | * @link http://pear.php.net/package/PEAR 24 | * @since Class available since Release 1.4.0a1 25 | */ 26 | class PEAR_Installer_Role_Script extends PEAR_Installer_Role_Common {} 27 | ?> -------------------------------------------------------------------------------- /PEAR/Installer/Role/Script.xml: -------------------------------------------------------------------------------- 1 | 2 | php 3 | extsrc 4 | extbin 5 | zendextsrc 6 | zendextbin 7 | 1 8 | bin_dir 9 | 1 10 | 11 | 12 | 1 13 | 14 | 15 | -------------------------------------------------------------------------------- /PEAR/Installer/Role/Src.php: -------------------------------------------------------------------------------- 1 | 10 | * @copyright 1997-2009 The Authors 11 | * @license http://opensource.org/licenses/bsd-license.php New BSD License 12 | * @link http://pear.php.net/package/PEAR 13 | * @since File available since Release 1.4.0a1 14 | */ 15 | 16 | /** 17 | * @category pear 18 | * @package PEAR 19 | * @author Greg Beaver 20 | * @copyright 1997-2009 The Authors 21 | * @license http://opensource.org/licenses/bsd-license.php New BSD License 22 | * @version Release: @package_version@ 23 | * @link http://pear.php.net/package/PEAR 24 | * @since Class available since Release 1.4.0a1 25 | */ 26 | class PEAR_Installer_Role_Src extends PEAR_Installer_Role_Common 27 | { 28 | function setup(&$installer, $pkg, $atts, $file) 29 | { 30 | $installer->source_files++; 31 | } 32 | } 33 | ?> -------------------------------------------------------------------------------- /PEAR/Installer/Role/Src.xml: -------------------------------------------------------------------------------- 1 | 2 | extsrc 3 | zendextsrc 4 | 1 5 | temp_dir 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /PEAR/Installer/Role/Test.php: -------------------------------------------------------------------------------- 1 | 10 | * @copyright 1997-2009 The Authors 11 | * @license http://opensource.org/licenses/bsd-license.php New BSD License 12 | * @link http://pear.php.net/package/PEAR 13 | * @since File available since Release 1.4.0a1 14 | */ 15 | 16 | /** 17 | * @category pear 18 | * @package PEAR 19 | * @author Greg Beaver 20 | * @copyright 1997-2009 The Authors 21 | * @license http://opensource.org/licenses/bsd-license.php New BSD License 22 | * @version Release: @package_version@ 23 | * @link http://pear.php.net/package/PEAR 24 | * @since Class available since Release 1.4.0a1 25 | */ 26 | class PEAR_Installer_Role_Test extends PEAR_Installer_Role_Common {} 27 | ?> -------------------------------------------------------------------------------- /PEAR/Installer/Role/Test.xml: -------------------------------------------------------------------------------- 1 | 2 | php 3 | extsrc 4 | extbin 5 | zendextsrc 6 | zendextbin 7 | 1 8 | test_dir 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /PEAR/Installer/Role/Www.php: -------------------------------------------------------------------------------- 1 | 10 | * @copyright 2007-2009 The Authors 11 | * @license http://opensource.org/licenses/bsd-license.php New BSD License 12 | * @link http://pear.php.net/package/PEAR 13 | * @since File available since Release 1.7.0 14 | */ 15 | 16 | /** 17 | * @category pear 18 | * @package PEAR 19 | * @author Greg Beaver 20 | * @copyright 2007-2009 The Authors 21 | * @license http://opensource.org/licenses/bsd-license.php New BSD License 22 | * @version Release: @package_version@ 23 | * @link http://pear.php.net/package/PEAR 24 | * @since Class available since Release 1.7.0 25 | */ 26 | class PEAR_Installer_Role_Www extends PEAR_Installer_Role_Common {} 27 | ?> -------------------------------------------------------------------------------- /PEAR/Installer/Role/Www.xml: -------------------------------------------------------------------------------- 1 | 2 | php 3 | extsrc 4 | extbin 5 | zendextsrc 6 | zendextbin 7 | 1 8 | www_dir 9 | 1 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /PEAR/PackageFile/Parser/v2.php: -------------------------------------------------------------------------------- 1 | 10 | * @copyright 1997-2009 The Authors 11 | * @license http://opensource.org/licenses/bsd-license.php New BSD License 12 | * @link http://pear.php.net/package/PEAR 13 | * @since File available since Release 1.4.0a1 14 | */ 15 | /** 16 | * base xml parser class 17 | */ 18 | require_once 'PEAR/XMLParser.php'; 19 | require_once 'PEAR/PackageFile/v2.php'; 20 | /** 21 | * Parser for package.xml version 2.0 22 | * @category pear 23 | * @package PEAR 24 | * @author Greg Beaver 25 | * @copyright 1997-2009 The Authors 26 | * @license http://opensource.org/licenses/bsd-license.php New BSD License 27 | * @version Release: @PEAR-VER@ 28 | * @link http://pear.php.net/package/PEAR 29 | * @since Class available since Release 1.4.0a1 30 | */ 31 | class PEAR_PackageFile_Parser_v2 extends PEAR_XMLParser 32 | { 33 | var $_config; 34 | var $_logger; 35 | var $_registry; 36 | 37 | function setConfig(&$c) 38 | { 39 | $this->_config = &$c; 40 | $this->_registry = &$c->getRegistry(); 41 | } 42 | 43 | function setLogger(&$l) 44 | { 45 | $this->_logger = &$l; 46 | } 47 | /** 48 | * Unindent given string 49 | * 50 | * @param string $str The string that has to be unindented. 51 | * @return string 52 | * @access private 53 | */ 54 | function _unIndent($str) 55 | { 56 | // remove leading newlines 57 | $str = preg_replace('/^[\r\n]+/', '', $str); 58 | // find whitespace at the beginning of the first line 59 | $indent_len = strspn($str, " \t"); 60 | $indent = substr($str, 0, $indent_len); 61 | $data = ''; 62 | // remove the same amount of whitespace from following lines 63 | foreach (explode("\n", $str) as $line) { 64 | if (substr($line, 0, $indent_len) == $indent) { 65 | $data .= substr($line, $indent_len) . "\n"; 66 | } else { 67 | $data .= $line . "\n"; 68 | } 69 | } 70 | return $data; 71 | } 72 | 73 | /** 74 | * post-process data 75 | * 76 | * @param string $data 77 | * @param string $element element name 78 | */ 79 | function postProcess($data, $element) 80 | { 81 | if ($element == 'notes') { 82 | return trim($this->_unIndent($data)); 83 | } 84 | return trim($data); 85 | } 86 | 87 | /** 88 | * @param string 89 | * @param string file name of the package.xml 90 | * @param string|false name of the archive this package.xml came from, if any 91 | * @param string class name to instantiate and return. This must be PEAR_PackageFile_v2 or 92 | * a subclass 93 | * @return PEAR_PackageFile_v2 94 | */ 95 | function parse($data, $file = null, $archive = false, $class = 'PEAR_PackageFile_v2') 96 | { 97 | if (PEAR::isError($err = parent::parse($data))) { 98 | return $err; 99 | } 100 | 101 | $ret = new $class; 102 | $ret->encoding = $this->encoding; 103 | $ret->setConfig($this->_config); 104 | if (isset($this->_logger)) { 105 | $ret->setLogger($this->_logger); 106 | } 107 | 108 | $ret->fromArray($this->_unserializedData); 109 | $ret->setPackagefile($file, $archive); 110 | return $ret; 111 | } 112 | } -------------------------------------------------------------------------------- /PEAR/Packager.php: -------------------------------------------------------------------------------- 1 | 10 | * @author Tomas V. V. Cox 11 | * @author Greg Beaver 12 | * @copyright 1997-2009 The Authors 13 | * @license http://opensource.org/licenses/bsd-license.php New BSD License 14 | * @link http://pear.php.net/package/PEAR 15 | * @since File available since Release 0.1 16 | */ 17 | 18 | /** 19 | * base class 20 | */ 21 | require_once 'PEAR/Common.php'; 22 | require_once 'PEAR/PackageFile.php'; 23 | require_once 'System.php'; 24 | 25 | /** 26 | * Administration class used to make a PEAR release tarball. 27 | * 28 | * @category pear 29 | * @package PEAR 30 | * @author Greg Beaver 31 | * @copyright 1997-2009 The Authors 32 | * @license http://opensource.org/licenses/bsd-license.php New BSD License 33 | * @version Release: @package_version@ 34 | * @link http://pear.php.net/package/PEAR 35 | * @since Class available since Release 0.1 36 | */ 37 | class PEAR_Packager extends PEAR_Common 38 | { 39 | /** 40 | * @var PEAR_Registry 41 | */ 42 | var $_registry; 43 | 44 | function package($pkgfile = null, $compress = true, $pkg2 = null) 45 | { 46 | // {{{ validate supplied package.xml file 47 | if (empty($pkgfile)) { 48 | $pkgfile = 'package.xml'; 49 | } 50 | 51 | PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); 52 | $pkg = new PEAR_PackageFile($this->config, $this->debug); 53 | $pf = &$pkg->fromPackageFile($pkgfile, PEAR_VALIDATE_NORMAL); 54 | $main = &$pf; 55 | PEAR::staticPopErrorHandling(); 56 | if (PEAR::isError($pf)) { 57 | if (is_array($pf->getUserInfo())) { 58 | foreach ($pf->getUserInfo() as $error) { 59 | $this->log(0, 'Error: ' . $error['message']); 60 | } 61 | } 62 | 63 | $this->log(0, $pf->getMessage()); 64 | return $this->raiseError("Cannot package, errors in package file"); 65 | } 66 | 67 | foreach ($pf->getValidationWarnings() as $warning) { 68 | $this->log(1, 'Warning: ' . $warning['message']); 69 | } 70 | 71 | // }}} 72 | if ($pkg2) { 73 | $this->log(0, 'Attempting to process the second package file'); 74 | PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); 75 | $pf2 = &$pkg->fromPackageFile($pkg2, PEAR_VALIDATE_NORMAL); 76 | PEAR::staticPopErrorHandling(); 77 | if (PEAR::isError($pf2)) { 78 | if (is_array($pf2->getUserInfo())) { 79 | foreach ($pf2->getUserInfo() as $error) { 80 | $this->log(0, 'Error: ' . $error['message']); 81 | } 82 | } 83 | $this->log(0, $pf2->getMessage()); 84 | return $this->raiseError("Cannot package, errors in second package file"); 85 | } 86 | 87 | foreach ($pf2->getValidationWarnings() as $warning) { 88 | $this->log(1, 'Warning: ' . $warning['message']); 89 | } 90 | 91 | if ($pf2->getPackagexmlVersion() == '2.0' || 92 | $pf2->getPackagexmlVersion() == '2.1' 93 | ) { 94 | $main = &$pf2; 95 | $other = &$pf; 96 | } else { 97 | $main = &$pf; 98 | $other = &$pf2; 99 | } 100 | 101 | if ($main->getPackagexmlVersion() != '2.0' && 102 | $main->getPackagexmlVersion() != '2.1') { 103 | return PEAR::raiseError('Error: cannot package two package.xml version 1.0, can ' . 104 | 'only package together a package.xml 1.0 and package.xml 2.0'); 105 | } 106 | 107 | if ($other->getPackagexmlVersion() != '1.0') { 108 | return PEAR::raiseError('Error: cannot package two package.xml version 2.0, can ' . 109 | 'only package together a package.xml 1.0 and package.xml 2.0'); 110 | } 111 | } 112 | 113 | $main->setLogger($this); 114 | if (!$main->validate(PEAR_VALIDATE_PACKAGING)) { 115 | foreach ($main->getValidationWarnings() as $warning) { 116 | $this->log(0, 'Error: ' . $warning['message']); 117 | } 118 | return $this->raiseError("Cannot package, errors in package"); 119 | } 120 | 121 | foreach ($main->getValidationWarnings() as $warning) { 122 | $this->log(1, 'Warning: ' . $warning['message']); 123 | } 124 | 125 | if ($pkg2) { 126 | $other->setLogger($this); 127 | $a = false; 128 | if (!$other->validate(PEAR_VALIDATE_NORMAL) || $a = !$main->isEquivalent($other)) { 129 | foreach ($other->getValidationWarnings() as $warning) { 130 | $this->log(0, 'Error: ' . $warning['message']); 131 | } 132 | 133 | foreach ($main->getValidationWarnings() as $warning) { 134 | $this->log(0, 'Error: ' . $warning['message']); 135 | } 136 | 137 | if ($a) { 138 | return $this->raiseError('The two package.xml files are not equivalent!'); 139 | } 140 | 141 | return $this->raiseError("Cannot package, errors in package"); 142 | } 143 | 144 | foreach ($other->getValidationWarnings() as $warning) { 145 | $this->log(1, 'Warning: ' . $warning['message']); 146 | } 147 | 148 | $gen = &$main->getDefaultGenerator(); 149 | $tgzfile = $gen->toTgz2($this, $other, $compress); 150 | if (PEAR::isError($tgzfile)) { 151 | return $tgzfile; 152 | } 153 | 154 | $dest_package = basename($tgzfile); 155 | $pkgdir = dirname($pkgfile); 156 | 157 | // TAR the Package ------------------------------------------- 158 | $this->log(1, "Package $dest_package done"); 159 | if (file_exists("$pkgdir/CVS/Root")) { 160 | $cvsversion = preg_replace('/[^a-z0-9]/i', '_', $pf->getVersion()); 161 | $cvstag = "RELEASE_$cvsversion"; 162 | $this->log(1, 'Tag the released code with "pear cvstag ' . 163 | $main->getPackageFile() . '"'); 164 | $this->log(1, "(or set the CVS tag $cvstag by hand)"); 165 | } elseif (file_exists("$pkgdir/.svn")) { 166 | $svnversion = preg_replace('/[^a-z0-9]/i', '.', $pf->getVersion()); 167 | $svntag = $pf->getName() . "-$svnversion"; 168 | $this->log(1, 'Tag the released code with "pear svntag ' . 169 | $main->getPackageFile() . '"'); 170 | $this->log(1, "(or set the SVN tag $svntag by hand)"); 171 | } 172 | } else { // this branch is executed for single packagefile packaging 173 | $gen = &$pf->getDefaultGenerator(); 174 | $tgzfile = $gen->toTgz($this, $compress); 175 | if (PEAR::isError($tgzfile)) { 176 | $this->log(0, $tgzfile->getMessage()); 177 | return $this->raiseError("Cannot package, errors in package"); 178 | } 179 | 180 | $dest_package = basename($tgzfile); 181 | $pkgdir = dirname($pkgfile); 182 | 183 | // TAR the Package ------------------------------------------- 184 | $this->log(1, "Package $dest_package done"); 185 | if (file_exists("$pkgdir/CVS/Root")) { 186 | $cvsversion = preg_replace('/[^a-z0-9]/i', '_', $pf->getVersion()); 187 | $cvstag = "RELEASE_$cvsversion"; 188 | $this->log(1, "Tag the released code with `pear cvstag $pkgfile'"); 189 | $this->log(1, "(or set the CVS tag $cvstag by hand)"); 190 | } elseif (file_exists("$pkgdir/.svn")) { 191 | $svnversion = preg_replace('/[^a-z0-9]/i', '.', $pf->getVersion()); 192 | $svntag = $pf->getName() . "-$svnversion"; 193 | $this->log(1, "Tag the released code with `pear svntag $pkgfile'"); 194 | $this->log(1, "(or set the SVN tag $svntag by hand)"); 195 | } 196 | } 197 | 198 | return $dest_package; 199 | } 200 | } -------------------------------------------------------------------------------- /PEAR/Proxy.php: -------------------------------------------------------------------------------- 1 | config = $config; 43 | $this->_parseProxyInfo(); 44 | } 45 | 46 | /** 47 | * @access private 48 | */ 49 | function _parseProxyInfo() 50 | { 51 | $this->proxy_host = $this->proxy_port = $this->proxy_user = $this->proxy_pass = ''; 52 | if ($this->config->get('http_proxy')&& 53 | $proxy = parse_url($this->config->get('http_proxy')) 54 | ) { 55 | $this->proxy_host = isset($proxy['host']) ? $proxy['host'] : null; 56 | 57 | $this->proxy_port = isset($proxy['port']) ? $proxy['port'] : 8080; 58 | $this->proxy_user = isset($proxy['user']) ? urldecode($proxy['user']) : null; 59 | $this->proxy_pass = isset($proxy['pass']) ? urldecode($proxy['pass']) : null; 60 | $this->proxy_schema = (isset($proxy['scheme']) && $proxy['scheme'] == 'https') ? 'https' : 'http'; 61 | } 62 | } 63 | 64 | /** 65 | * @access private 66 | */ 67 | function _httpConnect($fp, $host, $port) 68 | { 69 | fwrite($fp, "CONNECT $host:$port HTTP/1.1\r\n"); 70 | fwrite($fp, "Host: $host:$port\r\n"); 71 | if ($this->getProxyAuth()) { 72 | fwrite($fp, 'Proxy-Authorization: Basic ' . $this->getProxyAuth() . "\r\n"); 73 | } 74 | fwrite($fp, "\r\n"); 75 | 76 | while ($line = trim(fgets($fp, 1024))) { 77 | if (preg_match('|^HTTP/1.[01] ([0-9]{3}) |', $line, $matches)) { 78 | $code = (int)$matches[1]; 79 | 80 | /* as per RFC 2817 */ 81 | if ($code < 200 || $code >= 300) { 82 | return PEAR::raiseError("Establishing a CONNECT tunnel through proxy failed with response code $code"); 83 | } 84 | } 85 | } 86 | 87 | // connection was successful -- establish SSL through 88 | // the tunnel 89 | $crypto_method = STREAM_CRYPTO_METHOD_TLS_CLIENT; 90 | 91 | if (defined('STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT')) { 92 | $crypto_method |= STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT; 93 | $crypto_method |= STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT; 94 | } 95 | 96 | // set the correct hostname for working hostname 97 | // verification 98 | stream_context_set_option($fp, 'ssl', 'peer_name', $host); 99 | 100 | // blocking socket needed for 101 | // stream_socket_enable_crypto() 102 | // see 103 | // 104 | stream_set_blocking ($fp, true); 105 | $crypto_res = stream_socket_enable_crypto($fp, true, $crypto_method); 106 | if (!$crypto_res) { 107 | return PEAR::raiseError("Could not establish SSL connection through proxy: $crypto_res"); 108 | } 109 | 110 | return true; 111 | } 112 | 113 | /** 114 | * get the authorization information for the proxy, encoded to be 115 | * passed in the Proxy-Authentication HTTP header. 116 | * @return null|string the encoded authentication information if a 117 | * proxy and authentication is configured, null 118 | * otherwise. 119 | */ 120 | function getProxyAuth() 121 | { 122 | if ($this->isProxyConfigured() && $this->proxy_user != '') { 123 | return base64_encode($this->proxy_user . ':' . $this->proxy_pass); 124 | } 125 | return null; 126 | } 127 | 128 | function getProxyUser() 129 | { 130 | return $this->proxy_user; 131 | } 132 | 133 | /** 134 | * Check if we are configured to use a proxy. 135 | * 136 | * @return boolean true if we are configured to use a proxy, false 137 | * otherwise. 138 | * @access public 139 | */ 140 | function isProxyConfigured() 141 | { 142 | return $this->proxy_host != ''; 143 | } 144 | 145 | /** 146 | * Open a socket to a remote server, possibly involving a HTTP 147 | * proxy. 148 | * 149 | * If an HTTP proxy has been configured (http_proxy PEAR_Config 150 | * setting), the proxy will be used. 151 | * 152 | * @param string $host the host to connect to 153 | * @param string $port the port to connect to 154 | * @param boolean $secure if true, establish a secure connection 155 | * using TLS. 156 | * @access public 157 | */ 158 | function openSocket($host, $port, $secure = false) 159 | { 160 | if ($this->isProxyConfigured()) { 161 | $fp = @fsockopen( 162 | $this->proxy_host, $this->proxy_port, 163 | $errno, $errstr, 15 164 | ); 165 | 166 | if (!$fp) { 167 | return PEAR::raiseError("Connection to the proxy failed: $errstr", -9276); 168 | } 169 | 170 | /* HTTPS is to be used and we have a proxy, use CONNECT verb */ 171 | if ($secure) { 172 | $res = $this->_httpConnect($fp, $host, $port); 173 | 174 | if (PEAR::isError($res)) { 175 | return $res; 176 | } 177 | } 178 | } else { 179 | if ($secure) { 180 | $host = 'ssl://' . $host; 181 | } 182 | 183 | $fp = @fsockopen($host, $port, $errno, $errstr); 184 | if (!$fp) { 185 | return PEAR::raiseError("Connection to `$host:$port' failed: $errstr", $errno); 186 | } 187 | } 188 | 189 | return $fp; 190 | } 191 | } 192 | -------------------------------------------------------------------------------- /PEAR/REST/14.php: -------------------------------------------------------------------------------- 1 | 10 | * @copyright 1997-2009 The Authors 11 | * @license http://opensource.org/licenses/bsd-license.php New BSD License 12 | * @version CVS: $Id: $ 13 | * @link http://pear.php.net/package/PEAR 14 | * @since File available since Release 1.9 15 | */ 16 | 17 | /** 18 | * For downloading REST xml/txt files 19 | */ 20 | require_once 'PEAR/REST.php'; 21 | require_once 'PEAR/REST/13.php'; 22 | 23 | /** 24 | * Implement REST 1.4 25 | * 26 | * @category pear 27 | * @package PEAR 28 | * @author Helgi Þormar Þorbjörnsson 29 | * @copyright 1997-2009 The Authors 30 | * @license http://opensource.org/licenses/bsd-license.php New BSD License 31 | * @version Release: @package_version@ 32 | * @link http://pear.php.net/package/PEAR 33 | * @since Class available since Release 1.9 34 | */ 35 | class PEAR_REST_14 extends PEAR_REST_13 36 | { 37 | function listLatestUpgrades($base, $pref_state, $installed, $channel, &$reg) 38 | { 39 | $packagelist = $this->_rest->retrieveData($base . 'p/latestpackages.xml', false, false, $channel); 40 | if (PEAR::isError($packagelist)) { 41 | return $packagelist; 42 | } 43 | 44 | $ret = array(); 45 | if (!is_array($packagelist) || !isset($packagelist['p'])) { 46 | return $ret; 47 | } 48 | 49 | if (isset($packagelist['p']['n'])) { 50 | $packagelist['p'] = array($packagelist['p']); 51 | } 52 | 53 | foreach ($packagelist['p'] as $package) { 54 | if (!isset($installed[strtolower($package['n'])])) { 55 | continue; 56 | } 57 | 58 | $inst_version = $reg->packageInfo($package['n'], 'version', $channel); 59 | $inst_state = $reg->packageInfo($package['n'], 'release_state', $channel); 60 | 61 | 62 | $release = $found = false; 63 | $data = array(); 64 | if (isset($package['alpha'])) { 65 | $data['alpha'] = $package['alpha']; 66 | } 67 | 68 | if (isset($package['beta'])) { 69 | $data['beta'] = $package['beta']; 70 | } 71 | 72 | if (isset($package['stable'])) { 73 | $data['stable'] = $package['stable']; 74 | } 75 | 76 | foreach ($data as $state => $release) { 77 | if ($inst_version && version_compare($release['v'], $inst_version, '<=')) { 78 | // not newer than the one installed 79 | break; 80 | } 81 | 82 | // new version > installed version 83 | if (!$pref_state) { 84 | // every state is a good state 85 | $found = true; 86 | $release['state'] = $state; 87 | break; 88 | } else { 89 | $new_state = $state; 90 | // if new state >= installed state: go 91 | if (in_array($new_state, $this->betterStates($inst_state, true))) { 92 | $found = true; 93 | $release['state'] = $state; 94 | break; 95 | } else { 96 | // only allow to lower the state of package, 97 | // if new state >= preferred state: go 98 | if (in_array($new_state, $this->betterStates($pref_state, true))) { 99 | $found = true; 100 | $release['state'] = $state; 101 | break; 102 | } 103 | } 104 | } 105 | } 106 | 107 | if (!$found) { 108 | continue; 109 | } 110 | 111 | $ret[$package] = array( 112 | 'version' => $release['v'], 113 | 'state' => $release['s'], 114 | 'filesize' => $release['f'], 115 | ); 116 | } 117 | 118 | return $ret; 119 | } 120 | } -------------------------------------------------------------------------------- /PEAR/Task/Common.php: -------------------------------------------------------------------------------- 1 | 10 | * @copyright 1997-2009 The Authors 11 | * @license http://opensource.org/licenses/bsd-license.php New BSD License 12 | * @link http://pear.php.net/package/PEAR 13 | * @since File available since Release 1.4.0a1 14 | */ 15 | /**#@+ 16 | * Error codes for task validation routines 17 | */ 18 | define('PEAR_TASK_ERROR_NOATTRIBS', 1); 19 | define('PEAR_TASK_ERROR_MISSING_ATTRIB', 2); 20 | define('PEAR_TASK_ERROR_WRONG_ATTRIB_VALUE', 3); 21 | define('PEAR_TASK_ERROR_INVALID', 4); 22 | /**#@-*/ 23 | define('PEAR_TASK_PACKAGE', 1); 24 | define('PEAR_TASK_INSTALL', 2); 25 | define('PEAR_TASK_PACKAGEANDINSTALL', 3); 26 | /** 27 | * A task is an operation that manipulates the contents of a file. 28 | * 29 | * Simple tasks operate on 1 file. Multiple tasks are executed after all files have been 30 | * processed and installed, and are designed to operate on all files containing the task. 31 | * The Post-install script task simply takes advantage of the fact that it will be run 32 | * after installation, replace is a simple task. 33 | * 34 | * Combining tasks is possible, but ordering is significant. 35 | * 36 | * 37 | * 38 | * 39 | * 40 | * 41 | * This will first replace any instance of @data-dir@ in the test.php file 42 | * with the path to the current data directory. Then, it will include the 43 | * test.php file and run the script it contains to configure the package post-installation. 44 | * 45 | * @category pear 46 | * @package PEAR 47 | * @author Greg Beaver 48 | * @copyright 1997-2009 The Authors 49 | * @license http://opensource.org/licenses/bsd-license.php New BSD License 50 | * @version Release: @package_version@ 51 | * @link http://pear.php.net/package/PEAR 52 | * @since Class available since Release 1.4.0a1 53 | * @abstract 54 | */ 55 | class PEAR_Task_Common 56 | { 57 | /** 58 | * Valid types for this version are 'simple' and 'multiple' 59 | * 60 | * - simple tasks operate on the contents of a file and write out changes to disk 61 | * - multiple tasks operate on the contents of many files and write out the 62 | * changes directly to disk 63 | * 64 | * Child task classes must override this property. 65 | * 66 | * @access protected 67 | */ 68 | protected $type = 'simple'; 69 | /** 70 | * Determines which install phase this task is executed under 71 | */ 72 | public $phase = PEAR_TASK_INSTALL; 73 | /** 74 | * @access protected 75 | */ 76 | protected $config; 77 | /** 78 | * @access protected 79 | */ 80 | protected $registry; 81 | /** 82 | * @access protected 83 | */ 84 | public $logger; 85 | /** 86 | * @access protected 87 | */ 88 | protected $installphase; 89 | /** 90 | * @param PEAR_Config 91 | * @param PEAR_Common 92 | */ 93 | function __construct(&$config, &$logger, $phase) 94 | { 95 | $this->config = &$config; 96 | $this->registry = &$config->getRegistry(); 97 | $this->logger = &$logger; 98 | $this->installphase = $phase; 99 | if ($this->type == 'multiple') { 100 | $GLOBALS['_PEAR_TASK_POSTINSTANCES'][get_class($this)][] = &$this; 101 | } 102 | } 103 | 104 | /** 105 | * Validate the basic contents of a task tag. 106 | * 107 | * @param PEAR_PackageFile_v2 108 | * @param array 109 | * @param PEAR_Config 110 | * @param array the entire parsed tag 111 | * 112 | * @return true|array On error, return an array in format: 113 | * array(PEAR_TASK_ERROR_???[, param1][, param2][, ...]) 114 | * 115 | * For PEAR_TASK_ERROR_MISSING_ATTRIB, pass the attribute name in 116 | * For PEAR_TASK_ERROR_WRONG_ATTRIB_VALUE, pass the attribute name and 117 | * an array of legal values in 118 | * 119 | * @abstract 120 | */ 121 | public static function validateXml($pkg, $xml, $config, $fileXml) 122 | { 123 | } 124 | 125 | /** 126 | * Initialize a task instance with the parameters 127 | * 128 | * @param array raw, parsed xml 129 | * @param array attributes from the tag containing this task 130 | * @param string|null last installed version of this package 131 | * @abstract 132 | */ 133 | public function init($xml, $fileAttributes, $lastVersion) 134 | { 135 | } 136 | 137 | /** 138 | * Begin a task processing session. All multiple tasks will be processed 139 | * after each file has been successfully installed, all simple tasks should 140 | * perform their task here and return any errors using the custom 141 | * throwError() method to allow forward compatibility 142 | * 143 | * This method MUST NOT write out any changes to disk 144 | * 145 | * @param PEAR_PackageFile_v2 146 | * @param string file contents 147 | * @param string the eventual final file location (informational only) 148 | * @return string|false|PEAR_Error false to skip this file, PEAR_Error to fail 149 | * (use $this->throwError), otherwise return the new contents 150 | * @abstract 151 | */ 152 | public function startSession($pkg, $contents, $dest) 153 | { 154 | } 155 | 156 | /** 157 | * This method is used to process each of the tasks for a particular 158 | * multiple class type. Simple tasks need not implement this method. 159 | * 160 | * @param array an array of tasks 161 | * @access protected 162 | */ 163 | public static function run($tasks) 164 | { 165 | } 166 | 167 | /** 168 | * @final 169 | */ 170 | public static function hasPostinstallTasks() 171 | { 172 | return isset($GLOBALS['_PEAR_TASK_POSTINSTANCES']); 173 | } 174 | 175 | /** 176 | * @final 177 | */ 178 | public static function runPostinstallTasks() 179 | { 180 | foreach ($GLOBALS['_PEAR_TASK_POSTINSTANCES'] as $class => $tasks) { 181 | $err = call_user_func( 182 | array($class, 'run'), 183 | $GLOBALS['_PEAR_TASK_POSTINSTANCES'][$class] 184 | ); 185 | if ($err) { 186 | return PEAR_Task_Common::throwError($err); 187 | } 188 | } 189 | unset($GLOBALS['_PEAR_TASK_POSTINSTANCES']); 190 | } 191 | 192 | /** 193 | * Determines whether a role is a script 194 | * @return bool 195 | */ 196 | public function isScript() 197 | { 198 | return $this->type == 'script'; 199 | } 200 | 201 | public function throwError($msg, $code = -1) 202 | { 203 | include_once 'PEAR.php'; 204 | 205 | return PEAR::raiseError($msg, $code); 206 | } 207 | } 208 | -------------------------------------------------------------------------------- /PEAR/Task/Postinstallscript/rw.php: -------------------------------------------------------------------------------- 1 | - read/write version 4 | * 5 | * PHP versions 4 and 5 6 | * 7 | * @category pear 8 | * @package PEAR 9 | * @author Greg Beaver 10 | * @copyright 1997-2009 The Authors 11 | * @license http://opensource.org/licenses/bsd-license.php New BSD License 12 | * @link http://pear.php.net/package/PEAR 13 | * @since File available since Release 1.4.0a10 14 | */ 15 | /** 16 | * Base class 17 | */ 18 | require_once 'PEAR/Task/Postinstallscript.php'; 19 | /** 20 | * Abstracts the postinstallscript file task xml. 21 | * @category pear 22 | * @package PEAR 23 | * @author Greg Beaver 24 | * @copyright 1997-2009 The Authors 25 | * @license http://opensource.org/licenses/bsd-license.php New BSD License 26 | * @version Release: @package_version@ 27 | * @link http://pear.php.net/package/PEAR 28 | * @since Class available since Release 1.4.0a10 29 | */ 30 | class PEAR_Task_Postinstallscript_rw extends PEAR_Task_Postinstallscript 31 | { 32 | /** 33 | * parent package file object 34 | * 35 | * @var PEAR_PackageFile_v2_rw 36 | */ 37 | public $_pkg; 38 | /** 39 | * Enter description here... 40 | * 41 | * @param PEAR_PackageFile_v2_rw $pkg Package 42 | * @param PEAR_Config $config Config 43 | * @param PEAR_Frontend $logger Logger 44 | * @param array $fileXml XML 45 | * 46 | * @return PEAR_Task_Postinstallscript_rw 47 | */ 48 | function __construct(&$pkg, &$config, &$logger, $fileXml) 49 | { 50 | parent::__construct($config, $logger, PEAR_TASK_PACKAGE); 51 | $this->_contents = $fileXml; 52 | $this->_pkg = &$pkg; 53 | $this->_params = array(); 54 | } 55 | 56 | public function validate() 57 | { 58 | return $this->validateXml($this->_pkg, $this->_params, $this->config, $this->_contents); 59 | } 60 | 61 | public function getName() 62 | { 63 | return 'postinstallscript'; 64 | } 65 | 66 | /** 67 | * add a simple to the post-install script 68 | * 69 | * Order is significant, so call this method in the same 70 | * sequence the users should see the paramgroups. The $params 71 | * parameter should either be the result of a call to {@link getParam()} 72 | * or an array of calls to getParam(). 73 | * 74 | * Use {@link addConditionTypeGroup()} to add a containing 75 | * a tag 76 | * 77 | * @param string $id id as seen by the script 78 | * @param array|false $params array of getParam() calls, or false for no params 79 | * @param string|false $instructions 80 | */ 81 | public function addParamGroup($id, $params = false, $instructions = false) 82 | { 83 | if ($params && isset($params[0]) && !isset($params[1])) { 84 | $params = $params[0]; 85 | } 86 | $stuff = 87 | array( 88 | $this->_pkg->getTasksNs().':id' => $id, 89 | ); 90 | if ($instructions) { 91 | $stuff[$this->_pkg->getTasksNs().':instructions'] = $instructions; 92 | } 93 | if ($params) { 94 | $stuff[$this->_pkg->getTasksNs().':param'] = $params; 95 | } 96 | $this->_params[$this->_pkg->getTasksNs().':paramgroup'][] = $stuff; 97 | } 98 | 99 | /** 100 | * Add a complex to the post-install script with conditions 101 | * 102 | * This inserts a with 103 | * 104 | * Order is significant, so call this method in the same 105 | * sequence the users should see the paramgroups. The $params 106 | * parameter should either be the result of a call to {@link getParam()} 107 | * or an array of calls to getParam(). 108 | * 109 | * Use {@link addParamGroup()} to add a simple 110 | * 111 | * @param string $id id as seen by the script 112 | * @param string $oldgroup id of the section referenced by 113 | * 114 | * @param string $param name of the from the older section referenced 115 | * by 116 | * @param string $value value to match of the parameter 117 | * @param string $conditiontype one of '=', '!=', 'preg_match' 118 | * @param array|false $params array of getParam() calls, or false for no params 119 | * @param string|false $instructions 120 | */ 121 | public function addConditionTypeGroup($id, 122 | $oldgroup, 123 | $param, 124 | $value, 125 | $conditiontype = '=', 126 | $params = false, 127 | $instructions = false 128 | ) { 129 | if ($params && isset($params[0]) && !isset($params[1])) { 130 | $params = $params[0]; 131 | } 132 | $stuff = array( 133 | $this->_pkg->getTasksNs().':id' => $id, 134 | ); 135 | if ($instructions) { 136 | $stuff[$this->_pkg->getTasksNs().':instructions'] = $instructions; 137 | } 138 | $stuff[$this->_pkg->getTasksNs().':name'] = $oldgroup.'::'.$param; 139 | $stuff[$this->_pkg->getTasksNs().':conditiontype'] = $conditiontype; 140 | $stuff[$this->_pkg->getTasksNs().':value'] = $value; 141 | if ($params) { 142 | $stuff[$this->_pkg->getTasksNs().':param'] = $params; 143 | } 144 | $this->_params[$this->_pkg->getTasksNs().':paramgroup'][] = $stuff; 145 | } 146 | 147 | public function getXml() 148 | { 149 | return $this->_params; 150 | } 151 | 152 | /** 153 | * Use to set up a param tag for use in creating a paramgroup 154 | * 155 | * @param mixed $name Name of parameter 156 | * @param mixed $prompt Prompt 157 | * @param string $type Type, defaults to 'string' 158 | * @param mixed $default Default value 159 | * 160 | * @return array 161 | */ 162 | public function getParam( 163 | $name, $prompt, $type = 'string', $default = null 164 | ) { 165 | if ($default !== null) { 166 | return 167 | array( 168 | $this->_pkg->getTasksNs().':name' => $name, 169 | $this->_pkg->getTasksNs().':prompt' => $prompt, 170 | $this->_pkg->getTasksNs().':type' => $type, 171 | $this->_pkg->getTasksNs().':default' => $default, 172 | ); 173 | } 174 | 175 | return 176 | array( 177 | $this->_pkg->getTasksNs().':name' => $name, 178 | $this->_pkg->getTasksNs().':prompt' => $prompt, 179 | $this->_pkg->getTasksNs().':type' => $type, 180 | ); 181 | } 182 | } 183 | -------------------------------------------------------------------------------- /PEAR/Task/Replace.php: -------------------------------------------------------------------------------- 1 | 4 | * 5 | * PHP versions 4 and 5 6 | * 7 | * @category pear 8 | * @package PEAR 9 | * @author Greg Beaver 10 | * @copyright 1997-2009 The Authors 11 | * @license http://opensource.org/licenses/bsd-license.php New BSD License 12 | * @link http://pear.php.net/package/PEAR 13 | * @since File available since Release 1.4.0a1 14 | */ 15 | /** 16 | * Base class 17 | */ 18 | require_once 'PEAR/Task/Common.php'; 19 | /** 20 | * Implements the replace file task. 21 | * @category pear 22 | * @package PEAR 23 | * @author Greg Beaver 24 | * @copyright 1997-2009 The Authors 25 | * @license http://opensource.org/licenses/bsd-license.php New BSD License 26 | * @version Release: @package_version@ 27 | * @link http://pear.php.net/package/PEAR 28 | * @since Class available since Release 1.4.0a1 29 | */ 30 | class PEAR_Task_Replace extends PEAR_Task_Common 31 | { 32 | public $type = 'simple'; 33 | public $phase = PEAR_TASK_PACKAGEANDINSTALL; 34 | public $_replacements; 35 | 36 | /** 37 | * Validate the raw xml at parsing-time. 38 | * 39 | * @param PEAR_PackageFile_v2 40 | * @param array raw, parsed xml 41 | * @param PEAR_Config 42 | */ 43 | public static function validateXml($pkg, $xml, $config, $fileXml) 44 | { 45 | if (!isset($xml['attribs'])) { 46 | return array(PEAR_TASK_ERROR_NOATTRIBS); 47 | } 48 | if (!isset($xml['attribs']['type'])) { 49 | return array(PEAR_TASK_ERROR_MISSING_ATTRIB, 'type'); 50 | } 51 | if (!isset($xml['attribs']['to'])) { 52 | return array(PEAR_TASK_ERROR_MISSING_ATTRIB, 'to'); 53 | } 54 | if (!isset($xml['attribs']['from'])) { 55 | return array(PEAR_TASK_ERROR_MISSING_ATTRIB, 'from'); 56 | } 57 | if ($xml['attribs']['type'] == 'pear-config') { 58 | if (!in_array($xml['attribs']['to'], $config->getKeys())) { 59 | return array(PEAR_TASK_ERROR_WRONG_ATTRIB_VALUE, 'to', $xml['attribs']['to'], 60 | $config->getKeys(), ); 61 | } 62 | } elseif ($xml['attribs']['type'] == 'php-const') { 63 | if (defined($xml['attribs']['to'])) { 64 | return true; 65 | } else { 66 | return array(PEAR_TASK_ERROR_WRONG_ATTRIB_VALUE, 'to', $xml['attribs']['to'], 67 | array('valid PHP constant'), ); 68 | } 69 | } elseif ($xml['attribs']['type'] == 'package-info') { 70 | if (in_array( 71 | $xml['attribs']['to'], 72 | array('name', 'summary', 'channel', 'notes', 'extends', 'description', 73 | 'release_notes', 'license', 'release-license', 'license-uri', 74 | 'version', 'api-version', 'state', 'api-state', 'release_date', 75 | 'date', 'time', ) 76 | )) { 77 | return true; 78 | } else { 79 | return array(PEAR_TASK_ERROR_WRONG_ATTRIB_VALUE, 'to', $xml['attribs']['to'], 80 | array('name', 'summary', 'channel', 'notes', 'extends', 'description', 81 | 'release_notes', 'license', 'release-license', 'license-uri', 82 | 'version', 'api-version', 'state', 'api-state', 'release_date', 83 | 'date', 'time', ), ); 84 | } 85 | } else { 86 | return array(PEAR_TASK_ERROR_WRONG_ATTRIB_VALUE, 'type', $xml['attribs']['type'], 87 | array('pear-config', 'package-info', 'php-const'), ); 88 | } 89 | 90 | return true; 91 | } 92 | 93 | /** 94 | * Initialize a task instance with the parameters 95 | * @param array raw, parsed xml 96 | * @param unused 97 | * @param unused 98 | */ 99 | public function init($xml, $attribs, $lastVersion = null) 100 | { 101 | $this->_replacements = isset($xml['attribs']) ? array($xml) : $xml; 102 | } 103 | 104 | /** 105 | * Do a package.xml 1.0 replacement, with additional package-info fields available 106 | * 107 | * See validateXml() source for the complete list of allowed fields 108 | * 109 | * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2 110 | * @param string file contents 111 | * @param string the eventual final file location (informational only) 112 | * @return string|false|PEAR_Error false to skip this file, PEAR_Error to fail 113 | * (use $this->throwError), otherwise return the new contents 114 | */ 115 | public function startSession($pkg, $contents, $dest) 116 | { 117 | $subst_from = $subst_to = array(); 118 | foreach ($this->_replacements as $a) { 119 | $a = $a['attribs']; 120 | $to = ''; 121 | if ($a['type'] == 'pear-config') { 122 | if ($this->installphase == PEAR_TASK_PACKAGE) { 123 | return false; 124 | } 125 | if ($a['to'] == 'master_server') { 126 | $chan = $this->registry->getChannel($pkg->getChannel()); 127 | if (!PEAR::isError($chan)) { 128 | $to = $chan->getServer(); 129 | } else { 130 | $this->logger->log(0, "$dest: invalid pear-config replacement: $a[to]"); 131 | 132 | return false; 133 | } 134 | } else { 135 | if ($this->config->isDefinedLayer('ftp')) { 136 | // try the remote config file first 137 | $to = $this->config->get($a['to'], 'ftp', $pkg->getChannel()); 138 | if (is_null($to)) { 139 | // then default to local 140 | $to = $this->config->get($a['to'], null, $pkg->getChannel()); 141 | } 142 | } else { 143 | $to = $this->config->get($a['to'], null, $pkg->getChannel()); 144 | } 145 | } 146 | if (is_null($to)) { 147 | $this->logger->log(0, "$dest: invalid pear-config replacement: $a[to]"); 148 | 149 | return false; 150 | } 151 | } elseif ($a['type'] == 'php-const') { 152 | if ($this->installphase == PEAR_TASK_PACKAGE) { 153 | return false; 154 | } 155 | if (defined($a['to'])) { 156 | $to = constant($a['to']); 157 | } else { 158 | $this->logger->log(0, "$dest: invalid php-const replacement: $a[to]"); 159 | 160 | return false; 161 | } 162 | } else { 163 | if ($t = $pkg->packageInfo($a['to'])) { 164 | $to = $t; 165 | } else { 166 | $this->logger->log(0, "$dest: invalid package-info replacement: $a[to]"); 167 | 168 | return false; 169 | } 170 | } 171 | if (!is_null($to)) { 172 | $subst_from[] = $a['from']; 173 | $subst_to[] = $to; 174 | } 175 | } 176 | $this->logger->log( 177 | 3, "doing ".sizeof($subst_from). 178 | " substitution(s) for $dest" 179 | ); 180 | if (sizeof($subst_from)) { 181 | $contents = str_replace($subst_from, $subst_to, $contents); 182 | } 183 | 184 | return $contents; 185 | } 186 | } 187 | -------------------------------------------------------------------------------- /PEAR/Task/Replace/rw.php: -------------------------------------------------------------------------------- 1 | - read/write version 4 | * 5 | * PHP versions 4 and 5 6 | * 7 | * @category pear 8 | * @package PEAR 9 | * @author Greg Beaver 10 | * @copyright 1997-2009 The Authors 11 | * @license http://opensource.org/licenses/bsd-license.php New BSD License 12 | * @link http://pear.php.net/package/PEAR 13 | * @since File available since Release 1.4.0a10 14 | */ 15 | /** 16 | * Base class 17 | */ 18 | require_once 'PEAR/Task/Replace.php'; 19 | /** 20 | * Abstracts the replace task xml. 21 | * @category pear 22 | * @package PEAR 23 | * @author Greg Beaver 24 | * @copyright 1997-2009 The Authors 25 | * @license http://opensource.org/licenses/bsd-license.php New BSD License 26 | * @version Release: @package_version@ 27 | * @link http://pear.php.net/package/PEAR 28 | * @since Class available since Release 1.4.0a10 29 | */ 30 | class PEAR_Task_Replace_rw extends PEAR_Task_Replace 31 | { 32 | public function __construct(&$pkg, &$config, &$logger, $fileXml) 33 | { 34 | parent::__construct($config, $logger, PEAR_TASK_PACKAGE); 35 | $this->_contents = $fileXml; 36 | $this->_pkg = &$pkg; 37 | $this->_params = array(); 38 | } 39 | 40 | public function validate() 41 | { 42 | return $this->validateXml($this->_pkg, $this->_params, $this->config, $this->_contents); 43 | } 44 | 45 | public function setInfo($from, $to, $type) 46 | { 47 | $this->_params = array('attribs' => array('from' => $from, 'to' => $to, 'type' => $type)); 48 | } 49 | 50 | public function getName() 51 | { 52 | return 'replace'; 53 | } 54 | 55 | public function getXml() 56 | { 57 | return $this->_params; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /PEAR/Task/Unixeol.php: -------------------------------------------------------------------------------- 1 | 4 | * 5 | * PHP versions 4 and 5 6 | * 7 | * @category pear 8 | * @package PEAR 9 | * @author Greg Beaver 10 | * @copyright 1997-2009 The Authors 11 | * @license http://opensource.org/licenses/bsd-license.php New BSD License 12 | * @link http://pear.php.net/package/PEAR 13 | * @since File available since Release 1.4.0a1 14 | */ 15 | /** 16 | * Base class 17 | */ 18 | require_once 'PEAR/Task/Common.php'; 19 | /** 20 | * Implements the unix line endings file task. 21 | * @category pear 22 | * @package PEAR 23 | * @author Greg Beaver 24 | * @copyright 1997-2009 The Authors 25 | * @license http://opensource.org/licenses/bsd-license.php New BSD License 26 | * @version Release: @package_version@ 27 | * @link http://pear.php.net/package/PEAR 28 | * @since Class available since Release 1.4.0a1 29 | */ 30 | class PEAR_Task_Unixeol extends PEAR_Task_Common 31 | { 32 | public $type = 'simple'; 33 | public $phase = PEAR_TASK_PACKAGE; 34 | public $_replacements; 35 | 36 | /** 37 | * Validate the raw xml at parsing-time. 38 | * 39 | * @param PEAR_PackageFile_v2 40 | * @param array raw, parsed xml 41 | * @param PEAR_Config 42 | */ 43 | public static function validateXml($pkg, $xml, $config, $fileXml) 44 | { 45 | if ($xml != '') { 46 | return array(PEAR_TASK_ERROR_INVALID, 'no attributes allowed'); 47 | } 48 | 49 | return true; 50 | } 51 | 52 | /** 53 | * Initialize a task instance with the parameters 54 | * @param array raw, parsed xml 55 | * @param unused 56 | * @param unused 57 | */ 58 | public function init($xml, $attribs, $lastVersion = null) 59 | { 60 | } 61 | 62 | /** 63 | * Replace all line endings with line endings customized for the current OS 64 | * 65 | * See validateXml() source for the complete list of allowed fields 66 | * 67 | * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2 68 | * @param string file contents 69 | * @param string the eventual final file location (informational only) 70 | * @return string|false|PEAR_Error false to skip this file, PEAR_Error to fail 71 | * (use $this->throwError), otherwise return the new contents 72 | */ 73 | public function startSession($pkg, $contents, $dest) 74 | { 75 | $this->logger->log(3, "replacing all line endings with \\n in $dest"); 76 | 77 | return preg_replace("/\r\n|\n\r|\r|\n/", "\n", $contents); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /PEAR/Task/Unixeol/rw.php: -------------------------------------------------------------------------------- 1 | - read/write version 4 | * 5 | * PHP versions 4 and 5 6 | * 7 | * @category pear 8 | * @package PEAR 9 | * @author Greg Beaver 10 | * @copyright 1997-2009 The Authors 11 | * @license http://opensource.org/licenses/bsd-license.php New BSD License 12 | * @link http://pear.php.net/package/PEAR 13 | * @since File available since Release 1.4.0a10 14 | */ 15 | /** 16 | * Base class 17 | */ 18 | require_once 'PEAR/Task/Unixeol.php'; 19 | /** 20 | * Abstracts the unixeol task xml. 21 | * @category pear 22 | * @package PEAR 23 | * @author Greg Beaver 24 | * @copyright 1997-2009 The Authors 25 | * @license http://opensource.org/licenses/bsd-license.php New BSD License 26 | * @version Release: @package_version@ 27 | * @link http://pear.php.net/package/PEAR 28 | * @since Class available since Release 1.4.0a10 29 | */ 30 | class PEAR_Task_Unixeol_rw extends PEAR_Task_Unixeol 31 | { 32 | function __construct(&$pkg, &$config, &$logger, $fileXml) 33 | { 34 | parent::__construct($config, $logger, PEAR_TASK_PACKAGE); 35 | $this->_contents = $fileXml; 36 | $this->_pkg = &$pkg; 37 | $this->_params = array(); 38 | } 39 | 40 | public function validate() 41 | { 42 | return true; 43 | } 44 | 45 | public function getName() 46 | { 47 | return 'unixeol'; 48 | } 49 | 50 | public function getXml() 51 | { 52 | return ''; 53 | } 54 | } 55 | ?> 56 | -------------------------------------------------------------------------------- /PEAR/Task/Windowseol.php: -------------------------------------------------------------------------------- 1 | 4 | * 5 | * PHP versions 4 and 5 6 | * 7 | * @category pear 8 | * @package PEAR 9 | * @author Greg Beaver 10 | * @copyright 1997-2009 The Authors 11 | * @license http://opensource.org/licenses/bsd-license.php New BSD License 12 | * @link http://pear.php.net/package/PEAR 13 | * @since File available since Release 1.4.0a1 14 | */ 15 | /** 16 | * Base class 17 | */ 18 | require_once 'PEAR/Task/Common.php'; 19 | /** 20 | * Implements the windows line endsings file task. 21 | * 22 | * @category pear 23 | * @package PEAR 24 | * @author Greg Beaver 25 | * @copyright 1997-2009 The Authors 26 | * @license http://opensource.org/licenses/bsd-license.php New BSD License 27 | * @version Release: @package_version@ 28 | * @link http://pear.php.net/package/PEAR 29 | * @since Class available since Release 1.4.0a1 30 | */ 31 | class PEAR_Task_Windowseol extends PEAR_Task_Common 32 | { 33 | public $type = 'simple'; 34 | public $phase = PEAR_TASK_PACKAGE; 35 | public $_replacements; 36 | 37 | /** 38 | * Validate the raw xml at parsing-time. 39 | * 40 | * @param PEAR_PackageFile_v2 41 | * @param array raw, parsed xml 42 | * @param PEAR_Config 43 | */ 44 | public static function validateXml($pkg, $xml, $config, $fileXml) 45 | { 46 | if ($xml != '') { 47 | return array(PEAR_TASK_ERROR_INVALID, 'no attributes allowed'); 48 | } 49 | 50 | return true; 51 | } 52 | 53 | /** 54 | * Initialize a task instance with the parameters 55 | * @param array raw, parsed xml 56 | * @param unused 57 | * @param unused 58 | */ 59 | public function init($xml, $attribs, $lastVersion = null) 60 | { 61 | } 62 | 63 | /** 64 | * Replace all line endings with windows line endings 65 | * 66 | * See validateXml() source for the complete list of allowed fields 67 | * 68 | * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2 69 | * @param string file contents 70 | * @param string the eventual final file location (informational only) 71 | * @return string|false|PEAR_Error false to skip this file, PEAR_Error to fail 72 | * (use $this->throwError), otherwise return the new contents 73 | */ 74 | public function startSession($pkg, $contents, $dest) 75 | { 76 | $this->logger->log(3, "replacing all line endings with \\r\\n in $dest"); 77 | 78 | return preg_replace("/\r\n|\n\r|\r|\n/", "\r\n", $contents); 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /PEAR/Task/Windowseol/rw.php: -------------------------------------------------------------------------------- 1 | - read/write version 4 | * 5 | * PHP versions 4 and 5 6 | * 7 | * @category pear 8 | * @package PEAR 9 | * @author Greg Beaver 10 | * @copyright 1997-2009 The Authors 11 | * @license http://opensource.org/licenses/bsd-license.php New BSD License 12 | * @link http://pear.php.net/package/PEAR 13 | * @since File available since Release 1.4.0a10 14 | */ 15 | /** 16 | * Base class 17 | */ 18 | require_once 'PEAR/Task/Windowseol.php'; 19 | /** 20 | * Abstracts the windowseol task xml. 21 | * 22 | * @category pear 23 | * @package PEAR 24 | * @author Greg Beaver 25 | * @copyright 1997-2009 The Authors 26 | * @license http://opensource.org/licenses/bsd-license.php New BSD License 27 | * @version Release: @package_version@ 28 | * @link http://pear.php.net/package/PEAR 29 | * @since Class available since Release 1.4.0a10 30 | */ 31 | class PEAR_Task_Windowseol_rw extends PEAR_Task_Windowseol 32 | { 33 | function __construct(&$pkg, &$config, &$logger, $fileXml) 34 | { 35 | parent::__construct($config, $logger, PEAR_TASK_PACKAGE); 36 | $this->_contents = $fileXml; 37 | $this->_pkg = &$pkg; 38 | $this->_params = array(); 39 | } 40 | 41 | public function validate() 42 | { 43 | return true; 44 | } 45 | 46 | public function getName() 47 | { 48 | return 'windowseol'; 49 | } 50 | 51 | public function getXml() 52 | { 53 | return ''; 54 | } 55 | } 56 | ?> 57 | -------------------------------------------------------------------------------- /PEAR/Validator/PECL.php: -------------------------------------------------------------------------------- 1 | 10 | * @copyright 1997-2006 The PHP Group 11 | * @license http://opensource.org/licenses/bsd-license.php New BSD License 12 | * @link http://pear.php.net/package/PEAR 13 | * @since File available since Release 1.4.0a5 14 | */ 15 | /** 16 | * This is the parent class for all validators 17 | */ 18 | require_once 'PEAR/Validate.php'; 19 | /** 20 | * Channel Validator for the pecl.php.net channel 21 | * @category pear 22 | * @package PEAR 23 | * @author Greg Beaver 24 | * @copyright 1997-2009 The Authors 25 | * @license http://opensource.org/licenses/bsd-license.php New BSD License 26 | * @version Release: @package_version@ 27 | * @link http://pear.php.net/package/PEAR 28 | * @since Class available since Release 1.4.0a5 29 | */ 30 | class PEAR_Validator_PECL extends PEAR_Validate 31 | { 32 | function validateVersion() 33 | { 34 | if ($this->_state == PEAR_VALIDATE_PACKAGING) { 35 | $version = $this->_packagexml->getVersion(); 36 | $versioncomponents = explode('.', $version); 37 | $last = array_pop($versioncomponents); 38 | if (substr($last, 1, 2) == 'rc') { 39 | $this->_addFailure('version', 'Release Candidate versions must have ' . 40 | 'upper-case RC, not lower-case rc'); 41 | return false; 42 | } 43 | } 44 | return true; 45 | } 46 | 47 | function validatePackageName() 48 | { 49 | $ret = parent::validatePackageName(); 50 | if ($this->_packagexml->getPackageType() == 'extsrc' || 51 | $this->_packagexml->getPackageType() == 'zendextsrc') { 52 | if (strtolower($this->_packagexml->getPackage()) != 53 | strtolower($this->_packagexml->getProvidesExtension())) { 54 | $this->_addWarning('providesextension', 'package name "' . 55 | $this->_packagexml->getPackage() . '" is different from extension name "' . 56 | $this->_packagexml->getProvidesExtension() . '"'); 57 | } 58 | } 59 | return $ret; 60 | } 61 | } 62 | ?> -------------------------------------------------------------------------------- /PEAR/XMLParser.php: -------------------------------------------------------------------------------- 1 | 10 | * @author Stephan Schmidt (original XML_Unserializer code) 11 | * @copyright 1997-2009 The Authors 12 | * @license http://opensource.org/licenses/bsd-license New BSD License 13 | * @link http://pear.php.net/package/PEAR 14 | * @since File available since Release 1.4.0a1 15 | */ 16 | 17 | /** 18 | * Parser for any xml file 19 | * @category pear 20 | * @package PEAR 21 | * @author Greg Beaver 22 | * @author Stephan Schmidt (original XML_Unserializer code) 23 | * @copyright 1997-2009 The Authors 24 | * @license http://opensource.org/licenses/bsd-license New BSD License 25 | * @version Release: @package_version@ 26 | * @link http://pear.php.net/package/PEAR 27 | * @since Class available since Release 1.4.0a1 28 | */ 29 | class PEAR_XMLParser 30 | { 31 | /** 32 | * unserilialized data 33 | * @var string $_serializedData 34 | */ 35 | var $_unserializedData = null; 36 | 37 | /** 38 | * name of the root tag 39 | * @var string $_root 40 | */ 41 | var $_root = null; 42 | 43 | /** 44 | * stack for all data that is found 45 | * @var array $_dataStack 46 | */ 47 | var $_dataStack = array(); 48 | 49 | /** 50 | * stack for all values that are generated 51 | * @var array $_valStack 52 | */ 53 | var $_valStack = array(); 54 | 55 | /** 56 | * current tag depth 57 | * @var int $_depth 58 | */ 59 | var $_depth = 0; 60 | 61 | /** 62 | * The XML encoding to use 63 | * @var string $encoding 64 | */ 65 | var $encoding = 'ISO-8859-1'; 66 | 67 | /** 68 | * @return array 69 | */ 70 | function getData() 71 | { 72 | return $this->_unserializedData; 73 | } 74 | 75 | /** 76 | * @param string xml content 77 | * @return true|PEAR_Error 78 | */ 79 | function parse($data) 80 | { 81 | if (!extension_loaded('xml')) { 82 | include_once 'PEAR.php'; 83 | return PEAR::raiseError("XML Extension not found", 1); 84 | } 85 | $this->_dataStack = $this->_valStack = array(); 86 | $this->_depth = 0; 87 | 88 | if ( 89 | strpos($data, 'encoding="UTF-8"') 90 | || strpos($data, 'encoding="utf-8"') 91 | || strpos($data, "encoding='UTF-8'") 92 | || strpos($data, "encoding='utf-8'") 93 | ) { 94 | $this->encoding = 'UTF-8'; 95 | } 96 | 97 | $xp = xml_parser_create($this->encoding); 98 | xml_parser_set_option($xp, XML_OPTION_CASE_FOLDING, 0); 99 | xml_set_object($xp, $this); 100 | xml_set_element_handler($xp, 'startHandler', 'endHandler'); 101 | xml_set_character_data_handler($xp, 'cdataHandler'); 102 | if (!xml_parse($xp, $data)) { 103 | $msg = xml_error_string(xml_get_error_code($xp)); 104 | $line = xml_get_current_line_number($xp); 105 | xml_parser_free($xp); 106 | include_once 'PEAR.php'; 107 | return PEAR::raiseError("XML Error: '$msg' on line '$line'", 2); 108 | } 109 | xml_parser_free($xp); 110 | return true; 111 | } 112 | 113 | /** 114 | * Start element handler for XML parser 115 | * 116 | * @access private 117 | * @param object $parser XML parser object 118 | * @param string $element XML element 119 | * @param array $attribs attributes of XML tag 120 | * @return void 121 | */ 122 | function startHandler($parser, $element, $attribs) 123 | { 124 | $this->_depth++; 125 | $this->_dataStack[$this->_depth] = null; 126 | 127 | $val = array( 128 | 'name' => $element, 129 | 'value' => null, 130 | 'type' => 'string', 131 | 'childrenKeys' => array(), 132 | 'aggregKeys' => array() 133 | ); 134 | 135 | if (count($attribs) > 0) { 136 | $val['children'] = array(); 137 | $val['type'] = 'array'; 138 | $val['children']['attribs'] = $attribs; 139 | } 140 | 141 | array_push($this->_valStack, $val); 142 | } 143 | 144 | /** 145 | * post-process data 146 | * 147 | * @param string $data 148 | * @param string $element element name 149 | */ 150 | function postProcess($data, $element) 151 | { 152 | return trim($data); 153 | } 154 | 155 | /** 156 | * End element handler for XML parser 157 | * 158 | * @access private 159 | * @param object XML parser object 160 | * @param string 161 | * @return void 162 | */ 163 | function endHandler($parser, $element) 164 | { 165 | $value = array_pop($this->_valStack); 166 | $data = $this->postProcess($this->_dataStack[$this->_depth], $element); 167 | 168 | // adjust type of the value 169 | switch (strtolower($value['type'])) { 170 | // unserialize an array 171 | case 'array': 172 | if ($data !== '') { 173 | $value['children']['_content'] = $data; 174 | } 175 | 176 | $value['value'] = isset($value['children']) ? $value['children'] : array(); 177 | break; 178 | 179 | /* 180 | * unserialize a null value 181 | */ 182 | case 'null': 183 | $data = null; 184 | break; 185 | 186 | /* 187 | * unserialize any scalar value 188 | */ 189 | default: 190 | settype($data, $value['type']); 191 | $value['value'] = $data; 192 | break; 193 | } 194 | 195 | $parent = array_pop($this->_valStack); 196 | if ($parent === null) { 197 | $this->_unserializedData = &$value['value']; 198 | $this->_root = &$value['name']; 199 | return true; 200 | } 201 | 202 | // parent has to be an array 203 | if (!isset($parent['children']) || !is_array($parent['children'])) { 204 | $parent['children'] = array(); 205 | if ($parent['type'] != 'array') { 206 | $parent['type'] = 'array'; 207 | } 208 | } 209 | 210 | if (!empty($value['name'])) { 211 | // there already has been a tag with this name 212 | if (in_array($value['name'], $parent['childrenKeys'])) { 213 | // no aggregate has been created for this tag 214 | if (!in_array($value['name'], $parent['aggregKeys'])) { 215 | if (isset($parent['children'][$value['name']])) { 216 | $parent['children'][$value['name']] = array($parent['children'][$value['name']]); 217 | } else { 218 | $parent['children'][$value['name']] = array(); 219 | } 220 | array_push($parent['aggregKeys'], $value['name']); 221 | } 222 | array_push($parent['children'][$value['name']], $value['value']); 223 | } else { 224 | $parent['children'][$value['name']] = &$value['value']; 225 | array_push($parent['childrenKeys'], $value['name']); 226 | } 227 | } else { 228 | array_push($parent['children'],$value['value']); 229 | } 230 | array_push($this->_valStack, $parent); 231 | 232 | $this->_depth--; 233 | } 234 | 235 | /** 236 | * Handler for character data 237 | * 238 | * @access private 239 | * @param object XML parser object 240 | * @param string CDATA 241 | * @return void 242 | */ 243 | function cdataHandler($parser, $cdata) 244 | { 245 | $this->_dataStack[$this->_depth] .= $cdata; 246 | } 247 | } -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | ************************* 2 | PEAR - The PEAR Installer 3 | ************************* 4 | .. image:: https://travis-ci.org/pear/pear-core.svg?branch=stable 5 | :target: https://travis-ci.org/pear/pear-core 6 | 7 | ========================================= 8 | What is the PEAR Installer? What is PEAR? 9 | ========================================= 10 | PEAR is the PHP Extension and Application Repository, found at 11 | http://pear.php.net. 12 | 13 | The **PEAR Installer** is this software, which contains executable 14 | files and PHP code that is used to **download and install** PEAR code 15 | from pear.php.net. 16 | 17 | PEAR contains useful **software libraries and applications** such as 18 | MDB2 (database abstraction), HTML_QuickForm (HTML forms management), 19 | PhpDocumentor (auto-documentation generator), DB_DataObject 20 | (Data Access Abstraction), and many hundreds more. 21 | Browse all available packages at http://pear.php.net, the list is 22 | constantly growing and updating to reflect improvements in the PHP language. 23 | 24 | .. warning:: 25 | Do not run PEAR without installing it - if you downloaded this 26 | tarball manually, you MUST install it. Read the instructions in INSTALL 27 | prior to use. 28 | 29 | 30 | ============= 31 | Documentation 32 | ============= 33 | Documentation for PEAR can be found at http://pear.php.net/manual/. 34 | Installation documentation can be found in the INSTALL file included 35 | in this tarball. 36 | 37 | 38 | ===== 39 | Tests 40 | ===== 41 | Run the tests without installation as follows:: 42 | 43 | $ ./scripts/pear.sh run-tests -r tests 44 | 45 | You should have the ``Text_Diff`` package installed to get nicer error output. 46 | 47 | To run the tests with another PHP version, modify ``php_bin`` and set the 48 | ``PHP_PEAR_PHP_BIN`` environment variable:: 49 | 50 | $ pear config-set php_bin /usr/local/bin/php7 51 | $ PHP_PEAR_PHP_BIN=/usr/local/bin/php7 ./scripts/pear.sh run-tests -r tests 52 | 53 | Happy PHPing, we hope PEAR will be a great tool for your development work! 54 | 55 | 56 | Test dependencies 57 | ================= 58 | * ``zlib`` 59 | 60 | 61 | ========= 62 | Releasing 63 | ========= 64 | Create a PEAR package, as well as phars for pear-less installation, 65 | simply run ``build-release.sh``). 66 | 67 | ``go-pear.phar`` contains the PEAR installer installer that asks where to install it. 68 | It is available from http://pear.php.net/go-pear.phar. 69 | 70 | ``install-pear-nozlib.phar`` installs PEAR automatically without asking anything. 71 | It is shipped with PHP itself. 72 | -------------------------------------------------------------------------------- /build-release.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # package up PEAR 3 | set -e 4 | set -x 5 | 6 | rm -f PEAR-*.tgz 7 | pear package package2.xml 8 | 9 | [ -d go-pear-tarballs ] && rm -r go-pear-tarballs 10 | mkdir go-pear-tarballs 11 | cd go-pear-tarballs 12 | 13 | rm -f PEAR-* 14 | cp ../PEAR-*.tgz . 15 | gunzip PEAR-*.tgz 16 | pear download -Z Archive_Tar Console_Getopt Structures_Graph XML_Util 17 | 18 | mkdir src && cd src 19 | for i in ../*.tar; do tar xvf $i; done 20 | mv *\/* . || true 21 | cd ../../ 22 | 23 | rm go-pear.phar install-pear-nozlib.phar || true 24 | php make-gopear-phar.php 25 | php make-installpear-nozlib-phar.php 26 | 27 | rm -rf go-pear-tarballs 28 | -------------------------------------------------------------------------------- /catalog: -------------------------------------------------------------------------------- 1 | PUBLIC "-//PHP Group//DTD PEAR Package 1.0//EN//XML" "package.dtd" 2 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": [ 3 | { 4 | "email": "cellog@php.net", 5 | "name": "Greg Beaver", 6 | "role": "Lead" 7 | }, 8 | { 9 | "email": "pierre@php.net", 10 | "name": "Pierre-Alain Joye", 11 | "role": "Lead" 12 | }, 13 | { 14 | "email": "stig@php.net", 15 | "name": "Stig Bakken", 16 | "role": "Lead" 17 | }, 18 | { 19 | "email": "cox@idecnet.com", 20 | "name": "Tomas V.V.Cox", 21 | "role": "Lead" 22 | }, 23 | { 24 | "email": "dufuz@php.net", 25 | "name": "Helgi Thormar", 26 | "role": "Lead" 27 | }, 28 | { 29 | "email": "tias@php.net", 30 | "name": "Tias Guns", 31 | "role": "Developer" 32 | }, 33 | { 34 | "email": "timj@php.net", 35 | "name": "Tim Jackson", 36 | "role": "Helper" 37 | }, 38 | { 39 | "email": "toggg@php.net", 40 | "name": "Bertrand Gugger", 41 | "role": "Helper" 42 | }, 43 | { 44 | "email": "mj@php.net", 45 | "name": "Martin Jansen", 46 | "role": "Helper" 47 | } 48 | ], 49 | "autoload": { 50 | "classmap": [ 51 | "./" 52 | ], 53 | "exclude-from-classmap": [ 54 | "/tests/" 55 | ] 56 | }, 57 | "include-path": [ 58 | "./" 59 | ], 60 | "description": "This is the definitive source of PEAR's core files.", 61 | "license": "BSD-2-Clause", 62 | "name": "pear/pear", 63 | "support": { 64 | "issues": "http://pear.php.net/bugs/search.php?cmd=display&package_name[]=PEAR", 65 | "source": "https://github.com/pear/PEAR" 66 | }, 67 | "type": "library", 68 | "require": { 69 | "php": ">=5.4", 70 | "ext-pcre": "*", 71 | "ext-xml": "*", 72 | "pear/archive_tar": "*", 73 | "pear/structures_graph": "*", 74 | "pear/console_getopt": "*", 75 | "pear/xml_util": "*" 76 | }, 77 | "suggest": { 78 | "pear/pear_frontend_gtk": "For GTK support", 79 | "pear/pear_frontend_web": "For Web support" 80 | }, 81 | "replace": { 82 | "pear/pear-core-minimal": "*", 83 | "pear/pear-exception": "*" 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /docs/rfc01_PEAR_pecl-binaries.txt: -------------------------------------------------------------------------------- 1 | Author: Tomas V.V.Cox 2 | Abstract: Open discussion on how to handle PECL binary packages 3 | 4 | 5 | pecl package name 6 | ----------------- 7 | 8 | The name of the extension would be: 9 | 10 | peclfoo-bin---3.1.2.tgz 11 | 12 | The os (Operating system) and arch (CPU type), would be the value 13 | returned by the OS_Guess class. 14 | 15 | package creation 16 | ---------------- 17 | 18 | pear package [-t ] 19 | 20 | -t The type of package you want to generate (pear, rpm, 21 | msi, src, etc) 22 | 23 | Without args it will package the extension as it does nowadays (the 24 | same as "-t src"). 25 | 26 | We have now native pear packages, rpm, msi is planned and others 27 | will surely come. Additionally of generating the native package description 28 | file, we could perhaps also call the tools for generating the whole package. 29 | 30 | An idea would be to create in addition a BUILDINFO.txt file with some data about 31 | the env where the extension was compiled at, like the 32 | php version, the php_uname(), the extra libs versions, os vendor 33 | version, pear version, etc. 34 | 35 | package.xml 36 | ----------- 37 | 38 | As a binary release shares the same release data with the source 39 | distrib, the same package.xml file could be used for all kind of 40 | distribs. Let's say something like: 41 | 42 | 43 | ... 44 | 45 | 46 | .. 47 | 48 | 49 | 50 | 51 | A package may contain many compiled extensions for different platforms, 52 | one single extension or the sources. 53 | 54 | 55 | Installation 56 | ------------ 57 | 58 | pear install -t bin peclfoo (download and install the binary distrib of 59 | peclfoo for your current OS-ARCH) 60 | 61 | pear install peclfoo (download, build and install peclfoo) 62 | 63 | All the files with role="ext" would be installed 64 | in "ext_dir" (pear cmd setting). The user can config it with "pear config-set ext_dir=XXX". 65 | If this var is not explicitly set, the following will be used for 66 | finding a default location: 67 | 68 | if (getenv('PHP_PEAR_EXTENSION_DIR')) { 69 | define('PEAR_CONFIG_DEFAULT_EXT_DIR', getenv('PHP_PEAR_EXTENSION_DIR')); 70 | } else { 71 | if (ini_get('extension_dir')) { 72 | define('PEAR_CONFIG_DEFAULT_EXT_DIR', ini_get('extension_dir')); 73 | } elseif (defined('PEAR_EXTENSION_DIR') && @is_dir(PEAR_EXTENSION_DIR)) { 74 | define('PEAR_CONFIG_DEFAULT_EXT_DIR', PEAR_EXTENSION_DIR); 75 | } elseif (defined('PHP_EXTENSION_DIR')) { 76 | define('PEAR_CONFIG_DEFAULT_EXT_DIR', PHP_EXTENSION_DIR); 77 | } else { 78 | define('PEAR_CONFIG_DEFAULT_EXT_DIR', '.'); 79 | } 80 | } 81 | 82 | Listing in the web 83 | ------------------ 84 | 85 | A new column "Type" should be added to the release listing under the 86 | package home page at pear.php.net, saying that the package is a binary 87 | distrib compiled for OS X and ARCH Y or sources. 88 | -------------------------------------------------------------------------------- /docs/rfc01_PEAR_subpackages.txt: -------------------------------------------------------------------------------- 1 | RFC: subpackages 2 | Sept. 17, 2003 3 | Greg Beaver 4 | 5 | The Problem: 6 | ------------ 7 | Many PEAR packages consist of a core and several ancillary self-contained program elements. Examples are: 8 | 9 | MDB/DB and database drivers 10 | Log and log classes 11 | Cache and Cache drivers 12 | phpDocumentor and Converters 13 | HTML_QuickForm and HTML_QuickForm_Controller 14 | 15 | In most cases, not all packages need be installed. The most common example of this is DB: how many people need to use every single database driver? Most of them just eat up disk space, except on multi-user installations. 16 | 17 | In addition, each ancillary program element may have a different stability level (sqlite driver may be beta quality, while the mysql driver is stable). Currently, this results in a contradiction: the core is stable, but one driver is not. What is the stability of the package? stable or beta? People who want to only install and use stable packages may be deceived by a package that is marked stable and contains an alpha-quality driver, for example. 18 | 19 | Plus, many PEAR packages are criticized for their bloat. 20 | 21 | The Solution: 22 | ------------- 23 | Subpackages will allow the solving of all of these problems. Note that subpackaging does not address other problems, such as bundling together related packages (PFC packages, for example, or packages needed for a framework that need not have any dependencies). Subpackages are a dependency relation. In other words, if Package Foo depends on Bar, Foo is not necessarily a subpackage of Bar, but might be. However, if Foo does not depend on Bar, Foo is definitively NOT a subpackage of Bar. 24 | 25 | In other words, subpackages by definition cannot function without the presence of the core package (DB drivers are pretty pointless without DB). 26 | 27 | Note that with the presence of subpackages, a subpackages can be released with a new version number without need to release a new version of the core, allowing rapid development on unstable subpackages, and slower development on stable components. 28 | 29 | How to differentiate a subpackage from a normal dependency: 30 | ----------------------------------------------------------- 31 | An addition should be made to the package.dtd file for package.xml files. A new dependency type, "spkg" should be used to define a subpackage dependency. This dependency type should be used by subpackages to definitively link to a parent package as a subpackage. 32 | 33 | example package Foo_Bar's package.xml dependency: 34 | 35 | Foo 36 | -or- 37 | Foo 38 | 39 | All rel values would be available including "not" if a particular version of the parent package must not be installed due to a bug affecting this particular subpackage (rare case). 40 | 41 | package Foo's package.xml dependencies may contain an optional dependency on the subpackage: 42 | 43 | Foo_Bar 44 | 45 | standard subpackages must be listed as optional dependencies in package.xml to allow easy installation with the --alldeps switch, but third party subpackages need not be listed as optional dependencies (if someone releases a custom DB driver or specialized phpDocumentor converter, for example, on their own website) 46 | 47 | Note that a required subpackage must be bundled as part of the core, and is not a subpackage - a subpackage MUST be an optional dependency. 48 | 49 | Naming/Path Conventions: 50 | ------------------------ 51 | Subpackages must reside in a subdirectory of the parent package, just as they would under normal circumstances as part of the package. Foo's subpackage Bar must be named Foo_Bar, and reside in Foo/Bar.php as per PEAR conventions. 52 | 53 | pear.php.net changes: 54 | --------------------- 55 | Subpackages would not be listed globally, but instead on the package page as optional components. 56 | 57 | Documentation for subpackages will reside as part of the main package's documentation. 58 | 59 | PEAR Installer changes: 60 | ----------------------- 61 | pear info/remote-info would list available subpackages (remote-info only) and installed subpackages (info only) 62 | 63 | pear list would list top-level packages, with some indication of packages that have subpackages (an asterisk or something). pear list PackageWithSubpackages would list subpackages as well 64 | 65 | pear uninstall PackageWithSubpackages would automatically uninstall any subpackages without requiring --force or other switches, as if they were simply a part of the main application. This is due to the fact that they would be simply a part of the package if PEAR didn't support subpackages. 66 | -------------------------------------------------------------------------------- /man1/pear.1: -------------------------------------------------------------------------------- 1 | .TH PEAR 1 "2013" "The PEAR Group" "User commands" 2 | .SH NAME 3 | pear, pecl, peardev \- PEAR installer 4 | 5 | .SH SYNOPSIS 6 | .B pear 7 | [ options ] command [command-options] 8 | .LP 9 | .B pecl 10 | [ options ] command [command-options] 11 | .LP 12 | .B peardev 13 | [ options ] command [command-options] 14 | .LP 15 | 16 | .SH DESCRIPTION 17 | \fBPEAR\fP is the PHP Extension and Application Repository, found at 18 | .B http://pear.php.net. 19 | .P 20 | .P 21 | The \fBpear\fP command is used to install PEAR extensions. 22 | .P 23 | The \fBpecl\fP command is used to install PECL extensions. 24 | .P 25 | The \fBpeardev\fP command is a wrapper for the \fBpear\fP command which 26 | removes the normal configured memory limit. 27 | 28 | .SH OPTIONS 29 | .TP 15 30 | .B \-v 31 | increase verbosity level (default 1) 32 | .TP 33 | .B \-q 34 | be quiet, decrease verbosity level 35 | .TP 36 | .B \-c \fIfile\fP 37 | find user configuration in \fBfile\fP 38 | .TP 39 | .B \-C \fIfile\fP 40 | find system configuration in \fBfile\fP 41 | .TP 42 | .B \-d \fIfoo=bar\fP 43 | set user config variable \fBfoo\fP to \fBbar\fP 44 | .TP 45 | .B \-D \fIfoo=bar\fP 46 | set system config variable \fBfoo\fP to \fBbar\fP 47 | .TP 48 | .B \-G 49 | start in graphical (Gtk) mode 50 | .TP 51 | .B \-S 52 | store system configuration 53 | .TP 54 | .B \-s 55 | store user configuration 56 | .TP 57 | .B \-y \fIfoo\fP 58 | unset 59 | .B foo 60 | in the user configuration 61 | .TP 62 | .B \-V 63 | version information 64 | .TP 65 | .PD 0 66 | .B \-h 67 | .TP 68 | .PD 1 69 | .B \-? 70 | display help/usage 71 | 72 | .SH COMMANDS 73 | .TP 15 74 | .B build 75 | Build an Extension From C Source 76 | .TP 77 | .B bundle 78 | Unpacks a Pecl Package 79 | .TP 80 | .B channel-add 81 | Add a Channel 82 | .TP 83 | .B channel-alias 84 | Specify an alias to a channel name 85 | .TP 86 | .B channel-delete 87 | Remove a Channel From the List 88 | .TP 89 | .B channel-discover 90 | Initialize a Channel from its server 91 | .TP 92 | .B channel-info 93 | Retrieve Information on a Channel 94 | .TP 95 | .TP 96 | .B channel-login 97 | Connects and authenticates to remote channel server 98 | .TP 99 | .B channel-logout 100 | Logs out from the remote channel server 101 | .TP 102 | .B channel-update 103 | Update an Existing Channel 104 | .TP 105 | .B clear-cache 106 | Clear Web Services Cache 107 | .TP 108 | .B config-create 109 | Create a Default configuration file 110 | .TP 111 | .B config-get 112 | Show One Setting 113 | .TP 114 | .B config-help 115 | Show Information About Setting 116 | .TP 117 | .B config-set 118 | Change Setting 119 | .TP 120 | .B config-show 121 | Show All Settings 122 | .TP 123 | .B convert 124 | Convert a package.xml 1.0 to package.xml 2.0 format 125 | .TP 126 | .B cvsdiff 127 | Run a "cvs diff" for all files in a package 128 | .TP 129 | .B cvstag 130 | Set CVS Release Tag 131 | .TP 132 | .B download 133 | Download Package 134 | .TP 135 | .B download-all 136 | Downloads each available package from the default channel 137 | .TP 138 | .B info 139 | Display information about a package 140 | .TP 141 | .B install 142 | Install Package 143 | .TP 144 | .B list 145 | List Installed Packages In The Default Channel 146 | .TP 147 | .B list-all 148 | List All Packages 149 | .TP 150 | .B list-channels 151 | List Available Channels 152 | .TP 153 | .B list-files 154 | List Files In Installed Package 155 | .TP 156 | .B list-upgrades 157 | List Available Upgrades 158 | .TP 159 | .B login 160 | Connects and authenticates to remote server [Deprecated in favor of channel-login] 161 | .TP 162 | .B logout 163 | Logs out from the remote server [Deprecated in favor of channel-logout] 164 | .TP 165 | .B make-rpm-spec 166 | Builds an RPM spec file from a PEAR package 167 | .TP 168 | .B makerpm 169 | Builds an RPM spec file from a PEAR package 170 | .TP 171 | .B package 172 | Build Package 173 | .TP 174 | .B package-dependencies 175 | Show package dependencies 176 | .TP 177 | .B package-validate 178 | Validate Package Consistency 179 | .TP 180 | .B pickle 181 | Build PECL Package 182 | .TP 183 | .B remote-info 184 | Information About Remote Packages 185 | .TP 186 | .B remote-list 187 | List Remote Packages 188 | .TP 189 | .B run-scripts 190 | Run Post-Install Scripts bundled with a package 191 | .TP 192 | .B run-tests 193 | Run Regression Tests 194 | .TP 195 | .B search 196 | Search remote package database 197 | .TP 198 | .B shell-test 199 | Shell Script Test 200 | .TP 201 | .B sign 202 | Sign a package distribution file 203 | .TP 204 | .B svntag 205 | Set SVN Release Tag 206 | .TP 207 | .B uninstall 208 | Un-install Package 209 | .TP 210 | .B update-channels 211 | Update the Channel List 212 | .TP 213 | .B upgrade 214 | Upgrade Package 215 | .TP 216 | .B upgrade-all 217 | Upgrade All Packages [Deprecated in favor of calling upgrade with no parameters] 218 | 219 | .SH FILES 220 | .TP 15 221 | .B /etc/pear.conf 222 | The system configuration file. 223 | .TP 224 | .B $HOME/.pearrc 225 | The user configuration. 226 | 227 | .SH SEE ALSO 228 | .TP 229 | To list all options, use 230 | .EX 231 | pear help options 232 | .EE 233 | .TP 234 | To list all command shortcuts, use 235 | .EX 236 | pear help shortcuts 237 | .EE 238 | .TP 239 | to get the help for the specified command, use 240 | .EX 241 | pear help \fIcommand\fP 242 | .EE 243 | .TP 244 | Documentation for PEAR can be found at 245 | .PD 0 246 | .P 247 | .B http://pear.php.net/manual/ 248 | 249 | .SH VERSION INFORMATION 250 | This manpage describes \fBPEAR\fP, version @package_version@. 251 | 252 | .SH COPYRIGHT 253 | Copyright \(co 1997\-2009 254 | Stig Bakken, 255 | Gregory Beaver, 256 | Helgi Þormar Þorbjörnsson, 257 | Tomas V.V.Cox, 258 | Martin Jansen. 259 | .P 260 | All rights reserved. 261 | .P 262 | Redistribution and use in source and binary forms, with or without 263 | modification, are permitted provided that the following conditions are met: 264 | .P 265 | * Redistributions of source code must retain the above copyright notice, 266 | this list of conditions and the following disclaimer. 267 | .P 268 | * Redistributions in binary form must reproduce the above copyright 269 | notice, this list of conditions and the following disclaimer in the 270 | documentation and/or other materials provided with the distribution. 271 | 272 | .SH BUGS 273 | You can view the list of known bugs or report any new bug you found at: 274 | .PD 0 275 | .P 276 | .B http://pear.php.net/bugs/ 277 | -------------------------------------------------------------------------------- /man1/peardev.1: -------------------------------------------------------------------------------- 1 | .so man1/pear.1 2 | 3 | -------------------------------------------------------------------------------- /man1/pecl.1: -------------------------------------------------------------------------------- 1 | .so man1/pear.1 2 | 3 | -------------------------------------------------------------------------------- /man5/pear.conf.5: -------------------------------------------------------------------------------- 1 | .TH PEAR.CONF 5 "2013" "File Formats" 2 | .SH NAME 3 | .B pear.conf 4 | \- configuration file for \fBPEAR\fR applications. 5 | 6 | .SH DESCRIPTION 7 | The \fBpear.conf\fP is used by \fBPEAR\fR applications 8 | to store their configuration. This file should not be edited. 9 | .P 10 | The \fBpear\fR command provides the \fBconfig-show\fR, \fBconfig-get\fR 11 | and \fBconfig-set\fR sub-commands needed to change the configuration. 12 | 13 | .SH FILES 14 | .TP 15 15 | .B /etc/pear.conf 16 | The system configuration file. 17 | .TP 18 | .B $HOME/.pearrc 19 | The user configuration file. 20 | 21 | .SH SEE ALSO 22 | .B pear(1) 23 | 24 | .SH COPYRIGHT 25 | .PD 0 26 | Copyright \(co 1997\-2009 27 | Stig Bakken, 28 | Gregory Beaver, 29 | Helgi Þormar Þorbjörnsson, 30 | Tomas V.V.Cox, 31 | Martin Jansen. 32 | .P 33 | All rights reserved. 34 | .P 35 | Redistribution and use in source and binary forms, with or without 36 | modification, are permitted provided that the following conditions are met: 37 | .P 38 | * Redistributions of source code must retain the above copyright notice, 39 | this list of conditions and the following disclaimer. 40 | .P 41 | * Redistributions in binary form must reproduce the above copyright 42 | notice, this list of conditions and the following disclaimer in the 43 | documentation and/or other materials provided with the distribution. 44 | 45 | .SH BUGS 46 | You can view the list of known bugs or report any new bug you found at: 47 | .PD 0 48 | .P 49 | .B http://pear.php.net/bugs/ 50 | 51 | -------------------------------------------------------------------------------- /package-ErrorStack.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | PEAR_ErrorStack 7 | pear.php.net 8 | Stack-based error handling/raising 9 | Advanced Error Handling 10 | 11 | 12 | Greg Beaver 13 | cellog 14 | cellog@php.net 15 | yes 16 | 17 | 2005-08-20 18 | 19 | 0.8.0 20 | 0.8.0 21 | 22 | 23 | beta 24 | beta 25 | 26 | PHP License 27 | 28 | Initial release separate from PEAR base package 29 | * fix Bug #5018: Notice due api changes in php5.1/php4.4 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 5.4.0 42 | 43 | 44 | 1.4.0a12 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 0.8.0 53 | 0.8.0 54 | 55 | 56 | beta 57 | beta 58 | 59 | 2005-05-11 60 | PHP License 61 | 62 | initial release separate from PEAR base package 63 | 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /package-manpages.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | PEAR_Manpages 7 | pear.php.net 8 | PEAR man pages 9 | 10 | Unix man pages for pear, pecl and peardev commands, and for pear.conf file. 11 | 12 | 13 | Remi Collet 14 | remicollet 15 | fedora@famillecollet.com 16 | no 17 | 18 | 19 | Christian Weiske 20 | cweiske 21 | cweiske@php.net 22 | yes 23 | 24 | 2015-10-07 25 | 26 | 1.10.0 27 | 1.10.0 28 | 29 | 30 | stable 31 | stable 32 | 33 | New BSD License 34 | 35 | No changes to 1.10.0dev2. 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 5.4.0 55 | 56 | 57 | 1.10.0dev2 58 | 59 | 60 | 61 | 62 | 63 | 64 | windows 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 2015-07-28 87 | 88 | 89 | 1.10.0dev2 90 | 1.10.0 91 | 92 | 93 | devel 94 | devel 95 | 96 | New BSD License 97 | 98 | Initial release 99 | 100 | 101 | 102 | 103 | 2015-10-07 104 | 105 | 1.10.0 106 | 1.10.0 107 | 108 | 109 | stable 110 | stable 111 | 112 | New BSD License 113 | 114 | No changes to 1.10.0dev2. 115 | 116 | 117 | 118 | 119 | 120 | -------------------------------------------------------------------------------- /package.dtd: -------------------------------------------------------------------------------- 1 | 23 | 24 | 25 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 68 | 69 | 70 | 71 | 72 | 75 | 76 | 77 | 80 | 81 | 82 | 83 | 86 | 87 | 88 | 96 | 97 | 98 | 101 | 102 | 103 | -------------------------------------------------------------------------------- /scripts/go-pear.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | set PHP_BIN=cli\php.exe 3 | %PHP_BIN% -d output_buffering=0 PEAR\go-pear.php %1 4 | pause -------------------------------------------------------------------------------- /scripts/pear.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | REM ---------------------------------------------------------------------- 4 | REM PHP version 5 5 | REM ---------------------------------------------------------------------- 6 | REM Copyright (c) 1997-2010 The Authors 7 | REM ---------------------------------------------------------------------- 8 | REM http://opensource.org/licenses/bsd-license.php New BSD License 9 | REM ---------------------------------------------------------------------- 10 | REM Authors: Alexander Merz (alexmerz@php.net) 11 | REM ---------------------------------------------------------------------- 12 | REM 13 | REM Last updated 12/29/2004 ($Id$ is not replaced if the file is binary) 14 | 15 | REM change this lines to match the paths of your system 16 | REM ------------------- 17 | 18 | 19 | REM Test to see if this is a raw pear.bat (uninstalled version) 20 | SET TMPTMPTMPTMPT=@includ 21 | SET PMTPMTPMT=%TMPTMPTMPTMPT%e_path@ 22 | FOR %%x IN ("@include_path@") DO (if %%x=="%PMTPMTPMT%" GOTO :NOTINSTALLED) 23 | 24 | REM Check PEAR global ENV, set them if they do not exist 25 | IF "%PHP_PEAR_INSTALL_DIR%"=="" SET "PHP_PEAR_INSTALL_DIR=@include_path@" 26 | IF "%PHP_PEAR_BIN_DIR%"=="" SET "PHP_PEAR_BIN_DIR=@bin_dir@" 27 | IF "%PHP_PEAR_PHP_BIN%"=="" SET "PHP_PEAR_PHP_BIN=@php_bin@" 28 | 29 | GOTO :INSTALLED 30 | 31 | :NOTINSTALLED 32 | ECHO WARNING: This is a raw, uninstalled pear.bat 33 | 34 | REM Check to see if we can grab the directory of this file (Windows NT+) 35 | IF %~n0 == pear ( 36 | FOR %%x IN (cli\php.exe php.exe) DO (if "%%~$PATH:x" NEQ "" ( 37 | SET "PHP_PEAR_PHP_BIN=%%~$PATH:x" 38 | echo Using PHP Executable "%PHP_PEAR_PHP_BIN%" 39 | "%PHP_PEAR_PHP_BIN%" -v 40 | GOTO :NEXTTEST 41 | )) 42 | GOTO :FAILAUTODETECT 43 | :NEXTTEST 44 | IF "%PHP_PEAR_PHP_BIN%" NEQ "" ( 45 | 46 | REM We can use this PHP to run a temporary php file to get the dirname of pear 47 | 48 | echo ^ > ~~getloc.php 49 | "%PHP_PEAR_PHP_BIN%" ~~getloc.php 50 | set /p PHP_PEAR_BIN_DIR=fakeprompt < ~a.a 51 | DEL ~a.a 52 | DEL ~~getloc.php 53 | set "PHP_PEAR_INSTALL_DIR=%PHP_PEAR_BIN_DIR%pear" 54 | 55 | REM Make sure there is a pearcmd.php at our disposal 56 | 57 | IF NOT EXIST %PHP_PEAR_INSTALL_DIR%\pearcmd.php ( 58 | IF EXIST %PHP_PEAR_INSTALL_DIR%\scripts\pearcmd.php COPY %PHP_PEAR_INSTALL_DIR%\scripts\pearcmd.php %PHP_PEAR_INSTALL_DIR%\pearcmd.php 59 | IF EXIST pearcmd.php COPY pearcmd.php %PHP_PEAR_INSTALL_DIR%\pearcmd.php 60 | IF EXIST %~dp0\scripts\pearcmd.php COPY %~dp0\scripts\pearcmd.php %PHP_PEAR_INSTALL_DIR%\pearcmd.php 61 | ) 62 | ) 63 | GOTO :INSTALLED 64 | ) ELSE ( 65 | REM Windows Me/98 cannot succeed, so allow the batch to fail 66 | ) 67 | :FAILAUTODETECT 68 | echo WARNING: failed to auto-detect pear information 69 | :INSTALLED 70 | 71 | REM Check Folders and files 72 | IF NOT EXIST "%PHP_PEAR_INSTALL_DIR%" GOTO PEAR_INSTALL_ERROR 73 | IF NOT EXIST "%PHP_PEAR_INSTALL_DIR%\pearcmd.php" GOTO PEAR_INSTALL_ERROR2 74 | IF NOT EXIST "%PHP_PEAR_BIN_DIR%" GOTO PEAR_BIN_ERROR 75 | IF NOT EXIST "%PHP_PEAR_PHP_BIN%" GOTO PEAR_PHPBIN_ERROR 76 | 77 | REM launch pearcmd 78 | GOTO RUN 79 | :PEAR_INSTALL_ERROR 80 | ECHO PHP_PEAR_INSTALL_DIR is not set correctly. 81 | ECHO Please fix it using your environment variable or modify 82 | ECHO the default value in pear.bat 83 | ECHO The current value is: 84 | ECHO %PHP_PEAR_INSTALL_DIR% 85 | GOTO END 86 | :PEAR_INSTALL_ERROR2 87 | ECHO PHP_PEAR_INSTALL_DIR is not set correctly. 88 | ECHO pearcmd.php could not be found there. 89 | ECHO Please fix it using your environment variable or modify 90 | ECHO the default value in pear.bat 91 | ECHO The current value is: 92 | ECHO %PHP_PEAR_INSTALL_DIR% 93 | GOTO END 94 | :PEAR_BIN_ERROR 95 | ECHO PHP_PEAR_BIN_DIR is not set correctly. 96 | ECHO Please fix it using your environment variable or modify 97 | ECHO the default value in pear.bat 98 | ECHO The current value is: 99 | ECHO %PHP_PEAR_BIN_DIR% 100 | GOTO END 101 | :PEAR_PHPBIN_ERROR 102 | ECHO PHP_PEAR_PHP_BIN is not set correctly. 103 | ECHO Please fix it using your environment variable or modify 104 | ECHO the default value in pear.bat 105 | ECHO The current value is: 106 | ECHO %PHP_PEAR_PHP_BIN% 107 | GOTO END 108 | :RUN 109 | "%PHP_PEAR_PHP_BIN%" -C -d date.timezone=UTC -d output_buffering=1 -d safe_mode=0 -d open_basedir="" -d auto_prepend_file="" -d auto_append_file="" -d variables_order=EGPCS -d register_argc_argv="On" -d "include_path='%PHP_PEAR_INSTALL_DIR%'" -f "%PHP_PEAR_INSTALL_DIR%\pearcmd.php" -- %1 %2 %3 %4 %5 %6 %7 %8 %9 110 | :END 111 | @ECHO ON -------------------------------------------------------------------------------- /scripts/pear.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # first find which PHP binary to use 4 | if test "x$PHP_PEAR_PHP_BIN" != "x"; then 5 | PHP="$PHP_PEAR_PHP_BIN" 6 | else 7 | if test "@php_bin@" = '@'php_bin'@'; then 8 | PHP=php 9 | else 10 | PHP="@php_bin@" 11 | fi 12 | fi 13 | 14 | # then look for the right pear include dir 15 | if test "x$PHP_PEAR_INSTALL_DIR" != "x"; then 16 | INCDIR=$PHP_PEAR_INSTALL_DIR 17 | INCARG="-d include_path=$PHP_PEAR_INSTALL_DIR" 18 | else 19 | if test "@php_dir@" = '@'php_dir'@'; then 20 | INCDIR=`dirname $0` 21 | INCARG="" 22 | else 23 | INCDIR="@php_dir@" 24 | INCARG="-d include_path=@php_dir@" 25 | fi 26 | fi 27 | 28 | exec $PHP -C -q $INCARG -d date.timezone=UTC -d output_buffering=1 -d variables_order=EGPCS -d open_basedir="" -d safe_mode=0 -d register_argc_argv="On" -d auto_prepend_file="" -d auto_append_file="" $INCDIR/pearcmd.php "$@" 29 | -------------------------------------------------------------------------------- /scripts/peardev.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | REM ---------------------------------------------------------------------- 4 | REM PHP version 5 5 | REM ---------------------------------------------------------------------- 6 | REM Copyright (c) 1997-2004 The PHP Group 7 | REM ---------------------------------------------------------------------- 8 | REM This source file is subject to the New BSD License, 9 | REM that is bundled with this package in the file LICENSE, and is 10 | REM available at through the world-wide-web at 11 | REM http://opensource.org/licenses/bsd-license.php. 12 | REM If you did not receive a copy of the New BSD License and are unable to 13 | REM obtain it through the world-wide-web, please send a note to 14 | REM license@php.net so we can mail you a copy immediately. 15 | REM ---------------------------------------------------------------------- 16 | REM Authors: Alexander Merz (alexmerz@php.net) 17 | REM ---------------------------------------------------------------------- 18 | REM 19 | 20 | REM change this lines to match the paths of your system 21 | REM ------------------- 22 | 23 | 24 | REM Test to see if this is a raw pear.bat (uninstalled version) 25 | SET TMPTMPTMPTMPT=@includ 26 | SET PMTPMTPMT=%TMPTMPTMPTMPT%e_path@ 27 | FOR %%x IN ("@include_path@") DO (if %%x=="%PMTPMTPMT%" GOTO :NOTINSTALLED) 28 | 29 | REM Check PEAR global ENV, set them if they do not exist 30 | IF "%PHP_PEAR_INSTALL_DIR%"=="" SET "PHP_PEAR_INSTALL_DIR=@include_path@" 31 | IF "%PHP_PEAR_BIN_DIR%"=="" SET "PHP_PEAR_BIN_DIR=@bin_dir@" 32 | IF "%PHP_PEAR_PHP_BIN%"=="" SET "PHP_PEAR_PHP_BIN=@php_bin@" 33 | GOTO :INSTALLED 34 | 35 | :NOTINSTALLED 36 | ECHO WARNING: This is a raw, uninstalled pear.bat 37 | 38 | REM Check to see if we can grab the directory of this file (Windows NT+) 39 | IF %~n0 == pear ( 40 | FOR %%x IN (cli\php.exe php.exe) DO (if "%%~$PATH:x" NEQ "" ( 41 | SET "PHP_PEAR_PHP_BIN=%%~$PATH:x" 42 | echo Using PHP Executable "%PHP_PEAR_PHP_BIN%" 43 | "%PHP_PEAR_PHP_BIN%" -v 44 | GOTO :NEXTTEST 45 | )) 46 | GOTO :FAILAUTODETECT 47 | :NEXTTEST 48 | IF "%PHP_PEAR_PHP_BIN%" NEQ "" ( 49 | 50 | REM We can use this PHP to run a temporary php file to get the dirname of pear 51 | 52 | echo ^ > ~~getloc.php 53 | "%PHP_PEAR_PHP_BIN%" ~~getloc.php 54 | set /p PHP_PEAR_BIN_DIR=fakeprompt < ~a.a 55 | DEL ~a.a 56 | DEL ~~getloc.php 57 | set "PHP_PEAR_INSTALL_DIR=%PHP_PEAR_BIN_DIR%pear" 58 | 59 | REM Make sure there is a pearcmd.php at our disposal 60 | 61 | IF NOT EXIST %PHP_PEAR_INSTALL_DIR%\pearcmd.php ( 62 | IF EXIST %PHP_PEAR_INSTALL_DIR%\scripts\pearcmd.php COPY %PHP_PEAR_INSTALL_DIR%\scripts\pearcmd.php %PHP_PEAR_INSTALL_DIR%\pearcmd.php 63 | IF EXIST pearcmd.php COPY pearcmd.php %PHP_PEAR_INSTALL_DIR%\pearcmd.php 64 | IF EXIST %~dp0\scripts\pearcmd.php COPY %~dp0\scripts\pearcmd.php %PHP_PEAR_INSTALL_DIR%\pearcmd.php 65 | ) 66 | ) 67 | GOTO :INSTALLED 68 | ) ELSE ( 69 | REM Windows Me/98 cannot succeed, so allow the batch to fail 70 | ) 71 | :FAILAUTODETECT 72 | echo WARNING: failed to auto-detect pear information 73 | :INSTALLED 74 | 75 | REM Check Folders and files 76 | IF NOT EXIST "%PHP_PEAR_INSTALL_DIR%" GOTO PEAR_INSTALL_ERROR 77 | IF NOT EXIST "%PHP_PEAR_INSTALL_DIR%\pearcmd.php" GOTO PEAR_INSTALL_ERROR2 78 | IF NOT EXIST "%PHP_PEAR_BIN_DIR%" GOTO PEAR_BIN_ERROR 79 | IF NOT EXIST "%PHP_PEAR_PHP_BIN%" GOTO PEAR_PHPBIN_ERROR 80 | REM launch pearcmd 81 | GOTO RUN 82 | :PEAR_INSTALL_ERROR 83 | ECHO PHP_PEAR_INSTALL_DIR is not set correctly. 84 | ECHO Please fix it using your environment variable or modify 85 | ECHO the default value in pear.bat 86 | ECHO The current value is: 87 | ECHO %PHP_PEAR_INSTALL_DIR% 88 | GOTO END 89 | :PEAR_INSTALL_ERROR2 90 | ECHO PHP_PEAR_INSTALL_DIR is not set correctly. 91 | ECHO pearcmd.php could not be found there. 92 | ECHO Please fix it using your environment variable or modify 93 | ECHO the default value in pear.bat 94 | ECHO The current value is: 95 | ECHO %PHP_PEAR_INSTALL_DIR% 96 | GOTO END 97 | :PEAR_BIN_ERROR 98 | ECHO PHP_PEAR_BIN_DIR is not set correctly. 99 | ECHO Please fix it using your environment variable or modify 100 | ECHO the default value in pear.bat 101 | ECHO The current value is: 102 | ECHO %PHP_PEAR_BIN_DIR% 103 | GOTO END 104 | :PEAR_PHPBIN_ERROR 105 | ECHO PHP_PEAR_PHP_BIN is not set correctly. 106 | ECHO Please fix it using your environment variable or modify 107 | ECHO the default value in pear.bat 108 | ECHO The current value is: 109 | ECHO %PHP_PEAR_PHP_BIN% 110 | GOTO END 111 | :RUN 112 | "%PHP_PEAR_PHP_BIN%" -C -d date.timezone=UTC -d memory_limit="-1" -d safe_mode=0 -d register_argc_argv="On" -d auto_prepend_file="" -d auto_append_file="" -d variables_order=EGPCS -d open_basedir="" -d output_buffering=1 -d "include_path='%PHP_PEAR_INSTALL_DIR%'" -f "%PHP_PEAR_INSTALL_DIR%\pearcmd.php" -- %1 %2 %3 %4 %5 %6 %7 %8 %9 113 | :END 114 | @ECHO ON 115 | -------------------------------------------------------------------------------- /scripts/peardev.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # first find which PHP binary to use 4 | if test "x$PHP_PEAR_PHP_BIN" != "x"; then 5 | PHP="$PHP_PEAR_PHP_BIN" 6 | else 7 | if test "@php_bin@" = '@'php_bin'@'; then 8 | PHP=php 9 | else 10 | PHP="@php_bin@" 11 | fi 12 | fi 13 | 14 | # then look for the right pear include dir 15 | if test "x$PHP_PEAR_INSTALL_DIR" != "x"; then 16 | INCDIR=$PHP_PEAR_INSTALL_DIR 17 | INCARG="-d include_path=$PHP_PEAR_INSTALL_DIR" 18 | else 19 | if test "@php_dir@" = '@'php_dir'@'; then 20 | INCDIR=`dirname $0` 21 | INCARG="" 22 | else 23 | INCDIR="@php_dir@" 24 | INCARG="-d include_path=@php_dir@" 25 | fi 26 | fi 27 | 28 | exec $PHP -d date.timezone=UTC -d memory_limit="-1" -C -q $INCARG -d output_buffering=1 -d open_basedir="" -d safe_mode=0 -d register_argc_argv="On" -d auto_prepend_file="" -d variables_order=EGPCS -d auto_append_file="" $INCDIR/pearcmd.php "$@" 29 | -------------------------------------------------------------------------------- /scripts/pecl.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | REM ---------------------------------------------------------------------- 4 | REM PHP version 5 5 | REM ---------------------------------------------------------------------- 6 | REM Copyright (c) 1997-2004 The PHP Group 7 | REM ---------------------------------------------------------------------- 8 | REM This source file is subject to the New BSD License, 9 | REM that is bundled with this package in the file LICENSE, and is 10 | REM available at through the world-wide-web at 11 | REM http://opensource.org/licenses/bsd-license.php. 12 | REM If you did not receive a copy of the New BSD License and are unable to 13 | REM obtain it through the world-wide-web, please send a note to 14 | REM license@php.net so we can mail you a copy immediately. 15 | REM ---------------------------------------------------------------------- 16 | REM Authors: Alexander Merz (alexmerz@php.net) 17 | REM ---------------------------------------------------------------------- 18 | REM 19 | 20 | REM change this lines to match the paths of your system 21 | REM ------------------- 22 | 23 | 24 | REM Test to see if this is a raw pear.bat (uninstalled version) 25 | SET TMPTMPTMPTMPT=@includ 26 | SET PMTPMTPMT=%TMPTMPTMPTMPT%e_path@ 27 | FOR %%x IN ("@include_path@") DO (if %%x=="%PMTPMTPMT%" GOTO :NOTINSTALLED) 28 | 29 | REM Check PEAR global ENV, set them if they do not exist 30 | IF "%PHP_PEAR_INSTALL_DIR%"=="" SET "PHP_PEAR_INSTALL_DIR=@include_path@" 31 | IF "%PHP_PEAR_BIN_DIR%"=="" SET "PHP_PEAR_BIN_DIR=@bin_dir@" 32 | IF "%PHP_PEAR_PHP_BIN%"=="" SET "PHP_PEAR_PHP_BIN=@php_bin@" 33 | GOTO :INSTALLED 34 | 35 | :NOTINSTALLED 36 | ECHO WARNING: This is a raw, uninstalled pear.bat 37 | 38 | REM Check to see if we can grab the directory of this file (Windows NT+) 39 | IF %~n0 == pear ( 40 | FOR %%x IN (cli\php.exe php.exe) DO (if "%%~$PATH:x" NEQ "" ( 41 | SET "PHP_PEAR_PHP_BIN=%%~$PATH:x" 42 | echo Using PHP Executable "%PHP_PEAR_PHP_BIN%" 43 | "%PHP_PEAR_PHP_BIN%" -v 44 | GOTO :NEXTTEST 45 | )) 46 | GOTO :FAILAUTODETECT 47 | :NEXTTEST 48 | IF "%PHP_PEAR_PHP_BIN%" NEQ "" ( 49 | 50 | REM We can use this PHP to run a temporary php file to get the dirname of pear 51 | 52 | echo ^ > ~~getloc.php 53 | "%PHP_PEAR_PHP_BIN%" ~~getloc.php 54 | set /p PHP_PEAR_BIN_DIR=fakeprompt < ~a.a 55 | DEL ~a.a 56 | DEL ~~getloc.php 57 | set "PHP_PEAR_INSTALL_DIR=%PHP_PEAR_BIN_DIR%pear" 58 | 59 | REM Make sure there is a pearcmd.php at our disposal 60 | 61 | IF NOT EXIST %PHP_PEAR_INSTALL_DIR%\pearcmd.php ( 62 | IF EXIST %PHP_PEAR_INSTALL_DIR%\scripts\pearcmd.php COPY %PHP_PEAR_INSTALL_DIR%\scripts\pearcmd.php %PHP_PEAR_INSTALL_DIR%\pearcmd.php 63 | IF EXIST pearcmd.php COPY pearcmd.php %PHP_PEAR_INSTALL_DIR%\pearcmd.php 64 | IF EXIST %~dp0\scripts\pearcmd.php COPY %~dp0\scripts\pearcmd.php %PHP_PEAR_INSTALL_DIR%\pearcmd.php 65 | ) 66 | ) 67 | GOTO :INSTALLED 68 | ) ELSE ( 69 | REM Windows Me/98 cannot succeed, so allow the batch to fail 70 | ) 71 | :FAILAUTODETECT 72 | echo WARNING: failed to auto-detect pear information 73 | :INSTALLED 74 | 75 | REM Check Folders and files 76 | IF NOT EXIST "%PHP_PEAR_INSTALL_DIR%" GOTO PEAR_INSTALL_ERROR 77 | IF NOT EXIST "%PHP_PEAR_INSTALL_DIR%\pearcmd.php" GOTO PEAR_INSTALL_ERROR2 78 | IF NOT EXIST "%PHP_PEAR_BIN_DIR%" GOTO PEAR_BIN_ERROR 79 | IF NOT EXIST "%PHP_PEAR_PHP_BIN%" GOTO PEAR_PHPBIN_ERROR 80 | REM launch pearcmd 81 | GOTO RUN 82 | :PEAR_INSTALL_ERROR 83 | ECHO PHP_PEAR_INSTALL_DIR is not set correctly. 84 | ECHO Please fix it using your environment variable or modify 85 | ECHO the default value in pear.bat 86 | ECHO The current value is: 87 | ECHO %PHP_PEAR_INSTALL_DIR% 88 | GOTO END 89 | :PEAR_INSTALL_ERROR2 90 | ECHO PHP_PEAR_INSTALL_DIR is not set correctly. 91 | ECHO pearcmd.php could not be found there. 92 | ECHO Please fix it using your environment variable or modify 93 | ECHO the default value in pear.bat 94 | ECHO The current value is: 95 | ECHO %PHP_PEAR_INSTALL_DIR% 96 | GOTO END 97 | :PEAR_BIN_ERROR 98 | ECHO PHP_PEAR_BIN_DIR is not set correctly. 99 | ECHO Please fix it using your environment variable or modify 100 | ECHO the default value in pear.bat 101 | ECHO The current value is: 102 | ECHO %PHP_PEAR_BIN_DIR% 103 | GOTO END 104 | :PEAR_PHPBIN_ERROR 105 | ECHO PHP_PEAR_PHP_BIN is not set correctly. 106 | ECHO Please fix it using your environment variable or modify 107 | ECHO the default value in pear.bat 108 | ECHO The current value is: 109 | ECHO %PHP_PEAR_PHP_BIN% 110 | GOTO END 111 | :RUN 112 | "%PHP_PEAR_PHP_BIN%" -C -d date.timezone=UTC -d output_buffering=1 -d safe_mode=0 -d "include_path='%PHP_PEAR_INSTALL_DIR%'" -d register_argc_argv="On" -d variables_order=EGPCS -f "%PHP_PEAR_INSTALL_DIR%\peclcmd.php" -- %1 %2 %3 %4 %5 %6 %7 %8 %9 113 | :END 114 | @ECHO ON 115 | -------------------------------------------------------------------------------- /scripts/pecl.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # first find which PHP binary to use 4 | if test "x$PHP_PEAR_PHP_BIN" != "x"; then 5 | PHP="$PHP_PEAR_PHP_BIN" 6 | else 7 | if test "@php_bin@" = '@'php_bin'@'; then 8 | PHP=php 9 | else 10 | PHP="@php_bin@" 11 | fi 12 | fi 13 | 14 | # then look for the right pear include dir 15 | if test "x$PHP_PEAR_INSTALL_DIR" != "x"; then 16 | INCDIR=$PHP_PEAR_INSTALL_DIR 17 | INCARG="-d include_path=$PHP_PEAR_INSTALL_DIR" 18 | else 19 | if test "@php_dir@" = '@'php_dir'@'; then 20 | INCDIR=`dirname $0` 21 | INCARG="" 22 | else 23 | INCDIR="@php_dir@" 24 | INCARG="-d include_path=@php_dir@" 25 | fi 26 | fi 27 | 28 | exec $PHP -C -q $INCARG -d date.timezone=UTC -d output_buffering=1 -d variables_order=EGPCS -d safe_mode=0 -d register_argc_argv="On" $INCDIR/peclcmd.php "$@" 29 | -------------------------------------------------------------------------------- /scripts/peclcmd.php: -------------------------------------------------------------------------------- 1 | 12 | * @author Tomas V.V.Cox 13 | * @copyright 1997-2009 The Authors 14 | * @license http://opensource.org/licenses/bsd-license.php New BSD License 15 | * @link http://pear.php.net/package/PEAR 16 | */ 17 | 18 | /** 19 | * @nodep Gtk 20 | */ 21 | //the space is needed for windows include paths with trailing backslash 22 | // http://pear.php.net/bugs/bug.php?id=19482 23 | if ('@include_path@ ' != '@'.'include_path'.'@ ') { 24 | ini_set('include_path', trim('@include_path@ '). PATH_SEPARATOR . get_include_path()); 25 | $raw = false; 26 | } else { 27 | // this is a raw, uninstalled pear, either a cvs checkout, or php distro 28 | ini_set('include_path', __DIR__ . PATH_SEPARATOR . get_include_path()); 29 | $raw = true; 30 | } 31 | define('PEAR_RUNTYPE', 'pecl'); 32 | require_once 'pearcmd.php'; 33 | /* 34 | * Local variables: 35 | * tab-width: 4 36 | * c-basic-offset: 4 37 | * indent-tabs-mode: nil 38 | * mode: php 39 | * End: 40 | */ 41 | // vim600:syn=php 42 | 43 | ?> 44 | -------------------------------------------------------------------------------- /template.spec: -------------------------------------------------------------------------------- 1 | Summary: PEAR: @summary@ 2 | Name: @rpm_package@ 3 | Version: @version@ 4 | Release: 1 5 | License: @release_license@ 6 | Group: Development/Libraries 7 | Source: http://@master_server@/get/@package@-%{version}.tgz 8 | BuildRoot: %{_tmppath}/%{name}-root 9 | URL: http://@master_server@/package/@package@ 10 | Prefix: %{_prefix} 11 | BuildArchitectures: @arch@ 12 | @extra_headers@ 13 | 14 | %description 15 | @description@ 16 | 17 | %prep 18 | rm -rf %{buildroot}/* 19 | %setup -c -T 20 | # XXX Source files location is missing here in pear cmd 21 | pear -v -c %{buildroot}/pearrc \ 22 | -d php_dir=%{_libdir}/php/pear \ 23 | -d doc_dir=/docs \ 24 | -d bin_dir=%{_bindir} \ 25 | -d data_dir=%{_libdir}/php/pear/data \ 26 | -d test_dir=%{_libdir}/php/pear/tests \ 27 | -d ext_dir=%{_libdir} \@extra_config@ 28 | -s 29 | 30 | %build 31 | echo BuildRoot=%{buildroot} 32 | 33 | %postun 34 | # if refcount = 0 then package has been removed (not upgraded) 35 | if [ "$1" -eq "0" ]; then 36 | pear uninstall --nodeps -r @possible_channel@@package@ 37 | rm @rpm_xml_dir@/@package@.xml 38 | fi 39 | 40 | 41 | %post 42 | # if refcount = 2 then package has been upgraded 43 | if [ "$1" -ge "2" ]; then 44 | pear upgrade --nodeps -r @rpm_xml_dir@/@package@.xml 45 | else 46 | pear install --nodeps -r @rpm_xml_dir@/@package@.xml 47 | fi 48 | 49 | %install 50 | pear -c %{buildroot}/pearrc install --nodeps -R %{buildroot} \ 51 | $RPM_SOURCE_DIR/@package@-%{version}.tgz 52 | rm %{buildroot}/pearrc 53 | rm %{buildroot}/%{_libdir}/php/pear/.filemap 54 | rm %{buildroot}/%{_libdir}/php/pear/.lock 55 | rm -rf %{buildroot}/%{_libdir}/php/pear/.registry 56 | if [ "@doc_files@" != "" ]; then 57 | mv %{buildroot}/docs/@package@/* . 58 | rm -rf %{buildroot}/docs 59 | fi 60 | mkdir -p %{buildroot}@rpm_xml_dir@ 61 | tar -xzf $RPM_SOURCE_DIR/@package@-%{version}.tgz package@package2xml@.xml 62 | cp -p package@package2xml@.xml %{buildroot}@rpm_xml_dir@/@package@.xml 63 | 64 | #rm -rf %{buildroot}/* 65 | #pear -q install -R %{buildroot} -n package@package2xml@.xml 66 | #mkdir -p %{buildroot}@rpm_xml_dir@ 67 | #cp -p package@package2xml@.xml %{buildroot}@rpm_xml_dir@/@package@.xml 68 | 69 | %files 70 | %defattr(-,root,root) 71 | %doc @doc_files@ 72 | / 73 | -------------------------------------------------------------------------------- /test-modified.php: -------------------------------------------------------------------------------- 1 | getModifiedTests(); 109 | if (!$force && !count($modified)) { 110 | echo "No changes to coverage needed. Bye!\n"; 111 | exit; 112 | } 113 | 114 | if (!count($modified) && $force) { 115 | goto norunnie; 116 | } 117 | 118 | chdir($testpath); 119 | $e = error_reporting(); 120 | error_reporting(0); 121 | $test->doRunTests('run-tests', array('coverage' => true), $modified); 122 | error_reporting($e); 123 | chdir($olddir); 124 | if (!$force && file_exists($testpath . '/run-tests.log')) { 125 | // tests failed 126 | echo "Tests failed - not regenerating coverage data\n"; 127 | exit; 128 | } 129 | norunnie: 130 | $a = new Aggregator($testpath, 131 | $codepath, 132 | $testpath . '/pear2coverage.db'); 133 | if ($norender) { 134 | exit; 135 | } 136 | 137 | if (file_exists(__DIR__ . '/coverage')) { 138 | echo "Removing old coverage HTML..."; 139 | foreach (new \DirectoryIterator(__DIR__ . '/coverage') as $file) { 140 | if ($file->isDot()) continue; 141 | unlink($file->getPathName()); 142 | } 143 | echo "done\n"; 144 | } else { 145 | mkdir(__DIR__ . '/coverage'); 146 | } 147 | 148 | echo "Rendering\n"; 149 | $a->render(__DIR__ . '/coverage'); 150 | echo "Done rendering\n"; 151 | } 152 | ?> 153 | --------------------------------------------------------------------------------