Okay, for the site archive date display, this is my analysis of what's going on. Filenames and line numbers relative to r415.
Archive .zip filename is generated usingproducing a timestamp in local time, according to the value of Settings->User Profile->Local Timezone of the logged-in user.
When the list of site archives is displayed, the date shown is derived from the filename. The filename is exploded (admin/archive.php, line 71) and the date/time from the front of the filename is passed to function lngDate() for formatting according to the active language file setting DATE_AND_TIME_FORMAT:
Unfortunately, strtotime() expects to be passed a Unix timestamp (i.e., UTC), it's actually getting a local time (UTC +/- offset). Function date() adds the local offset again, so in fact the time value returned for display is (UTC + 2*offset).
My date display of one hour error is due to my local timezone being UTC+1; by temporarily setting the User Profile to UTC+2, I get a two hour error.
Suggested (easiest) resolution:This will give the .zip file a timestamp in UTC. The archive display in the backend will always show that time in the User's local timezone, according to the profile setting.
Possible drawback: it would be possible to have an archive filename with the previous day's date, if the user is in a TZ with a large offset from UTC. This may cause confusion when archives are downloaded, apparently with the wrong date on them. Adding the offset to the filename might be a solution:
producing a filename formatted 2011-03-22-0927_+0100_archive.zip for a backup taken at 10:27, local time. No changes are required elsewhere in GS.
Edit: Can't have a '+' sign in the filename – prevents deleting the file (corrupted by the HTTP GET?). You can have gmdate('Y-m-d-Hi_s') to accommodate multiple archives per minute. ;-)
Archive .zip filename is generated using
Code:
$timestamp = date('Y-m-d-Hi'); // admin/zip.php, line 21
When the list of site archives is displayed, the date shown is derived from the filename. The filename is exploded (admin/archive.php, line 71) and the date/time from the front of the filename is passed to function lngDate() for formatting according to the active language file setting DATE_AND_TIME_FORMAT:
Code:
$data = date(i18n_r('DATE_AND_TIME_FORMAT'), strtotime($dt)); // admin/inc/basic.php, line 259
Unfortunately, strtotime() expects to be passed a Unix timestamp (i.e., UTC), it's actually getting a local time (UTC +/- offset). Function date() adds the local offset again, so in fact the time value returned for display is (UTC + 2*offset).
My date display of one hour error is due to my local timezone being UTC+1; by temporarily setting the User Profile to UTC+2, I get a two hour error.
Suggested (easiest) resolution:
Code:
admin/zip.php, line 21:
--- $timestamp = date('Y-m-d-Hi');
+++ $timestamp = gmdate('Y-m-d-Hi');
Possible drawback: it would be possible to have an archive filename with the previous day's date, if the user is in a TZ with a large offset from UTC. This may cause confusion when archives are downloaded, apparently with the wrong date on them. Adding the offset to the filename might be a solution:
Code:
$timestamp = gmdate('Y-m-d-Hi') .'_'. date('O'); // admin/zip.php, line 21
Edit: Can't have a '+' sign in the filename – prevents deleting the file (corrupted by the HTTP GET?). You can have gmdate('Y-m-d-Hi_s') to accommodate multiple archives per minute. ;-)
--
Nick.
Nick.