Partial fix [1.3B1] Import Smilies creates category even if smilies can't be

Kevin

Well-known member
When using the "Import Smilies" function with an XML file the categories for the selected smilies will be created even if none of the smilies assigned to the category can be.

To demonstrate what I mean the attached XML file is for one smiley, :D, which by default is already assigned to Big Grin on a fresh XF install. For the purpose of testing it has been assigned to a category named "Don't Worry, Be Happy" in the XML. Attempting to import using the XML file will give an error message. Going back to your smilies page you will now see an empty "Don't Worry, Be Happy" category. Go back and try to reimport the XML file again. This time change the :D replacement text to something unique so you don't get an error. Go back to your smilies page and now you will see a second "Don't Worry, Be Happy" category.

For any admins who tend to have a lot of smilies .... :whistle: .... I think there are two things at play here. The first is that if the category in the XML file already exists then it should use the existing category instead of creating a duplicate one with the same name -- just think of the cleanup an admin will have to do every time they import an XML collection with the category name "Star Trek" in it. The second is that it shouldn't create the category unless at least imported smiley request is valid to be imported -- because you are not preemptively warned that the replacement text is already in use, if it takes you a few tries to get it imported you'll end up with several duplicate empty categories to be cleaned up.
 

Attachments

Looking into this...

First change in this system for beta 2, duplicate-named categories are no longer created.
 
I'm trying to track down your problem Kevin - could you check to see that both your xf_smilie and xf_smilie_category tables are both InnoDB?
 
I've added some code to hopefully work around the empty categories issue, but I can't 100% confirm it will sort out your problem, Kevin, until you test it :)
 
I'm trying to track down your problem Kevin - could you check to see that both your xf_smilie and xf_smilie_category tables are both InnoDB?
I've added some code to hopefully work around the empty categories issue, but I can't 100% confirm it will sort out your problem, Kevin, until you test it :)
Kier, thanks for checking into this.

To my surprise my (relatively new) VPS server was having issues with InnoDB and the engine type was showing as disabled; the default engine type is set for MyISAM and both tables were MyISAM.

I installed B2 and my first test of whether existing categories would be re-used or duplicates created. Success! (y)

The next test was if an empty category would be created if no valid smilies were selected. Failure. But you didn't mention if having those tables as InnoDB was a good thing or a bad thing so, after getting my server issue resolved and InnoDB enabled as an engine type, I converted both tables to InnoDB and repeated the experimented. Success! (y)

With the table engine types changed I went back and repeated the first experiment. Success! (y)

So in short, reusing existing categories works with both MyISAM & InnoDB types and not creating an empty table if no valid smilies are selected works with InnoDB. I think you can mark this one as resolved.
 
Thanks for the feedback, Kevin. Given that having MyISAM tables is not the default configuration, and it creates only inconvenience rather than damage, I think I'll leave it now with the fixes that were applied for B2 :)
 
Top Bottom