Fixed Defining new style property

gldtn

Well-known member
I'm going to try to explain in detail what I did so you guys can try to recreate it..

Ok, I initially tried to define a new style property with a set "Property Type: Scalar with default value:" of a image background into the "Color Pallet", it did not work, so I tried again.. this time with "Property Type: CSS with components:" with the Background and Extra options selected still trying to set it in the Color Pallet area. My new defined style property then disappeared, so I went to the "Styles & Templates > Customized Components" and saw my style property there. I then deleted it to try to define a new style property again, but this time into a new area other than the "Color Pallet" and I ran into the following database error:

Code:
The following error occurred:
 
Mysqli statement execute error : Duplicate entry '16-refinedColor' for key 'definition_style_id_property_name'
Zend_Db_Statement_Mysqli->_execute() in Zend/Db/Statement.php at line 317
Zend_Db_Statement->execute() in Zend/Db/Adapter/Abstract.php at line 479
Zend_Db_Adapter_Abstract->query() in Zend/Db/Adapter/Abstract.php at line 574
Zend_Db_Adapter_Abstract->insert() in XenForo/DataWriter.php at line 1591
XenForo_DataWriter->_insert() in XenForo/DataWriter.php at line 1580
XenForo_DataWriter->_save() in XenForo/DataWriter.php at line 1381
XenForo_DataWriter->save() in XenForo/Model/StyleProperty.php at line 1390
XenForo_Model_StyleProperty->createOrUpdateStylePropertyDefinition() in XenForo/ControllerAdmin/StylePropertyDefinition.php at line 120
XenForo_ControllerAdmin_StylePropertyDefinition->actionSave() in XenForo/FrontController.php at line 310
XenForo_FrontController->dispatch() in XenForo/FrontController.php at line 132
XenForo_FrontController->run() in /Users/gldtn/Sites/xenforo/admin.php at line 13

The reason why I'm reporting as a bug is because I thought if I deleted it, it should've also deleted from the database correct?

Also, where in the database is that key set so I can delete it manually, or can you provide a sql query please?

Thanks!
 
Strangely I can't seem to find it in that table, I see all my other defined properties but that certain one :/

I looked to EVERY single property name in that table and also tried several searches, including my browser search for the style property description, name and ID.
 
Well, there definitely should be data in the definition table -- that's what's causing the error.

I should note that one of the underlying issues is that you can't have a CSS style property in the color palette group. I've prevented that from happening now too.

However, it looks like the problem here is that the customized components system can't handle deleting components that are defined outside the master style level. If you try to delete/revert something in that state, it will create a very messed up situation. I think I have to just hide those from showing up there.
 
Mike, I'll have to check again under the definition table, but I looked several times through it that day and did not find it :/.. Also I haven't updated to the latest version yet, but on 1.1.0 that also happened on other occasions outside of the color palette group. Will let you guys know if I can reproduce it on 1.1.1 though.

..If you try to delete/revert something in that state, it will create a very messed up situation...

Hmm, does this mean I should be worried about something with my installed copy, or will it fix it self on the next update?

Thank you!
 
I am more or less getting the same error after importing an earlier export style update.

Mysqli statement execute error : Duplicate entry '4-border' for key 'definition_style_id_property_name'
  1. Zend_Db_Statement_Mysqli->_execute() in Zend/Db/Statement.php at line 297
  2. Zend_Db_Statement->execute() in Zend/Db/Adapter/Abstract.php at line 479
  3. Zend_Db_Adapter_Abstract->query() in Zend/Db/Adapter/Abstract.php at line 574
  4. Zend_Db_Adapter_Abstract->insert() in XenForo/DataWriter.php at line 1591
  5. XenForo_DataWriter->_insert() in XenForo/DataWriter.php at line 1580
  6. XenForo_DataWriter->_save() in XenForo/DataWriter.php at line 1381
  7. XenForo_DataWriter->save() in XenForo/Model/StyleProperty.php at line 2275
  8. XenForo_Model_StyleProperty->importStylePropertiesFromArray() in XenForo/Model/StyleProperty.php at line 2187
  9. XenForo_Model_StyleProperty->importStylePropertyXml() in XenForo/Model/Style.php at line 533
  10. XenForo_Model_Style->importStyleXml() in XenForo/ControllerAdmin/Style.php at line 181
  11. XenForo_ControllerAdmin_Style->actionImport() in XenForo/FrontController.php at line 310
  12. XenForo_FrontController->dispatch() in XenForo/FrontController.php at line 132
  13. XenForo_FrontController->run() in /var/www/mysite.com/forum/admin.php at line 13
 
This bug covers a very specific case. What you're seeing is not directly related and can generally be resolved with a couple refreshes.
 
Top Bottom