<definitionname>com.woltlab.wcf.importer</definitionname>
<classname><![CDATA[wcf\system\importer\LabelImporter]]></classname>
</type>
+ <type>
+ <name>com.woltlab.wcf.smiley</name>
+ <definitionname>com.woltlab.wcf.importer</definitionname>
+ <classname><![CDATA[wcf\system\importer\SmileyImporter]]></classname>
+ </type>
<!-- /importers -->
<!-- rebuild data workers -->
*/
protected $defaultLimit = 1000;
+ /**
+ * selected import data
+ * @var array
+ */
+ protected $selectedData = array();
+
/**
* @see wcf\system\exporter\IExporter::setData()
*/
$limit = (isset($this->limits[$objectType]) ? $this->limits[$objectType] : $this->defaultLimit);
call_user_func(array($this, 'export'.$this->methods[$objectType]), $loopCount * $limit, $limit);
}
+
+ /**
+ * @see wcf\system\exporter\IExporter::validateSelectedData()
+ */
+ public function validateSelectedData(array $selectedData) {
+ $this->selectedData = $selectedData;
+
+ if (!count($this->selectedData)) {
+ return false;
+ }
+
+ $supportedData = $this->getSupportedData();
+ foreach ($this->selectedData as $name) {
+ if (isset($supportedData[$name])) break;
+
+ foreach ($supportedData as $key => $data) {
+ if (in_array($name, $data)) {
+ if (!in_array($key, $selectedData)) return false;
+
+ break 2;
+ }
+ }
+
+ return false;
+ }
+
+ return true;
+ }
+
}
unset($this->idMappingCache[$objectTypeID][$oldID]);
}
+ /**
+ * Resets the mapping.
+ */
+ public function resetMapping() {
+ $sql = "DELETE FROM wcf".WCF_N."_import_mapping";
+ $statement = WCF::getDB()->prepareStatement($sql);
+ $statement->execute();
+
+ $this->idMappingCache = array();
+ }
+
/**
* Sets the user merge mode.
*
--- /dev/null
+<?php
+namespace wcf\system\importer;
+use wcf\data\smiley\SmileyEditor;
+
+/**
+ * Imports smilies.
+ *
+ * @author Marcel Werk
+ * @copyright 2001-2013 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package com.woltlab.wcf
+ * @subpackage system.importer
+ * @category Community Framework
+ */
+class SmileyImporter implements IImporter {
+ /**
+ * @see wcf\system\importer\IImporter::import()
+ */
+ public function import($oldID, array $data, array $additionalData = array()) {
+ // copy smiley
+ $data['smileyPath'] = 'images/smilies/'.basename($additionalData['fileLocation']);
+ if (!@copy($additionalData['fileLocation'], WCF_DIR.$data['smileyPath'])) return 0;
+
+ // save smiley
+ $smiley = SmileyEditor::create($data);
+
+ return $smiley->smileyID;
+ }
+}
<item name="wcf.acp.dataImport.data.com.woltlab.wcf.user.comment"><![CDATA[Pinnwand-Kommentare]]></item>
<item name="wcf.acp.dataImport.data.com.woltlab.wcf.user.comment.response"><![CDATA[Pinnwand-Kommentar-Antworten]]></item>
<item name="wcf.acp.dataImport.data.com.woltlab.wcf.label"><![CDATA[Labels]]></item>
+ <item name="wcf.acp.dataImport.data.com.woltlab.wcf.smiley"><![CDATA[Smileys]]></item>
<item name="wcf.acp.dataImport.configure.database"><![CDATA[Datenbank-Zugang]]></item>
<item name="wcf.acp.dataImport.configure.database.host"><![CDATA[Hostname]]></item>
<item name="wcf.acp.dataImport.configure.database.user"><![CDATA[Benutzername]]></item>
<item name="wcf.acp.dataImport.data.com.woltlab.wcf.user.comment"><![CDATA[TODO: Pinwand-Kommentare]]></item>
<item name="wcf.acp.dataImport.data.com.woltlab.wcf.user.comment.response"><![CDATA[TODO: Pinwand-Kommentar-Antworten]]></item>
<item name="wcf.acp.dataImport.data.com.woltlab.wcf.label"><![CDATA[TODO: Labels]]></item>
+ <item name="wcf.acp.dataImport.data.com.woltlab.wcf.smiley"><![CDATA[Smilies]]></item>
<item name="wcf.acp.dataImport.configure.database"><![CDATA[TODO: Datenbank-Zugang]]></item>
<item name="wcf.acp.dataImport.configure.database.host"><![CDATA[TODO: Hostname]]></item>
<item name="wcf.acp.dataImport.configure.database.user"><![CDATA[TODO: Benutzername]]></item>