We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

Database Exception | Forum

Purusothaman Ramanujam
Hi all,

I get the below database exception when I try to activate or deactivate the plugin in development.

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'menutext_value-rssreader' for key 'key'
File:     /home/ladiedmx/public_html/oxwall/ow_core/database.php
Line:     305
Trace:    

#0 /home/ladiedmx/public_html/oxwall/ow_core/database.php(305): PDOStatement->execute()
#1 /home/ladiedmx/public_html/oxwall/ow_core/database.php(414): OW_Database->execute('INSERT INTO `ow...', Array)
#2 /home/ladiedmx/public_html/oxwall/ow_core/database.php(451): OW_Database->insert('INSERT INTO `ow...', Array)
#3 /home/ladiedmx/public_html/oxwall/ow_core/base_dao.php(209): OW_Database->insertObject('ow_base_menu_it...', Object(BOL_MenuItem))
#4 /home/ladiedmx/public_html/oxwall/ow_system_plugins/base/bol/navigation_service.php(103): OW_BaseDao->save(Object(BOL_MenuItem))
#5 /home/ladiedmx/public_html/oxwall/ow_core/navigation.php(109): BOL_NavigationService->saveMenuItem(Object(BOL_MenuItem))
#6 /home/ladiedmx/public_html/oxwall/ow_plugins/rssreader/activate.php(2): OW_Navigation->addMenuItem('main', 'rssreader_index', 'rssreader', 'menutext_value', 3)
#7 /home/ladiedmx/public_html/oxwall/ow_system_plugins/base/bol/plugin_service.php(385): include_once('/home/ladiedmx/...')
#8 /home/ladiedmx/public_html/oxwall/ow_system_plugins/admin/controllers/plugins.php(591): BOL_PluginService->install('rssreader')
#9 [internal function]: ADMIN_CTRL_Plugins->install(Array)
#10 /home/ladiedmx/public_html/oxwall/ow_core/request_handler.php(266): ReflectionMethod->invokeArgs(Object(ADMIN_CTRL_Plugins), Array)
#11 /home/ladiedmx/public_html/oxwall/ow_core/application.php(300): OW_RequestHandler->dispatch()
#12 /home/ladiedmx/public_html/oxwall/index.php(65): OW_Application->handleRequest()
#13 {main}

The below code of line is present in the activate.php and I have created a language string menutext_value in the Admin Language page.

OW::getNavigation()->addMenuItem(OW_Navigation::MAIN, 'rssreader_index', 'rssreader', 'menutext_value', OW_Navigation::VISIBLE_FOR_ALL);
Sardar
Sardar Apr 25 '12
Hello,


You tried to add duplicate entry for pair - `rssreader` + `menutext_value` in `ow_base_menu_item` table. You should delete old entry before adding new one, ie add code to delete menu item in deactivate.php. Deactivate script should clean up such things.

Purusothaman Ramanujam
Hi Sardar,

I have the below code already in deactivate.php file.

OW::getNavigation()->deleteMenuItem('rssreader', 'rssreader');

Apart from this do I need to have any clean up code?

Thanks alot again for your help on this.
Michael I.
Michael I. Dec 21 '12
Topic was moved from Plugins.