Bearsampp 2026.9.23
Loading...
Searching...
No Matches
PEAR_PackageFile_v2 Class Reference
Inheritance diagram for PEAR_PackageFile_v2:

Public Member Functions

 __construct ()
 _differentDescription ($description)
 _differentEmail ($handle, $email, $selfemail)
 _differentName ($handle, $name, $selfname)
 _differentNotes ($notes)
 _differentPackage ($package)
 _differentRole ($handle, $role, $selfrole)
 _differentState ($state)
 _differentSummary ($summary)
 _differentVersion ($version)
 _getFlattenedFilelist (&$files, $dir, $baseinstall=false, $path='')
 _insertBefore ($array, $keys, $contents, $newkey)
 _ksplice ($array, $key, $value, $newkey)
 _mergeTag ($manip, $contents, $order)
 _missingFile ($file)
 _unmatchedMaintainers ($my, $yours)
 analyzeSourceCode ($file, $string=false)
 dependsOn ($package, $channel)
 flattenFilelist ()
 fromArray ($pinfo)
 getArchiveFile ()
 getArray ($forReg=false)
 getBundledPackages ()
 getChangelog ()
 getChannel ()
 getCompatible ()
 getConfigureOptions ()
 getContents ()
 getContributors ()
 getDate ()
& getDefaultGenerator ()
 getDependencies ()
 getDependencyGroup ($name)
 getDeps ($raw=false, $nopearinstaller=false)
 getDescription ()
 getDevelopers ()
 getDirtree ()
 getExtends ()
 getFileContents ($file)
 getFilelist ($preserve=false)
 getHelpers ()
 getInstallationFilelist ($forfilecheck=false)
 getInstalledBinary ()
 getInstalledLocation ($file)
 getLastInstalledVersion ()
 getLastModified ()
 getLeads ()
 getLicense ($raw=false)
 getLicenseLocation ()
 getMaintainers ($raw=false)
 getName ()
 getNotes ()
 getPackage ()
 getPackageFile ()
 getPackageType ()
 getPackagexmlVersion ()
& getPEARDependency2 (&$c, $o, $p, $s=PEAR_VALIDATE_INSTALLING)
& getPEARDownloader (&$i, $o, &$c)
 getProvidesExtension ()
 getReleases ()
 getRequestedGroup ()
& getRW ()
 getSourcePackage ()
 getStability ()
 getState ($key='release')
 getSummary ()
 getTask ($task)
 getTasksNs ()
 getTime ()
 getUri ()
 getUsesrole ()
 getUsestask ()
 getValidationWarnings ($purge=true)
 getVersion ($key='release')
 hasDeps ()
 initPostinstallScripts ()
 installBinary (&$installer)
 installedFile ($file, $atts)
 isCompatible ($pf)
 isEquivalent ($pf1)
 isExtension ($extension)
 isIncomplete ()
 isSubpackage ($p)
 isSubpackageOf ($p)
 listPostinstallScripts ()
 packageInfo ($field)
 PEAR_PackageFile_v2 ()
 resetDirtree ()
 resetFilelist ()
 runPostinstallScripts ()
 setCompatible ($compat)
 setConfig (&$config)
 setDate ($date)
 setDeps ($deps)
 setDirtree ($path)
 setFileAttribute ($filename, $attr, $value, $index=false)
 setInstalledAs ($file, $path)
 setLastInstalledVersion ($version)
 setLogger (&$logger)
 setPackagefile ($file, $archive=false)
 setRawChannel ($channel)
 setRawCompatible ($compatible)
 setRawPackage ($package)
 setRawState ($state)
 setRequestedGroup ($group)
 setTime ($time)
 toArray ($forreg=false)
 validate ($state=PEAR_VALIDATE_NORMAL)

Data Fields

 $_archiveFile
 $_config
 $_filesValid = false
 $_incomplete = true
 $_isValid = 0
 $_logger
 $_packageFile
 $_packageInfo = array()
 $_registry
 $_requestedGroup = false
 $_stack
 $_tasksNs
 $_v2Validator

Detailed Description

Definition at line 29 of file v2.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( )

The constructor merely sets up the private error stack

Definition at line 131 of file v2.php.

132 {
133 $this->_stack = new PEAR_ErrorStack('PEAR_PackageFile_v2', false, null);
134 $this->_isValid = false;
135 }

Referenced by PEAR_PackageFile_v2().

Here is the caller graph for this function:

Member Function Documentation

◆ _differentDescription()

_differentDescription ( $description)

Definition at line 457 of file v2.php.

458 {
459 $truncdescription = trim(strlen($description) < 25 ? $description : substr($description, 0, 24) . '...');
460 $truncmydescription = trim(strlen($this->getDescription()) < 25 ? $this->getDescription() :
461 substr($this->getdescription(), 0, 24) . '...');
462 $this->_stack->push(__FUNCTION__, 'error', array('description' => $truncdescription,
463 'self' => $truncmydescription),
464 'package.xml 1.0 description "%description%" does not match "%self%"');
465 }

References getDescription().

Referenced by isEquivalent().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _differentEmail()

_differentEmail ( $handle,
$email,
$selfemail )

Definition at line 409 of file v2.php.

410 {
411 $this->_stack->push(__FUNCTION__, 'error', array('handle' => $handle,
412 'email' => $email, 'self' => $selfemail),
413 'package.xml 1.0 maintainer "%handle%" email "%email%" does not match "%self%"');
414 }

Referenced by isEquivalent().

Here is the caller graph for this function:

◆ _differentName()

_differentName ( $handle,
$name,
$selfname )

Definition at line 416 of file v2.php.

417 {
418 $this->_stack->push(__FUNCTION__, 'error', array('handle' => $handle,
419 'name' => $name, 'self' => $selfname),
420 'package.xml 1.0 maintainer "%handle%" name "%name%" does not match "%self%"');
421 }

Referenced by isEquivalent().

Here is the caller graph for this function:

◆ _differentNotes()

_differentNotes ( $notes)

Definition at line 437 of file v2.php.

438 {
439 $truncnotes = strlen($notes) < 25 ? $notes : substr($notes, 0, 24) . '...';
440 $truncmynotes = strlen($this->getNotes()) < 25 ? $this->getNotes() :
441 substr($this->getNotes(), 0, 24) . '...';
442 $this->_stack->push(__FUNCTION__, 'error', array('notes' => $truncnotes,
443 'self' => $truncmynotes),
444 'package.xml 1.0 release notes "%notes%" do not match "%self%"');
445 }

References getNotes().

Referenced by isEquivalent().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _differentPackage()

_differentPackage ( $package)

Definition at line 381 of file v2.php.

382 {
383 $this->_stack->push(__FUNCTION__, 'error', array('package' => $package,
384 'self' => $this->getPackage()),
385 'package.xml 1.0 package "%package%" does not match "%self%"');
386 }

References getPackage().

Referenced by isEquivalent().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _differentRole()

_differentRole ( $handle,
$role,
$selfrole )

Definition at line 402 of file v2.php.

403 {
404 $this->_stack->push(__FUNCTION__, 'error', array('handle' => $handle,
405 'role' => $role, 'self' => $selfrole),
406 'package.xml 1.0 maintainer "%handle%" role "%role%" does not match "%self%"');
407 }

Referenced by isEquivalent().

Here is the caller graph for this function:

◆ _differentState()

_differentState ( $state)

Definition at line 395 of file v2.php.

396 {
397 $this->_stack->push(__FUNCTION__, 'error', array('state' => $state,
398 'self' => $this->getState()),
399 'package.xml 1.0 state "%state%" does not match "%self%"');
400 }
getState($key='release')
Definition v2.php:1106

References getState().

Referenced by isEquivalent().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _differentSummary()

_differentSummary ( $summary)

Definition at line 447 of file v2.php.

448 {
449 $truncsummary = strlen($summary) < 25 ? $summary : substr($summary, 0, 24) . '...';
450 $truncmysummary = strlen($this->getsummary()) < 25 ? $this->getSummary() :
451 substr($this->getsummary(), 0, 24) . '...';
452 $this->_stack->push(__FUNCTION__, 'error', array('summary' => $truncsummary,
453 'self' => $truncmysummary),
454 'package.xml 1.0 summary "%summary%" does not match "%self%"');
455 }

References getSummary().

Referenced by isEquivalent().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _differentVersion()

_differentVersion ( $version)

Definition at line 388 of file v2.php.

389 {
390 $this->_stack->push(__FUNCTION__, 'error', array('version' => $version,
391 'self' => $this->getVersion()),
392 'package.xml 1.0 version "%version%" does not match "%self%"');
393 }
getVersion($key='release')
Definition v2.php:1090

References getVersion().

Referenced by isEquivalent().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _getFlattenedFilelist()

_getFlattenedFilelist ( & $files,
$dir,
$baseinstall = false,
$path = '' )
Parameters
arraythe final flattened file list
arraythe current directory being processed
string|falseany recursively inherited baeinstalldir attribute
stringprivate recursion variable
Returns
array @access protected

Definition at line 701 of file v2.php.

702 {
703 if (isset($dir['attribs']) && isset($dir['attribs']['baseinstalldir'])) {
704 $baseinstall = $dir['attribs']['baseinstalldir'];
705 }
706 if (isset($dir['dir'])) {
707 if (!isset($dir['dir'][0])) {
708 $dir['dir'] = array($dir['dir']);
709 }
710 foreach ($dir['dir'] as $subdir) {
711 if (!isset($subdir['attribs']) || !isset($subdir['attribs']['name'])) {
712 $name = '*unknown*';
713 } else {
714 $name = $subdir['attribs']['name'];
715 }
716 $newpath = empty($path) ? $name :
717 $path . '/' . $name;
718 $this->_getFlattenedFilelist($files, $subdir,
719 $baseinstall, $newpath);
720 }
721 }
722 if (isset($dir['file'])) {
723 if (!isset($dir['file'][0])) {
724 $dir['file'] = array($dir['file']);
725 }
726 foreach ($dir['file'] as $file) {
727 $attrs = $file['attribs'];
728 $name = $attrs['name'];
729 if ($baseinstall && !isset($attrs['baseinstalldir'])) {
730 $attrs['baseinstalldir'] = $baseinstall;
731 }
732 $attrs['name'] = empty($path) ? $name : $path . '/' . $name;
733 $attrs['name'] = preg_replace(array('!\\\\+!', '!/+!'), array('/', '/'),
734 $attrs['name']);
735 $file['attribs'] = $attrs;
736 $files[] = $file;
737 }
738 }
739 }
_getFlattenedFilelist(&$files, $dir, $baseinstall=false, $path='')
Definition v2.php:701

References _getFlattenedFilelist().

Referenced by _getFlattenedFilelist(), and flattenFilelist().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _insertBefore()

_insertBefore ( $array,
$keys,
$contents,
$newkey )
Parameters
arraya list of possible keys, in the order they may occur
mixedcontents of the new package.xml tag
stringtag name @access private

Definition at line 2005 of file v2.php.

2006 {
2007 foreach ($keys as $key) {
2008 if (isset($array[$key])) {
2009 return $array = $this->_ksplice($array, $key, $contents, $newkey);
2010 }
2011 }
2012 $array[$newkey] = $contents;
2013 return $array;
2014 }
_ksplice($array, $key, $value, $newkey)
Definition v2.php:1990

References _ksplice().

Referenced by _mergeTag(), PEAR_PackageFile_v2_rw\addFile(), PEAR_PackageFile_v2_rw\addMaintainer(), PEAR_PackageFile_v2_rw\clearContents(), PEAR_PackageFile_v2_rw\setChannel(), setDate(), PEAR_PackageFile_v2_rw\setDescription(), PEAR_PackageFile_v2_rw\setExtends(), PEAR_PackageFile_v2_rw\setLicense(), PEAR_PackageFile_v2_rw\setNotes(), PEAR_PackageFile_v2_rw\setPackageType(), PEAR_PackageFile_v2_rw\setProvidesExtension(), PEAR_PackageFile_v2_rw\setSourcePackage(), PEAR_PackageFile_v2_rw\setSummary(), setTime(), and PEAR_PackageFile_v2_rw\setUri().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _ksplice()

_ksplice ( $array,
$key,
$value,
$newkey )

Key-friendly array_splice

Parameters
tagnameto splice a value in before
mixedthe value to splice in
stringthe new tag name

Definition at line 1990 of file v2.php.

1991 {
1992 $offset = array_search($key, array_keys($array));
1993 $after = array_slice($array, $offset);
1994 $before = array_slice($array, 0, $offset);
1995 $before[$newkey] = $value;
1996 return array_merge($before, $after);
1997 }

Referenced by _insertBefore().

Here is the caller graph for this function:

◆ _mergeTag()

_mergeTag ( $manip,
$contents,
$order )
Parameters
subsectionof $_packageInfo
array|stringtag contents
arrayformat:
array(
  tagname => array(list of tag names that follow this one),
  childtagname => array(list of child tag names that follow this one),
)

This allows construction of nested tags @access private

Definition at line 2030 of file v2.php.

2031 {
2032 if (count($order)) {
2033 foreach ($order as $tag => $curorder) {
2034 if (!isset($manip[$tag])) {
2035 // ensure that the tag is set up
2036 $manip = $this->_insertBefore($manip, $curorder, array(), $tag);
2037 }
2038 if (count($order) > 1) {
2039 $manip[$tag] = $this->_mergeTag($manip[$tag], $contents, array_slice($order, 1));
2040 return $manip;
2041 }
2042 }
2043 } else {
2044 return $manip;
2045 }
2046 if (is_array($manip[$tag]) && !empty($manip[$tag]) && isset($manip[$tag][0])) {
2047 $manip[$tag][] = $contents;
2048 } else {
2049 if (is_array($manip[$tag]) && !count($manip[$tag])) {
2050 $manip[$tag] = $contents;
2051 } else {
2052 $manip[$tag] = array($manip[$tag]);
2053 $manip[$tag][] = $contents;
2054 }
2055 }
2056 return $manip;
2057 }
_mergeTag($manip, $contents, $order)
Definition v2.php:2030
_insertBefore($array, $keys, $contents, $newkey)
Definition v2.php:2005

References _insertBefore(), and _mergeTag().

Referenced by PEAR_PackageFile_v2_rw\_addGroupDependency(), _mergeTag(), PEAR_PackageFile_v2_rw\addArchDep(), PEAR_PackageFile_v2_rw\addBinarypackage(), PEAR_PackageFile_v2_rw\addBundledPackage(), PEAR_PackageFile_v2_rw\addCompatiblePackage(), PEAR_PackageFile_v2_rw\addConfigureOption(), PEAR_PackageFile_v2_rw\addConflictingPackageDepWithChannel(), PEAR_PackageFile_v2_rw\addConflictingPackageDepWithUri(), PEAR_PackageFile_v2_rw\addDependencyGroup(), PEAR_PackageFile_v2_rw\addExtensionDep(), PEAR_PackageFile_v2_rw\addExtensionInstallCondition(), PEAR_PackageFile_v2_rw\addIgnore(), PEAR_PackageFile_v2_rw\addInstallAs(), PEAR_PackageFile_v2_rw\addOsDep(), PEAR_PackageFile_v2_rw\addPackageDepWithChannel(), PEAR_PackageFile_v2_rw\addPackageDepWithUri(), PEAR_PackageFile_v2_rw\addRelease(), PEAR_PackageFile_v2_rw\addSubpackageDepWithChannel(), PEAR_PackageFile_v2_rw\addSubpackageDepWithUri(), PEAR_PackageFile_v2_rw\addUsesrole(), PEAR_PackageFile_v2_rw\addUsestask(), PEAR_PackageFile_v2_rw\clearDeps(), PEAR_PackageFile_v2_rw\setAPIStability(), PEAR_PackageFile_v2_rw\setAPIVersion(), PEAR_PackageFile_v2_rw\setArchInstallCondition(), PEAR_PackageFile_v2_rw\setOsInstallCondition(), PEAR_PackageFile_v2_rw\setPearinstallerDep(), PEAR_PackageFile_v2_rw\setPhpDep(), PEAR_PackageFile_v2_rw\setPhpInstallCondition(), PEAR_PackageFile_v2_rw\setReleaseStability(), and PEAR_PackageFile_v2_rw\setReleaseVersion().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _missingFile()

_missingFile ( $file)

Definition at line 467 of file v2.php.

468 {
469 $this->_stack->push(__FUNCTION__, 'error', array('file' => $file),
470 'package.xml 1.0 file "%file%" is not present in <contents>');
471 }

Referenced by isEquivalent().

Here is the caller graph for this function:

◆ _unmatchedMaintainers()

_unmatchedMaintainers ( $my,
$yours )

Definition at line 423 of file v2.php.

424 {
425 if ($my) {
426 array_walk($my, function(&$i, $k) { $i = $i["handle"]; });
427 $this->_stack->push(__FUNCTION__, 'error', array('handles' => $my),
428 'package.xml 2.0 has unmatched extra maintainers "%handles%"');
429 }
430 if ($yours) {
431 array_walk($yours, function(&$i, $k) { $i = $i["handle"]; });
432 $this->_stack->push(__FUNCTION__, 'error', array('handles' => $yours),
433 'package.xml 1.0 has unmatched extra maintainers "%handles%"');
434 }
435 }

Referenced by isEquivalent().

Here is the caller graph for this function:

◆ analyzeSourceCode()

analyzeSourceCode ( $file,
$string = false )

Definition at line 1910 of file v2.php.

1911 {
1912 if (!isset($this->_v2Validator) ||
1913 !is_a($this->_v2Validator, 'PEAR_PackageFile_v2_Validator')) {
1914 if (!class_exists('PEAR_PackageFile_v2_Validator')) {
1915 require_once 'PEAR/PackageFile/v2/Validator.php';
1916 }
1917 $this->_v2Validator = new PEAR_PackageFile_v2_Validator;
1918 }
1919 return $this->_v2Validator->analyzeSourceCode($file, $string);
1920 }

◆ dependsOn()

dependsOn ( $package,
$channel )

Definition at line 1569 of file v2.php.

1570 {
1571 if (!($deps = $this->getDependencies())) {
1572 return false;
1573 }
1574 foreach (array('package', 'subpackage') as $type) {
1575 foreach (array('required', 'optional') as $needed) {
1576 if (isset($deps[$needed][$type])) {
1577 if (!isset($deps[$needed][$type][0])) {
1578 $deps[$needed][$type] = array($deps[$needed][$type]);
1579 }
1580 foreach ($deps[$needed][$type] as $dep) {
1581 $depchannel = isset($dep['channel']) ? $dep['channel'] : '__uri';
1582 if (strtolower($dep['name']) == strtolower($package) &&
1583 $depchannel == $channel) {
1584 return true;
1585 }
1586 }
1587 }
1588 }
1589 if (isset($deps['group'])) {
1590 if (!isset($deps['group'][0])) {
1591 $dep['group'] = array($deps['group']);
1592 }
1593 foreach ($deps['group'] as $group) {
1594 if (isset($group[$type])) {
1595 if (!is_array($group[$type])) {
1596 $group[$type] = array($group[$type]);
1597 }
1598 foreach ($group[$type] as $dep) {
1599 $depchannel = isset($dep['channel']) ? $dep['channel'] : '__uri';
1600 if (strtolower($dep['name']) == strtolower($package) &&
1601 $depchannel == $channel) {
1602 return true;
1603 }
1604 }
1605 }
1606 }
1607 }
1608 }
1609 return false;
1610 }

References getDependencies().

Here is the call graph for this function:

◆ flattenFilelist()

flattenFilelist ( )

Convert a recursive set of <dir> and <file> tags into a single <dir> tag with <file> tags.

Definition at line 659 of file v2.php.

660 {
661 if (isset($this->_packageInfo['bundle'])) {
662 return;
663 }
664 $filelist = array();
665 if (isset($this->_packageInfo['contents']['dir']['dir'])) {
666 $this->_getFlattenedFilelist($filelist, $this->_packageInfo['contents']['dir']);
667 if (!isset($filelist[1])) {
668 $filelist = $filelist[0];
669 }
670 $this->_packageInfo['contents']['dir']['file'] = $filelist;
671 unset($this->_packageInfo['contents']['dir']['dir']);
672 } else {
673 // else already flattened but check for baseinstalldir propagation
674 if (isset($this->_packageInfo['contents']['dir']['attribs']['baseinstalldir'])) {
675 if (isset($this->_packageInfo['contents']['dir']['file'][0])) {
676 foreach ($this->_packageInfo['contents']['dir']['file'] as $i => $file) {
677 if (isset($file['attribs']['baseinstalldir'])) {
678 continue;
679 }
680 $this->_packageInfo['contents']['dir']['file'][$i]['attribs']['baseinstalldir']
681 = $this->_packageInfo['contents']['dir']['attribs']['baseinstalldir'];
682 }
683 } else {
684 if (!isset($this->_packageInfo['contents']['dir']['file']['attribs']['baseinstalldir'])) {
685 $this->_packageInfo['contents']['dir']['file']['attribs']['baseinstalldir']
686 = $this->_packageInfo['contents']['dir']['attribs']['baseinstalldir'];
687 }
688 }
689 }
690 }
691 }

References _getFlattenedFilelist().

Referenced by getFilelist().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fromArray()

fromArray ( $pinfo)

Directly set the array that defines this packagefile

WARNING: no validation. This should only be performed by internal methods inside PEAR or by inputting an array saved from an existing PEAR_PackageFile_v2

Parameters
array

Definition at line 805 of file v2.php.

806 {
807 unset($pinfo['old']);
808 unset($pinfo['xsdversion']);
809 // If the changelog isn't an array then it was passed in as an empty tag
810 if (isset($pinfo['changelog']) && !is_array($pinfo['changelog'])) {
811 unset($pinfo['changelog']);
812 }
813 $this->_incomplete = false;
814 $this->_packageInfo = $pinfo;
815 }

◆ getArchiveFile()

getArchiveFile ( )

Definition at line 792 of file v2.php.

793 {
794 return $this->_archiveFile;
795 }

References $_archiveFile.

◆ getArray()

getArray ( $forReg = false)

Definition at line 833 of file v2.php.

834 {
835 if ($forReg) {
836 $arr = $this->_packageInfo;
837 $arr['old'] = array();
838 $arr['old']['version'] = $this->getVersion();
839 $arr['old']['release_date'] = $this->getDate();
840 $arr['old']['release_state'] = $this->getState();
841 $arr['old']['release_license'] = $this->getLicense();
842 $arr['old']['release_notes'] = $this->getNotes();
843 $arr['old']['release_deps'] = $this->getDeps();
844 $arr['old']['maintainers'] = $this->getMaintainers();
845 $arr['xsdversion'] = '2.0';
846 return $arr;
847 } else {
848 $info = $this->_packageInfo;
849 unset($info['dirtree']);
850 if (isset($info['_lastversion'])) {
851 unset($info['_lastversion']);
852 }
853 if (isset($info['#binarypackage'])) {
854 unset($info['#binarypackage']);
855 }
856 return $info;
857 }
858 }
getLicense($raw=false)
Definition v2.php:1114
getDeps($raw=false, $nopearinstaller=false)
Definition v2.php:1646
getMaintainers($raw=false)
Definition v2.php:943

References $_packageInfo, getDate(), getDeps(), getLicense(), getMaintainers(), getNotes(), getState(), and getVersion().

Referenced by packageInfo(), and toArray().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getBundledPackages()

getBundledPackages ( )

Definition at line 1835 of file v2.php.

1836 {
1837 if (isset($this->_packageInfo['bundle'])) {
1838 return $this->_packageInfo['contents']['bundledpackage'];
1839 }
1840 return false;
1841 }

◆ getChangelog()

getChangelog ( )
Returns
array

Definition at line 1798 of file v2.php.

1799 {
1800 if (isset($this->_packageInfo['changelog'])) {
1801 return $this->_packageInfo['changelog'];
1802 }
1803 return false;
1804 }

◆ getChannel()

getChannel ( )

Definition at line 900 of file v2.php.

901 {
902 if (isset($this->_packageInfo['uri'])) {
903 return '__uri';
904 }
905 if (isset($this->_packageInfo['channel'])) {
906 return strtolower($this->_packageInfo['channel']);
907 }
908 return false;
909 }

Referenced by getInstallationFilelist().

Here is the caller graph for this function:

◆ getCompatible()

getCompatible ( )
Returns
array|false

Definition at line 1494 of file v2.php.

1495 {
1496 if (isset($this->_packageInfo['compatible'])) {
1497 return $this->_packageInfo['compatible'];
1498 }
1499 return false;
1500 }

◆ getConfigureOptions()

getConfigureOptions ( )

Return configure options array, if any

Returns
array|false

Definition at line 1209 of file v2.php.

1210 {
1211 if ($this->getPackageType() != 'extsrc' && $this->getPackageType() != 'zendextsrc') {
1212 return false;
1213 }
1214
1215 $releases = $this->getReleases();
1216 if (isset($releases[0])) {
1217 $releases = $releases[0];
1218 }
1219
1220 if (isset($releases['configureoption'])) {
1221 if (!isset($releases['configureoption'][0])) {
1222 $releases['configureoption'] = array($releases['configureoption']);
1223 }
1224
1225 for ($i = 0; $i < count($releases['configureoption']); $i++) {
1226 $releases['configureoption'][$i] = $releases['configureoption'][$i]['attribs'];
1227 }
1228
1229 return $releases['configureoption'];
1230 }
1231
1232 return false;
1233 }

References getPackageType(), and getReleases().

Here is the call graph for this function:

◆ getContents()

getContents ( )

Retrieve the contents tag

Definition at line 1371 of file v2.php.

1372 {
1373 if (isset($this->_packageInfo['contents'])) {
1374 return $this->_packageInfo['contents'];
1375 }
1376 return false;
1377 }

Referenced by getFilelist(), initPostinstallScripts(), and listPostinstallScripts().

Here is the caller graph for this function:

◆ getContributors()

getContributors ( )

Definition at line 1025 of file v2.php.

1026 {
1027 if (isset($this->_packageInfo['contributor'])) {
1028 return $this->_packageInfo['contributor'];
1029 }
1030 return false;
1031 }

◆ getDate()

getDate ( )

Definition at line 1071 of file v2.php.

1072 {
1073 if (isset($this->_packageInfo['date'])) {
1074 return $this->_packageInfo['date'];
1075 }
1076 return false;
1077 }

Referenced by PEAR_PackageFile_v2_rw\generateChangeLogEntry(), and getArray().

Here is the caller graph for this function:

◆ getDefaultGenerator()

& getDefaultGenerator ( )

Definition at line 1901 of file v2.php.

1902 {
1903 if (!class_exists('PEAR_PackageFile_Generator_v2')) {
1904 require_once 'PEAR/PackageFile/Generator/v2.php';
1905 }
1906 $a = new PEAR_PackageFile_Generator_v2($this);
1907 return $a;
1908 }

◆ getDependencies()

getDependencies ( )

Definition at line 1502 of file v2.php.

1503 {
1504 if (isset($this->_packageInfo['dependencies'])) {
1505 return $this->_packageInfo['dependencies'];
1506 }
1507 return false;
1508 }

Referenced by dependsOn().

Here is the caller graph for this function:

◆ getDependencyGroup()

getDependencyGroup ( $name)

Get the contents of a dependency group

Parameters
string
Returns
array|false

Definition at line 1617 of file v2.php.

1618 {
1619 $name = strtolower($name);
1620 if (!isset($this->_packageInfo['dependencies']['group'])) {
1621 return false;
1622 }
1623 $groups = $this->_packageInfo['dependencies']['group'];
1624 if (!isset($groups[0])) {
1625 $groups = array($groups);
1626 }
1627 foreach ($groups as $group) {
1628 if (strtolower($group['attribs']['name']) == $name) {
1629 return $group;
1630 }
1631 }
1632 return false;
1633 }

◆ getDeps()

getDeps ( $raw = false,
$nopearinstaller = false )

Retrieve a partial package.xml 1.0 representation of dependencies

a very limited representation of dependencies is returned by this method. The <exclude> tag for excluding certain versions of a dependency is completely ignored. In addition, dependency groups are ignored, with the assumption that all dependencies in dependency groups are also listed in the optional group that work with all dependency groups

Parameters
booleanreturn package.xml 2.0 <dependencies> tag
Returns
array|false

Definition at line 1646 of file v2.php.

1647 {
1648 if (isset($this->_packageInfo['dependencies'])) {
1649 if ($raw) {
1650 return $this->_packageInfo['dependencies'];
1651 }
1652 $ret = array();
1653 $map = array(
1654 'php' => 'php',
1655 'package' => 'pkg',
1656 'subpackage' => 'pkg',
1657 'extension' => 'ext',
1658 'os' => 'os',
1659 'pearinstaller' => 'pkg',
1660 );
1661 foreach (array('required', 'optional') as $type) {
1662 $optional = ($type == 'optional') ? 'yes' : 'no';
1663 if (!isset($this->_packageInfo['dependencies'][$type])
1664 || empty($this->_packageInfo['dependencies'][$type])) {
1665 continue;
1666 }
1667 foreach ($this->_packageInfo['dependencies'][$type] as $dtype => $deps) {
1668 if ($dtype == 'pearinstaller' && $nopearinstaller) {
1669 continue;
1670 }
1671 if ((is_array($deps) && !isset($deps[0])) || !is_array($deps)) {
1672 $deps = array($deps);
1673 }
1674 foreach ($deps as $dep) {
1675 if (!isset($map[$dtype])) {
1676 // no support for arch type
1677 continue;
1678 }
1679 if ($dtype == 'pearinstaller') {
1680 $dep['name'] = 'PEAR';
1681 $dep['channel'] = 'pear.php.net';
1682 }
1683 $s = array('type' => $map[$dtype]);
1684 if (isset($dep['channel'])) {
1685 $s['channel'] = $dep['channel'];
1686 }
1687 if (isset($dep['uri'])) {
1688 $s['uri'] = $dep['uri'];
1689 }
1690 if (isset($dep['name'])) {
1691 $s['name'] = $dep['name'];
1692 }
1693 if (isset($dep['conflicts'])) {
1694 $s['rel'] = 'not';
1695 } else {
1696 if (!isset($dep['min']) &&
1697 !isset($dep['max'])) {
1698 $s['rel'] = 'has';
1699 $s['optional'] = $optional;
1700 } elseif (isset($dep['min']) &&
1701 isset($dep['max'])) {
1702 $s['rel'] = 'ge';
1703 $s1 = $s;
1704 $s1['rel'] = 'le';
1705 $s['version'] = $dep['min'];
1706 $s1['version'] = $dep['max'];
1707 if (isset($dep['channel'])) {
1708 $s1['channel'] = $dep['channel'];
1709 }
1710 if ($dtype != 'php') {
1711 $s['name'] = $dep['name'];
1712 $s1['name'] = $dep['name'];
1713 }
1714 $s['optional'] = $optional;
1715 $s1['optional'] = $optional;
1716 $ret[] = $s1;
1717 } elseif (isset($dep['min'])) {
1718 if (isset($dep['exclude']) &&
1719 $dep['exclude'] == $dep['min']) {
1720 $s['rel'] = 'gt';
1721 } else {
1722 $s['rel'] = 'ge';
1723 }
1724 $s['version'] = $dep['min'];
1725 $s['optional'] = $optional;
1726 if ($dtype != 'php') {
1727 $s['name'] = $dep['name'];
1728 }
1729 } elseif (isset($dep['max'])) {
1730 if (isset($dep['exclude']) &&
1731 $dep['exclude'] == $dep['max']) {
1732 $s['rel'] = 'lt';
1733 } else {
1734 $s['rel'] = 'le';
1735 }
1736 $s['version'] = $dep['max'];
1737 $s['optional'] = $optional;
1738 if ($dtype != 'php') {
1739 $s['name'] = $dep['name'];
1740 }
1741 }
1742 }
1743 $ret[] = $s;
1744 }
1745 }
1746 }
1747 if (count($ret)) {
1748 return $ret;
1749 }
1750 }
1751 return false;
1752 }
$raw
Definition pearcmd.php:116

References $raw.

Referenced by getArray().

Here is the caller graph for this function:

◆ getDescription()

getDescription ( )

Definition at line 935 of file v2.php.

936 {
937 if (isset($this->_packageInfo['description'])) {
938 return $this->_packageInfo['description'];
939 }
940 return false;
941 }

Referenced by _differentDescription(), and isEquivalent().

Here is the caller graph for this function:

◆ getDevelopers()

getDevelopers ( )

Definition at line 1017 of file v2.php.

1018 {
1019 if (isset($this->_packageInfo['developer'])) {
1020 return $this->_packageInfo['developer'];
1021 }
1022 return false;
1023 }

◆ getDirtree()

getDirtree ( )

Definition at line 1431 of file v2.php.

1432 {
1433 if (isset($this->_packageInfo['dirtree']) && count($this->_packageInfo['dirtree'])) {
1434 return $this->_packageInfo['dirtree'];
1435 }
1436 return false;
1437 }

◆ getExtends()

getExtends ( )

Definition at line 919 of file v2.php.

920 {
921 if (isset($this->_packageInfo['extends'])) {
922 return $this->_packageInfo['extends'];
923 }
924 return false;
925 }

◆ getFileContents()

getFileContents ( $file)

Get the contents of a file listed within the package.xml

Parameters
string
Returns
string

Definition at line 1856 of file v2.php.

1857 {
1858 if ($this->_archiveFile == $this->_packageFile) { // unpacked
1859 $dir = dirname($this->_packageFile);
1860 $file = $dir . DIRECTORY_SEPARATOR . $file;
1861 $file = str_replace(array('/', '\\'),
1862 array(DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR), $file);
1863 if (file_exists($file) && is_readable($file)) {
1864 return implode('', file($file));
1865 }
1866 } else { // tgz
1867 $tar = new Archive_Tar($this->_archiveFile);
1868 $tar->pushErrorHandling(PEAR_ERROR_RETURN);
1869 if ($file != 'package.xml' && $file != 'package2.xml') {
1870 $file = $this->getPackage() . '-' . $this->getVersion() . '/' . $file;
1871 }
1872 $file = $tar->extractInString($file);
1873 $tar->popErrorHandling();
1874 if (PEAR::isError($file)) {
1875 return PEAR::raiseError("Cannot locate file '$file' in archive");
1876 }
1877 return $file;
1878 }
1879 }
const PEAR_ERROR_RETURN
Definition PEAR.php:24

References getPackage(), getVersion(), and PEAR_ERROR_RETURN.

Here is the call graph for this function:

◆ getFilelist()

getFilelist ( $preserve = false)

This should only be used to retrieve filenames and install attributes

Definition at line 1172 of file v2.php.

1173 {
1174 if (isset($this->_packageInfo['filelist']) && !$preserve) {
1175 return $this->_packageInfo['filelist'];
1176 }
1177 $this->flattenFilelist();
1178 if ($contents = $this->getContents()) {
1179 $ret = array();
1180 if (!isset($contents['dir'])) {
1181 return false;
1182 }
1183 if (!isset($contents['dir']['file'][0])) {
1184 $contents['dir']['file'] = array($contents['dir']['file']);
1185 }
1186 foreach ($contents['dir']['file'] as $file) {
1187 if (!isset($file['attribs']['name'])) {
1188 continue;
1189 }
1190 $name = $file['attribs']['name'];
1191 if (!$preserve) {
1192 $file = $file['attribs'];
1193 }
1194 $ret[$name] = $file;
1195 }
1196 if (!$preserve) {
1197 $this->_packageInfo['filelist'] = $ret;
1198 }
1199 return $ret;
1200 }
1201 return false;
1202 }

References flattenFilelist(), and getContents().

Referenced by getInstallationFilelist(), initPostinstallScripts(), isEquivalent(), and listPostinstallScripts().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getHelpers()

getHelpers ( )

Definition at line 1033 of file v2.php.

1034 {
1035 if (isset($this->_packageInfo['helper'])) {
1036 return $this->_packageInfo['helper'];
1037 }
1038 return false;
1039 }

◆ getInstallationFilelist()

getInstallationFilelist ( $forfilecheck = false)

Retrieve a list of files that should be installed on this computer

Returns
array

Definition at line 1248 of file v2.php.

1249 {
1250 $contents = $this->getFilelist(true);
1251 if (isset($contents['dir']['attribs']['baseinstalldir'])) {
1252 $base = $contents['dir']['attribs']['baseinstalldir'];
1253 }
1254 if (isset($this->_packageInfo['bundle'])) {
1255 return PEAR::raiseError(
1256 'Exception: bundles should be handled in download code only');
1257 }
1258 $release = $this->getReleases();
1259 if ($release) {
1260 if (!isset($release[0])) {
1261 if (!isset($release['installconditions']) && !isset($release['filelist'])) {
1262 if ($forfilecheck) {
1263 return $this->getFilelist();
1264 }
1265 return $contents;
1266 }
1267 $release = array($release);
1268 }
1269 $depchecker = &$this->getPEARDependency2($this->_config, array(),
1270 array('channel' => $this->getChannel(), 'package' => $this->getPackage()),
1272 foreach ($release as $instance) {
1273 if (isset($instance['installconditions'])) {
1274 $installconditions = $instance['installconditions'];
1275 if (is_array($installconditions)) {
1276 PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
1277 foreach ($installconditions as $type => $conditions) {
1278 if (!isset($conditions[0])) {
1279 $conditions = array($conditions);
1280 }
1281 foreach ($conditions as $condition) {
1282 $ret = $depchecker->{"validate{$type}Dependency"}($condition);
1283 if (PEAR::isError($ret)) {
1284 PEAR::popErrorHandling();
1285 continue 3; // skip this release
1286 }
1287 }
1288 }
1289 PEAR::popErrorHandling();
1290 }
1291 }
1292 // this is the release to use
1293 if (isset($instance['filelist'])) {
1294 // ignore files
1295 if (isset($instance['filelist']['ignore'])) {
1296 $ignore = isset($instance['filelist']['ignore'][0]) ?
1297 $instance['filelist']['ignore'] :
1298 array($instance['filelist']['ignore']);
1299 foreach ($ignore as $ig) {
1300 unset ($contents[$ig['attribs']['name']]);
1301 }
1302 }
1303 // install files as this name
1304 if (isset($instance['filelist']['install'])) {
1305 $installas = isset($instance['filelist']['install'][0]) ?
1306 $instance['filelist']['install'] :
1307 array($instance['filelist']['install']);
1308 foreach ($installas as $as) {
1309 $contents[$as['attribs']['name']]['attribs']['install-as'] =
1310 $as['attribs']['as'];
1311 }
1312 }
1313 }
1314 if ($forfilecheck) {
1315 foreach ($contents as $file => $attrs) {
1316 $contents[$file] = $attrs['attribs'];
1317 }
1318 }
1319 return $contents;
1320 }
1321 } else { // simple release - no installconditions or install-as
1322 if ($forfilecheck) {
1323 return $this->getFilelist();
1324 }
1325 return $contents;
1326 }
1327 // no releases matched
1328 return PEAR::raiseError('No releases in package.xml matched the existing operating ' .
1329 'system, extensions installed, or architecture, cannot install');
1330 }
const PEAR_VALIDATE_INSTALLING
Definition Validate.php:18
getFilelist($preserve=false)
Definition v2.php:1172
& getPEARDependency2(&$c, $o, $p, $s=PEAR_VALIDATE_INSTALLING)
Definition v2.php:169

References getChannel(), getFilelist(), getPackage(), getPEARDependency2(), getReleases(), PEAR_ERROR_RETURN, and PEAR_VALIDATE_INSTALLING.

Here is the call graph for this function:

◆ getInstalledBinary()

getInstalledBinary ( )

Definition at line 178 of file v2.php.

179 {
180 return isset($this->_packageInfo['#binarypackage']) ? $this->_packageInfo['#binarypackage'] :
181 false;
182 }

◆ getInstalledLocation()

getInstalledLocation ( $file)

Definition at line 1346 of file v2.php.

1347 {
1348 if (isset($this->_packageInfo['filelist'][$file]['installed_as'])) {
1349 return $this->_packageInfo['filelist'][$file]['installed_as'];
1350 }
1351 return false;
1352 }

◆ getLastInstalledVersion()

getLastInstalledVersion ( )
Returns
string|false

Definition at line 535 of file v2.php.

536 {
537 if (isset($this->_packageInfo['_lastversion'])) {
538 return $this->_packageInfo['_lastversion'];
539 }
540 return false;
541 }

◆ getLastModified()

getLastModified ( )

Definition at line 1843 of file v2.php.

1844 {
1845 if (isset($this->_packageInfo['_lastmodified'])) {
1846 return $this->_packageInfo['_lastmodified'];
1847 }
1848 return false;
1849 }

◆ getLeads()

getLeads ( )

Definition at line 1009 of file v2.php.

1010 {
1011 if (isset($this->_packageInfo['lead'])) {
1012 return $this->_packageInfo['lead'];
1013 }
1014 return false;
1015 }

◆ getLicense()

getLicense ( $raw = false)

Definition at line 1114 of file v2.php.

1115 {
1116 if (isset($this->_packageInfo['license'])) {
1117 if ($raw) {
1118 return $this->_packageInfo['license'];
1119 }
1120 if (is_array($this->_packageInfo['license'])) {
1121 return $this->_packageInfo['license']['_content'];
1122 } else {
1123 return $this->_packageInfo['license'];
1124 }
1125 }
1126 return false;
1127 }

References $raw.

Referenced by PEAR_PackageFile_v2_rw\generateChangeLogEntry(), and getArray().

Here is the caller graph for this function:

◆ getLicenseLocation()

getLicenseLocation ( )

Definition at line 1129 of file v2.php.

1130 {
1131 if (!isset($this->_packageInfo['license']) || !is_array($this->_packageInfo['license'])) {
1132 return false;
1133 }
1134 return $this->_packageInfo['license']['attribs'];
1135 }

◆ getMaintainers()

getMaintainers ( $raw = false)

Definition at line 943 of file v2.php.

944 {
945 if (!isset($this->_packageInfo['lead'])) {
946 return false;
947 }
948 if ($raw) {
949 $ret = array('lead' => $this->_packageInfo['lead']);
950 (isset($this->_packageInfo['developer'])) ?
951 $ret['developer'] = $this->_packageInfo['developer'] :null;
952 (isset($this->_packageInfo['contributor'])) ?
953 $ret['contributor'] = $this->_packageInfo['contributor'] :null;
954 (isset($this->_packageInfo['helper'])) ?
955 $ret['helper'] = $this->_packageInfo['helper'] :null;
956 return $ret;
957 } else {
958 $ret = array();
959 $leads = isset($this->_packageInfo['lead'][0]) ? $this->_packageInfo['lead'] :
960 array($this->_packageInfo['lead']);
961 foreach ($leads as $lead) {
962 $s = $lead;
963 $s['handle'] = $s['user'];
964 unset($s['user']);
965 $s['role'] = 'lead';
966 $ret[] = $s;
967 }
968 if (isset($this->_packageInfo['developer'])) {
969 $leads = isset($this->_packageInfo['developer'][0]) ?
970 $this->_packageInfo['developer'] :
971 array($this->_packageInfo['developer']);
972 foreach ($leads as $maintainer) {
973 $s = $maintainer;
974 $s['handle'] = $s['user'];
975 unset($s['user']);
976 $s['role'] = 'developer';
977 $ret[] = $s;
978 }
979 }
980 if (isset($this->_packageInfo['contributor'])) {
981 $leads = isset($this->_packageInfo['contributor'][0]) ?
982 $this->_packageInfo['contributor'] :
983 array($this->_packageInfo['contributor']);
984 foreach ($leads as $maintainer) {
985 $s = $maintainer;
986 $s['handle'] = $s['user'];
987 unset($s['user']);
988 $s['role'] = 'contributor';
989 $ret[] = $s;
990 }
991 }
992 if (isset($this->_packageInfo['helper'])) {
993 $leads = isset($this->_packageInfo['helper'][0]) ?
994 $this->_packageInfo['helper'] :
995 array($this->_packageInfo['helper']);
996 foreach ($leads as $maintainer) {
997 $s = $maintainer;
998 $s['handle'] = $s['user'];
999 unset($s['user']);
1000 $s['role'] = 'helper';
1001 $ret[] = $s;
1002 }
1003 }
1004 return $ret;
1005 }
1006 return false;
1007 }

References $raw.

Referenced by getArray(), and isEquivalent().

Here is the caller graph for this function:

◆ getName()

getName ( )

Definition at line 887 of file v2.php.

888 {
889 return $this->getPackage();
890 }

References getPackage().

Here is the call graph for this function:

◆ getNotes()

getNotes ( )

Definition at line 1137 of file v2.php.

1138 {
1139 if (isset($this->_packageInfo['notes'])) {
1140 return $this->_packageInfo['notes'];
1141 }
1142 return false;
1143 }

Referenced by _differentNotes(), PEAR_PackageFile_v2_rw\generateChangeLogEntry(), getArray(), and isEquivalent().

Here is the caller graph for this function:

◆ getPackage()

getPackage ( )

Definition at line 892 of file v2.php.

893 {
894 if (isset($this->_packageInfo['name'])) {
895 return $this->_packageInfo['name'];
896 }
897 return false;
898 }

Referenced by _differentPackage(), getFileContents(), getInstallationFilelist(), and getName().

Here is the caller graph for this function:

◆ getPackageFile()

getPackageFile ( )

Definition at line 787 of file v2.php.

788 {
789 return $this->_packageFile;
790 }

References $_packageFile.

◆ getPackageType()

getPackageType ( )
Returns
php|extsrc|extbin|zendextsrc|zendextbin|bundle|false

Definition at line 1757 of file v2.php.

1758 {
1759 if (isset($this->_packageInfo['phprelease'])) {
1760 return 'php';
1761 }
1762 if (isset($this->_packageInfo['extsrcrelease'])) {
1763 return 'extsrc';
1764 }
1765 if (isset($this->_packageInfo['extbinrelease'])) {
1766 return 'extbin';
1767 }
1768 if (isset($this->_packageInfo['zendextsrcrelease'])) {
1769 return 'zendextsrc';
1770 }
1771 if (isset($this->_packageInfo['zendextbinrelease'])) {
1772 return 'zendextbin';
1773 }
1774 if (isset($this->_packageInfo['bundle'])) {
1775 return 'bundle';
1776 }
1777 return false;
1778 }

Referenced by PEAR_PackageFile_v2_rw\_getCurrentRelease(), PEAR_PackageFile_v2_rw\addBinarypackage(), PEAR_PackageFile_v2_rw\addBundledPackage(), PEAR_PackageFile_v2_rw\addConfigureOption(), PEAR_PackageFile_v2_rw\addExtensionInstallCondition(), PEAR_PackageFile_v2_rw\addFile(), PEAR_PackageFile_v2_rw\addRelease(), PEAR_PackageFile_v2_rw\clearContents(), getConfigureOptions(), getProvidesExtension(), getReleases(), installBinary(), isEquivalent(), isExtension(), PEAR_PackageFile_v2_rw\setArchInstallCondition(), PEAR_PackageFile_v2_rw\setOsInstallCondition(), PEAR_PackageFile_v2_rw\setPhpInstallCondition(), and PEAR_PackageFile_v2_rw\setProvidesExtension().

Here is the caller graph for this function:

◆ getPackagexmlVersion()

getPackagexmlVersion ( )

Definition at line 1811 of file v2.php.

1812 {
1813 if (isset($this->_packageInfo['zendextsrcrelease'])) {
1814 return '2.1';
1815 }
1816 if (isset($this->_packageInfo['zendextbinrelease'])) {
1817 return '2.1';
1818 }
1819 return '2.0';
1820 }

◆ getPEARDependency2()

& getPEARDependency2 ( & $c,
$o,
$p,
$s = PEAR_VALIDATE_INSTALLING )

To make unit-testing easier

Parameters
PEAR_Config
arrayoptions
arraypackage name as returned from PEAR_Registry::parsePackageName()
intPEAR_VALIDATE_* constant
Returns
PEAR_Dependency2 @access protected

Definition at line 169 of file v2.php.

170 {
171 if (!class_exists('PEAR_Dependency2')) {
172 require_once 'PEAR/Dependency2.php';
173 }
174 $z = new PEAR_Dependency2($c, $o, $p, $s);
175 return $z;
176 }

References PEAR_VALIDATE_INSTALLING.

Referenced by getInstallationFilelist().

Here is the caller graph for this function:

◆ getPEARDownloader()

& getPEARDownloader ( & $i,
$o,
& $c )

To make unit-testing easier

Parameters
PEAR_Frontend_*
arrayoptions
PEAR_Config
Returns
PEAR_Downloader @access protected

Definition at line 154 of file v2.php.

155 {
156 $z = new PEAR_Downloader($i, $o, $c);
157 return $z;
158 }

Referenced by installBinary().

Here is the caller graph for this function:

◆ getProvidesExtension()

getProvidesExtension ( )
Returns
string|false Extension name

Definition at line 268 of file v2.php.

269 {
270 if (in_array($this->getPackageType(),
271 array('extsrc', 'extbin', 'zendextsrc', 'zendextbin'))) {
272 if (isset($this->_packageInfo['providesextension'])) {
273 return $this->_packageInfo['providesextension'];
274 }
275 }
276 return false;
277 }

References getPackageType().

Here is the call graph for this function:

◆ getReleases()

getReleases ( )
Returns
array|false

Definition at line 1783 of file v2.php.

1784 {
1785 $type = $this->getPackageType();
1786 if ($type != 'bundle') {
1787 $type .= 'release';
1788 }
1789 if ($this->getPackageType() && isset($this->_packageInfo[$type])) {
1790 return $this->_packageInfo[$type];
1791 }
1792 return false;
1793 }

References getPackageType().

Referenced by getConfigureOptions(), and getInstallationFilelist().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getRequestedGroup()

getRequestedGroup ( )

Definition at line 513 of file v2.php.

514 {
515 if (isset($this->_requestedGroup)) {
517 }
518 return false;
519 }

References $_requestedGroup.

◆ getRW()

& getRW ( )

Definition at line 1881 of file v2.php.

1882 {
1883 if (!class_exists('PEAR_PackageFile_v2_rw')) {
1884 require_once 'PEAR/PackageFile/v2/rw.php';
1885 }
1886 $a = new PEAR_PackageFile_v2_rw;
1887 foreach (get_object_vars($this) as $name => $unused) {
1888 if (!isset($this->$name)) {
1889 continue;
1890 }
1891 if ($name == '_config' || $name == '_logger'|| $name == '_registry' ||
1892 $name == '_stack') {
1893 $a->$name = &$this->$name;
1894 } else {
1895 $a->$name = $this->$name;
1896 }
1897 }
1898 return $a;
1899 }

◆ getSourcePackage()

getSourcePackage ( )
Returns
array|false

Definition at line 1825 of file v2.php.

1826 {
1827 if (isset($this->_packageInfo['extbinrelease']) ||
1828 isset($this->_packageInfo['zendextbinrelease'])) {
1829 return array('channel' => $this->_packageInfo['srcchannel'],
1830 'package' => $this->_packageInfo['srcpackage']);
1831 }
1832 return false;
1833 }

◆ getStability()

getStability ( )

Definition at line 1098 of file v2.php.

1099 {
1100 if (isset($this->_packageInfo['stability'])) {
1101 return $this->_packageInfo['stability'];
1102 }
1103 return false;
1104 }

Referenced by PEAR_PackageFile_v2_rw\generateChangeLogEntry().

Here is the caller graph for this function:

◆ getState()

getState ( $key = 'release')

Definition at line 1106 of file v2.php.

1107 {
1108 if (isset($this->_packageInfo['stability'][$key])) {
1109 return $this->_packageInfo['stability'][$key];
1110 }
1111 return false;
1112 }

Referenced by _differentState(), and getArray().

Here is the caller graph for this function:

◆ getSummary()

getSummary ( )

Definition at line 927 of file v2.php.

928 {
929 if (isset($this->_packageInfo['summary'])) {
930 return $this->_packageInfo['summary'];
931 }
932 return false;
933 }

Referenced by _differentSummary().

Here is the caller graph for this function:

◆ getTask()

getTask ( $task)

Determine whether a task name is a valid task. Custom tasks may be defined using subdirectories by putting a "-" in the name, as in <tasks:mycustom-task>

Note that this method will auto-load the task class file and test for the existence of the name with "-" replaced by "_" as in PEAR/Task/mycustom/task.php makes class PEAR_Task_mycustom_task

Parameters
string
Returns
boolean

Definition at line 1965 of file v2.php.

1966 {
1967 $this->getTasksNs();
1968 // transform all '-' to '/' and 'tasks:' to '' so tasks:replace becomes replace
1969 $task = str_replace(array($this->_tasksNs . ':', '-'), array('', ' '), $task);
1970 $taskfile = str_replace(' ', '/', ucwords($task));
1971 $task = str_replace(array(' ', '/'), '_', ucwords($task));
1972 if (class_exists("PEAR_Task_$task")) {
1973 return "PEAR_Task_$task";
1974 }
1975 $fp = @fopen("PEAR/Task/$taskfile.php", 'r', true);
1976 if ($fp) {
1977 fclose($fp);
1978 require_once "PEAR/Task/$taskfile.php";
1979 return "PEAR_Task_$task";
1980 }
1981 return false;
1982 }

References getTasksNs().

Referenced by initPostinstallScripts(), and listPostinstallScripts().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getTasksNs()

getTasksNs ( )

Definition at line 1940 of file v2.php.

1941 {
1942 if (!isset($this->_tasksNs)) {
1943 if (isset($this->_packageInfo['attribs'])) {
1944 foreach ($this->_packageInfo['attribs'] as $name => $value) {
1945 if ($value == 'http://pear.php.net/dtd/tasks-1.0') {
1946 $this->_tasksNs = str_replace('xmlns:', '', $name);
1947 break;
1948 }
1949 }
1950 }
1951 }
1952 return $this->_tasksNs;
1953 }

Referenced by PEAR_PackageFile_v2_rw\addTaskToFile(), and getTask().

Here is the caller graph for this function:

◆ getTime()

getTime ( )

Definition at line 1079 of file v2.php.

1080 {
1081 if (isset($this->_packageInfo['time'])) {
1082 return $this->_packageInfo['time'];
1083 }
1084 return false;
1085 }

◆ getUri()

getUri ( )

Definition at line 911 of file v2.php.

912 {
913 if (isset($this->_packageInfo['uri'])) {
914 return $this->_packageInfo['uri'];
915 }
916 return false;
917 }

◆ getUsesrole()

getUsesrole ( )

Return the <usesrole> tag contents, if any

Returns
array|false

Definition at line 1149 of file v2.php.

1150 {
1151 if (isset($this->_packageInfo['usesrole'])) {
1152 return $this->_packageInfo['usesrole'];
1153 }
1154 return false;
1155 }

◆ getUsestask()

getUsestask ( )

Return the <usestask> tag contents, if any

Returns
array|false

Definition at line 1161 of file v2.php.

1162 {
1163 if (isset($this->_packageInfo['usestask'])) {
1164 return $this->_packageInfo['usestask'];
1165 }
1166 return false;
1167 }

◆ getValidationWarnings()

getValidationWarnings ( $purge = true)

Wrapper to PEAR_ErrorStack::getErrors()

Parameters
booleandetermines whether to purge the error stack after retrieving
Returns
array

Definition at line 782 of file v2.php.

783 {
784 return $this->_stack->getErrors($purge);
785 }

◆ getVersion()

getVersion ( $key = 'release')
Parameters
package|apiversion category to return

Definition at line 1090 of file v2.php.

1091 {
1092 if (isset($this->_packageInfo['version'][$key])) {
1093 return $this->_packageInfo['version'][$key];
1094 }
1095 return false;
1096 }

Referenced by _differentVersion(), PEAR_PackageFile_v2_rw\generateChangeLogEntry(), getArray(), getFileContents(), and installBinary().

Here is the caller graph for this function:

◆ hasDeps()

hasDeps ( )

Definition at line 1806 of file v2.php.

1807 {
1808 return isset($this->_packageInfo['dependencies']);
1809 }

◆ initPostinstallScripts()

initPostinstallScripts ( )

Initialize post-install scripts for running

This method can be used to detect post-install scripts, as the return value indicates whether any exist

Returns
bool

Definition at line 594 of file v2.php.

595 {
596 $filelist = $this->getFilelist();
597 $contents = $this->getContents();
598 $contents = $contents['dir']['file'];
599 if (!is_array($contents) || !isset($contents[0])) {
600 $contents = array($contents);
601 }
602 $taskfiles = array();
603 foreach ($contents as $file) {
604 $atts = $file['attribs'];
605 unset($file['attribs']);
606 if (count($file)) {
607 $taskfiles[$atts['name']] = $file;
608 }
609 }
610 $common = new PEAR_Common;
611 $common->debug = $this->_config->get('verbose');
612 $this->_scripts = array();
613 foreach ($taskfiles as $name => $tasks) {
614 if (!isset($filelist[$name])) {
615 // file was not installed due to installconditions
616 continue;
617 }
618 $atts = $filelist[$name];
619 foreach ($tasks as $tag => $raw) {
620 $taskname = $this->getTask($tag);
621 $task = new $taskname($this->_config, $common, PEAR_TASK_INSTALL);
622 if (!$task->isScript()) {
623 continue; // scripts are only handled after installation
624 }
625 $lastversion = isset($this->_packageInfo['_lastversion']) ?
626 $this->_packageInfo['_lastversion'] : null;
627 $task->init($raw, $atts, $lastversion);
628 $res = $task->startSession($this, $atts['installed_as'], null);
629 if (!$res) {
630 continue; // skip this file
631 }
632 if (PEAR::isError($res)) {
633 return $res;
634 }
635 $this->_scripts[] = $task;
636 }
637 }
638 if (count($this->_scripts)) {
639 return true;
640 }
641 return false;
642 }
const PEAR_TASK_INSTALL
Definition Common.php:24

References $raw, getContents(), getFilelist(), getTask(), and PEAR_TASK_INSTALL.

Referenced by runPostinstallScripts().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ installBinary()

installBinary ( & $installer)

Installation of source package has failed, attempt to download and install the binary version of this package.

Parameters
PEAR_Installer
Returns
array|false

Definition at line 190 of file v2.php.

191 {
192 if (!OS_WINDOWS) {
193 $a = false;
194 return $a;
195 }
196 if ($this->getPackageType() == 'extsrc' || $this->getPackageType() == 'zendextsrc') {
197 $releasetype = $this->getPackageType() . 'release';
198 if (!is_array($installer->getInstallPackages())) {
199 $a = false;
200 return $a;
201 }
202 foreach ($installer->getInstallPackages() as $p) {
203 if ($p->isExtension($this->_packageInfo['providesextension'])) {
204 if ($p->getPackageType() != 'extsrc' && $p->getPackageType() != 'zendextsrc') {
205 $a = false;
206 return $a; // the user probably downloaded it separately
207 }
208 }
209 }
210 if (isset($this->_packageInfo[$releasetype]['binarypackage'])) {
211 $installer->log(0, 'Attempting to download binary version of extension "' .
212 $this->_packageInfo['providesextension'] . '"');
213 $params = $this->_packageInfo[$releasetype]['binarypackage'];
214 if (!is_array($params) || !isset($params[0])) {
215 $params = array($params);
216 }
217 if (isset($this->_packageInfo['channel'])) {
218 foreach ($params as $i => $param) {
219 $params[$i] = array('channel' => $this->_packageInfo['channel'],
220 'package' => $param, 'version' => $this->getVersion());
221 }
222 }
223 $dl = &$this->getPEARDownloader($installer->ui, $installer->getOptions(),
224 $installer->config);
225 $verbose = $dl->config->get('verbose');
226 $dl->config->set('verbose', -1);
227 foreach ($params as $param) {
228 PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
229 $ret = $dl->download(array($param));
230 PEAR::popErrorHandling();
231 if (is_array($ret) && count($ret)) {
232 break;
233 }
234 }
235 $dl->config->set('verbose', $verbose);
236 if (is_array($ret)) {
237 if (count($ret) == 1) {
238 $pf = $ret[0]->getPackageFile();
239 PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
240 $err = $installer->install($ret[0]);
241 PEAR::popErrorHandling();
242 if (is_array($err)) {
243 $this->_packageInfo['#binarypackage'] = $ret[0]->getPackage();
244 // "install" self, so all dependencies will work transparently
245 $this->_registry->addPackage2($this);
246 $installer->log(0, 'Download and install of binary extension "' .
247 $this->_registry->parsedPackageNameToString(
248 array('channel' => $pf->getChannel(),
249 'package' => $pf->getPackage()), true) . '" successful');
250 $a = array($ret[0], $err);
251 return $a;
252 }
253 $installer->log(0, 'Download and install of binary extension "' .
254 $this->_registry->parsedPackageNameToString(
255 array('channel' => $pf->getChannel(),
256 'package' => $pf->getPackage()), true) . '" failed');
257 }
258 }
259 }
260 }
261 $a = false;
262 return $a;
263 }
& getPEARDownloader(&$i, $o, &$c)
Definition v2.php:154
$verbose
Definition pearcmd.php:167

References $verbose, getPackageType(), getPEARDownloader(), getVersion(), and PEAR_ERROR_RETURN.

Here is the call graph for this function:

◆ installedFile()

installedFile ( $file,
$atts )

This is only used at install-time, after all serialization is over.

Reimplemented in PEAR_PackageFile_v2_rw.

Definition at line 1358 of file v2.php.

1359 {
1360 if (isset($this->_packageInfo['filelist'][$file])) {
1361 $this->_packageInfo['filelist'][$file] =
1362 array_merge($this->_packageInfo['filelist'][$file], $atts['attribs']);
1363 } else {
1364 $this->_packageInfo['filelist'][$file] = $atts['attribs'];
1365 }
1366 }

◆ isCompatible()

isCompatible ( $pf)

Determines whether this package claims it is compatible with the version of the package that has a recommended version dependency

Parameters
PEAR_PackageFile_v2|PEAR_PackageFile_v1|PEAR_Downloader_Package
Returns
boolean

Definition at line 1450 of file v2.php.

1451 {
1452 if (!isset($this->_packageInfo['compatible'])) {
1453 return false;
1454 }
1455 if (!isset($this->_packageInfo['channel'])) {
1456 return false;
1457 }
1458 $me = $pf->getVersion();
1459 $compatible = $this->_packageInfo['compatible'];
1460 if (!isset($compatible[0])) {
1461 $compatible = array($compatible);
1462 }
1463 $found = false;
1464 foreach ($compatible as $info) {
1465 if (strtolower($info['name']) == strtolower($pf->getPackage())) {
1466 if (strtolower($info['channel']) == strtolower($pf->getChannel())) {
1467 $found = true;
1468 break;
1469 }
1470 }
1471 }
1472 if (!$found) {
1473 return false;
1474 }
1475 if (isset($info['exclude'])) {
1476 if (!isset($info['exclude'][0])) {
1477 $info['exclude'] = array($info['exclude']);
1478 }
1479 foreach ($info['exclude'] as $exclude) {
1480 if (version_compare($me, $exclude, '==')) {
1481 return false;
1482 }
1483 }
1484 }
1485 if (version_compare($me, $info['min'], '>=') && version_compare($me, $info['max'], '<=')) {
1486 return true;
1487 }
1488 return false;
1489 }

◆ isEquivalent()

isEquivalent ( $pf1)

Tests whether every part of the package.xml 1.0 is represented in this package.xml 2.0

Parameters
PEAR_PackageFile_v1
Returns
bool

Definition at line 298 of file v2.php.

299 {
300 if (!$pf1) {
301 return true;
302 }
303 if ($this->getPackageType() == 'bundle') {
304 return false;
305 }
306 $this->_stack->getErrors(true);
307 if (!$pf1->validate(PEAR_VALIDATE_NORMAL)) {
308 return false;
309 }
310 $pass = true;
311 if ($pf1->getPackage() != $this->getPackage()) {
312 $this->_differentPackage($pf1->getPackage());
313 $pass = false;
314 }
315 if ($pf1->getVersion() != $this->getVersion()) {
316 $this->_differentVersion($pf1->getVersion());
317 $pass = false;
318 }
319 if (trim($pf1->getSummary()) != $this->getSummary()) {
320 $this->_differentSummary($pf1->getSummary());
321 $pass = false;
322 }
323 if (preg_replace('/\s+/', '', $pf1->getDescription()) !=
324 preg_replace('/\s+/', '', $this->getDescription())) {
325 $this->_differentDescription($pf1->getDescription());
326 $pass = false;
327 }
328 if ($pf1->getState() != $this->getState()) {
329 $this->_differentState($pf1->getState());
330 $pass = false;
331 }
332 if (!strstr(preg_replace('/\s+/', '', $this->getNotes()),
333 preg_replace('/\s+/', '', $pf1->getNotes()))) {
334 $this->_differentNotes($pf1->getNotes());
335 $pass = false;
336 }
337 $mymaintainers = $this->getMaintainers();
338 $yourmaintainers = $pf1->getMaintainers();
339 for ($i1 = 0; $i1 < count($yourmaintainers); $i1++) {
340 $reset = false;
341 for ($i2 = 0; $i2 < count($mymaintainers); $i2++) {
342 if ($mymaintainers[$i2]['handle'] == $yourmaintainers[$i1]['handle']) {
343 if ($mymaintainers[$i2]['role'] != $yourmaintainers[$i1]['role']) {
344 $this->_differentRole($mymaintainers[$i2]['handle'],
345 $yourmaintainers[$i1]['role'], $mymaintainers[$i2]['role']);
346 $pass = false;
347 }
348 if ($mymaintainers[$i2]['email'] != $yourmaintainers[$i1]['email']) {
349 $this->_differentEmail($mymaintainers[$i2]['handle'],
350 $yourmaintainers[$i1]['email'], $mymaintainers[$i2]['email']);
351 $pass = false;
352 }
353 if ($mymaintainers[$i2]['name'] != $yourmaintainers[$i1]['name']) {
354 $this->_differentName($mymaintainers[$i2]['handle'],
355 $yourmaintainers[$i1]['name'], $mymaintainers[$i2]['name']);
356 $pass = false;
357 }
358 unset($mymaintainers[$i2]);
359 $mymaintainers = array_values($mymaintainers);
360 unset($yourmaintainers[$i1]);
361 $yourmaintainers = array_values($yourmaintainers);
362 $reset = true;
363 break;
364 }
365 }
366 if ($reset) {
367 $i1 = -1;
368 }
369 }
370 $this->_unmatchedMaintainers($mymaintainers, $yourmaintainers);
371 $filelist = $this->getFilelist();
372 foreach ($pf1->getFilelist() as $file => $atts) {
373 if (!isset($filelist[$file])) {
374 $this->_missingFile($file);
375 $pass = false;
376 }
377 }
378 return $pass;
379 }
const PEAR_VALIDATE_NORMAL
Definition Validate.php:20
_unmatchedMaintainers($my, $yours)
Definition v2.php:423
_differentSummary($summary)
Definition v2.php:447
_differentRole($handle, $role, $selfrole)
Definition v2.php:402
_differentEmail($handle, $email, $selfemail)
Definition v2.php:409
_missingFile($file)
Definition v2.php:467
_differentVersion($version)
Definition v2.php:388
_differentDescription($description)
Definition v2.php:457
_differentName($handle, $name, $selfname)
Definition v2.php:416
_differentNotes($notes)
Definition v2.php:437
_differentPackage($package)
Definition v2.php:381
_differentState($state)
Definition v2.php:395

References _differentDescription(), _differentEmail(), _differentName(), _differentNotes(), _differentPackage(), _differentRole(), _differentState(), _differentSummary(), _differentVersion(), _missingFile(), _unmatchedMaintainers(), getDescription(), getFilelist(), getMaintainers(), getNotes(), getPackageType(), and PEAR_VALIDATE_NORMAL.

Here is the call graph for this function:

◆ isExtension()

isExtension ( $extension)
Parameters
stringExtension name
Returns
bool

Definition at line 283 of file v2.php.

284 {
285 if (in_array($this->getPackageType(),
286 array('extsrc', 'extbin', 'zendextsrc', 'zendextbin'))) {
287 return $this->_packageInfo['providesextension'] == $extension;
288 }
289 return false;
290 }

References getPackageType().

Here is the call graph for this function:

◆ isIncomplete()

isIncomplete ( )

Definition at line 817 of file v2.php.

818 {
819 return $this->_incomplete;
820 }

References $_incomplete.

◆ isSubpackage()

isSubpackage ( $p)

Determines whether the passed in package is a subpackage of this package.

No version checking is done, only name verification.

Parameters
PEAR_PackageFile_v1|PEAR_PackageFile_v2
Returns
bool

Definition at line 1522 of file v2.php.

1523 {
1524 $sub = array();
1525 if (isset($this->_packageInfo['dependencies']['required']['subpackage'])) {
1526 $sub = $this->_packageInfo['dependencies']['required']['subpackage'];
1527 if (!isset($sub[0])) {
1528 $sub = array($sub);
1529 }
1530 }
1531 if (isset($this->_packageInfo['dependencies']['optional']['subpackage'])) {
1532 $sub1 = $this->_packageInfo['dependencies']['optional']['subpackage'];
1533 if (!isset($sub1[0])) {
1534 $sub1 = array($sub1);
1535 }
1536 $sub = array_merge($sub, $sub1);
1537 }
1538 if (isset($this->_packageInfo['dependencies']['group'])) {
1539 $group = $this->_packageInfo['dependencies']['group'];
1540 if (!isset($group[0])) {
1541 $group = array($group);
1542 }
1543 foreach ($group as $deps) {
1544 if (isset($deps['subpackage'])) {
1545 $sub2 = $deps['subpackage'];
1546 if (!isset($sub2[0])) {
1547 $sub2 = array($sub2);
1548 }
1549 $sub = array_merge($sub, $sub2);
1550 }
1551 }
1552 }
1553 foreach ($sub as $dep) {
1554 if (strtolower($dep['name']) == strtolower($p->getPackage())) {
1555 if (isset($dep['channel'])) {
1556 if (strtolower($dep['channel']) == strtolower($p->getChannel())) {
1557 return true;
1558 }
1559 } else {
1560 if ($dep['uri'] == $p->getURI()) {
1561 return true;
1562 }
1563 }
1564 }
1565 }
1566 return false;
1567 }

◆ isSubpackageOf()

isSubpackageOf ( $p)

Definition at line 1510 of file v2.php.

1511 {
1512 return $p->isSubpackage($this);
1513 }

◆ listPostinstallScripts()

listPostinstallScripts ( )

Determines whether this package.xml has post-install scripts or not

Returns
array|false

Definition at line 547 of file v2.php.

548 {
549 $filelist = $this->getFilelist();
550 $contents = $this->getContents();
551 $contents = $contents['dir']['file'];
552 if (!is_array($contents) || !isset($contents[0])) {
553 $contents = array($contents);
554 }
555 $taskfiles = array();
556 foreach ($contents as $file) {
557 $atts = $file['attribs'];
558 unset($file['attribs']);
559 if (count($file)) {
560 $taskfiles[$atts['name']] = $file;
561 }
562 }
563 $common = new PEAR_Common;
564 $common->debug = $this->_config->get('verbose');
565 $this->_scripts = array();
566 $ret = array();
567 foreach ($taskfiles as $name => $tasks) {
568 if (!isset($filelist[$name])) {
569 // ignored files will not be in the filelist
570 continue;
571 }
572 $atts = $filelist[$name];
573 foreach ($tasks as $tag => $raw) {
574 $task = $this->getTask($tag);
575 $task = new $task($this->_config, $common, PEAR_TASK_INSTALL);
576 if ($task->isScript()) {
577 $ret[] = $filelist[$name]['installed_as'];
578 }
579 }
580 }
581 if (count($ret)) {
582 return $ret;
583 }
584 return false;
585 }

References $raw, getContents(), getFilelist(), getTask(), and PEAR_TASK_INSTALL.

Here is the call graph for this function:

◆ packageInfo()

packageInfo ( $field)

Definition at line 860 of file v2.php.

861 {
862 $arr = $this->getArray(true);
863 if ($field == 'state') {
864 return $arr['stability']['release'];
865 }
866 if ($field == 'api-version') {
867 return $arr['version']['api'];
868 }
869 if ($field == 'api-state') {
870 return $arr['stability']['api'];
871 }
872 if (isset($arr['old'][$field])) {
873 if (!is_string($arr['old'][$field])) {
874 return null;
875 }
876 return $arr['old'][$field];
877 }
878 if (isset($arr[$field])) {
879 if (!is_string($arr[$field])) {
880 return null;
881 }
882 return $arr[$field];
883 }
884 return null;
885 }
getArray($forReg=false)
Definition v2.php:833

References getArray().

Here is the call graph for this function:

◆ PEAR_PackageFile_v2()

PHP 4 style constructor for backwards compatibility. Used by PEAR_PackageFileManager2

Definition at line 141 of file v2.php.

142 {
143 $this->__construct();
144 }

References __construct().

Here is the call graph for this function:

◆ resetDirtree()

resetDirtree ( )

Definition at line 1439 of file v2.php.

1440 {
1441 unset($this->_packageInfo['dirtree']);
1442 }

◆ resetFilelist()

resetFilelist ( )

This is only used at install-time, after all serialization is over.

Definition at line 1239 of file v2.php.

1240 {
1241 $this->_packageInfo['filelist'] = array();
1242 }

◆ runPostinstallScripts()

runPostinstallScripts ( )

Definition at line 644 of file v2.php.

645 {
646 if ($this->initPostinstallScripts()) {
648 if ($ui) {
649 $ui->runPostinstallScripts($this->_scripts, $this);
650 }
651 }
652 }
static & singleton($type=null)
Definition Frontend.php:51
initPostinstallScripts()
Definition v2.php:594
$ui
Definition pearcmd.php:181

References $ui, initPostinstallScripts(), and PEAR_Frontend\singleton().

Here is the call graph for this function:

◆ setCompatible()

setCompatible ( $compat)

WARNING - do not use this function directly unless you know what you're doing

Definition at line 766 of file v2.php.

767 {
768 $this->_packageInfo['compatible'] = $compat;
769 }

◆ setConfig()

setConfig ( & $config)

Definition at line 741 of file v2.php.

742 {
743 $this->_config = &$config;
744 $this->_registry = &$config->getRegistry();
745 }
$config
Definition pearcmd.php:182

References $config.

◆ setDate()

setDate ( $date)

Definition at line 1041 of file v2.php.

1042 {
1043 if (!isset($this->_packageInfo['date'])) {
1044 // ensure that the extends tag is set up in the right location
1045 $this->_packageInfo = $this->_insertBefore($this->_packageInfo,
1046 array('time', 'version',
1047 'stability', 'license', 'notes', 'contents', 'compatible',
1048 'dependencies', 'providesextension', 'srcpackage', 'srcuri',
1049 'phprelease', 'extsrcrelease', 'extbinrelease', 'zendextsrcrelease',
1050 'zendextbinrelease', 'bundle', 'changelog'), array(), 'date');
1051 }
1052 $this->_packageInfo['date'] = $date;
1053 $this->_isValid = 0;
1054 }

References _insertBefore().

Here is the call graph for this function:

◆ setDeps()

setDeps ( $deps)

WARNING - do not use this function directly unless you know what you're doing

Definition at line 758 of file v2.php.

759 {
760 $this->_packageInfo['dependencies'] = $deps;
761 }

◆ setDirtree()

setDirtree ( $path)

Definition at line 1423 of file v2.php.

1424 {
1425 if (!isset($this->_packageInfo['dirtree'])) {
1426 $this->_packageInfo['dirtree'] = array();
1427 }
1428 $this->_packageInfo['dirtree'][$path] = true;
1429 }

◆ setFileAttribute()

setFileAttribute ( $filename,
$attr,
$value,
$index = false )
Parameters
stringfull path to file
stringattribute name
stringattribute value
intrisky but fast - use this to choose a file based on its position in the list of files. Index is zero-based like PHP arrays.
Returns
bool success of operation

Definition at line 1387 of file v2.php.

1388 {
1389 $this->_isValid = 0;
1390 if (in_array($attr, array('role', 'name', 'baseinstalldir'))) {
1391 $this->_filesValid = false;
1392 }
1393 if ($index !== false &&
1394 isset($this->_packageInfo['contents']['dir']['file'][$index]['attribs'])) {
1395 $this->_packageInfo['contents']['dir']['file'][$index]['attribs'][$attr] = $value;
1396 return true;
1397 }
1398 if (!isset($this->_packageInfo['contents']['dir']['file'])) {
1399 return false;
1400 }
1401 $files = $this->_packageInfo['contents']['dir']['file'];
1402 if (!isset($files[0])) {
1403 $files = array($files);
1404 $ind = false;
1405 } else {
1406 $ind = true;
1407 }
1408 foreach ($files as $i => $file) {
1409 if (isset($file['attribs'])) {
1410 if ($file['attribs']['name'] == $filename) {
1411 if ($ind) {
1412 $this->_packageInfo['contents']['dir']['file'][$i]['attribs'][$attr] = $value;
1413 } else {
1414 $this->_packageInfo['contents']['dir']['file']['attribs'][$attr] = $value;
1415 }
1416 return true;
1417 }
1418 }
1419 }
1420 return false;
1421 }

◆ setInstalledAs()

setInstalledAs ( $file,
$path )

This is only used at install-time, after all serialization is over.

Parameters
stringfile name
stringinstalled path

Reimplemented in PEAR_PackageFile_v2_rw.

Definition at line 1338 of file v2.php.

1339 {
1340 if ($path) {
1341 return $this->_packageInfo['filelist'][$file]['installed_as'] = $path;
1342 }
1343 unset($this->_packageInfo['filelist'][$file]['installed_as']);
1344 }

◆ setLastInstalledVersion()

setLastInstalledVersion ( $version)

For saving in the registry.

Set the last version that was installed

Parameters
string

Definition at line 527 of file v2.php.

528 {
529 $this->_packageInfo['_lastversion'] = $version;
530 }

◆ setLogger()

setLogger ( & $logger)

Definition at line 747 of file v2.php.

748 {
749 if (!is_object($logger) || !method_exists($logger, 'log')) {
750 return PEAR::raiseError('Logger must be compatible with PEAR_Common::log');
751 }
752 $this->_logger = &$logger;
753 }

◆ setPackagefile()

setPackagefile ( $file,
$archive = false )

Definition at line 771 of file v2.php.

772 {
773 $this->_packageFile = $file;
774 $this->_archiveFile = $archive ? $archive : $file;
775 }

◆ setRawChannel()

setRawChannel ( $channel)

WARNING - do not use this function unless you know what you're doing

Definition at line 503 of file v2.php.

504 {
505 $this->_packageInfo['channel'] = $channel;
506 }

Referenced by PEAR_Downloader\_getDepPackageDownloadUrl(), and PEAR_Downloader\_getPackageDownloadUrl().

Here is the caller graph for this function:

◆ setRawCompatible()

setRawCompatible ( $compatible)

WARNING - do not use this function unless you know what you're doing

Definition at line 487 of file v2.php.

488 {
489 $this->_packageInfo['compatible'] = $compatible;
490 }

◆ setRawPackage()

setRawPackage ( $package)

WARNING - do not use this function unless you know what you're doing

Definition at line 495 of file v2.php.

496 {
497 $this->_packageInfo['name'] = $package;
498 }

◆ setRawState()

setRawState ( $state)

WARNING - do not use this function unless you know what you're doing

Definition at line 476 of file v2.php.

477 {
478 if (!isset($this->_packageInfo['stability'])) {
479 $this->_packageInfo['stability'] = array();
480 }
481 $this->_packageInfo['stability']['release'] = $state;
482 }

◆ setRequestedGroup()

setRequestedGroup ( $group)

Definition at line 508 of file v2.php.

509 {
510 $this->_requestedGroup = $group;
511 }

◆ setTime()

setTime ( $time)

Definition at line 1056 of file v2.php.

1057 {
1058 $this->_isValid = 0;
1059 if (!isset($this->_packageInfo['time'])) {
1060 // ensure that the time tag is set up in the right location
1061 $this->_packageInfo = $this->_insertBefore($this->_packageInfo,
1062 array('version',
1063 'stability', 'license', 'notes', 'contents', 'compatible',
1064 'dependencies', 'providesextension', 'srcpackage', 'srcuri',
1065 'phprelease', 'extsrcrelease', 'extbinrelease', 'zendextsrcrelease',
1066 'zendextbinrelease', 'bundle', 'changelog'), $time, 'time');
1067 }
1068 $this->_packageInfo['time'] = $time;
1069 }

References _insertBefore().

Here is the call graph for this function:

◆ toArray()

toArray ( $forreg = false)
Returns
array

Definition at line 825 of file v2.php.

826 {
827 if (!$this->validate(PEAR_VALIDATE_NORMAL)) {
828 return false;
829 }
830 return $this->getArray($forreg);
831 }
validate($state=PEAR_VALIDATE_NORMAL)
Definition v2.php:1922

References getArray(), PEAR_VALIDATE_NORMAL, and validate().

Here is the call graph for this function:

◆ validate()

validate ( $state = PEAR_VALIDATE_NORMAL)

Definition at line 1922 of file v2.php.

1923 {
1924 if (!isset($this->_packageInfo) || !is_array($this->_packageInfo)) {
1925 return false;
1926 }
1927 if (!isset($this->_v2Validator) ||
1928 !is_a($this->_v2Validator, 'PEAR_PackageFile_v2_Validator')) {
1929 if (!class_exists('PEAR_PackageFile_v2_Validator')) {
1930 require_once 'PEAR/PackageFile/v2/Validator.php';
1931 }
1932 $this->_v2Validator = new PEAR_PackageFile_v2_Validator;
1933 }
1934 if (isset($this->_packageInfo['xsdversion'])) {
1935 unset($this->_packageInfo['xsdversion']);
1936 }
1937 return $this->_v2Validator->validate($this, $state);
1938 }

References PEAR_VALIDATE_NORMAL.

Referenced by toArray().

Here is the caller graph for this function:

Field Documentation

◆ $_archiveFile

$_archiveFile

Definition at line 44 of file v2.php.

Referenced by getArchiveFile().

◆ $_config

$_config

Definition at line 90 of file v2.php.

◆ $_filesValid

$_filesValid = false

True if the filelist has been validated

Parameters
bool

Definition at line 78 of file v2.php.

◆ $_incomplete

$_incomplete = true

Definition at line 121 of file v2.php.

Referenced by isIncomplete().

◆ $_isValid

$_isValid = 0

Definition at line 72 of file v2.php.

◆ $_logger

$_logger

Definition at line 58 of file v2.php.

◆ $_packageFile

$_packageFile

Definition at line 51 of file v2.php.

Referenced by getPackageFile().

◆ $_packageInfo

$_packageInfo = array()

Definition at line 37 of file v2.php.

Referenced by getArray().

◆ $_registry

$_registry

Definition at line 84 of file v2.php.

◆ $_requestedGroup

$_requestedGroup = false

Definition at line 97 of file v2.php.

Referenced by getRequestedGroup().

◆ $_stack

$_stack

Definition at line 103 of file v2.php.

◆ $_tasksNs

$_tasksNs

Namespace prefix used for tasks in this package.xml - use tasks: whenever possible

Definition at line 108 of file v2.php.

◆ $_v2Validator

$_v2Validator

Definition at line 126 of file v2.php.


The documentation for this class was generated from the following file:
  • E:/Bearsampp-development/sandbox/core/libs/php/pear/pear/PEAR/PackageFile/v2.php