19require_once
'PEAR/ErrorStack.php';
20require_once
'PEAR/XMLParser.php';
21require_once
'PEAR/Common.php';
26define(
'PEAR_CHANNELFILE_ERROR_NO_VERSION', 1);
31define(
'PEAR_CHANNELFILE_ERROR_INVALID_VERSION', 2);
36define(
'PEAR_CHANNELFILE_ERROR_NO_XML_EXT', 3);
41define(
'PEAR_CHANNELFILE_ERROR_CANT_MAKE_PARSER', 4);
46define(
'PEAR_CHANNELFILE_ERROR_PARSER_ERROR', 5);
54define(
'PEAR_CHANNELFILE_ERROR_NO_NAME', 6);
58define(
'PEAR_CHANNELFILE_ERROR_INVALID_NAME', 7);
62define(
'PEAR_CHANNELFILE_ERROR_NO_SUMMARY', 8);
66define(
'PEAR_CHANNELFILE_ERROR_MULTILINE_SUMMARY', 9);
70define(
'PEAR_CHANNELFILE_ERROR_NO_HOST', 10);
74define(
'PEAR_CHANNELFILE_ERROR_INVALID_HOST', 11);
78define(
'PEAR_CHANNELFILE_ERROR_INVALID_MIRROR', 21);
82define(
'PEAR_CHANNELFILE_ERROR_INVALID_MIRRORTYPE', 22);
86define(
'PEAR_CHANNELFILE_ERROR_INVALID', 23);
90define(
'PEAR_CHANNELFILE_ERROR_EMPTY_REGEX', 24);
94define(
'PEAR_CHANNELFILE_ERROR_NO_FUNCTIONVERSION', 25);
98define(
'PEAR_CHANNELFILE_ERROR_NO_FUNCTIONNAME', 26);
102define(
'PEAR_CHANNELFILE_ERROR_NOVALIDATE_NAME', 27);
106define(
'PEAR_CHANNELFILE_ERROR_NOVALIDATE_VERSION', 28);
111define(
'PEAR_CHANNELFILE_ERROR_MIRROR_NOT_FOUND', 32);
115define(
'PEAR_CHANNELFILE_ERROR_INVALID_PORT', 33);
119define(
'PEAR_CHANNELFILE_ERROR_NO_STATICVERSION', 34);
123define(
'PEAR_CHANNELFILE_ERROR_NOBASEURLTYPE', 35);
127define(
'PEAR_CHANNELFILE_URI_CANT_MIRROR', 36);
131define(
'PEAR_CHANNELFILE_ERROR_INVALID_SSL', 37);
137$GLOBALS[
'_PEAR_CHANNELS_MIRROR_TYPES'] = array(
'server');
200 $this->_isValid =
false;
212 'While parsing channel.xml, an invalid version number "%version% was passed in, expecting one of %versions%',
214 'No version number found in <channel> tag',
218 'Unable to create XML parser',
222 'Missing channel name',
224 'Invalid channel %tag% "%name%"',
226 'Missing channel summary',
228 'Channel summary should be on one line, but is multi-line',
230 'Missing channel server for %type% server',
232 'Server name "%server%" is invalid for %type% server',
234 'Invalid mirror name "%name%", mirror type %type%',
236 'Invalid mirror type "%type%"',
238 'Cannot generate xml, contents are invalid',
240 'packagenameregex cannot be empty',
242 '%parent% %protocol% function has no version',
244 '%parent% %protocol% function has no name',
246 '%parent% rest baseurl has no type',
248 'Validation package has no name in <validatepackage> tag',
250 'Validation package "%package%" has no version',
252 'Mirror "%mirror%" does not exist',
254 'Port "%port%" must be numeric',
256 '<static> tag must contain version attribute',
258 'The __uri pseudo-channel cannot have mirrors',
260 '%server% has invalid ssl attribute "%ssl%" can only be yes or not present',
270 if (preg_match(
'/<channel\s+version="([0-9]+\.[0-9]+)"/', $data, $channelversion)) {
271 if (!in_array($channelversion[1], $this->_supportedVersions)) {
273 array(
'version' => $channelversion[1]));
277 $result = $parser->parse($data);
281 array(
'error' =>
$result->getMessage()));
287 $this->_channelInfo = $parser->getData();
300 if (!$this->_isValid && !$this->
validate()) {
312 $data, $compatibility =
false, $stackClass =
'PEAR_ErrorStack'
315 $a->_fromArray($data);
316 if (!$a->validate()) {
331 $data, $compatibility =
false, $stackClass =
'PEAR_ErrorStack'
334 $a->_fromArray($data);
344 $this->_channelInfo = $data;
354 return $this->_stack->getErrors($purge);
367 $str = preg_replace(
'/^[\r\n]+/',
'', $str);
369 $indent_len = strspn($str,
" \t");
370 $indent = substr($str, 0, $indent_len);
373 foreach (explode(
"\n", $str) as $line) {
374 if (substr($line, 0, $indent_len) == $indent) {
375 $data .= substr($line, $indent_len) .
"\n";
390 if (!file_exists($descfile) || !is_file($descfile) || !is_readable($descfile) ||
391 (!$fp = fopen($descfile,
'r'))) {
392 require_once
'PEAR.php';
393 return PEAR::raiseError(
"Unable to open $descfile");
399 $data = file_get_contents($descfile);
415 if (is_string($info) && file_exists($info) && strlen($info) < 255) {
416 $tmp = substr($info, -4);
417 if ($tmp ==
'.xml') {
420 $fp = fopen($info,
"r");
421 $test = fread($fp, 5);
423 if ($test ==
"<?xml") {
427 if (PEAR::isError($info)) {
428 require_once
'PEAR.php';
429 return PEAR::raiseError($info);
432 if (is_string($info)) {
447 if (!$this->_isValid && !$this->
validate()) {
451 if (!isset($this->_channelInfo[
'attribs'][
'version'])) {
452 $this->_channelInfo[
'attribs'][
'version'] =
'1.0';
455 $ret =
"<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n";
456 $ret .=
"<channel version=\"" .
457 $channelInfo[
'attribs'][
'version'] .
"\" xmlns=\"http://pear.php.net/channel-1.0\"
458 xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
459 xsi:schemaLocation=\"http://pear.php.net/dtd/channel-"
460 . $channelInfo[
'attribs'][
'version'] .
" http://pear.php.net/dtd/channel-" .
461 $channelInfo[
'attribs'][
'version'] .
".xsd\">
462 <name>$channelInfo[name]</name>
463 <summary>" . htmlspecialchars($channelInfo[
'summary']).
"</summary>
465 if (isset($channelInfo[
'suggestedalias'])) {
466 $ret .=
' <suggestedalias>' . $channelInfo[
'suggestedalias'] .
"</suggestedalias>\n";
468 if (isset($channelInfo[
'validatepackage'])) {
469 $ret .=
' <validatepackage version="' .
470 $channelInfo[
'validatepackage'][
'attribs'][
'version'].
'">' .
471 htmlspecialchars($channelInfo[
'validatepackage'][
'_content']) .
472 "</validatepackage>\n";
474 $ret .=
" <servers>\n";
476 if (isset($channelInfo[
'servers'][
'primary'][
'attribs'][
'ssl'])) {
477 $ret .=
' ssl="' . $channelInfo[
'servers'][
'primary'][
'attribs'][
'ssl'] .
'"';
479 if (isset($channelInfo[
'servers'][
'primary'][
'attribs'][
'port'])) {
480 $ret .=
' port="' . $channelInfo[
'servers'][
'primary'][
'attribs'][
'port'] .
'"';
483 if (isset($channelInfo[
'servers'][
'primary'][
'rest'])) {
484 $ret .= $this->
_makeRestXml($channelInfo[
'servers'][
'primary'][
'rest'],
' ');
486 $ret .=
" </primary>\n";
487 if (isset($channelInfo[
'servers'][
'mirror'])) {
490 $ret .=
" </servers>\n";
491 $ret .=
"</channel>";
492 return str_replace(
"\r",
"\n", str_replace(
"\r\n",
"\n", $ret));
501 $ret = $indent .
"<rest>\n";
502 if (isset($info[
'baseurl']) && !isset($info[
'baseurl'][0])) {
503 $info[
'baseurl'] = array($info[
'baseurl']);
506 if (isset($info[
'baseurl'])) {
507 foreach ($info[
'baseurl'] as $url) {
508 $ret .=
"$indent <baseurl type=\"" . $url[
'attribs'][
'type'] .
"\"";
509 $ret .=
">" . $url[
'_content'] .
"</baseurl>\n";
512 $ret .= $indent .
"</rest>\n";
523 if (!isset($channelInfo[
'servers'][
'mirror'][0])) {
524 $channelInfo[
'servers'][
'mirror'] = array($channelInfo[
'servers'][
'mirror']);
526 foreach ($channelInfo[
'servers'][
'mirror'] as $mirror) {
527 $ret .=
' <mirror host="' . $mirror[
'attribs'][
'host'] .
'"';
528 if (isset($mirror[
'attribs'][
'port'])) {
529 $ret .=
' port="' . $mirror[
'attribs'][
'port'] .
'"';
531 if (isset($mirror[
'attribs'][
'ssl'])) {
532 $ret .=
' ssl="' . $mirror[
'attribs'][
'ssl'] .
'"';
535 if (isset($mirror[
'rest'])) {
536 if (isset($mirror[
'rest'])) {
539 $ret .=
" </mirror>\n";
554 if (!isset($functions[0])) {
555 $functions = array($functions);
557 foreach ($functions as $function) {
558 $ret .=
"$indent<function version=\"" . $function[
'attribs'][
'version'] .
"\"";
560 $ret .=
' uri="' . $function[
'attribs'][
'uri'] .
'"';
562 $ret .=
">" . $function[
'_content'] .
"</function>\n";
575 $this->_stack->push($code,
'error', $params);
576 $this->_isValid =
false;
587 $this->_stack->push($code,
'warning', $params);
598 $this->_isValid =
true;
600 if (empty($info[
'name'])) {
603 if ($info[
'name'] !=
'__uri') {
605 'name' => $info[
'name']));
608 if (empty($info[
'summary'])) {
610 } elseif (strpos(trim($info[
'summary']),
"\n") !==
false) {
612 array(
'summary' => $info[
'summary']));
614 if (isset($info[
'suggestedalias'])) {
617 array(
'tag' =>
'suggestedalias',
'name' =>$info[
'suggestedalias']));
620 if (isset($info[
'localalias'])) {
623 array(
'tag' =>
'localalias',
'name' =>$info[
'localalias']));
626 if (isset($info[
'validatepackage'])) {
627 if (!isset($info[
'validatepackage'][
'_content'])) {
630 if (!isset($info[
'validatepackage'][
'attribs'][
'version'])) {
631 $content = isset($info[
'validatepackage'][
'_content']) ?
632 $info[
'validatepackage'][
'_content'] :
635 array(
'package' => $content));
639 if (isset($info[
'servers'][
'primary'][
'attribs'], $info[
'servers'][
'primary'][
'attribs'][
'port']) &&
640 !is_numeric($info[
'servers'][
'primary'][
'attribs'][
'port'])) {
642 array(
'port' => $info[
'servers'][
'primary'][
'attribs'][
'port']));
645 if (isset($info[
'servers'][
'primary'][
'attribs'], $info[
'servers'][
'primary'][
'attribs'][
'ssl']) &&
646 $info[
'servers'][
'primary'][
'attribs'][
'ssl'] !=
'yes') {
648 array(
'ssl' => $info[
'servers'][
'primary'][
'attribs'][
'ssl'],
649 'server' => $info[
'name']));
652 if (isset($info[
'servers'][
'primary'][
'rest']) &&
653 isset($info[
'servers'][
'primary'][
'rest'][
'baseurl'])) {
656 if (isset($info[
'servers'][
'mirror'])) {
657 if ($this->_channelInfo[
'name'] ==
'__uri') {
660 if (!isset($info[
'servers'][
'mirror'][0])) {
661 $info[
'servers'][
'mirror'] = array($info[
'servers'][
'mirror']);
663 foreach ($info[
'servers'][
'mirror'] as $mirror) {
664 if (!isset($mirror[
'attribs'][
'host'])) {
666 array(
'type' =>
'mirror'));
669 array(
'server' => $mirror[
'attribs'][
'host'],
'type' =>
'mirror'));
671 if (isset($mirror[
'attribs'][
'ssl']) && $mirror[
'attribs'][
'ssl'] !=
'yes') {
673 array(
'ssl' => $info[
'ssl'],
'server' => $mirror[
'attribs'][
'host']));
675 if (isset($mirror[
'rest'])) {
677 $mirror[
'attribs'][
'host']);
691 if (!isset($functions[0])) {
692 $functions = array($functions);
695 foreach ($functions as $function) {
696 if (!isset($function[
'_content']) || empty($function[
'_content'])) {
698 array(
'parent' => $parent,
'protocol' => $protocol));
701 if ($protocol ==
'rest') {
702 if (!isset($function[
'attribs'][
'type']) ||
703 empty($function[
'attribs'][
'type'])) {
705 array(
'parent' => $parent,
'protocol' => $protocol));
708 if (!isset($function[
'attribs'][
'version']) ||
709 empty($function[
'attribs'][
'version'])) {
711 array(
'parent' => $parent,
'protocol' => $protocol));
724 if ($server ==
'__uri') {
735 if (isset($this->_channelInfo[
'name'])) {
736 return $this->_channelInfo[
'name'];
747 if (isset($this->_channelInfo[
'name'])) {
748 return $this->_channelInfo[
'name'];
761 if (isset($mir[
'attribs'][
'port'])) {
762 return $mir[
'attribs'][
'port'];
765 if ($this->
getSSL($mirror)) {
775 if (isset($this->_channelInfo[
'servers'][
'primary'][
'attribs'][
'port'])) {
776 return $this->_channelInfo[
'servers'][
'primary'][
'attribs'][
'port'];
793 if (isset($mir[
'attribs'][
'ssl'])) {
803 if (isset($this->_channelInfo[
'servers'][
'primary'][
'attribs'][
'ssl'])) {
815 if (isset($this->_channelInfo[
'summary'])) {
816 return $this->_channelInfo[
'summary'];
829 if ($this->
getName() ==
'__uri') {
833 $function = $protocol ==
'rest' ?
'baseurl' :
'function';
836 if (isset($mir[$protocol][$function])) {
837 return $mir[$protocol][$function];
844 if (isset($this->_channelInfo[
'servers'][
'primary'][$protocol][$function])) {
845 return $this->_channelInfo[
'servers'][
'primary'][$protocol][$function];
865 foreach ($protocols as $protocol) {
866 if ($name ===
null) {
870 if ($protocol[
'_content'] != $name) {
887 function supports($type, $name =
null, $mirror =
false, $version =
'1.0')
894 foreach ($protocols as $protocol) {
895 if ($protocol[
'attribs'][
'version'] != $version) {
899 if ($name ===
null) {
903 if ($protocol[
'_content'] != $name) {
921 if ($mirror == $this->_channelInfo[
'name']) {
927 return isset($mir[
'rest']);
933 return isset($this->_channelInfo[
'servers'][
'primary'][
'rest']);
945 if ($mirror == $this->_channelInfo[
'name']) {
955 $rest = $mir[
'rest'];
957 $rest = $this->_channelInfo[
'servers'][
'primary'][
'rest'];
960 if (!isset($rest[
'baseurl'][0])) {
961 $rest[
'baseurl'] = array($rest[
'baseurl']);
964 foreach ($rest[
'baseurl'] as $baseurl) {
965 if (strtolower($baseurl[
'attribs'][
'type']) == strtolower($resourceType)) {
966 return $baseurl[
'_content'];
991 if (isset($this->_channelInfo[
'servers'][
'mirror'])) {
992 $mirrors = $this->_channelInfo[
'servers'][
'mirror'];
993 if (!isset($mirrors[0])) {
994 $mirrors = array($mirrors);
997 foreach ($mirrors as $i => $mir) {
998 if ($mir[
'attribs'][
'host'] == $mirror) {
999 if (isset($this->_channelInfo[
'servers'][
'mirror'][$i][$type])) {
1000 unset($this->_channelInfo[
'servers'][
'mirror'][$i][$type]);
1013 if (isset($this->_channelInfo[
'servers'][
'primary'][$type])) {
1014 unset($this->_channelInfo[
'servers'][
'primary'][$type]);
1029 if (!isset($this->_channelInfo[
'servers'])) {
1030 $this->_channelInfo[
'servers'] = array(
'primary' =>
1031 array(
'rest' => array()));
1032 } elseif (!isset($this->_channelInfo[
'servers'][
'primary'])) {
1033 $this->_channelInfo[
'servers'][
'primary'] = array(
'rest' => array());
1049 if (isset($this->_channelInfo[
'servers'][
'mirror'])) {
1050 $mirrors = $this->_channelInfo[
'servers'][
'mirror'];
1051 if (!isset($mirrors[0])) {
1052 $mirrors = array($mirrors);
1068 if ($mirror[
'attribs'][
'host'] == $server) {
1095 if (!isset($this->_channelInfo[
'servers'][
'mirror'])) {
1097 array(
'mirror' => $mirror));
1101 if (isset($this->_channelInfo[
'servers'][
'mirror'][0])) {
1102 foreach ($this->_channelInfo[
'servers'][
'mirror'] as $i => $mir) {
1103 if ($mirror == $mir[
'attribs'][
'host']) {
1104 $this->_channelInfo[
'servers'][
'mirror'][$i][
'attribs'][
'port'] =
$port;
1110 } elseif ($this->_channelInfo[
'servers'][
'mirror'][
'attribs'][
'host'] == $mirror) {
1111 $this->_channelInfo[
'servers'][
'mirror'][
'attribs'][
'port'] =
$port;
1112 $this->_isValid =
false;
1117 $this->_channelInfo[
'servers'][
'primary'][
'attribs'][
'port'] =
$port;
1118 $this->_isValid =
false;
1127 function setSSL($ssl =
true, $mirror =
false)
1130 if (!isset($this->_channelInfo[
'servers'][
'mirror'])) {
1132 array(
'mirror' => $mirror));
1136 if (isset($this->_channelInfo[
'servers'][
'mirror'][0])) {
1137 foreach ($this->_channelInfo[
'servers'][
'mirror'] as $i => $mir) {
1138 if ($mirror == $mir[
'attribs'][
'host']) {
1140 if (isset($this->_channelInfo[
'servers'][
'mirror'][$i]
1141 [
'attribs'][
'ssl'])) {
1142 unset($this->_channelInfo[
'servers'][
'mirror'][$i][
'attribs'][
'ssl']);
1145 $this->_channelInfo[
'servers'][
'mirror'][$i][
'attribs'][
'ssl'] =
'yes';
1153 } elseif ($this->_channelInfo[
'servers'][
'mirror'][
'attribs'][
'host'] == $mirror) {
1155 if (isset($this->_channelInfo[
'servers'][
'mirror'][
'attribs'][
'ssl'])) {
1156 unset($this->_channelInfo[
'servers'][
'mirror'][
'attribs'][
'ssl']);
1159 $this->_channelInfo[
'servers'][
'mirror'][
'attribs'][
'ssl'] =
'yes';
1162 $this->_isValid =
false;
1168 $this->_channelInfo[
'servers'][
'primary'][
'attribs'][
'ssl'] =
'yes';
1170 if (isset($this->_channelInfo[
'servers'][
'primary'][
'attribs'][
'ssl'])) {
1171 unset($this->_channelInfo[
'servers'][
'primary'][
'attribs'][
'ssl']);
1175 $this->_isValid =
false;
1187 if (empty($server)) {
1192 array(
'tag' =>
'name',
'name' => $server));
1198 foreach ($this->_channelInfo[
'servers'][
'mirror'] as $i => $mir) {
1199 if ($mirror == $mir[
'attribs'][
'host']) {
1207 array(
'mirror' => $mirror));
1211 $this->_channelInfo[
'mirror'][$i][
'attribs'][
'host'] = $server;
1215 $this->_channelInfo[
'name'] = $server;
1227 if (empty($summary)) {
1230 } elseif (strpos(trim($summary),
"\n") !==
false) {
1232 array(
'summary' => $summary));
1235 $this->_channelInfo[
'summary'] = $summary;
1248 array(
'tag' =>
'suggestedalias',
'name' => $alias));
1253 $this->_channelInfo[
'localalias'] = $alias;
1255 $this->_channelInfo[
'suggestedalias'] = $alias;
1266 if (isset($this->_channelInfo[
'localalias'])) {
1267 return $this->_channelInfo[
'localalias'];
1269 if (isset($this->_channelInfo[
'suggestedalias'])) {
1270 return $this->_channelInfo[
'suggestedalias'];
1272 if (isset($this->_channelInfo[
'name'])) {
1273 return $this->_channelInfo[
'name'];
1287 if (empty($validateclass)) {
1288 unset($this->_channelInfo[
'validatepackage']);
1290 $this->_channelInfo[
'validatepackage'] = array(
'_content' => $validateclass);
1291 $this->_channelInfo[
'validatepackage'][
'attribs'] = array(
'version' => $version);
1308 $set = array(
'attribs' => array(
'version' => $version),
'_content' => $name);
1309 if (!isset($this->_channelInfo[
'servers'][
'primary'][$type][
'function'])) {
1310 if (!isset($this->_channelInfo[
'servers'])) {
1311 $this->_channelInfo[
'servers'] = array(
'primary' =>
1312 array($type => array()));
1313 } elseif (!isset($this->_channelInfo[
'servers'][
'primary'])) {
1314 $this->_channelInfo[
'servers'][
'primary'] = array($type => array());
1317 $this->_channelInfo[
'servers'][
'primary'][$type][
'function'] = $set;
1318 $this->_isValid =
false;
1320 } elseif (!isset($this->_channelInfo[
'servers'][
'primary'][$type][
'function'][0])) {
1321 $this->_channelInfo[
'servers'][
'primary'][$type][
'function'] = array(
1322 $this->_channelInfo[
'servers'][
'primary'][$type][
'function']);
1325 $this->_channelInfo[
'servers'][
'primary'][$type][
'function'][] = $set;
1337 if (!isset($this->_channelInfo[
'servers'][
'mirror'])) {
1339 array(
'mirror' => $mirror));
1344 if (isset($this->_channelInfo[
'servers'][
'mirror'][0])) {
1345 foreach ($this->_channelInfo[
'servers'][
'mirror'] as $i => $mir) {
1346 if ($mirror == $mir[
'attribs'][
'host']) {
1347 $setmirror = &$this->_channelInfo[
'servers'][
'mirror'][$i];
1352 if ($this->_channelInfo[
'servers'][
'mirror'][
'attribs'][
'host'] == $mirror) {
1353 $setmirror = &$this->_channelInfo[
'servers'][
'mirror'];
1359 array(
'mirror' => $mirror));
1363 $set = array(
'attribs' => array(
'version' => $version),
'_content' => $name);
1364 if (!isset($setmirror[$type][
'function'])) {
1365 $setmirror[$type][
'function'] = $set;
1366 $this->_isValid =
false;
1368 } elseif (!isset($setmirror[$type][
'function'][0])) {
1369 $setmirror[$type][
'function'] = array($setmirror[$type][
'function']);
1372 $setmirror[$type][
'function'][] = $set;
1373 $this->_isValid =
false;
1385 if (!isset($this->_channelInfo[
'servers'][
'mirror'])) {
1387 array(
'mirror' => $mirror));
1392 if (isset($this->_channelInfo[
'servers'][
'mirror'][0])) {
1393 foreach ($this->_channelInfo[
'servers'][
'mirror'] as $i => $mir) {
1394 if ($mirror == $mir[
'attribs'][
'host']) {
1395 $setmirror = &$this->_channelInfo[
'servers'][
'mirror'][$i];
1400 if ($this->_channelInfo[
'servers'][
'mirror'][
'attribs'][
'host'] == $mirror) {
1401 $setmirror = &$this->_channelInfo[
'servers'][
'mirror'];
1405 $setmirror = &$this->_channelInfo[
'servers'][
'primary'];
1408 $set = array(
'attribs' => array(
'type' => $resourceType),
'_content' => $url);
1409 if (!isset($setmirror[
'rest'])) {
1410 $setmirror[
'rest'] = array();
1413 if (!isset($setmirror[
'rest'][
'baseurl'])) {
1414 $setmirror[
'rest'][
'baseurl'] = $set;
1415 $this->_isValid =
false;
1417 } elseif (!isset($setmirror[
'rest'][
'baseurl'][0])) {
1418 $setmirror[
'rest'][
'baseurl'] = array($setmirror[
'rest'][
'baseurl']);
1421 foreach ($setmirror[
'rest'][
'baseurl'] as $i => $url) {
1422 if ($url[
'attribs'][
'type'] == $resourceType) {
1423 $this->_isValid =
false;
1424 $setmirror[
'rest'][
'baseurl'][$i] = $set;
1429 $setmirror[
'rest'][
'baseurl'][] = $set;
1430 $this->_isValid =
false;
1441 if ($this->_channelInfo[
'name'] ==
'__uri') {
1445 $set = array(
'attribs' => array(
'host' => $server));
1446 if (is_numeric(
$port)) {
1447 $set[
'attribs'][
'port'] =
$port;
1450 if (!isset($this->_channelInfo[
'servers'][
'mirror'])) {
1451 $this->_channelInfo[
'servers'][
'mirror'] = $set;
1455 if (!isset($this->_channelInfo[
'servers'][
'mirror'][0])) {
1456 $this->_channelInfo[
'servers'][
'mirror'] =
1457 array($this->_channelInfo[
'servers'][
'mirror']);
1460 $this->_channelInfo[
'servers'][
'mirror'][] = $set;
1470 if (!$this->_isValid && !$this->
validate()) {
1474 if (!isset($this->_channelInfo[
'validatepackage'])) {
1475 return array(
'attribs' => array(
'version' =>
'default'),
1476 '_content' =>
'PEAR_Validate');
1479 return $this->_channelInfo[
'validatepackage'];
1491 if (!class_exists(
'PEAR_Validate')) {
1492 require_once
'PEAR/Validate.php';
1495 if (!$this->_isValid) {
1502 if (isset($this->_channelInfo[
'validatepackage'])) {
1503 if ($package == $this->_channelInfo[
'validatepackage']) {
1509 if (!class_exists(str_replace(
'.',
'_',
1510 $this->_channelInfo[
'validatepackage'][
'_content']))) {
1512 $this->_channelInfo[
'validatepackage'][
'_content']) .
'.php')) {
1513 include_once str_replace(
'_',
'/',
1514 $this->_channelInfo[
'validatepackage'][
'_content']) .
'.php';
1515 $vclass = str_replace(
'.',
'_',
1516 $this->_channelInfo[
'validatepackage'][
'_content']);
1523 $vclass = str_replace(
'.',
'_',
1524 $this->_channelInfo[
'validatepackage'][
'_content']);
1536 $possibilities = explode(PATH_SEPARATOR, ini_get(
'include_path'));
1537 foreach ($possibilities as $dir) {
1538 if (file_exists($dir . DIRECTORY_SEPARATOR . $path)
1539 && is_readable($dir . DIRECTORY_SEPARATOR . $path)) {
1554 if (isset($this->_channelInfo[
'_lastmodified'])) {
1555 return $this->_channelInfo[
'_lastmodified'];
const PEAR_CHANNELFILE_ERROR_INVALID_VERSION
const PEAR_CHANNELFILE_ERROR_CANT_MAKE_PARSER
const PEAR_CHANNELFILE_ERROR_NOVALIDATE_NAME
const PEAR_CHANNELFILE_ERROR_INVALID_SSL
const PEAR_CHANNELFILE_ERROR_INVALID_NAME
const PEAR_CHANNELFILE_ERROR_EMPTY_REGEX
const PEAR_CHANNELFILE_ERROR_MULTILINE_SUMMARY
const PEAR_CHANNELFILE_ERROR_INVALID_MIRRORTYPE
const PEAR_CHANNELFILE_ERROR_NO_FUNCTIONVERSION
const PEAR_CHANNELFILE_ERROR_NOBASEURLTYPE
const PEAR_CHANNELFILE_ERROR_MIRROR_NOT_FOUND
const PEAR_CHANNELFILE_ERROR_NO_STATICVERSION
const PEAR_CHANNELFILE_ERROR_NO_FUNCTIONNAME
const PEAR_CHANNELFILE_ERROR_NO_HOST
const PEAR_CHANNELFILE_ERROR_INVALID_HOST
const PEAR_CHANNELFILE_ERROR_NO_SUMMARY
const PEAR_CHANNELFILE_ERROR_INVALID_MIRROR
const PEAR_CHANNELFILE_ERROR_NOVALIDATE_VERSION
const PEAR_CHANNELFILE_ERROR_INVALID_PORT
const PEAR_CHANNELFILE_ERROR_PARSER_ERROR
const PEAR_CHANNELFILE_ERROR_NO_VERSION
const PEAR_CHANNELFILE_ERROR_NO_NAME
const PEAR_CHANNELFILE_URI_CANT_MIRROR
const PEAR_CHANNELFILE_ERROR_NO_XML_EXT
const PEAR_CHANNELFILE_ERROR_INVALID
const PEAR_CHANNELS_SERVER_PREG
$GLOBALS['_PEAR_default_error_mode']
getFunction($type, $name=null, $mirror=false)
setValidationPackage($validateclass, $version)
_makeFunctionsXml($functions, $indent, $rest=false)
& getValidationObject($package=false)
static & fromArray( $data, $compatibility=false, $stackClass='PEAR_ErrorStack')
setServer($server, $mirror=false)
supportsREST($mirror=false)
supports($type, $name=null, $mirror=false, $version='1.0')
setAlias($alias, $local=false)
_makeRestXml($info, $indent)
setDefaultPEARProtocols($version='1.0', $mirror=false)
getBaseURL($resourceType, $mirror=false)
setPort($port, $mirror=false)
_makeMirrorsXml($channelInfo)
_validateError($code, $params=array())
setSSL($ssl=true, $mirror=false)
addMirrorFunction($mirror, $type, $version, $name='')
addFunction($type, $version, $name='', $mirror=false)
setBaseURL($resourceType, $url, $mirror=false)
_validateFunctions($protocol, $functions, $parent='')
addMirror($server, $port=null)
_validateWarning($code, $params=array())
getFunctions($protocol, $mirror=false)
static & fromArrayWithErrors( $data, $compatibility=false, $stackClass='PEAR_ErrorStack')
resetFunctions($type, $mirror=false)
validChannelServer($server)