Subversion Repositories Applications.gtt

Compare Revisions

Ignore whitespace Rev 186 → Rev 187

/trunk/bibliotheque/pear/PEAR/PackageFile/v2.php
4,18 → 4,11
*
* PHP versions 4 and 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_0.txt. If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to license@php.net so we can mail you a copy immediately.
*
* @category pear
* @package PEAR
* @author Greg Beaver <cellog@php.net>
* @copyright 1997-2006 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id: v2.php,v 1.136 2007/02/20 00:16:12 cellog Exp $
* @copyright 1997-2009 The Authors
* @license http://opensource.org/licenses/bsd-license.php New BSD License
* @link http://pear.php.net/package/PEAR
* @since File available since Release 1.4.0a1
*/
27,9 → 20,9
* @category pear
* @package PEAR
* @author Greg Beaver <cellog@php.net>
* @copyright 1997-2006 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 1.5.1
* @copyright 1997-2009 The Authors
* @license http://opensource.org/licenses/bsd-license.php New BSD License
* @version Release: 1.10.1
* @link http://pear.php.net/package/PEAR
* @since Class available since Release 1.4.0a1
*/
121,7 → 114,7
*
* - package name
* - channel name
* - dependencies
* - dependencies
* @var boolean
* @access private
*/
135,7 → 128,7
/**
* The constructor merely sets up the private error stack
*/
function PEAR_PackageFile_v2()
function __construct()
{
$this->_stack = new PEAR_ErrorStack('PEAR_PackageFile_v2', false, null);
$this->_isValid = false;
142,6 → 135,15
}
 
/**
* PHP 4 style constructor for backwards compatibility.
* Used by PEAR_PackageFileManager2
*/
public function PEAR_PackageFile_v2()
{
$this->__construct();
}
 
/**
* To make unit-testing easier
* @param PEAR_Frontend_*
* @param array options
151,7 → 153,7
*/
function &getPEARDownloader(&$i, $o, &$c)
{
$z = &new PEAR_Downloader($i, $o, $c);
$z = new PEAR_Downloader($i, $o, $c);
return $z;
}
 
169,7 → 171,7
if (!class_exists('PEAR_Dependency2')) {
require_once 'PEAR/Dependency2.php';
}
$z = &new PEAR_Dependency2($c, $o, $p, $s);
$z = new PEAR_Dependency2($c, $o, $p, $s);
return $z;
}
 
473,6 → 475,9
*/
function setRawState($state)
{
if (!isset($this->_packageInfo['stability'])) {
$this->_packageInfo['stability'] = array();
}
$this->_packageInfo['stability']['release'] = $state;
}
 
567,7 → 572,7
$atts = $filelist[$name];
foreach ($tasks as $tag => $raw) {
$task = $this->getTask($tag);
$task = &new $task($this->_config, $common, PEAR_TASK_INSTALL);
$task = new $task($this->_config, $common, PEAR_TASK_INSTALL);
if ($task->isScript()) {
$ret[] = $filelist[$name]['installed_as'];
}
613,7 → 618,7
$atts = $filelist[$name];
foreach ($tasks as $tag => $raw) {
$taskname = $this->getTask($tag);
$task = &new $taskname($this->_config, $common, PEAR_TASK_INSTALL);
$task = new $taskname($this->_config, $common, PEAR_TASK_INSTALL);
if (!$task->isScript()) {
continue; // scripts are only handled after installation
}
802,6 → 807,10
{
unset($pinfo['old']);
unset($pinfo['xsdversion']);
// If the changelog isn't an array then it was passed in as an empty tag
if (isset($pinfo['changelog']) && !is_array($pinfo['changelog'])) {
unset($pinfo['changelog']);
}
$this->_incomplete = false;
$this->_packageInfo = $pinfo;
}
1169,10 → 1178,16
$this->flattenFilelist();
if ($contents = $this->getContents()) {
$ret = array();
if (!isset($contents['dir'])) {
return false;
}
if (!isset($contents['dir']['file'][0])) {
$contents['dir']['file'] = array($contents['dir']['file']);
}
foreach ($contents['dir']['file'] as $file) {
if (!isset($file['attribs']['name'])) {
continue;
}
$name = $file['attribs']['name'];
if (!$preserve) {
$file = $file['attribs'];
1197,19 → 1212,24
if ($this->getPackageType() != 'extsrc' && $this->getPackageType() != 'zendextsrc') {
return false;
}
 
$releases = $this->getReleases();
if (isset($releases[0])) {
$releases = $releases[0];
}
 
if (isset($releases['configureoption'])) {
if (!isset($releases['configureoption'][0])) {
$releases['configureoption'] = array($releases['configureoption']);
}
 
for ($i = 0; $i < count($releases['configureoption']); $i++) {
$releases['configureoption'][$i] = $releases['configureoption'][$i]['attribs'];
}
 
return $releases['configureoption'];
}
 
return false;
}
 
1563,7 → 1583,7
if (strtolower($dep['name']) == strtolower($package) &&
$depchannel == $channel) {
return true;
}
}
}
}
}
1581,7 → 1601,7
if (strtolower($dep['name']) == strtolower($package) &&
$depchannel == $channel) {
return true;
}
}
}
}
}
1641,7 → 1661,8
);
foreach (array('required', 'optional') as $type) {
$optional = ($type == 'optional') ? 'yes' : 'no';
if (!isset($this->_packageInfo['dependencies'][$type])) {
if (!isset($this->_packageInfo['dependencies'][$type])
|| empty($this->_packageInfo['dependencies'][$type])) {
continue;
}
foreach ($this->_packageInfo['dependencies'][$type] as $dtype => $deps) {
1844,7 → 1865,7
return implode('', file($file));
}
} else { // tgz
$tar = &new Archive_Tar($this->_archiveFile);
$tar = new Archive_Tar($this->_archiveFile);
$tar->pushErrorHandling(PEAR_ERROR_RETURN);
if ($file != 'package.xml' && $file != 'package2.xml') {
$file = $this->getPackage() . '-' . $this->getVersion() . '/' . $file;
1883,7 → 1904,7
if (!class_exists('PEAR_PackageFile_Generator_v2')) {
require_once 'PEAR/PackageFile/Generator/v2.php';
}
$a = &new PEAR_PackageFile_Generator_v2($this);
$a = new PEAR_PackageFile_Generator_v2($this);
return $a;
}
 
1947,17 → 1968,17
$this->getTasksNs();
// transform all '-' to '/' and 'tasks:' to '' so tasks:replace becomes replace
$task = str_replace(array($this->_tasksNs . ':', '-'), array('', ' '), $task);
$task = str_replace(' ', '/', ucwords($task));
$ps = (strtolower(substr(PHP_OS, 0, 3)) == 'win') ? ';' : ':';
foreach (explode($ps, ini_get('include_path')) as $path) {
if (file_exists($path . "/PEAR/Task/$task.php")) {
include_once "PEAR/Task/$task.php";
$task = str_replace('/', '_', $task);
if (class_exists("PEAR_Task_$task")) {
return "PEAR_Task_$task";
}
}
$taskfile = str_replace(' ', '/', ucwords($task));
$task = str_replace(array(' ', '/'), '_', ucwords($task));
if (class_exists("PEAR_Task_$task")) {
return "PEAR_Task_$task";
}
$fp = @fopen("PEAR/Task/$taskfile.php", 'r', true);
if ($fp) {
fclose($fp);
require_once "PEAR/Task/$taskfile.php";
return "PEAR_Task_$task";
}
return false;
}