diff --git a/classes/migration/upgrade/v3_4_0/I10249_FixProfileImageDataLoss.php b/classes/migration/upgrade/v3_4_0/I10249_FixProfileImageDataLoss.php index c433a6da492..994e1d4dd8c 100644 --- a/classes/migration/upgrade/v3_4_0/I10249_FixProfileImageDataLoss.php +++ b/classes/migration/upgrade/v3_4_0/I10249_FixProfileImageDataLoss.php @@ -40,7 +40,11 @@ public function up(): void $globPattern = "{$publicFilesPath}/profileImage-{$row->user_id}.*"; $candidates = glob($globPattern, GLOB_NOSORT); if (empty($candidates)) { - $this->_installer->log("Failed to locate a profile image for the user ID {$row->user_id} at {$globPattern}"); + $this->_installer->log("Failed to locate a profile image for the user ID {$row->user_id} at {$globPattern}, cleaning up the value"); + DB::table('user_settings') + ->where('user_id', $row->user_id) + ->where('setting_name', 'profileImage') + ->update(['setting_value' => null]); continue; } @@ -61,7 +65,8 @@ public function up(): void 'width' => $width, 'height' => $height, 'dateUploaded' => date('Y-m-d H:i:s', filemtime($filePath)) - ]) + ]), + 'setting_type' => 'object' ]); } }, 'user_id');