From ec74b980c64ddeab49b7c0cf17bd183a40733ead Mon Sep 17 00:00:00 2001 From: Eric Merrill Date: Wed, 22 Jan 2014 08:57:53 -0500 Subject: [PATCH] MDL-43794 Files API Set the mtime of files to extraction time. The restore cleanup code expects the mtime to be the time of extraction not the mtime before archiving. If set to the old mtime, the restore files may be cleaned up before the restore is complete. This behaviour also matches the behaviour of the zip unpacker. --- lib/filestorage/tgz_extractor.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/filestorage/tgz_extractor.php b/lib/filestorage/tgz_extractor.php index 0ac6de59018..0fb40ba38a0 100644 --- a/lib/filestorage/tgz_extractor.php +++ b/lib/filestorage/tgz_extractor.php @@ -456,8 +456,10 @@ class tgz_extractor { 'Failed to close output file: ' . $this->currentfile); } - // Update modified time. - touch($this->currentfile, $this->currentmtime); + // At this point we should touch the file to set its modified + // time to $this->currentmtime. However, when extracting to the + // temp directory, cron will delete files more than a week old, + // so to avoid problems we leave all files at their current time. } if ($this->currentarchivepath === tgz_packer::ARCHIVE_INDEX_FILE) {