1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Fixed Server error when disabling add-ons in quick succession (Fix inside)

Discussion in 'Resolved Bug Reports' started by Chris D, Aug 7, 2013.

  1. Chris D

    Chris D XenForo Developer Staff Member

    Similar (fixed) bug here: http://xenforo.com/community/thread...abling-two-add-ons-in-short-succession.54140/

    This appears to be a similar thing and I think, without looking back at the original code, probably the same fix.

    XenForo_Model_AdminTemplate line 746

    Replace:
    PHP:
                $db->insert('xf_admin_template_phrase', array(
                    
    'template_id' => $templateId,
                    
    'phrase_title' => $includedPhrase
                
    ));
    With:
    PHP:
                $db->query('
                        INSERT IGNORE INTO xf_admin_template_phrase
                            (template_id, phrase_title)
                        VALUES
                            (?, ?)
                '
    , array($templateId$includedPhrase));
     
  2. Chris D

    Chris D XenForo Developer Staff Member

    Would maybe help if I included the error and stack trace :rolleyes:

    These were all separate times where I was crazily enabling and disabling add-ons from the Admin CP home in quick succession.

    Code:
    Error Info
    Zend_Db_Statement_Mysqli_Exception: Mysqli statement execute error : Duplicate entry '4561-new_threads' for key 'PRIMARY' - library\Zend\Db\Statement\Mysqli.php:214
    Generated By: Chris Deeming, 17 minutes ago
    Stack Trace
    #0 C:\Program Files (x86)\Zend\Apache2\htdocs\library\Zend\Db\Statement.php(317): Zend_Db_Statement_Mysqli->_execute(Array)
    #1 C:\Program Files (x86)\Zend\Apache2\htdocs\library\Zend\Db\Adapter\Abstract.php(479): Zend_Db_Statement->execute(Array)
    #2 C:\Program Files (x86)\Zend\Apache2\htdocs\library\Zend\Db\Adapter\Abstract.php(574): Zend_Db_Adapter_Abstract->query('INSERT INTO `xf...', Array)
    #3 C:\Program Files (x86)\Zend\Apache2\htdocs\library\XenForo\Model\AdminTemplate.php(749): Zend_Db_Adapter_Abstract->insert('xf_admin_templa...', Array)
    #4 C:\Program Files (x86)\Zend\Apache2\htdocs\library\XenForo\Deferred\AdminTemplatePartialCompile.php(51): XenForo_Model_AdminTemplate->compileParsedAdminTemplate(4561, Array, 'forum_edit')
    #5 C:\Program Files (x86)\Zend\Apache2\htdocs\library\XenForo\Model\Deferred.php(197): XenForo_Deferred_AdminTemplatePartialCompile->execute(Array, Array, 9.8730850219727, 'Rebuilding... A...')
    #6 C:\Program Files (x86)\Zend\Apache2\htdocs\library\XenForo\Model\Deferred.php(320): XenForo_Model_Deferred->runDeferred(Array, 9.8730850219727, 'Rebuilding... A...', false)
    #7 C:\Program Files (x86)\Zend\Apache2\htdocs\library\XenForo\Model\Deferred.php(273): XenForo_Model_Deferred->_runInternal(Array, 9.8730869293213, 'Rebuilding... A...', false)
    #8 C:\Program Files (x86)\Zend\Apache2\htdocs\library\XenForo\ViewRenderer\Abstract.php(352): XenForo_Model_Deferred->run(true, 9.8730869293213)
    #9 C:\Program Files (x86)\Zend\Apache2\htdocs\library\XenForo\ViewRenderer\Json.php(147): XenForo_ViewRenderer_Abstract::hasManualDeferredToRun()
    #10 C:\Program Files (x86)\Zend\Apache2\htdocs\library\XenForo\ViewRenderer\Json.php(181): XenForo_ViewRenderer_Json::_addDefaultParams(Array)
    #11 C:\Program Files (x86)\Zend\Apache2\htdocs\library\XenForo\ViewRenderer\Json.php(37): XenForo_ViewRenderer_Json::jsonEncodeForOutput(Array)
    #12 C:\Program Files (x86)\Zend\Apache2\htdocs\library\XenForo\FrontController.php(583): XenForo_ViewRenderer_Json->renderRedirect(4, 'http://localhos...', NULL, Array)
    #13 C:\Program Files (x86)\Zend\Apache2\htdocs\library\XenForo\FrontController.php(158): XenForo_FrontController->renderView(Object(XenForo_ControllerResponse_Redirect), Object(XenForo_ViewRenderer_Json), Array)
    #14 C:\Program Files (x86)\Zend\Apache2\htdocs\admin.php(13): XenForo_FrontController->run()
    #15 {main}
    
    Code:
    Error Info
    Zend_Db_Statement_Mysqli_Exception: Mysqli statement execute error : Duplicate entry '4561-display_in_node_list' for key 'PRIMARY' - library\Zend\Db\Statement\Mysqli.php:214
    Generated By: Chris Deeming, 18 minutes ago
    Stack Trace
    #0 C:\Program Files (x86)\Zend\Apache2\htdocs\library\Zend\Db\Statement.php(317): Zend_Db_Statement_Mysqli->_execute(Array)
    #1 C:\Program Files (x86)\Zend\Apache2\htdocs\library\Zend\Db\Adapter\Abstract.php(479): Zend_Db_Statement->execute(Array)
    #2 C:\Program Files (x86)\Zend\Apache2\htdocs\library\Zend\Db\Adapter\Abstract.php(574): Zend_Db_Adapter_Abstract->query('INSERT INTO `xf...', Array)
    #3 C:\Program Files (x86)\Zend\Apache2\htdocs\library\XenForo\Model\AdminTemplate.php(749): Zend_Db_Adapter_Abstract->insert('xf_admin_templa...', Array)
    #4 C:\Program Files (x86)\Zend\Apache2\htdocs\library\XenForo\Deferred\AdminTemplatePartialCompile.php(51): XenForo_Model_AdminTemplate->compileParsedAdminTemplate(4561, Array, 'forum_edit')
    #5 C:\Program Files (x86)\Zend\Apache2\htdocs\library\XenForo\Model\Deferred.php(197): XenForo_Deferred_AdminTemplatePartialCompile->execute(Array, Array, 9.8452389240265, 'Rebuilding... A...')
    #6 C:\Program Files (x86)\Zend\Apache2\htdocs\library\XenForo\Model\Deferred.php(320): XenForo_Model_Deferred->runDeferred(Array, 9.8452389240265, 'Rebuilding... A...', false)
    #7 C:\Program Files (x86)\Zend\Apache2\htdocs\library\XenForo\Model\Deferred.php(273): XenForo_Model_Deferred->_runInternal(Array, 9.8452410697937, 'Rebuilding... A...', false)
    #8 C:\Program Files (x86)\Zend\Apache2\htdocs\library\XenForo\ViewRenderer\Abstract.php(352): XenForo_Model_Deferred->run(true, 9.8452410697937)
    #9 C:\Program Files (x86)\Zend\Apache2\htdocs\library\XenForo\ViewRenderer\Json.php(147): XenForo_ViewRenderer_Abstract::hasManualDeferredToRun()
    #10 C:\Program Files (x86)\Zend\Apache2\htdocs\library\XenForo\ViewRenderer\Json.php(181): XenForo_ViewRenderer_Json::_addDefaultParams(Array)
    #11 C:\Program Files (x86)\Zend\Apache2\htdocs\library\XenForo\ViewRenderer\Json.php(37): XenForo_ViewRenderer_Json::jsonEncodeForOutput(Array)
    #12 C:\Program Files (x86)\Zend\Apache2\htdocs\library\XenForo\FrontController.php(583): XenForo_ViewRenderer_Json->renderRedirect(4, 'http://localhos...', NULL, Array)
    #13 C:\Program Files (x86)\Zend\Apache2\htdocs\library\XenForo\FrontController.php(158): XenForo_FrontController->renderView(Object(XenForo_ControllerResponse_Redirect), Object(XenForo_ViewRenderer_Json), Array)
    #14 C:\Program Files (x86)\Zend\Apache2\htdocs\admin.php(13): XenForo_FrontController->run()
    #15 {main}
    Request State
    Code:
    Error Info
    Zend_Db_Statement_Mysqli_Exception: Mysqli statement execute error : Duplicate entry '4561-style' for key 'PRIMARY' - library\Zend\Db\Statement\Mysqli.php:214
    Generated By: Chris Deeming, 28 minutes ago
    Stack Trace
    #0 C:\Program Files (x86)\Zend\Apache2\htdocs\library\Zend\Db\Statement.php(317): Zend_Db_Statement_Mysqli->_execute(Array)
    #1 C:\Program Files (x86)\Zend\Apache2\htdocs\library\Zend\Db\Adapter\Abstract.php(479): Zend_Db_Statement->execute(Array)
    #2 C:\Program Files (x86)\Zend\Apache2\htdocs\library\Zend\Db\Adapter\Abstract.php(574): Zend_Db_Adapter_Abstract->query('INSERT INTO `xf...', Array)
    #3 C:\Program Files (x86)\Zend\Apache2\htdocs\library\XenForo\Model\AdminTemplate.php(749): Zend_Db_Adapter_Abstract->insert('xf_admin_templa...', Array)
    #4 C:\Program Files (x86)\Zend\Apache2\htdocs\library\XenForo\Deferred\AdminTemplatePartialCompile.php(51): XenForo_Model_AdminTemplate->compileParsedAdminTemplate(4561, Array, 'forum_edit')
    #5 C:\Program Files (x86)\Zend\Apache2\htdocs\library\XenForo\Model\Deferred.php(197): XenForo_Deferred_AdminTemplatePartialCompile->execute(Array, Array, 9.1387326717377, 'Rebuilding... A...')
    #6 C:\Program Files (x86)\Zend\Apache2\htdocs\library\XenForo\Model\Deferred.php(320): XenForo_Model_Deferred->runDeferred(Array, 9.1387326717377, 'Rebuilding... A...', false)
    #7 C:\Program Files (x86)\Zend\Apache2\htdocs\library\XenForo\Model\Deferred.php(273): XenForo_Model_Deferred->_runInternal(Array, 9.8867478370667, 'Rebuilding... A...', false)
    #8 C:\Program Files (x86)\Zend\Apache2\htdocs\library\XenForo\ViewRenderer\Abstract.php(352): XenForo_Model_Deferred->run(true, 9.8867478370667)
    #9 C:\Program Files (x86)\Zend\Apache2\htdocs\library\XenForo\ViewRenderer\Json.php(147): XenForo_ViewRenderer_Abstract::hasManualDeferredToRun()
    #10 C:\Program Files (x86)\Zend\Apache2\htdocs\library\XenForo\ViewRenderer\Json.php(181): XenForo_ViewRenderer_Json::_addDefaultParams(Array)
    #11 C:\Program Files (x86)\Zend\Apache2\htdocs\library\XenForo\ViewRenderer\Json.php(37): XenForo_ViewRenderer_Json::jsonEncodeForOutput(Array)
    #12 C:\Program Files (x86)\Zend\Apache2\htdocs\library\XenForo\FrontController.php(583): XenForo_ViewRenderer_Json->renderRedirect(4, 'http://localhos...', NULL, Array)
    #13 C:\Program Files (x86)\Zend\Apache2\htdocs\library\XenForo\FrontController.php(158): XenForo_FrontController->renderView(Object(XenForo_ControllerResponse_Redirect), Object(XenForo_ViewRenderer_Json), Array)
    #14 C:\Program Files (x86)\Zend\Apache2\htdocs\admin.php(13): XenForo_FrontController->run()
    #15 {main}
     
  3. Kier

    Kier XenForo Developer Staff Member

    Fix applied :)
     
    Chris D likes this.

Share This Page