From f7a677ef19891a5ee2340198ee2046c7928380a6 Mon Sep 17 00:00:00 2001 From: Derky Date: Fri, 26 Sep 2025 15:02:01 +0200 Subject: [PATCH 1/2] [ticket/17548] Add DISTINCT to storage_track migration PHPBB-17548 --- phpBB/phpbb/db/migration/data/v400/storage_track.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/phpBB/phpbb/db/migration/data/v400/storage_track.php b/phpBB/phpbb/db/migration/data/v400/storage_track.php index 54827d7d29..01e667d53a 100644 --- a/phpBB/phpbb/db/migration/data/v400/storage_track.php +++ b/phpBB/phpbb/db/migration/data/v400/storage_track.php @@ -75,7 +75,7 @@ class storage_track extends container_aware_migration /** @var file_tracker $file_tracker */ $file_tracker = $this->container->get('storage.file_tracker'); - $sql = 'SELECT user_avatar + $sql = 'SELECT DISTINCT user_avatar FROM ' . USERS_TABLE . " WHERE user_avatar_type = 'avatar.driver.upload'"; $result = $this->db->sql_query($sql); @@ -121,7 +121,7 @@ class storage_track extends container_aware_migration /** @var file_tracker $file_tracker */ $file_tracker = $this->container->get('storage.file_tracker'); - $sql = 'SELECT physical_filename, thumbnail + $sql = 'SELECT DISTINCT physical_filename, thumbnail FROM ' . ATTACHMENTS_TABLE; $result = $this->db->sql_query($sql); @@ -161,7 +161,7 @@ class storage_track extends container_aware_migration /** @var file_tracker $file_tracker */ $file_tracker = $this->container->get('storage.file_tracker'); - $sql = 'SELECT filename + $sql = 'SELECT DISTINCT filename FROM ' . BACKUPS_TABLE; $result = $this->db->sql_query($sql); From 812406b778a8b351f6456b3c6c98b76c66015e0a Mon Sep 17 00:00:00 2001 From: Derky Date: Fri, 26 Sep 2025 15:07:12 +0200 Subject: [PATCH 2/2] [ticket/17548] Suppress filesize errors in storage_track migration If the file size could not be retrieved right now it will be set to 0 PHPBB-17548 --- phpBB/phpbb/db/migration/data/v400/storage_track.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/phpBB/phpbb/db/migration/data/v400/storage_track.php b/phpBB/phpbb/db/migration/data/v400/storage_track.php index 01e667d53a..7d2b4dec20 100644 --- a/phpBB/phpbb/db/migration/data/v400/storage_track.php +++ b/phpBB/phpbb/db/migration/data/v400/storage_track.php @@ -130,14 +130,14 @@ class storage_track extends container_aware_migration { $files[] = [ 'file_path' => $row['physical_filename'], - 'filesize' => filesize($this->phpbb_root_path . $this->config['storage\\attachment\\config\\path'] . '/' . $row['physical_filename']), + 'filesize' => @filesize($this->phpbb_root_path . $this->config['storage\\attachment\\config\\path'] . '/' . $row['physical_filename']), ]; if ($row['thumbnail'] == 1) { $files[] = [ 'file_path' => 'thumb_' . $row['physical_filename'], - 'filesize' => filesize($this->phpbb_root_path . $this->config['storage\\attachment\\config\\path'] . '/thumb_' . $row['physical_filename']), + 'filesize' => @filesize($this->phpbb_root_path . $this->config['storage\\attachment\\config\\path'] . '/thumb_' . $row['physical_filename']), ]; } @@ -170,7 +170,7 @@ class storage_track extends container_aware_migration { $files[] = [ 'file_path' => $row['filename'], - 'filesize' => filesize($this->phpbb_root_path . $this->config['storage\\backup\\config\\path'] . '/' . $row['filename']), + 'filesize' => @filesize($this->phpbb_root_path . $this->config['storage\\backup\\config\\path'] . '/' . $row['filename']), ]; if (count($files) >= self::BATCH_SIZE)