cvs: php-gtk-doc /updater updateMethods.php

[email protected] ("Christian Weiske")
Newsgroups php.gtk.doc
Message-ID <cvscweiske1160301800@cvsserver>
cweiske		Sun Oct  8 10:03:20 2006 UTC

  Modified files:              
    /php-gtk-doc/updater	updateMethods.php 
  Log:
  Do not modify if XML is broken
  
  
http://cvs.php.net/viewvc.cgi/php-gtk-doc/updater/updateMethods.php?r1=1.13&r2=1.14&diff_format=u
Index: php-gtk-doc/updater/updateMethods.php
diff -u php-gtk-doc/updater/updateMethods.php:1.13 php-gtk-doc/updater/updateMethods.php:1.14
--- php-gtk-doc/updater/updateMethods.php:1.13	Sun Oct  8 08:43:15 2006
+++ php-gtk-doc/updater/updateMethods.php	Sun Oct  8 10:03:20 2006
@@ -56,10 +56,13 @@
     function updateClass($classname, $file)
     {
         /* Obtain reflection object for current class */
+        if (!class_exists($classname)) {
+            include_once $classname . '.php';
+        }
         try {
             $refObject  = new ReflectionClass($classname);
         } catch (ReflectionException $re) {
-            echo $re->getMessage() . "\n";
+            echo 'Error getting ReflectionClass: ' . $re->getMessage() . "\n";
             return;
         }
         $refObject      = new ReflectionClass($classname);
@@ -79,11 +82,14 @@
         }
         echo ' ' . str_pad(count($trueMethods), 3) . " methods\n";
         $xml = new DOMDocument();
-        $xml->load($file);
-        $xpath = new DOMXPath($xml);
-        foreach ($trueMethods as $key => $methodObj) {
-            /* Update each method */
-            $this->updateMethod($classname, $file, $key, $methodObj, $xml, $xpath);
+        if ($xml->load($file)) {
+            $xpath = new DOMXPath($xml);
+            foreach ($trueMethods as $key => $methodObj) {
+                /* Update each method */
+                $this->updateMethod($classname, $file, $key, $methodObj, $xml, $xpath);
+            }
+        } else {
+            echo 'XML is broken in ' . $file . " - skipping.\n";
         }
     }//function updateClass($classname, $file)
 
@@ -360,9 +366,11 @@
     echo "\n\nNo Methods to Update! Quitting...\n\n";
 } else {
     echo "\n\n" . $doIt->methodCount . " methods were updated!";
-    echo "\nThe following classes' xml source files do not exist and therefore were NOT updated:\n";
-    foreach ($doIt->missingClasses as $missClass) {
-        echo $missClass."\n";
+    if (count($doIt->missingClasses) > 0) {
+        echo "\nThe following classes' xml source files do not exist and therefore were NOT updated:\n";
+        foreach ($doIt->missingClasses as $missClass) {
+            echo $missClass."\n";
+        }
     }
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.