]> granicus.if.org Git - php/commitdiff
* fixes to make package.xml parsing case insensitive
authorStig Bakken <ssb@php.net>
Mon, 27 Aug 2001 21:25:16 +0000 (21:25 +0000)
committerStig Bakken <ssb@php.net>
Mon, 27 Aug 2001 21:25:16 +0000 (21:25 +0000)
pear/PEAR/Common.php
pear/PEAR/Installer.php
pear/PEAR/WebInstaller.php

index 412fe56d645d8b17bb358fc69ba29d51369bb58c..584eb42d2bc04e628aee24b9e73621804f748974 100644 (file)
@@ -133,29 +133,29 @@ class PEAR_Common extends PEAR
         $this->prev_element    = $this->element_stack[sizeof($this->element_stack)-2];
         $this->current_attributes = $attribs;
         switch ($name) {
-            case 'Dir':
+            case 'DIR':
                 if (isset($this->dir_names)) {
-                    $this->dir_names[] = $attribs['Name'];
+                    $this->dir_names[] = $attribs['NAME'];
                 } else {
                     // Don't add the root dir
                     $this->dir_names = array();
                 }
-                if (isset($attribs['BaseInstallDir'])) {
-                    $this->dir_install = $attribs['BaseInstallDir'];
+                if (isset($attribs['BASEINSTALLDIR'])) {
+                    $this->dir_install = $attribs['BASEINSTALLDIR'];
                 }
-                if (isset($attribs['Role'])) {
-                    $this->dir_role = $attribs['Role'];
+                if (isset($attribs['ROLE'])) {
+                    $this->dir_role = $attribs['ROLE'];
                 }
                 break;
-            case 'LibFile':
+            case 'LIBFILE':
                 $this->lib_atts = $attribs;
-                $this->lib_atts['Role'] = 'extension';
+                $this->lib_atts['ROLE'] = 'extension';
                 break;
-            case 'Maintainers':
+            case 'MAINTAINERS':
                 $this->pkginfo['maintainers'] = array();
                 $this->m_i = 0; // maintainers array index
                 break;
-            case 'Maintainer':
+            case 'MAINTAINER':
                 // compatibility check
                 if (!isset($this->pkginfo['maintainers'])) {
                     $this->pkginfo['maintainers'] = array();
@@ -164,12 +164,12 @@ class PEAR_Common extends PEAR
                 $this->pkginfo['maintainers'][$this->m_i] = array();
                 $this->current_maintainer =& $this->pkginfo['maintainers'][$this->m_i];
                 break;
-            case 'Changelog':
+            case 'CHANGELOG':
                 $this->pkginfo['changelog'] = array();
                 $this->c_i = 0; // changelog array index
                 $this->in_changelog = true;
                 break;
-            case 'Release':
+            case 'RELEASE':
                 if ($this->in_changelog) {
                     $this->pkginfo['changelog'][$this->c_i] = array();
                     $this->current_release =& $this->pkginfo['changelog'][$this->c_i];
@@ -184,12 +184,12 @@ class PEAR_Common extends PEAR
     function _element_end($xp, $name)
     {
         switch ($name) {
-            case 'Dir':
+            case 'DIR':
                 array_pop($this->dir_names);
                 unset($this->dir_install);
                 unset($this->dir_role);
                 break;
-            case 'File':
+            case 'FILE':
                 $path = '';
                 foreach ($this->dir_names as $dir) {
                     $path .= $dir . DIRECTORY_SEPARATOR;
@@ -197,17 +197,17 @@ class PEAR_Common extends PEAR
                 $path .= $this->current_file;
                 $this->filelist[$path] = $this->current_attributes;
                 // Set the baseinstalldir only if the file don't have this attrib
-                if (!isset($this->filelist[$path]['BaseInstallDir']) &&
+                if (!isset($this->filelist[$path]['BASEINSTALLDIR']) &&
                     isset($this->dir_install))
                 {
-                    $this->filelist[$path]['BaseInstallDir'] = $this->dir_install;
+                    $this->filelist[$path]['BASEINSTALLDIR'] = $this->dir_install;
                 }
                 // Set the Role
-                if (!isset($this->filelist[$path]['Role']) && isset($this->dir_role)) {
-                    $this->filelist[$path]['Role'] = $this->dir_role;
+                if (!isset($this->filelist[$path]['ROLE']) && isset($this->dir_role)) {
+                    $this->filelist[$path]['ROLE'] = $this->dir_role;
                 }
                 break;
-            case 'LibFile':
+            case 'LIBFILE':
                 $path = '';
                 foreach ($this->dir_names as $dir) {
                     $path .= $dir . DIRECTORY_SEPARATOR;
@@ -215,10 +215,10 @@ class PEAR_Common extends PEAR
                 $path .= $this->lib_name;
                 $this->filelist[$path] = $this->lib_atts;
                 // Set the baseinstalldir only if the file don't have this attrib
-                if (!isset($this->filelist[$path]['BaseInstallDir']) &&
+                if (!isset($this->filelist[$path]['BASEINSTALLDIR']) &&
                     isset($this->dir_install))
                 {
-                    $this->filelist[$path]['BaseInstallDir'] = $this->dir_install;
+                    $this->filelist[$path]['BASEINSTALLDIR'] = $this->dir_install;
                 }
                 if (isset($this->lib_sources)) {
                     $this->filelist[$path]['sources'] = $this->lib_sources;
@@ -226,15 +226,15 @@ class PEAR_Common extends PEAR
                 unset($this->lib_atts);
                 unset($this->lib_sources);
                 break;
-            case 'Maintainer':
+            case 'MAINTAINER':
                 $this->m_i++;
                 break;
-            case 'Release':
+            case 'RELEASE':
                 if ($this->in_changelog) {
                     $this->c_i++;
                 }
                 break;
-            case 'Changelog':
+            case 'CHANGELOG':
                 $this->in_changelog = false;
         }
         array_pop($this->element_stack);
@@ -247,54 +247,54 @@ class PEAR_Common extends PEAR
     function _pkginfo_cdata($xp, $data)
     {
         switch ($this->current_element) {
-            case 'Name':
+            case 'NAME':
                 switch ($this->prev_element) {
-                    case 'Package':
+                    case 'PACKAGE':
                         $this->pkginfo['package'] .= $data;
                         break;
-                    case 'Maintainer':
+                    case 'MAINTAINER':
                         $this->current_maintainer['name'] .= $data;
                         break;
                 }
                 break;
-            case 'Summary':
+            case 'SUMMARY':
                 $this->pkginfo['summary'] .= $data;
                 break;
-            case 'Initials':
+            case 'INITIALS':
                 $this->current_maintainer['handle'] .= $data;
                 break;
-            case 'Email':
+            case 'EMAIL':
                 $this->current_maintainer['email'] .= $data;
                 break;
-            case 'Role':
+            case 'ROLE':
                 if (!in_array($data, $this->maintainer_roles)) {
                     trigger_error("The maintainer role: '$data' is not valid", E_USER_WARNING);
                 } else {
                     $this->current_maintainer['role'] .= $data;
                 }
                 break;
-            case 'Version':
+            case 'VERSION':
                 if ($this->in_changelog) {
                     $this->current_release['version'] .= $data;
                 } else {
                     $this->pkginfo['version'] .= $data;
                 }
                 break;
-            case 'Date':
+            case 'DATE':
                 if ($this->in_changelog) {
                     $this->current_release['release_date'] .= $data;
                 } else {
                     $this->pkginfo['release_date'] .= $data;
                 }
                 break;
-            case 'Notes':
+            case 'NOTES':
                 if ($this->in_changelog) {
                     $this->current_release['release_notes'] .= $data;
                 } else {
                     $this->pkginfo['release_notes'] .= $data;
                 }
                 break;
-            case 'State':
+            case 'STATE':
                 if (!in_array($data, $this->releases_states)) {
                     trigger_error("The release state: '$data' is not valid", E_USER_WARNING);
                 } elseif ($this->in_changelog) {
@@ -303,16 +303,16 @@ class PEAR_Common extends PEAR
                     $this->pkginfo['release_state'] .= $data;
                 }
                 break;
-            case 'Dir':
+            case 'DIR':
                 break;
-            case 'File':
-                $role = strtolower($this->current_attributes['Role']);
+            case 'FILE':
+                $role = strtolower($this->current_attributes['ROLE']);
                 $this->current_file = trim($data);
                 break;
-            case 'LibName':
+            case 'LIBNAME':
                 $this->lib_name = trim($data);
                 break;
-            case 'Sources':
+            case 'SOURCES':
                 $this->lib_sources[] = trim($data);
                 break;
         }
@@ -334,7 +334,7 @@ class PEAR_Common extends PEAR
         xml_set_object($xp, $this);
         xml_set_element_handler($xp, '_element_start', '_element_end');
         xml_set_character_data_handler($xp, '_pkginfo_cdata');
-        xml_parser_set_option($xp, XML_OPTION_CASE_FOLDING, false);
+        xml_parser_set_option($xp, XML_OPTION_CASE_FOLDING, true);
 
         $this->element_stack = array();
         $this->pkginfo = array();
index 948eab69ec8c8afad4b1ade46afd08366f081481..01ff470cd370e080b6aa35bddc92c87f747c1662 100644 (file)
@@ -193,8 +193,8 @@ class PEAR_Installer extends PEAR_Common
         $tmp_path = dirname($descfile);
         foreach ($pkginfo['filelist'] as $fname => $atts) {
             $dest_dir = $this->phpdir . DIRECTORY_SEPARATOR;
-            if (isset($atts['BaseInstallDir'])) {
-                $dest_dir .= $atts['BaseInstallDir'] . DIRECTORY_SEPARATOR;
+            if (isset($atts['BASEINSTALLDIR'])) {
+                $dest_dir .= $atts['BASEINSTALLDIR'] . DIRECTORY_SEPARATOR;
             }
             if (dirname($fname) != '.') {
                 $dest_dir .= dirname($fname) . DIRECTORY_SEPARATOR;
@@ -205,9 +205,13 @@ class PEAR_Installer extends PEAR_Common
         return true;
     }
 
+    // }}}
+
+    // {{{ _installFile()
+
     function _installFile($file, $dest_dir, $atts)
     {
-        $type = strtolower($atts['Role']);
+        $type = strtolower($atts['ROLE']);
         switch ($type) {
             case "test":
                 // don't install test files for now
index 5fb7c46aece854beaf9015ed611a5b4bdefed67f..4932610532bc60a8f7506dcfb20da2b2b07b28cb 100644 (file)
@@ -432,7 +432,7 @@ class PEAR_WebInstaller extends PEAR
     function _element_end($xp, $name)
     {
         array_pop($this->element_stack);
-        if ($name == "Package")
+        if ($name == "PACKAGE")
         {
             $this->AllPackages[$this->pkginfo["name"]] = $this->pkginfo;
             $this->pkginfo = array();
@@ -449,36 +449,36 @@ class PEAR_WebInstaller extends PEAR
     {
         $next = $this->element_stack[sizeof($this->element_stack)-1];
         switch ($this->current_element) {
-        case "Name":
+        case "NAME":
                 $this->pkginfo["name"] .= $data;
             break;
-        case "Summary":
+        case "SUMMARY":
             $this->pkginfo["summary"] .= $data;
             break;
-        case "Initials":
+        case "INITIALS":
             $this->pkginfo["maintainer_handle"] .= $data;
             break;
-        case "Email":
+        case "EMAIL":
             $this->pkginfo["maintainer_email"] .= $data;
             break;
-        case "Version":
+        case "VERSION":
             $this->pkginfo["version"] .= $data;
             break;
-        case "Date":
+        case "DATE":
             $this->pkginfo["release_date"] .= $data;
             break;
-        case "Notes":
+        case "NOTES":
             $this->pkginfo["release_notes"] .= $data;
             break;
-        case "Dir":
+        case "DIR":
             if (!$this->installdir) {
                 break;
             }
             $dir = trim($data);
             // XXX add to file list
             break;
-        case "File":
-            $role = strtolower($this->current_attributes["Role"]);
+        case "FILE":
+            $role = strtolower($this->current_attributes["ROLE"]);
             $file = trim($data);
             // XXX add to file list
             break;
@@ -504,7 +504,7 @@ class PEAR_WebInstaller extends PEAR
 
         xml_set_element_handler($xp, "_element_start", "_element_end");
         xml_set_character_data_handler($xp, "_pkginfo_cdata");
-        xml_parser_set_option($xp, XML_OPTION_CASE_FOLDING, false);
+        xml_parser_set_option($xp, XML_OPTION_CASE_FOLDING, true);
 
         $this->element_stack = array();
         $this->pkginfo = array();
@@ -600,7 +600,7 @@ class PEAR_WebInstaller extends PEAR
         }
     }
     function help ($Full = False) {
-global $PHP_SELF;
+        global $PHP_SELF;
         $this->loggerEnd();
         print "From the WebInstaller.php introduction: <p>";