A ZIP file consists of the following areas:
- An indicator whether it's a split archive at the beginning of the file
- File data records
- ZIP Central Directory
- ZIP stats and end of archive marker
The central directory contains some stats and essentially the headers of the files which are already present in the archive. It's used to quickly scan the contents of the archive and produce a ZIP file listing without having to read the entire archive. The trick is that the ZIP stats at the end of the file contain a pointer to the Central Directory (CD) so unzip applications can locate the CD fast. This was very important in the days of floppies because file seek time was in the order of hundreds of milliseconds. It's quite irrelevant now that we have SSDs and large in-memory file caches but the ZIP format is what it is and we have to abide by it (hence our JPA format: it doesn't have a central directory and follows other simplifications which can be afforded by modern computer architectures).
Because the CD is duplicated data at the end of the file we only add the file data records during backup to the archive (after the split file indicator!) and write the ZIP Central Directory records in a temporary file. At the end of the backup process we need to "glue together" the already written file data with the central directory and finally append the ZIP stats and end of archive marker. This is called the finalization process.
When you have a single part archive this happens as the final step of the backup process and it's pretty straightforward. You just do a quick buffered copy from one file to the other.
When it's a multipart archive you have to take into account two things. First, the ZIP format says that a Central Directory record cannot span two volumes (parts). Therefore we have to see if we have enough space in our last part. If not, we need to create a new part.
Here comes the second consideration, post-processing. If you have selected to post-process each archive part immediately the creation of a new part on the previous step triggers an immediate upload for the part. At this point it's possible that there is a step break and the finalization will resume in the next page load.
I can't see why that would cause a NULL return since we are, indeed, closing any open file pointers at the end of each backup step. Something weird happens there with PHP returning null when it's trying to reopen the file? I am not sure since I cannot reproduce this and nobody else has reported it. Blind debugging is no fun and it's about as accurate as trying to hit a fly's wing at a hundred years with a slingshot while blindfolded and spun around in a merry-go-round so there's that...
The fact that the archive DOES extract tells me that the NULL is returned after we are done finalizing which is truly weird but, hey, at least the code I've now put in place is catching that. I'll accept this as a viable solution.
Regarding the time format, please note that there are two variables, [TIME] and [TIME_TZ]. New backup profiles use the latter which includes the timezone (please read the documentation about it) whereas your old profiles would use the old default, [TIME], which prints out the UTC time stamp. People were confused with UTC, especially around the summer time switch-over twice a year, hence the introduction of TIME_TZ.
Nicholas K. Dionysopoulos
Lead Developer and Director
🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!