Fixed vB4 Import: Smileys step fails if there are no smileys

Steffen

Well-known member
Code:
[LogicException]                                                    
Must have use addSmilie() to add at least one smilie before fetching XML.

Exception trace:
() at src/XF/Import/DataHelper/Smilie.php:80
XF\Import\DataHelper\Smilie->getXml() at src/XF/Import/DataHelper/Smilie.php:128
XF\Import\DataHelper\Smilie->saveXml() at src/addons/XFI/Import/Importer/vBulletin.php:5251
XFI\Import\Importer\vBulletin->stepSmilies() at src/XF/Import/Runner.php:163
XF\Import\Runner->runStep() at src/XF/Import/Runner.php:77
XF\Import\Runner->run() at src/XF/Cli/Command/Import.php:72
XF\Cli\Command\Import->execute() at src/vendor/symfony/console/Command/Command.php:242
Symfony\Component\Console\Command\Command->run() at src/vendor/symfony/console/Application.php:843
Symfony\Component\Console\Application->doRunCommand() at src/vendor/symfony/console/Application.php:193
Symfony\Component\Console\Application->doRun() at src/vendor/symfony/console/Application.php:117
Symfony\Component\Console\Application->run() at src/XF/Cli/Runner.php:63
XF\Cli\Runner->run() at cmd.php:15

Diff:
diff --git a/src/addons/XFI/Import/Importer/vBulletin.php b/src/addons/XFI/Import/Importer/vBulletin.php
index 4db2b1b87..fa9c04027 100644
--- a/src/addons/XFI/Import/Importer/vBulletin.php
+++ b/src/addons/XFI/Import/Importer/vBulletin.php
@@ -5248,7 +5248,10 @@ class vBulletin extends AbstractForumImporter
             }
         }

-        $helper->saveXml($stepConfig['filename']);
+        if ($state->imported > 0)
+        {
+            $helper->saveXml($stepConfig['filename']);
+        }

         return $state->complete();
     }

Obviously, this error was raised while running the importer on a reduced sample of the database with an empty smileys table. :eek:
 
Last edited:
I actually fixed it with something more in keeping with the way the other steps drop out early with no results:
Diff:
Index: src/addons/XFI/Import/Importer/vBulletin.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- src/addons/XFI/Import/Importer/vBulletin.php    (date 1521198957000)
+++ src/addons/XFI/Import/Importer/vBulletin.php    (date 1521199084000)
@@ -4637,6 +4637,11 @@
             ORDER BY cat.displayorder, smilie.displayorder
         "));
 
+        if (!$smilies)
+        {
+            return $state->complete();
+        }
+
         $categoriesImported = [];
 
         /** @var \XF\Import\DataHelper\Smilie $helper */
 
Hi,
after importing from VB4.2.5. my smileys aren't imported at all :(, there are the 71 standard XF2 smileys available only
Was I supposed to add your code somewhere or should it be incorporated in the latest importer?
Seems to be quite some effort to import a VB having it's roots back to VB3.6 ;)
txs for any help
 
Jakko,
go to "Content/Smilies" in the ACP. In the drop-down you'll find "import".

The VB import-process should have generated a "smilies.vbulletin.xml". Simply select from the dropdown:
1531844792521.webp

HTH,
-Markus
 
Back
Top Bottom