Fixed import of unknown user option types
authorMarcel Werk <burntime@woltlab.com>
Wed, 5 Oct 2016 16:28:08 +0000 (18:28 +0200)
committerMarcel Werk <burntime@woltlab.com>
Wed, 5 Oct 2016 16:28:12 +0000 (18:28 +0200)
files/lib/system/exporter/WBB4xExporter.class.php

index 92f3d4303a6feb95686091aab3ff1dca3a9b5673..729b44c4fc4ae33be3c9964f09f490553aa0f1db 100644 (file)
@@ -9,6 +9,7 @@ use wcf\system\database\util\PreparedStatementConditionBuilder;
 use wcf\system\importer\ImportHandler;
 use wcf\system\WCF;
 use wcf\util\FileUtil;
+use wcf\util\StringUtil;
 
 /**
  * Exporter for Burning Board 4.x
@@ -641,9 +642,15 @@ class WBB4xExporter extends AbstractExporter {
                $statement = $this->database->prepareStatement($sql);
                $statement->execute($conditionBuilder->getParameters());
                while ($row = $statement->fetchArray()) {
+                       $optionType = StringUtil::firstCharToUpperCase($row['optionType']);
+                       $className = 'wcf\system\option\\'.$optionType.'OptionType';
+                       if (!class_exists($className)) {
+                               $optionType = 'textarea';
+                       }
+                       
                        ImportHandler::getInstance()->getImporter('com.woltlab.wcf.user.option')->import($row['optionID'], [
                                'categoryName' => $row['categoryName'],
-                               'optionType' => $row['optionType'],
+                               'optionType' => $optionType,
                                'defaultValue' => $row['defaultValue'],
                                'validationPattern' => $row['validationPattern'],
                                'selectOptions' => $row['selectOptions'],