summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2019-08-14 13:57:31 +0300
committerAndrew Dolgov <[email protected]>2019-08-14 13:57:31 +0300
commit6953ca02fd5df11d3ef59cf0b4049a5b329f655b (patch)
tree0e83f050ea6eeb20990be3f659143fe0003a56fd
parent1f1bd315e1a770a380aca694b6b067bdef469207 (diff)
* check whether ZIP operation completed successfully on close because ZipArchive will happily write into a nonexistent archive with no errors
* add .zip extension to output file if not present
-rw-r--r--init.php8
1 files changed, 7 insertions, 1 deletions
diff --git a/init.php b/init.php
index 0cdbf8c..f0a4f48 100644
--- a/init.php
+++ b/init.php
@@ -110,6 +110,9 @@ class Data_Migration extends Plugin {
if ($row = $sth->fetch()) {
$owner_uid = $row['id'];
+ if (stripos($output_file, ".zip") === FALSE)
+ $output_file = $output_file . ".zip";
+
Debug::log("exporting articles of user $user to $output_file...");
if ($only_marked)
@@ -151,7 +154,10 @@ class Data_Migration extends Plugin {
break;
}
- $zip->close();
+ if ($zip->close() !== TRUE) {
+ Debug::log("write error while saving data to $output_file");
+ exit(3);
+ }
Debug::log("exported $total_processed articles to $output_file.");