A platform for community discussion. Free, open, simple.
FIX: add support for string avatar_type values in PHPBB3 importer
Neil Lalonde1ba8e8948d5c
diff --git a/script/import_scripts/phpbb3/importers/avatar_importer.rb b/script/import_scripts/phpbb3/importers/avatar_importer.rbindex a9cd22d4c97..2178ed800c4 100644--- a/script/import_scripts/phpbb3/importers/avatar_importer.rb+++ b/script/import_scripts/phpbb3/importers/avatar_importer.rb@@ -47,16 +47,16 @@ module ImportScripts::PhpBB3def get_avatar_path(avatar_type, filename)case avatar_type- when Constants::AVATAR_TYPE_UPLOADED then+ when Constants::AVATAR_TYPE_UPLOADED, Constants::AVATAR_TYPE_STRING_UPLOADED thenfilename.gsub!(/_[0-9]+\./, '.') # we need 1337.jpg, not 1337_2983745.jpgget_uploaded_path(filename)- when Constants::AVATAR_TYPE_GALLERY then+ when Constants::AVATAR_TYPE_GALLERY, Constants::AVATAR_TYPE_STRING_GALLERY thenget_gallery_path(filename)- when Constants::AVATAR_TYPE_REMOTE then+ when Constants::AVATAR_TYPE_REMOTE, Constants::AVATAR_TYPE_STRING_REMOTE thendownload_avatar(filename)- else- Rails.logger.error("Invalid avatar type #{avatar_type}. Skipping...")- nil+ else+ puts "Invalid avatar type #{avatar_type}. Skipping..."+ nilendend@@ -97,13 +97,13 @@ module ImportScripts::PhpBB3def is_allowed_avatar_type?(avatar_type)case avatar_type- when Constants::AVATAR_TYPE_UPLOADED then+ when Constants::AVATAR_TYPE_UPLOADED, Constants::AVATAR_TYPE_STRING_UPLOADED then@settings.import_uploaded_avatars- when Constants::AVATAR_TYPE_REMOTE then+ when Constants::AVATAR_TYPE_REMOTE, Constants::AVATAR_TYPE_STRING_REMOTE then@settings.import_remote_avatars- when Constants::AVATAR_TYPE_GALLERY then+ when Constants::AVATAR_TYPE_GALLERY, Constants::AVATAR_TYPE_STRING_GALLERY then@settings.import_gallery_avatars- else+ elsefalseendenddiff --git a/script/import_scripts/phpbb3/support/constants.rb b/script/import_scripts/phpbb3/support/constants.rbindex af7482d5da6..6e9612e6785 100644--- a/script/import_scripts/phpbb3/support/constants.rb+++ b/script/import_scripts/phpbb3/support/constants.rb@@ -19,6 +19,10 @@ module ImportScripts::PhpBB3AVATAR_TYPE_REMOTE = 2AVATAR_TYPE_GALLERY = 3+ AVATAR_TYPE_STRING_UPLOADED = 'avatar.driver.upload'+ AVATAR_TYPE_STRING_REMOTE = 'avatar.driver.remote'+ AVATAR_TYPE_STRING_GALLERY = 'avatar.driver.local'+FORUM_TYPE_CATEGORY = 0FORUM_TYPE_POST = 1FORUM_TYPE_LINK = 2