Bearsampp 2026.9.23
Loading...
Searching...
No Matches
PEAR_PackageFile_v1 Class Reference

Public Member Functions

 __construct ()
 _analyzePhpFiles ()
 _analyzeSourceCode ($file)
 _buildProvidesArray ($srcinfo)
 _getErrorMessage ()
 _validateError ($code, $params=array())
 _validateWarning ($code, $params=array())
 addConfigureOption ($name, $prompt, $default=false)
 addExtensionDep ($name, $version, $rel, $optional='no')
 addFile ($dir, $file, $attrs)
 addMaintainer ($role, $handle, $name, $email)
 addPackageDep ($name, $version, $rel, $optional='no')
 addPhpDep ($version, $rel)
 clearConfigureOptions ()
 clearDeps ()
 clearMaintainers ()
 deleteMaintainer ($handle)
 dependsOn ($package, $channel)
 fromArray ($pinfo)
 getArchiveFile ()
 getArray ()
 getChangelog ()
 getChannel ()
 getConfigureOptions ()
 getDate ()
& getDefaultGenerator ()
 getDependencyGroup ($group)
 getDeps ()
 getDescription ()
 getDirtree ()
 getExtends ()
 getFileContents ($file)
 getFilelist ()
 getInstallationFilelist ()
 getInstalledBinary ()
 getLastInstalledVersion ()
 getLicense ()
 getMaintainers ()
 getName ()
 getNotes ()
 getPackage ()
 getPackageFile ()
 getPackageType ()
 getPackagexmlVersion ()
 getProvides ()
 getProvidesExtension ()
 getState ()
 getSummary ()
 getTime ()
 getUri ()
 getValidationWarnings ($purge=true)
 getVersion ()
 hasConfigureOptions ()
 hasDeps ()
 initPostinstallScripts ()
 installBinary ($installer)
 installedFile ($file, $atts)
 isCompatible ($pf)
 isExtension ($name)
 isIncomplete ()
 isSubpackage ($p)
 isSubpackageOf ($p)
 listPostinstallScripts ()
 packageInfo ($field)
 resetDirtree ()
 resetFilelist ()
 setConfig (&$config)
 setDate ($date)
 setDeps ($deps)
 setDescription ($desc)
 setDirtree ($path)
 setFileAttribute ($file, $attr, $value)
 setInstalledAs ($file, $path)
 setLastInstalledVersion ($version)
 setLicense ($date)
 setLogger (&$logger)
 setNotes ($notes)
 setPackage ($package)
 setPackagefile ($file, $archive=false)
 setRawPackage ($package)
 setRawState ($state)
 setRequestedGroup ()
 setState ($state)
 setSummary ($summary)
 setVersion ($version)
 toArray ()
 updateMaintainer ($role, $handle, $name, $email)
 validate ($state=PEAR_VALIDATE_NORMAL, $nofilechecking=false)

Data Fields

 $_archiveFile
 $_incomplete = true
 $_isValid = 0
 $_logger
 $_packageFile
 $_packageInfo
 $_registry
 $_stack

Detailed Description

Definition at line 281 of file v1.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( )
Parameters
booldetermines whether to return a PEAR_Error object, or use the PEAR_ErrorStack
stringName of Error Stack class to use.

Definition at line 348 of file v1.php.

349 {
350 $this->_stack = new PEAR_ErrorStack('PEAR_PackageFile_v1');
351 $this->_stack->setErrorMessageTemplate($this->_getErrorMessage());
352 $this->_isValid = 0;
353 }

References _getErrorMessage().

Here is the call graph for this function:

Member Function Documentation

◆ _analyzePhpFiles()

_analyzePhpFiles ( )

Definition at line 1245 of file v1.php.

1246 {
1247 if (!$this->_isValid) {
1248 return false;
1249 }
1250 if (!isset($this->_packageFile)) {
1251 return false;
1252 }
1253 $dir_prefix = dirname($this->_packageFile);
1254 $common = new PEAR_Common;
1255 $log = isset($this->_logger) ? array(&$this->_logger, 'log') :
1256 array($common, 'log');
1257 $info = $this->getFilelist();
1258 foreach ($info as $file => $fa) {
1259 if (!file_exists($dir_prefix . DIRECTORY_SEPARATOR . $file)) {
1261 array('file' => realpath($dir_prefix) . DIRECTORY_SEPARATOR . $file));
1262 continue;
1263 }
1264 if ($fa['role'] == 'php' && $dir_prefix) {
1265 call_user_func_array($log, array(1, "Analyzing $file"));
1266 $srcinfo = $this->_analyzeSourceCode($dir_prefix . DIRECTORY_SEPARATOR . $file);
1267 if ($srcinfo) {
1268 $this->_buildProvidesArray($srcinfo);
1269 }
1270 }
1271 }
1272 $this->_packageName = $pn = $this->getPackage();
1273 $pnl = strlen($pn);
1274 if (isset($this->_packageInfo['provides'])) {
1275 foreach ((array) $this->_packageInfo['provides'] as $key => $what) {
1276 if (isset($what['explicit'])) {
1277 // skip conformance checks if the provides entry is
1278 // specified in the package.xml file
1279 continue;
1280 }
1281 extract($what);
1282 if ($type == 'class') {
1283 if (!strncasecmp($name, $pn, $pnl)) {
1284 continue;
1285 }
1287 array('file' => $file, 'type' => $type, 'name' => $name, 'package' => $pn));
1288 } elseif ($type == 'function') {
1289 if (strstr($name, '::') || !strncasecmp($name, $pn, $pnl)) {
1290 continue;
1291 }
1293 array('file' => $file, 'type' => $type, 'name' => $name, 'package' => $pn));
1294 }
1295 }
1296 }
1297 return $this->_isValid;
1298 }
_buildProvidesArray($srcinfo)
Definition v1.php:1554
_validateError($code, $params=array())
Definition v1.php:946
_analyzeSourceCode($file)
Definition v1.php:1355
_validateWarning($code, $params=array())
Definition v1.php:958
const PEAR_PACKAGEFILE_ERROR_FILE_NOTFOUND
Definition v1.php:244
const PEAR_PACKAGEFILE_ERROR_NO_PNAME_PREFIX
Definition v1.php:214

References $_isValid, _analyzeSourceCode(), _buildProvidesArray(), _validateError(), _validateWarning(), getFilelist(), getPackage(), PEAR_PACKAGEFILE_ERROR_FILE_NOTFOUND, and PEAR_PACKAGEFILE_ERROR_NO_PNAME_PREFIX.

Referenced by validate().

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

◆ _analyzeSourceCode()

_analyzeSourceCode ( $file)

Analyze the source code of the given PHP file

Parameters
stringFilename of the PHP file
Returns
mixed @access private

Definition at line 1355 of file v1.php.

1356 {
1357 if (!function_exists("token_get_all")) {
1358 return false;
1359 }
1360 if (!defined('T_DOC_COMMENT')) {
1361 define('T_DOC_COMMENT', T_COMMENT);
1362 }
1363 if (!defined('T_INTERFACE')) {
1364 define('T_INTERFACE', -1);
1365 }
1366 if (!defined('T_IMPLEMENTS')) {
1367 define('T_IMPLEMENTS', -1);
1368 }
1369 if (!$fp = @fopen($file, "r")) {
1370 return false;
1371 }
1372 fclose($fp);
1373 $contents = file_get_contents($file);
1374 $tokens = token_get_all($contents);
1375/*
1376 for ($i = 0; $i < sizeof($tokens); $i++) {
1377 @list($token, $data) = $tokens[$i];
1378 if (is_string($token)) {
1379 var_dump($token);
1380 } else {
1381 print token_name($token) . ' ';
1382 var_dump(rtrim($data));
1383 }
1384 }
1385*/
1386 $look_for = 0;
1387 $paren_level = 0;
1388 $bracket_level = 0;
1389 $brace_level = 0;
1390 $lastphpdoc = '';
1391 $current_class = '';
1392 $current_interface = '';
1393 $current_class_level = -1;
1394 $current_function = '';
1395 $current_function_level = -1;
1396 $declared_classes = array();
1397 $declared_interfaces = array();
1398 $declared_functions = array();
1399 $declared_methods = array();
1400 $used_classes = array();
1401 $used_functions = array();
1402 $extends = array();
1403 $implements = array();
1404 $nodeps = array();
1405 $inquote = false;
1406 $interface = false;
1407 for ($i = 0; $i < sizeof($tokens); $i++) {
1408 if (is_array($tokens[$i])) {
1409 list($token, $data) = $tokens[$i];
1410 } else {
1411 $token = $tokens[$i];
1412 $data = '';
1413 }
1414 if ($inquote) {
1415 if ($token != '"' && $token != T_END_HEREDOC) {
1416 continue;
1417 } else {
1418 $inquote = false;
1419 continue;
1420 }
1421 }
1422 switch ($token) {
1423 case T_WHITESPACE:
1424 break;
1425 case ';':
1426 if ($interface) {
1427 $current_function = '';
1428 $current_function_level = -1;
1429 }
1430 break;
1431 case '"':
1432 case T_START_HEREDOC:
1433 $inquote = true;
1434 break;
1435 case T_CURLY_OPEN:
1436 case T_DOLLAR_OPEN_CURLY_BRACES:
1437 case '{': $brace_level++; continue 2;
1438 case '}':
1439 $brace_level--;
1440 if ($current_class_level == $brace_level) {
1441 $current_class = '';
1442 $current_class_level = -1;
1443 }
1444 if ($current_function_level == $brace_level) {
1445 $current_function = '';
1446 $current_function_level = -1;
1447 }
1448 continue 2;
1449 case '[': $bracket_level++; continue 2;
1450 case ']': $bracket_level--; continue 2;
1451 case '(': $paren_level++; continue 2;
1452 case ')': $paren_level--; continue 2;
1453 case T_INTERFACE:
1454 $interface = true;
1455 case T_CLASS:
1456 if (($current_class_level != -1) || ($current_function_level != -1)) {
1458 array('file' => $file));
1459 return false;
1460 }
1461 case T_FUNCTION:
1462 case T_NEW:
1463 case T_EXTENDS:
1464 case T_IMPLEMENTS:
1465 $look_for = $token;
1466 continue 2;
1467 case T_STRING:
1468 if ($look_for == T_CLASS) {
1469 $current_class = $data;
1470 $current_class_level = $brace_level;
1471 $declared_classes[] = $current_class;
1472 } elseif ($look_for == T_INTERFACE) {
1473 $current_interface = $data;
1474 $current_class_level = $brace_level;
1475 $declared_interfaces[] = $current_interface;
1476 } elseif ($look_for == T_IMPLEMENTS) {
1477 $implements[$current_class] = $data;
1478 } elseif ($look_for == T_EXTENDS) {
1479 $extends[$current_class] = $data;
1480 } elseif ($look_for == T_FUNCTION) {
1481 if ($current_class) {
1482 $current_function = "$current_class::$data";
1483 $declared_methods[$current_class][] = $data;
1484 } elseif ($current_interface) {
1485 $current_function = "$current_interface::$data";
1486 $declared_methods[$current_interface][] = $data;
1487 } else {
1488 $current_function = $data;
1489 $declared_functions[] = $current_function;
1490 }
1491 $current_function_level = $brace_level;
1492 $m = array();
1493 } elseif ($look_for == T_NEW) {
1494 $used_classes[$data] = true;
1495 }
1496 $look_for = 0;
1497 continue 2;
1498 case T_VARIABLE:
1499 $look_for = 0;
1500 continue 2;
1501 case T_DOC_COMMENT:
1502 case T_COMMENT:
1503 if (preg_match('!^/\*\*\s!', $data)) {
1504 $lastphpdoc = $data;
1505 if (preg_match_all('/@nodep\s+(\S+)/', $lastphpdoc, $m)) {
1506 $nodeps = array_merge($nodeps, $m[1]);
1507 }
1508 }
1509 continue 2;
1510 case T_DOUBLE_COLON:
1511 if (!($tokens[$i - 1][0] == T_WHITESPACE || $tokens[$i - 1][0] == T_STRING)) {
1513 array('file' => $file));
1514 return false;
1515 }
1516 $class = $tokens[$i - 1][1];
1517 if (strtolower($class) != 'parent') {
1518 $used_classes[$class] = true;
1519 }
1520 continue 2;
1521 }
1522 }
1523 return array(
1524 "source_file" => $file,
1525 "declared_classes" => $declared_classes,
1526 "declared_interfaces" => $declared_interfaces,
1527 "declared_methods" => $declared_methods,
1528 "declared_functions" => $declared_functions,
1529 "used_classes" => array_diff(array_keys($used_classes), $nodeps),
1530 "inheritance" => $extends,
1531 "implements" => $implements,
1532 );
1533 }
const PEAR_PACKAGEFILE_ERROR_INVALID_PHPFILE
Definition v1.php:208

References _validateError(), and PEAR_PACKAGEFILE_ERROR_INVALID_PHPFILE.

Referenced by _analyzePhpFiles().

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

◆ _buildProvidesArray()

_buildProvidesArray ( $srcinfo)

Build a "provides" array from data returned by analyzeSourceCode(). The format of the built array is like this:

array( 'class;MyClass' => 'array('type' => 'class', 'name' => 'MyClass'), ... )

Parameters
array$srcinfoarray with information about a source file as returned by the analyzeSourceCode() method.
Returns
void

@access private

Definition at line 1554 of file v1.php.

1555 {
1556 if (!$this->_isValid) {
1557 return false;
1558 }
1559 $file = basename($srcinfo['source_file']);
1560 $pn = $this->getPackage();
1561 $pnl = strlen($pn);
1562 foreach ($srcinfo['declared_classes'] as $class) {
1563 $key = "class;$class";
1564 if (isset($this->_packageInfo['provides'][$key])) {
1565 continue;
1566 }
1567 $this->_packageInfo['provides'][$key] =
1568 array('file'=> $file, 'type' => 'class', 'name' => $class);
1569 if (isset($srcinfo['inheritance'][$class])) {
1570 $this->_packageInfo['provides'][$key]['extends'] =
1571 $srcinfo['inheritance'][$class];
1572 }
1573 }
1574 foreach ($srcinfo['declared_methods'] as $class => $methods) {
1575 foreach ($methods as $method) {
1576 $function = "$class::$method";
1577 $key = "function;$function";
1578 if ($method[0] == '_' || !strcasecmp($method, $class) ||
1579 isset($this->_packageInfo['provides'][$key])) {
1580 continue;
1581 }
1582 $this->_packageInfo['provides'][$key] =
1583 array('file'=> $file, 'type' => 'function', 'name' => $function);
1584 }
1585 }
1586
1587 foreach ($srcinfo['declared_functions'] as $function) {
1588 $key = "function;$function";
1589 if ($function[0] == '_' || isset($this->_packageInfo['provides'][$key])) {
1590 continue;
1591 }
1592 if (!strstr($function, '::') && strncasecmp($function, $pn, $pnl)) {
1593 $warnings[] = "in1 " . $file . ": function \"$function\" not prefixed with package name \"$pn\"";
1594 }
1595 $this->_packageInfo['provides'][$key] =
1596 array('file'=> $file, 'type' => 'function', 'name' => $function);
1597 }
1598 }

References getPackage().

Referenced by _analyzePhpFiles().

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

◆ _getErrorMessage()

_getErrorMessage ( )
Parameters
integererror code @access protected

Definition at line 967 of file v1.php.

968 {
969 return array(
971 'Missing Package Name',
973 'No summary found',
975 'Summary should be on one line',
977 'Missing description',
979 'Missing license',
981 'No release version found',
983 'No release state found',
985 'No release date found',
987 'No release notes found',
989 'Package must have at least one lead maintainer',
991 'No maintainers found, at least one must be defined',
993 'Maintainer %index% has no handle (user ID at channel server)',
995 'Maintainer %index% has no role',
997 'Maintainer %index% has no name',
999 'Maintainer %index% has no email',
1001 'Dependency %index% is not a php dependency, and has no name',
1003 'Dependency %index% has no relation (rel)',
1005 'Dependency %index% has no type',
1007 'PHP Dependency %index% has a name attribute of "%name%" which will be' .
1008 ' ignored!',
1010 'Dependency %index% is not a rel="has" or rel="not" dependency, ' .
1011 'and has no version',
1013 'Dependency %index% is a type="php" dependency, ' .
1014 'and has no version',
1016 'Dependency %index% is a rel="%rel%" dependency, versioning is ignored',
1018 'Dependency %index% has invalid optional value "%opt%", should be yes or no',
1020 'Dependency %index%: php dependencies cannot use "not" rel, use "ne"' .
1021 ' to exclude specific versions',
1023 'Configure Option %index% has no name',
1025 'Configure Option %index% has no prompt',
1027 'No files in <filelist> section of package.xml',
1029 'File "%file%" has no role, expecting one of "%roles%"',
1031 'File "%file%" has invalid role "%role%", expecting one of "%roles%"',
1033 'File "%file%" cannot start with ".", cannot package or install',
1035 'Parser error: invalid PHP found in file "%file%"',
1037 'in %file%: %type% "%name%" not prefixed with package name "%package%"',
1039 'Parser error: invalid PHP file "%file%"',
1041 'Channel validator error: field "%field%" - %reason%',
1043 'Error, PHP5 token encountered in %file%, analysis should be in PHP5',
1045 'File "%file%" in package.xml does not exist',
1047 'Package.xml contains non-ISO-8859-1 characters, and may not validate',
1048 );
1049 }
const PEAR_PACKAGEFILE_ERROR_INVALID_DEPOPTIONAL
Definition v1.php:163
const PEAR_PACKAGEFILE_ERROR_NO_MAINTNAME
Definition v1.php:118
const PEAR_PACKAGEFILE_ERROR_NO_DESCRIPTION
Definition v1.php:58
const PEAR_PACKAGEFILE_ERROR_NO_DATE
Definition v1.php:88
const PEAR_PACKAGEFILE_ERROR_NO_SUMMARY
Definition v1.php:48
const PEAR_PACKAGEFILE_ERROR_NO_DEPREL
Definition v1.php:143
const PEAR_PACKAGEFILE_ERROR_PHP5
Definition v1.php:239
const PEAR_PACKAGEFILE_PHP_NO_NOT
Definition v1.php:249
const PEAR_PACKAGEFILE_ERROR_NO_MAINTROLE
Definition v1.php:113
const PEAR_PACKAGEFILE_ERROR_NO_LICENSE
Definition v1.php:63
const PEAR_PACKAGEFILE_ERROR_INVALID_FILEROLE
Definition v1.php:198
const PEAR_PACKAGEFILE_ERROR_INVALID_FILENAME
Definition v1.php:269
const PEAR_PACKAGEFILE_ERROR_DEPNAME_IGNORED
Definition v1.php:183
const PEAR_PACKAGEFILE_ERROR_NO_MAINTEMAIL
Definition v1.php:123
const PEAR_PACKAGEFILE_ERROR_NO_MAINTAINERS
Definition v1.php:103
const PEAR_PACKAGEFILE_ERROR_NO_DEPTYPE
Definition v1.php:138
const PEAR_PACKAGEFILE_ERROR_NO_DEPPHPVERSION
Definition v1.php:259
const PEAR_PACKAGEFILE_ERROR_CHANNELVAL
Definition v1.php:234
const PEAR_PACKAGEFILE_ERROR_NON_ISO_CHARS
Definition v1.php:254
const PEAR_PACKAGEFILE_ERROR_NO_FILES
Definition v1.php:224
const PEAR_PACKAGEFILE_ERROR_INVALID_FILE
Definition v1.php:229
const PEAR_PACKAGEFILE_ERROR_NO_CONFPROMPT
Definition v1.php:193
const PEAR_PACKAGEFILE_ERROR_DEPVERSION_IGNORED
Definition v1.php:178
const PEAR_PACKAGEFILE_ERROR_NO_DEPNAME
Definition v1.php:133
const PEAR_PACKAGEFILE_ERROR_NO_MAINTHANDLE
Definition v1.php:108
const PEAR_PACKAGEFILE_ERROR_NO_FILEROLE
Definition v1.php:203
const PEAR_PACKAGEFILE_ERROR_NO_LEAD
Definition v1.php:264
const PEAR_PACKAGEFILE_ERROR_NO_NAME
Definition v1.php:38
const PEAR_PACKAGEFILE_ERROR_NO_NOTES
Definition v1.php:98
const PEAR_PACKAGEFILE_ERROR_NO_VERSION
Definition v1.php:68
const PEAR_PACKAGEFILE_ERROR_MULTILINE_SUMMARY
Definition v1.php:53
const PEAR_PACKAGEFILE_ERROR_NO_DEPVERSION
Definition v1.php:148
const PEAR_PACKAGEFILE_ERROR_NO_STATE
Definition v1.php:78
const PEAR_PACKAGEFILE_ERROR_NO_CONFNAME
Definition v1.php:188

References PEAR_PACKAGEFILE_ERROR_CHANNELVAL, PEAR_PACKAGEFILE_ERROR_DEPNAME_IGNORED, PEAR_PACKAGEFILE_ERROR_DEPVERSION_IGNORED, PEAR_PACKAGEFILE_ERROR_FILE_NOTFOUND, PEAR_PACKAGEFILE_ERROR_INVALID_DEPOPTIONAL, PEAR_PACKAGEFILE_ERROR_INVALID_FILE, PEAR_PACKAGEFILE_ERROR_INVALID_FILENAME, PEAR_PACKAGEFILE_ERROR_INVALID_FILEROLE, PEAR_PACKAGEFILE_ERROR_INVALID_PHPFILE, PEAR_PACKAGEFILE_ERROR_MULTILINE_SUMMARY, PEAR_PACKAGEFILE_ERROR_NO_CONFNAME, PEAR_PACKAGEFILE_ERROR_NO_CONFPROMPT, PEAR_PACKAGEFILE_ERROR_NO_DATE, PEAR_PACKAGEFILE_ERROR_NO_DEPNAME, PEAR_PACKAGEFILE_ERROR_NO_DEPPHPVERSION, PEAR_PACKAGEFILE_ERROR_NO_DEPREL, PEAR_PACKAGEFILE_ERROR_NO_DEPTYPE, PEAR_PACKAGEFILE_ERROR_NO_DEPVERSION, PEAR_PACKAGEFILE_ERROR_NO_DESCRIPTION, PEAR_PACKAGEFILE_ERROR_NO_FILEROLE, PEAR_PACKAGEFILE_ERROR_NO_FILES, PEAR_PACKAGEFILE_ERROR_NO_LEAD, PEAR_PACKAGEFILE_ERROR_NO_LICENSE, PEAR_PACKAGEFILE_ERROR_NO_MAINTAINERS, PEAR_PACKAGEFILE_ERROR_NO_MAINTEMAIL, PEAR_PACKAGEFILE_ERROR_NO_MAINTHANDLE, PEAR_PACKAGEFILE_ERROR_NO_MAINTNAME, PEAR_PACKAGEFILE_ERROR_NO_MAINTROLE, PEAR_PACKAGEFILE_ERROR_NO_NAME, PEAR_PACKAGEFILE_ERROR_NO_NOTES, PEAR_PACKAGEFILE_ERROR_NO_PNAME_PREFIX, PEAR_PACKAGEFILE_ERROR_NO_STATE, PEAR_PACKAGEFILE_ERROR_NO_SUMMARY, PEAR_PACKAGEFILE_ERROR_NO_VERSION, PEAR_PACKAGEFILE_ERROR_NON_ISO_CHARS, PEAR_PACKAGEFILE_ERROR_PHP5, and PEAR_PACKAGEFILE_PHP_NO_NOT.

Referenced by __construct().

Here is the caller graph for this function:

◆ _validateError()

_validateError ( $code,
$params = array() )

Validation error. Also marks the object contents as invalid

Parameters
errorcode
arrayerror information @access private

Definition at line 946 of file v1.php.

947 {
948 $this->_stack->push($code, 'error', $params, false, false, debug_backtrace());
949 $this->_isValid = false;
950 }

Referenced by _analyzePhpFiles(), _analyzeSourceCode(), and validate().

Here is the caller graph for this function:

◆ _validateWarning()

_validateWarning ( $code,
$params = array() )

Validation warning. Does not mark the object contents invalid.

Parameters
errorcode
arrayerror information @access private

Definition at line 958 of file v1.php.

959 {
960 $this->_stack->push($code, 'warning', $params, false, false, debug_backtrace());
961 }

Referenced by _analyzePhpFiles(), and validate().

Here is the caller graph for this function:

◆ addConfigureOption()

addConfigureOption ( $name,
$prompt,
$default = false )

Definition at line 832 of file v1.php.

833 {
834 $o = array('name' => $name, 'prompt' => $prompt);
835 if ($default !== false) {
836 $o['default'] = $default;
837 }
838 if (!isset($this->_packageInfo['configure_options'])) {
839 $this->_packageInfo['configure_options'] = array();
840 }
841 $this->_packageInfo['configure_options'][] = $o;
842 }

◆ addExtensionDep()

addExtensionDep ( $name,
$version,
$rel,
$optional = 'no' )

Definition at line 754 of file v1.php.

755 {
756 $this->_isValid = false;
757 $this->_packageInfo['release_deps'][] =
758 array('type' => 'ext',
759 'name' => $name,
760 'rel' => $rel,
761 'version' => $version,
762 'optional' => $optional);
763 }

◆ addFile()

addFile ( $dir,
$file,
$attrs )

Definition at line 862 of file v1.php.

863 {
864 $dir = preg_replace(array('!\\\\+!', '!/+!'), array('/', '/'), $dir);
865 if ($dir == '/' || $dir == '') {
866 $dir = '';
867 } else {
868 $dir .= '/';
869 }
870 $file = $dir . $file;
871 $file = preg_replace('![\\/]+!', '/', $file);
872 $this->_packageInfo['filelist'][$file] = $attrs;
873 }

◆ addMaintainer()

addMaintainer ( $role,
$handle,
$name,
$email )

Adds a new maintainer - no checking of duplicates is performed, use updatemaintainer for that purpose.

Definition at line 580 of file v1.php.

581 {
582 $this->_packageInfo['maintainers'][] =
583 array('handle' => $handle, 'role' => $role, 'email' => $email, 'name' => $name);
584 $this->_isValid = false;
585 }

Referenced by updateMaintainer().

Here is the caller graph for this function:

◆ addPackageDep()

addPackageDep ( $name,
$version,
$rel,
$optional = 'no' )

Definition at line 740 of file v1.php.

741 {
742 $this->_isValid = false;
743 $dep =
744 array('type' => 'pkg',
745 'name' => $name,
746 'rel' => $rel,
747 'optional' => $optional);
748 if ($rel != 'has' && $rel != 'not') {
749 $dep['version'] = $version;
750 }
751 $this->_packageInfo['release_deps'][] = $dep;
752 }

◆ addPhpDep()

addPhpDep ( $version,
$rel )

Definition at line 731 of file v1.php.

732 {
733 $this->_isValid = false;
734 $this->_packageInfo['release_deps'][] =
735 array('type' => 'php',
736 'rel' => $rel,
737 'version' => $version);
738 }

◆ clearConfigureOptions()

clearConfigureOptions ( )

Definition at line 844 of file v1.php.

845 {
846 unset($this->_packageInfo['configure_options']);
847 }

◆ clearDeps()

clearDeps ( )

Reset dependencies prior to adding new ones

Definition at line 726 of file v1.php.

727 {
728 unset($this->_packageInfo['release_deps']);
729 }

◆ clearMaintainers()

clearMaintainers ( )

Definition at line 563 of file v1.php.

564 {
565 unset($this->_packageInfo['maintainers']);
566 }

◆ deleteMaintainer()

deleteMaintainer ( $handle)

Definition at line 608 of file v1.php.

609 {
610 $found = false;
611 foreach ($this->_packageInfo['maintainers'] as $i => $maintainer) {
612 if ($maintainer['handle'] == $handle) {
613 $found = $i;
614 break;
615 }
616 }
617 if ($found !== false) {
618 unset($this->_packageInfo['maintainers'][$found]);
619 $this->_packageInfo['maintainers'] =
620 array_values($this->_packageInfo['maintainers']);
621 return true;
622 }
623 return false;
624 }

◆ dependsOn()

dependsOn ( $package,
$channel )

Definition at line 799 of file v1.php.

800 {
801 if (strtolower($channel) != 'pear.php.net') {
802 return false;
803 }
804 if (!($deps = $this->getDeps())) {
805 return false;
806 }
807 foreach ($deps as $dep) {
808 if ($dep['type'] != 'pkg') {
809 continue;
810 }
811 if (strtolower($dep['name']) == strtolower($package)) {
812 return true;
813 }
814 }
815 return false;
816 }

References getDeps().

Here is the call graph for this function:

◆ fromArray()

fromArray ( $pinfo)

Definition at line 472 of file v1.php.

473 {
474 $this->_incomplete = false;
475 $this->_packageInfo = $pinfo;
476 }

Referenced by PEAR_PackageFile_Parser_v1\fromV2().

Here is the caller graph for this function:

◆ getArchiveFile()

getArchiveFile ( )

Definition at line 437 of file v1.php.

438 {
439 return $this->_archiveFile;
440 }

References $_archiveFile.

◆ getArray()

getArray ( )

Definition at line 517 of file v1.php.

518 {
519 return $this->_packageInfo;
520 }

References $_packageInfo.

Referenced by toArray().

Here is the caller graph for this function:

◆ getChangelog()

getChangelog ( )

Definition at line 916 of file v1.php.

917 {
918 if (isset($this->_packageInfo['changelog'])) {
919 return $this->_packageInfo['changelog'];
920 }
921 return false;
922 }

◆ getChannel()

getChannel ( )

Definition at line 483 of file v1.php.

484 {
485 return 'pear.php.net';
486 }

◆ getConfigureOptions()

getConfigureOptions ( )

Definition at line 818 of file v1.php.

819 {
820 if (isset($this->_packageInfo['configure_options'])) {
821 return $this->_packageInfo['configure_options'];
822 }
823 return false;
824 }

◆ getDate()

getDate ( )

Definition at line 645 of file v1.php.

646 {
647 if (isset($this->_packageInfo['release_date'])) {
648 return $this->_packageInfo['release_date'];
649 }
650 return false;
651 }

◆ getDefaultGenerator()

& getDefaultGenerator ( )

Get the default xml generator object

Returns
PEAR_PackageFile_Generator_v1

Definition at line 1305 of file v1.php.

1306 {
1307 if (!class_exists('PEAR_PackageFile_Generator_v1')) {
1308 require_once 'PEAR/PackageFile/Generator/v1.php';
1309 }
1310 $a = new PEAR_PackageFile_Generator_v1($this);
1311 return $a;
1312 }

◆ getDependencyGroup()

getDependencyGroup ( $group)

Definition at line 779 of file v1.php.

780 {
781 return false;
782 }

◆ getDeps()

getDeps ( )

Definition at line 715 of file v1.php.

716 {
717 if (isset($this->_packageInfo['release_deps'])) {
718 return $this->_packageInfo['release_deps'];
719 }
720 return false;
721 }

Referenced by dependsOn().

Here is the caller graph for this function:

◆ getDescription()

getDescription ( )

Definition at line 687 of file v1.php.

688 {
689 if (isset($this->_packageInfo['description'])) {
690 return $this->_packageInfo['description'];
691 }
692 return false;
693 }

◆ getDirtree()

getDirtree ( )

Definition at line 459 of file v1.php.

460 {
461 if (isset($this->_packageInfo['dirtree']) && count($this->_packageInfo['dirtree'])) {
462 return $this->_packageInfo['dirtree'];
463 }
464 return false;
465 }

◆ getExtends()

getExtends ( )

Definition at line 498 of file v1.php.

499 {
500 if (isset($this->_packageInfo['extends'])) {
501 return $this->_packageInfo['extends'];
502 }
503 return false;
504 }

◆ getFileContents()

getFileContents ( $file)

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

Parameters
string
Returns
string

Definition at line 1319 of file v1.php.

1320 {
1321 if ($this->_archiveFile == $this->_packageFile) { // unpacked
1322 $dir = dirname($this->_packageFile);
1323 $file = $dir . DIRECTORY_SEPARATOR . $file;
1324 $file = str_replace(array('/', '\\'),
1325 array(DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR), $file);
1326 if (file_exists($file) && is_readable($file)) {
1327 return implode('', file($file));
1328 }
1329 } else { // tgz
1330 if (!class_exists('Archive_Tar')) {
1331 require_once 'Archive/Tar.php';
1332 }
1333 $tar = new Archive_Tar($this->_archiveFile);
1334 $tar->pushErrorHandling(PEAR_ERROR_RETURN);
1335 if ($file != 'package.xml' && $file != 'package2.xml') {
1336 $file = $this->getPackage() . '-' . $this->getVersion() . '/' . $file;
1337 }
1338 $file = $tar->extractInString($file);
1339 $tar->popErrorHandling();
1340 if (PEAR::isError($file)) {
1341 return PEAR::raiseError("Cannot locate file '$file' in archive");
1342 }
1343 return $file;
1344 }
1345 }
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 ( )

Definition at line 880 of file v1.php.

881 {
882 if (isset($this->_packageInfo['filelist'])) {
883 return $this->_packageInfo['filelist'];
884 }
885 return false;
886 }

Referenced by _analyzePhpFiles(), and getInstallationFilelist().

Here is the caller graph for this function:

◆ getInstallationFilelist()

getInstallationFilelist ( )

Definition at line 875 of file v1.php.

876 {
877 return $this->getFilelist();
878 }

References getFilelist().

Here is the call graph for this function:

◆ getInstalledBinary()

getInstalledBinary ( )

Definition at line 398 of file v1.php.

399 {
400 return false;
401 }

◆ getLastInstalledVersion()

getLastInstalledVersion ( )
Returns
string|false

Definition at line 390 of file v1.php.

391 {
392 if (isset($this->_packageInfo['_lastversion'])) {
393 return $this->_packageInfo['_lastversion'];
394 }
395 return false;
396 }

◆ getLicense()

getLicense ( )

Definition at line 659 of file v1.php.

660 {
661 if (isset($this->_packageInfo['release_license'])) {
662 return $this->_packageInfo['release_license'];
663 }
664 return false;
665 }

◆ getMaintainers()

getMaintainers ( )

Definition at line 568 of file v1.php.

569 {
570 if (isset($this->_packageInfo['maintainers'])) {
571 return $this->_packageInfo['maintainers'];
572 }
573 return false;
574 }

◆ getName()

getName ( )

Definition at line 522 of file v1.php.

523 {
524 return $this->getPackage();
525 }

References getPackage().

Here is the call graph for this function:

◆ getNotes()

getNotes ( )

Definition at line 701 of file v1.php.

702 {
703 if (isset($this->_packageInfo['release_notes'])) {
704 return $this->_packageInfo['release_notes'];
705 }
706 return false;
707 }

◆ getPackage()

getPackage ( )

Definition at line 527 of file v1.php.

528 {
529 if (isset($this->_packageInfo['package'])) {
530 return $this->_packageInfo['package'];
531 }
532 return false;
533 }

Referenced by _analyzePhpFiles(), _buildProvidesArray(), getFileContents(), and getName().

Here is the caller graph for this function:

◆ getPackageFile()

getPackageFile ( )

Definition at line 427 of file v1.php.

428 {
429 return isset($this->_packageFile) ? $this->_packageFile : false;
430 }

◆ getPackageType()

getPackageType ( )

Definition at line 432 of file v1.php.

433 {
434 return 'php';
435 }

◆ getPackagexmlVersion()

getPackagexmlVersion ( )

Definition at line 924 of file v1.php.

925 {
926 return '1.0';
927 }

◆ getProvides()

getProvides ( )

Definition at line 849 of file v1.php.

850 {
851 if (isset($this->_packageInfo['provides'])) {
852 return $this->_packageInfo['provides'];
853 }
854 return false;
855 }

◆ getProvidesExtension()

getProvidesExtension ( )

Definition at line 857 of file v1.php.

858 {
859 return false;
860 }

◆ getState()

getState ( )

Definition at line 626 of file v1.php.

627 {
628 if (isset($this->_packageInfo['release_state'])) {
629 return $this->_packageInfo['release_state'];
630 }
631 return false;
632 }

◆ getSummary()

getSummary ( )

Definition at line 673 of file v1.php.

674 {
675 if (isset($this->_packageInfo['summary'])) {
676 return $this->_packageInfo['summary'];
677 }
678 return false;
679 }

◆ getTime()

getTime ( )

Definition at line 493 of file v1.php.

494 {
495 return false;
496 }

◆ getUri()

getUri ( )

Definition at line 488 of file v1.php.

489 {
490 return false;
491 }

◆ getValidationWarnings()

getValidationWarnings ( $purge = true)

Wrapper to PEAR_ErrorStack::getErrors()

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

Definition at line 934 of file v1.php.

935 {
936 return $this->_stack->getErrors($purge);
937 }

◆ getVersion()

getVersion ( )

Definition at line 549 of file v1.php.

550 {
551 if (isset($this->_packageInfo['version'])) {
552 return $this->_packageInfo['version'];
553 }
554 return false;
555 }

Referenced by getFileContents().

Here is the caller graph for this function:

◆ hasConfigureOptions()

hasConfigureOptions ( )

Definition at line 826 of file v1.php.

827 {
828 return isset($this->_packageInfo['configure_options']) &&
829 count($this->_packageInfo['configure_options']);
830 }

◆ hasDeps()

hasDeps ( )

Definition at line 773 of file v1.php.

774 {
775 return isset($this->_packageInfo['release_deps']) &&
776 count($this->_packageInfo['release_deps']);
777 }

◆ initPostinstallScripts()

initPostinstallScripts ( )

Definition at line 408 of file v1.php.

409 {
410 return false;
411 }

◆ installBinary()

installBinary ( $installer)

Definition at line 355 of file v1.php.

356 {
357 return false;
358 }

◆ installedFile()

installedFile ( $file,
$atts )

Definition at line 906 of file v1.php.

907 {
908 if (isset($this->_packageInfo['filelist'][$file])) {
909 $this->_packageInfo['filelist'][$file] =
910 array_merge($this->_packageInfo['filelist'][$file], $atts);
911 } else {
912 $this->_packageInfo['filelist'][$file] = $atts;
913 }
914 }

◆ isCompatible()

isCompatible ( $pf)

Definition at line 784 of file v1.php.

785 {
786 return false;
787 }

◆ isExtension()

isExtension ( $name)

Definition at line 360 of file v1.php.

361 {
362 return false;
363 }

◆ isIncomplete()

isIncomplete ( )

Definition at line 478 of file v1.php.

479 {
480 return $this->_incomplete;
481 }

References $_incomplete.

◆ isSubpackage()

isSubpackage ( $p)

Definition at line 794 of file v1.php.

795 {
796 return false;
797 }

◆ isSubpackageOf()

isSubpackageOf ( $p)

Definition at line 789 of file v1.php.

790 {
791 return $p->isSubpackage($this);
792 }

◆ listPostinstallScripts()

listPostinstallScripts ( )

Definition at line 403 of file v1.php.

404 {
405 return false;
406 }

◆ packageInfo()

packageInfo ( $field)

Definition at line 442 of file v1.php.

443 {
444 if (!is_string($field) || empty($field) ||
445 !isset($this->_packageInfo[$field])) {
446 return false;
447 }
448 return $this->_packageInfo[$field];
449 }

◆ resetDirtree()

resetDirtree ( )

Definition at line 467 of file v1.php.

468 {
469 unset($this->_packageInfo['dirtree']);
470 }

◆ resetFilelist()

resetFilelist ( )

Definition at line 893 of file v1.php.

894 {
895 $this->_packageInfo['filelist'] = array();
896 }

◆ setConfig()

setConfig ( & $config)

Definition at line 365 of file v1.php.

366 {
367 $this->_config = &$config;
368 $this->_registry = &$config->getRegistry();
369 }
$config
Definition pearcmd.php:182

References $config.

Referenced by PEAR_Command_Pickle\_convertPackage(), PEAR_Registry\addPackage(), PEAR_PackageFile_Parser_v1\parse(), and PEAR_Registry\updatePackage().

Here is the caller graph for this function:

◆ setDate()

setDate ( $date)

Definition at line 653 of file v1.php.

654 {
655 $this->_packageInfo['release_date'] = $date;
656 $this->_isValid = false;
657 }

◆ setDeps()

setDeps ( $deps)

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

Definition at line 768 of file v1.php.

769 {
770 $this->_packageInfo['release_deps'] = $deps;
771 }

◆ setDescription()

setDescription ( $desc)

Definition at line 695 of file v1.php.

696 {
697 $this->_packageInfo['description'] = $desc;
698 $this->_isValid = false;
699 }

◆ setDirtree()

setDirtree ( $path)

Definition at line 451 of file v1.php.

452 {
453 if (!isset($this->_packageInfo['dirtree'])) {
454 $this->_packageInfo['dirtree'] = array();
455 }
456 $this->_packageInfo['dirtree'][$path] = true;
457 }

◆ setFileAttribute()

setFileAttribute ( $file,
$attr,
$value )

Definition at line 888 of file v1.php.

889 {
890 $this->_packageInfo['filelist'][$file][$attr] = $value;
891 }

◆ setInstalledAs()

setInstalledAs ( $file,
$path )

Definition at line 898 of file v1.php.

899 {
900 if ($path) {
901 return $this->_packageInfo['filelist'][$file]['installed_as'] = $path;
902 }
903 unset($this->_packageInfo['filelist'][$file]['installed_as']);
904 }

◆ setLastInstalledVersion()

setLastInstalledVersion ( $version)

For saving in the registry.

Set the last version that was installed

Parameters
string

Definition at line 382 of file v1.php.

383 {
384 $this->_packageInfo['_lastversion'] = $version;
385 }

◆ setLicense()

setLicense ( $date)

Definition at line 667 of file v1.php.

668 {
669 $this->_packageInfo['release_license'] = $date;
670 $this->_isValid = false;
671 }

◆ setLogger()

setLogger ( & $logger)

Definition at line 413 of file v1.php.

414 {
415 if ($logger && (!is_object($logger) || !method_exists($logger, 'log'))) {
416 return PEAR::raiseError('Logger must be compatible with PEAR_Common::log');
417 }
418 $this->_logger = &$logger;
419 }

◆ setNotes()

setNotes ( $notes)

Definition at line 709 of file v1.php.

710 {
711 $this->_packageInfo['release_notes'] = $notes;
712 $this->_isValid = false;
713 }

◆ setPackage()

setPackage ( $package)

Definition at line 543 of file v1.php.

544 {
545 $this->_packageInfo['package'] = $package;
546 $this->_isValid = false;
547 }

Referenced by PEAR_Downloader_Package\_detect1().

Here is the caller graph for this function:

◆ setPackagefile()

setPackagefile ( $file,
$archive = false )

Definition at line 421 of file v1.php.

422 {
423 $this->_packageFile = $file;
424 $this->_archiveFile = $archive ? $archive : $file;
425 }

◆ setRawPackage()

setRawPackage ( $package)

WARNING - don't use this unless you know what you are doing

Definition at line 538 of file v1.php.

539 {
540 $this->_packageInfo['package'] = $package;
541 }

◆ setRawState()

setRawState ( $state)

Definition at line 634 of file v1.php.

635 {
636 $this->_packageInfo['release_state'] = $state;
637 }

◆ setRequestedGroup()

setRequestedGroup ( )

Definition at line 371 of file v1.php.

372 {
373 // placeholder
374 }

◆ setState()

setState ( $state)

Definition at line 639 of file v1.php.

640 {
641 $this->_packageInfo['release_state'] = $state;
642 $this->_isValid = false;
643 }

◆ setSummary()

setSummary ( $summary)

Definition at line 681 of file v1.php.

682 {
683 $this->_packageInfo['summary'] = $summary;
684 $this->_isValid = false;
685 }

◆ setVersion()

setVersion ( $version)

Definition at line 557 of file v1.php.

558 {
559 $this->_packageInfo['version'] = $version;
560 $this->_isValid = false;
561 }

◆ toArray()

toArray ( )
Returns
array

Definition at line 509 of file v1.php.

510 {
511 if (!$this->validate(PEAR_VALIDATE_NORMAL)) {
512 return false;
513 }
514 return $this->getArray();
515 }
const PEAR_VALIDATE_NORMAL
Definition Validate.php:20
validate($state=PEAR_VALIDATE_NORMAL, $nofilechecking=false)
Definition v1.php:1057

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

Here is the call graph for this function:

◆ updateMaintainer()

updateMaintainer ( $role,
$handle,
$name,
$email )

Definition at line 587 of file v1.php.

588 {
589 $found = false;
590 if (!isset($this->_packageInfo['maintainers']) ||
591 !is_array($this->_packageInfo['maintainers'])) {
592 return $this->addMaintainer($role, $handle, $name, $email);
593 }
594 foreach ($this->_packageInfo['maintainers'] as $i => $maintainer) {
595 if ($maintainer['handle'] == $handle) {
596 $found = $i;
597 break;
598 }
599 }
600 if ($found !== false) {
601 unset($this->_packageInfo['maintainers'][$found]);
602 $this->_packageInfo['maintainers'] =
603 array_values($this->_packageInfo['maintainers']);
604 }
605 $this->addMaintainer($role, $handle, $name, $email);
606 }
addMaintainer($role, $handle, $name, $email)
Definition v1.php:580

References addMaintainer().

Here is the call graph for this function:

◆ validate()

validate ( $state = PEAR_VALIDATE_NORMAL,
$nofilechecking = false )

Validate XML package definition file.

@access public

Returns
boolean

Definition at line 1057 of file v1.php.

1058 {
1059 if (($this->_isValid & $state) == $state) {
1060 return true;
1061 }
1062 $this->_isValid = true;
1063 $info = $this->_packageInfo;
1064 if (empty($info['package'])) {
1066 $this->_packageName = $pn = 'unknown';
1067 } else {
1068 $this->_packageName = $pn = $info['package'];
1069 }
1070
1071 if (empty($info['summary'])) {
1073 } elseif (strpos(trim($info['summary']), "\n") !== false) {
1075 array('summary' => $info['summary']));
1076 }
1077 if (empty($info['description'])) {
1079 }
1080 if (empty($info['release_license'])) {
1082 }
1083 if (empty($info['version'])) {
1085 }
1086 if (empty($info['release_state'])) {
1088 }
1089 if (empty($info['release_date'])) {
1091 }
1092 if (empty($info['release_notes'])) {
1094 }
1095 if (empty($info['maintainers'])) {
1097 } else {
1098 $haslead = false;
1099 $i = 1;
1100 foreach ($info['maintainers'] as $m) {
1101 if (empty($m['handle'])) {
1103 array('index' => $i));
1104 }
1105 if (empty($m['role'])) {
1107 array('index' => $i, 'roles' => PEAR_Common::getUserRoles()));
1108 } elseif ($m['role'] == 'lead') {
1109 $haslead = true;
1110 }
1111 if (empty($m['name'])) {
1113 array('index' => $i));
1114 }
1115 if (empty($m['email'])) {
1117 array('index' => $i));
1118 }
1119 $i++;
1120 }
1121 if (!$haslead) {
1123 }
1124 }
1125 if (!empty($info['release_deps'])) {
1126 $i = 1;
1127 foreach ($info['release_deps'] as $d) {
1128 if (!isset($d['type']) || empty($d['type'])) {
1130 array('index' => $i, 'types' => PEAR_Common::getDependencyTypes()));
1131 continue;
1132 }
1133 if (!isset($d['rel']) || empty($d['rel'])) {
1135 array('index' => $i, 'rels' => PEAR_Common::getDependencyRelations()));
1136 continue;
1137 }
1138 if (!empty($d['optional'])) {
1139 if (!in_array($d['optional'], array('yes', 'no'))) {
1141 array('index' => $i, 'opt' => $d['optional']));
1142 }
1143 }
1144 if ($d['rel'] != 'has' && $d['rel'] != 'not' && empty($d['version'])) {
1146 array('index' => $i));
1147 } elseif (($d['rel'] == 'has' || $d['rel'] == 'not') && !empty($d['version'])) {
1149 array('index' => $i, 'rel' => $d['rel']));
1150 }
1151 if ($d['type'] == 'php' && !empty($d['name'])) {
1153 array('index' => $i, 'name' => $d['name']));
1154 } elseif ($d['type'] != 'php' && empty($d['name'])) {
1156 array('index' => $i));
1157 }
1158 if ($d['type'] == 'php' && empty($d['version'])) {
1160 array('index' => $i));
1161 }
1162 if (($d['rel'] == 'not') && ($d['type'] == 'php')) {
1164 array('index' => $i));
1165 }
1166 $i++;
1167 }
1168 }
1169 if (!empty($info['configure_options'])) {
1170 $i = 1;
1171 foreach ($info['configure_options'] as $c) {
1172 if (empty($c['name'])) {
1174 array('index' => $i));
1175 }
1176 if (empty($c['prompt'])) {
1178 array('index' => $i));
1179 }
1180 $i++;
1181 }
1182 }
1183 if (empty($info['filelist'])) {
1185 $errors[] = 'no files';
1186 } else {
1187 foreach ($info['filelist'] as $file => $fa) {
1188 if (empty($fa['role'])) {
1190 array('file' => $file, 'roles' => PEAR_Common::getFileRoles()));
1191 continue;
1192 } elseif (!in_array($fa['role'], PEAR_Common::getFileRoles())) {
1194 array('file' => $file, 'role' => $fa['role'], 'roles' => PEAR_Common::getFileRoles()));
1195 }
1196 if (preg_match('~/\.\.?(/|\\z)|^\.\.?/~', str_replace('\\', '/', $file))) {
1197 // file contains .. parent directory or . cur directory references
1199 array('file' => $file));
1200 }
1201 if (isset($fa['install-as']) &&
1202 preg_match('~/\.\.?(/|\\z)|^\.\.?/~',
1203 str_replace('\\', '/', $fa['install-as']))) {
1204 // install-as contains .. parent directory or . cur directory references
1206 array('file' => $file . ' [installed as ' . $fa['install-as'] . ']'));
1207 }
1208 if (isset($fa['baseinstalldir']) &&
1209 preg_match('~/\.\.?(/|\\z)|^\.\.?/~',
1210 str_replace('\\', '/', $fa['baseinstalldir']))) {
1211 // install-as contains .. parent directory or . cur directory references
1213 array('file' => $file . ' [baseinstalldir ' . $fa['baseinstalldir'] . ']'));
1214 }
1215 }
1216 }
1217 if (isset($this->_registry) && $this->_isValid) {
1218 $chan = $this->_registry->getChannel('pear.php.net');
1219 if (PEAR::isError($chan)) {
1220 $this->_validateError(PEAR_PACKAGEFILE_ERROR_CHANNELVAL, $chan->getMessage());
1221 return $this->_isValid = 0;
1222 }
1223 $validator = $chan->getValidationObject();
1224 $validator->setPackageFile($this);
1225 $validator->validate($state);
1226 $failures = $validator->getFailures();
1227 foreach ($failures['errors'] as $error) {
1229 }
1230 foreach ($failures['warnings'] as $warning) {
1232 }
1233 }
1234 if ($this->_isValid && $state == PEAR_VALIDATE_PACKAGING && !$nofilechecking) {
1235 if ($this->_analyzePhpFiles()) {
1236 $this->_isValid = true;
1237 }
1238 }
1239 if ($this->_isValid) {
1240 return $this->_isValid = $state;
1241 }
1242 return $this->_isValid = 0;
1243 }
const PEAR_VALIDATE_PACKAGING
Definition Validate.php:22
static getFileRoles()
Definition Common.php:365
static getDependencyTypes()
Definition Common.php:345
static getDependencyRelations()
Definition Common.php:355
static getUserRoles()
Definition Common.php:325

References $_packageInfo, _analyzePhpFiles(), _validateError(), _validateWarning(), PEAR_Common\getDependencyRelations(), PEAR_Common\getDependencyTypes(), PEAR_Common\getFileRoles(), PEAR_Common\getUserRoles(), PEAR_PACKAGEFILE_ERROR_CHANNELVAL, PEAR_PACKAGEFILE_ERROR_DEPNAME_IGNORED, PEAR_PACKAGEFILE_ERROR_DEPVERSION_IGNORED, PEAR_PACKAGEFILE_ERROR_INVALID_DEPOPTIONAL, PEAR_PACKAGEFILE_ERROR_INVALID_FILENAME, PEAR_PACKAGEFILE_ERROR_INVALID_FILEROLE, PEAR_PACKAGEFILE_ERROR_MULTILINE_SUMMARY, PEAR_PACKAGEFILE_ERROR_NO_CONFNAME, PEAR_PACKAGEFILE_ERROR_NO_CONFPROMPT, PEAR_PACKAGEFILE_ERROR_NO_DATE, PEAR_PACKAGEFILE_ERROR_NO_DEPNAME, PEAR_PACKAGEFILE_ERROR_NO_DEPPHPVERSION, PEAR_PACKAGEFILE_ERROR_NO_DEPREL, PEAR_PACKAGEFILE_ERROR_NO_DEPTYPE, PEAR_PACKAGEFILE_ERROR_NO_DEPVERSION, PEAR_PACKAGEFILE_ERROR_NO_DESCRIPTION, PEAR_PACKAGEFILE_ERROR_NO_FILEROLE, PEAR_PACKAGEFILE_ERROR_NO_FILES, PEAR_PACKAGEFILE_ERROR_NO_LEAD, PEAR_PACKAGEFILE_ERROR_NO_LICENSE, PEAR_PACKAGEFILE_ERROR_NO_MAINTAINERS, PEAR_PACKAGEFILE_ERROR_NO_MAINTEMAIL, PEAR_PACKAGEFILE_ERROR_NO_MAINTHANDLE, PEAR_PACKAGEFILE_ERROR_NO_MAINTNAME, PEAR_PACKAGEFILE_ERROR_NO_MAINTROLE, PEAR_PACKAGEFILE_ERROR_NO_NAME, PEAR_PACKAGEFILE_ERROR_NO_NOTES, PEAR_PACKAGEFILE_ERROR_NO_STATE, PEAR_PACKAGEFILE_ERROR_NO_SUMMARY, PEAR_PACKAGEFILE_ERROR_NO_VERSION, PEAR_PACKAGEFILE_PHP_NO_NOT, PEAR_VALIDATE_NORMAL, and PEAR_VALIDATE_PACKAGING.

Referenced by toArray().

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

Field Documentation

◆ $_archiveFile

$_archiveFile

Definition at line 323 of file v1.php.

Referenced by getArchiveFile().

◆ $_incomplete

$_incomplete = true

Definition at line 342 of file v1.php.

Referenced by isIncomplete().

◆ $_isValid

$_isValid = 0

Definition at line 329 of file v1.php.

Referenced by _analyzePhpFiles().

◆ $_logger

$_logger

Definition at line 302 of file v1.php.

◆ $_packageFile

$_packageFile

Definition at line 316 of file v1.php.

◆ $_packageInfo

$_packageInfo

Definition at line 309 of file v1.php.

Referenced by getArray(), and validate().

◆ $_registry

$_registry

Definition at line 295 of file v1.php.

◆ $_stack

$_stack

Definition at line 288 of file v1.php.


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