From a3d949c3d0d596b977a7d38f68e047feab8ff805 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Calvo?= Date: Wed, 20 Jun 2018 23:57:19 +0200 Subject: [PATCH] [ticket/15342] Fix migration PHPBB3-15342 --- .../db/migration/data/v330/storage_track.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/phpBB/phpbb/db/migration/data/v330/storage_track.php b/phpBB/phpbb/db/migration/data/v330/storage_track.php index 0c4f620c28..7463e4641b 100644 --- a/phpBB/phpbb/db/migration/data/v330/storage_track.php +++ b/phpBB/phpbb/db/migration/data/v330/storage_track.php @@ -15,7 +15,7 @@ namespace phpbb\db\migration\data\v330; use phpbb\storage\storage; -class storage_track extends \phpbb\db\migration\migration +class storage_track extends \phpbb\db\migration\container_aware_migration { static public function depends_on() { @@ -74,7 +74,19 @@ class storage_track extends \phpbb\db\migration\migration while ($row = $this->db->sql_fetchrow($result)) { - $storage->track_file($row['user_avatar']); + $avatar_group = false; + $filename = $row['user_avatar']; + + if (isset($filename[0]) && $filename[0] === 'g') + { + $avatar_group = true; + $filename = substr($filename, 1); + } + + $ext = substr(strrchr($filename, '.'), 1); + $filename = (int) $filename; + + $storage->track_file($this->config['avatar_salt'] . '_' . ($avatar_group ? 'g' : '') . $filename . '.' . $ext); } $this->db->sql_freeresult($result); }