cvs: php-gtk-doc /updater updateMethods.php
| From: | Christian Weiske | Date: | Sun, 08 Oct 2006 10:03:20 +0000 |
| Subject: | cvs: php-gtk-doc /updater updateMethods.php | ||
| Groups: | php.gtk.doc | ||
| Request: | Send a blank email to php-gtk-doc+get-2918@lists.php.net to get a copy of this message | ||
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";
+ }
}
}