cvs: peardoc / make-partial.php
| From: | anatoly techtonik | Date: | Wed, 28 Sep 2005 15:18:15 +0000 |
| Subject: | cvs: peardoc / make-partial.php | ||
| Groups: | php.pear.doc | ||
| Request: | Send a blank email to pear-doc+get-6933@lists.php.net to get a copy of this message | ||
techtonik Wed Sep 28 11:18:15 2005 EDT
Modified files:
/peardoc make-partial.php
Log:
* recover manual.xml.in if the script was terminated unexpectedly
http://cvs.php.net/diff.php/peardoc/make-partial.php?r1=1.7&r2=1.8&ty=u
Index: peardoc/make-partial.php
diff -u peardoc/make-partial.php:1.7 peardoc/make-partial.php:1.8
--- peardoc/make-partial.php:1.7 Tue Sep 13 18:46:08 2005
+++ peardoc/make-partial.php Wed Sep 28 11:18:14 2005
@@ -12,7 +12,7 @@
*
* @author Martin Jansen <mj@php.net>
* @copyright 2005 The PEAR Group
- * @version CVS: $Id: make-partial.php,v 1.7 2005/09/13 22:46:08 techtonik Exp $
+ * @version CVS: $Id: make-partial.php,v 1.8 2005/09/28 15:18:14 techtonik Exp $
*/
if (substr(PHP_VERSION, 0, 1) == "4") {
@@ -63,15 +63,18 @@
}
}
+// recover manual.xml.in if the script was terminated unexpectedly
+restoreFile();
+
+copy("manual.xml.in", "manual.xml.in.partial-backup");
+register_shutdown_function("restoreFile", filemtime("manual.xml.in"));
+
$file = file("manual.xml.in");
if (!$file) {
echo "Error: Unable to read manual.xml.in!";
exit(1);
}
-copy("manual.xml.in", "manual.xml.in.partial-backup");
-register_shutdown_function("restoreFile", filemtime("manual.xml.in"));
-
$newFile = "";
$partStack = array();
$includePart = true;
@@ -168,14 +171,14 @@
/**
* Restores the original manual.xml.in file
*/
-function restoreFile($savedmtime) {
+function restoreFile($savedmtime = null) {
if (!is_file("manual.xml.in.partial-backup")) {
return;
}
unlink("manual.xml.in");
rename("manual.xml.in.partial-backup", "manual.xml.in");
- touch("manual.xml.in", $savedmtime);
+ if ($savedmtime) touch("manual.xml.in", $savedmtime);
}
/**