S3 backup list times are shifted by the site's UTC offset (timezone offset applied twice)

Abierto Apto para principiantes
#240 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

  • #239 de @chata — cerrado sin fusionar

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
76/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Tranquilo
Stack tecnológico
aws, php
Área
backend, cloud

Línea de trabajo

Comienza en BackWPup_Destination_S3::file_update_list() e inspecciona cómo LastModified se convierte en $changetime; después, sigue su uso en components/table-row-backups.php, BackWPup_Page_Backups::column_time() y la lista de archivos de S3. Reprodúcelo con una zona horaria del sitio distinta de UTC y confirma que las tres vistas muestran la hora real de la copia de seguridad exactamente una vez en la zona horaria del sitio, coincidiendo con las copias de seguridad en carpetas locales.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Describe the bug

Backups stored on an S3 (or S3-compatible) destination are listed in the Backups History table with a time shifted into the future by the site's UTC offset. On a UTC+9 (Asia/Tokyo) site, a scheduled backup that ran at 0:00 JST is shown as "9:00 AM", and a manual backup taken at 1:40 PM is shown as "10:40 PM". Backups stored on the local folder destination show the correct time, so S3 rows look inconsistent next to them.

Cause

BackWPup_Destination_S3::file_update_list() converts the S3 object's LastModified (UTC) into a Unix timestamp and then adds the site's gmt_offset:

$changetime = strtotime((string) $object['LastModified']) + (get_option('gmt_offset') * 3600);

Unix timestamps are timezone-independent, and all three consumers of this value format it with wp_date(), which already converts the epoch to the site timezone:

  • the backups history table: components/table-row-backups.php (lines 9-10)
  • the legacy backups page: BackWPup_Page_Backups::column_time()
  • the S3 file list (download/restore view): $files[$filecounter]['time'] within the same method

The offset is therefore applied twice.

To Reproduce

  1. Set the site timezone to a non-UTC zone (e.g. Asia/Tokyo, UTC+9) in Settings → General.
  2. Configure a job with an S3 (or S3-compatible, e.g. Cloudflare R2) destination and run it.
  3. Open BackWPup → Backups History: the row shows the backup 9 hours in the future, while the filename (which uses site-local time) and a backup stored on the server show the correct time.

Expected behavior

The S3 backup rows show the actual backup time in the site timezone, matching backups stored on the local folder destination.

Environment

  • BackWPup 5.7.4
  • WordPress with PHP 8.4
  • Destination: Cloudflare R2 (S3-compatible)

Additional context

Proposed fix in #239: drop the gmt_offset addition and keep the true epoch.

Lenguaje dominante
PHP
Estrellas
96
Forks
48
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de wp-media/backwpup

Todos los issues de wp-media/backwpup

Issues similares

Más issues de PHP

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.