com web/rmtools: Enable partial uploads, still needs improvement: script/snap.php
| From: | Anatol Belski | Date: | Tue, 19 Sep 2017 16:47:37 +0000 |
| Subject: | com web/rmtools: Enable partial uploads, still needs improvement: script/snap.php | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-26416@lists.php.net to get a copy of this message | ||
Commit: 433bd0a90d8f0f89cecbdad37c81c1867087bdbf
Author: Anatol Belski <ab@php.net> Tue, 19 Sep 2017 18:47:37 +0200
Parents: cb41be0fb0a690e01d1f743779bf49e0d1ea38c2
Branches: master
Link: http://git.php.net/?p=web/rmtools.git;a=commitdiff;h=433bd0a90d8f0f89cecbdad37c81c1867087bdbf
Log:
Enable partial uploads, still needs improvement
Changed paths:
M script/snap.php
Diff:
diff --git a/script/snap.php b/script/snap.php
index 79e3791..234f821 100644
--- a/script/snap.php
+++ b/script/snap.php
@@ -213,16 +213,21 @@ if ($branch->hasNewRevision() || $branch->hasUnfinishedBuild() ||
$force) {
$branch->buildFinished();
}
-
- /* Only upload once, and then cleanup. */
- //if ($branch->requiredBuildRunsReached()) {
- $src_dir = $branch_name . '/r' . $last_rev;
- rm\upload_build_result_ftp_curl($toupload_dir, $src_dir);
- //rm\rmdir_rf($toupload_dir);
- //}
+ $src_dir = $branch_name . '/r' . $last_rev;
+ rm\upload_build_result_ftp_curl($toupload_dir, $src_dir);
+ /* FIXME This is still not safe, locking needed! */
+ foreach (["$to_upload_dir/logs", $to_upload_dir] as $path) {
+ $items = scandir($path);
+ foreach ($items as $item) {
+ $full = $path . "/" . $item;
+ if (is_file($full)) {
+ @unlink($full);
+ }
+ }
+ }
+ //rm\rmdir_rf($toupload_dir);
$branch->setLastRevisionExported($last_rev);
- $branch->resetBuildInfo();
}
out_here:
@@ -239,6 +244,7 @@ if ($have_build_run) {
$status = rm\upload_file_curl($branch->db_path, $branch_name . '/' .
basename($branch->db_path));
$try++;
} while ( $status === false && $try < 10 );
+ $branch->resetBuildInfo();
}
//if ($has_build_errors) {