diff options
| author | Stig Bakken <ssb@php.net> | 2001-10-30 12:29:55 +0000 |
|---|---|---|
| committer | Stig Bakken <ssb@php.net> | 2001-10-30 12:29:55 +0000 |
| commit | 3a97065f8717679147f7df06bd927d9a110cec48 (patch) | |
| tree | 67d343c765a1803ca7f4bb49aaccb8e3352e4760 /pear/PEAR/Packager.php | |
| parent | 9a8854b5b1fae635c9bdefa7dac70ba6e8db65bd (diff) | |
| download | php-git-3a97065f8717679147f7df06bd927d9a110cec48.tar.gz | |
* disable case-folding in the xml parser (for consistency now that the
DTD is all lowercase)
Diffstat (limited to 'pear/PEAR/Packager.php')
| -rw-r--r-- | pear/PEAR/Packager.php | 172 |
1 files changed, 0 insertions, 172 deletions
diff --git a/pear/PEAR/Packager.php b/pear/PEAR/Packager.php index f07764a818..8ad7ea1972 100644 --- a/pear/PEAR/Packager.php +++ b/pear/PEAR/Packager.php @@ -173,178 +173,6 @@ class PEAR_Packager extends PEAR_Common return $dest_package; } - /* XXXX REMOVEME: this is the old code - function _package($pkgfile = "package.xml") - { - $pwd = getcwd(); - $fp = @fopen($pkgfile, "r"); - if (!is_resource($fp)) { - return $this->raiseError($php_errormsg); - } - - $xp = xml_parser_create(); - if (!$xp) { - return $this->raiseError("Unable to create XML parser."); - } - xml_set_object($xp, $this); - xml_set_element_handler($xp, "startHandler", "endHandler"); - xml_set_character_data_handler($xp, "charHandler"); - xml_parser_set_option($xp, XML_OPTION_CASE_FOLDING, false); - xml_parser_set_option($xp, XML_OPTION_TARGET_ENCODING, "UTF-8"); - - $this->element_stack = array(); - $this->pkginfo = array(); - $this->current_element = false; - - $data = fread($fp, filesize($pkgfile)); - fclose($fp); - if (!xml_parse($xp, $data, true)) { - $msg = sprintf("XML error: %s at line %d", - xml_error_string(xml_get_error_code($xp)), - xml_get_current_line_number($xp)); - xml_parser_free($xp); - return $this->raiseError($msg); - } - xml_parser_free($xp); - - $pkginfofile = $this->tmpdir . DIRECTORY_SEPARATOR . "package.xml"; - $fp = fopen($pkginfofile, "w"); - if (!is_resource($fp)) { - return $this->raiseError("Could not create $pkginfofile: $php_errormsg"); - } - - $this->filelist = preg_replace('/^[\r\n]+\s+/', ' ', $this->filelist); - $this->filelist = preg_replace('/\n\s+/', "\n ", $this->filelist); - $this->filelist = preg_replace('/\n\s+$/', "", $this->filelist); - - fputs($fp, "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n". - "<!DOCTYPE Package PUBLIC \"-//PHP Group//DTD PEAR Package 1.0//EN//XML\" \"http://php.net/pear/package.dtd\">\n". - "<Package Type=\"Source\">\n". - " <Name>".$this->pkginfo["Package,Name"]."</Name>\n". - " <Summary>".$this->pkginfo["Package,Summary"]."</Summary>\n". - " <Maintainer>\n". - " <Initials>".$this->pkginfo["Maintainer,Initials"]."</Initials>\n". - " <Name>".$this->pkginfo["Maintainer,Name"]."</Name>\n". - " <Email>".$this->pkginfo["Maintainer,Email"]."</Email>\n". - " </Maintainer>\n". - " <Release>\n". - " <Version>".$this->pkginfo["Release,Version"]."</Version>\n". - " <Date>".$this->pkginfo["Release,Date"]."</Date>\n". - " <Notes>".$this->pkginfo["Release,Notes"]."</Notes>\n". - " </Release>\n". - " <FileList>\n". - "$this->filelist\n". - " </FileList>\n". - "</Package>\n"); - fclose($fp); - chdir(dirname($this->tmpdir)); - // XXX FIXME Windows and non-GNU tar - $pkgver = $this->pkgver; - $cmd = "tar -cvzf $pwd/${pkgver}.tgz $pkgver"; - $this->log(1, `$cmd`); - $this->log(1, "Package $pwd/${pkgver}.tgz done"); - } - - // }}} - - // {{{ startHandler() - - function startHandler($xp, $name, $attribs) - { - array_push($this->element_stack, $name); - $this->current_element = $name; - $this->current_attributes = $attribs; - $this->tmpdata = ''; - if ($this->recordfilelist) { - $this->filelist .= "<$name"; - foreach ($attribs as $k => $v) { - $this->filelist .= " $k=\"$v\""; - } - $this->filelist .= ">"; - } - switch ($name) { - case "Package": - if ($attribs["Type"]) { - // warning - } - break; - case "FileList": - // XXX FIXME Windows - $this->recordfilelist = true; - $pwd = getcwd(); - $this->pkgver = $this->pkginfo["Package,Name"] . "-" . - $this->pkginfo["Release,Version"]; - // don't want extrange characters - $this->pkgver = ereg_replace ("[^a-zA-Z0-9._-]", '_', $this->pkgver); - $this->tmpdir = $pwd . DIRECTORY_SEPARATOR . $this->pkgver; - if (file_exists($this->tmpdir)) { - xml_parser_free($xp); - $this->raiseError("$this->tmpdir already exists", - null, PEAR_ERROR_TRIGGER, - E_USER_ERROR); - } - if (!mkdir($this->tmpdir, 0755)) { - xml_parser_free($xp); - $this->raiseError("Unable to create temporary directory $this->tmpdir.", - null, PEAR_ERROR_TRIGGER, - E_USER_ERROR); - } - $this->_tempfiles[] = $this->tmpdir; - break; - } - } - - // }}} - // {{{ endHandler() - - function endHandler($xp, $name) - { - array_pop($this->element_stack); - $this->current_element = $this->element_stack[sizeof($this->element_stack)-1]; - switch ($name) { - case "FileList": - $this->recordfilelist = false; - break; - } - if ($this->recordfilelist) { - $this->filelist .= "</$name>"; - } - } - - // }}} - // {{{ charHandler() - - function charHandler($xp, $data) - { - if ($this->recordfilelist) { - $this->filelist .= $data; - } - switch ($this->current_element) { - case "Dir": - break; - case "File": - $file = "$this->tmpdir/$data"; - $dir = dirname($file); - if (!is_dir($dir)) { - if (!$this->mkDirHier($dir)) { - $this->log(0, "could not mkdir $dir"); - break; - } - } - if (!@copy($data, $file)) { - $this->log(0, "could not copy $data to $file"); - } - // fall through - default: - $data = trim($data); - if ($data) { - $id = implode(",", array_slice($this->element_stack, -2)); - $this->pkginfo[$id] = $data; - } - break; - } - } - */ // }}} } |
