PDA

View Full Version : DB Error uninstalling Plugin


Guest210212002
03-22-2015, 04:31 PM
I'm cleaning up my vb3 install before migrating up to vb4, and one of the plugins I'm uninstalling is teh viglink plugin. Here's the uninstall code:


<uninstallcode><![CDATA[if( ! defined( "VGLNK_IN_UPDATER" ) || defined( "VGLNK_IN_INSTALLER" ) ) {
define( "VGLNK_VERSION", "2.0.7" );
}

define( "VGLNK_BASE_DIR", defined( "DIR" ) ? DIR : ( dirname( __FILE__ ) . "/../.." ) );
define( "VGLNK_CRON_DIR", VGLNK_BASE_DIR . "/includes/cron" );
define( "VGLNK_UPDATE_LOADER", VGLNK_CRON_DIR . "/viglink_updater.php" );

define( "VGLNK_BASE_URL", "http://cdn.viglink.com/downloads/vbulletin" );
define( "VGLNK_UPDATE_URL", VGLNK_BASE_URL );
define( "VGLNK_VERSION_URL", VGLNK_BASE_URL . "/version.xml" );

$vl_link_insertion_fields_r = $vbulletin->db->query_read("SELECT * FROM " . TABLE_PREFIX . "viglink_link_insertion ORDER BY id DESC;");
$vl_link_insertion_fields = $vbulletin->db->fetch_array($vl_link_insertion_fields_r);
$vl_ID_own = $vl_link_insertion_fields['link_insertion_ownposts'];
$vl_ID_posts = $vl_link_insertion_fields['link_insertion_inposts'];

if($vl_ID_own && $vl_ID_posts) {
$vbulletin->db->query_write("DELETE FROM " . TABLE_PREFIX . "profilefield WHERE profilefieldid = ".$vl_ID_own." OR profilefieldid = ".$vl_ID_posts.";");
$vbulletin->db->query_write("ALTER TABLE " . TABLE_PREFIX . "userfield DROP COLUMN field".$vl_ID_posts.";");
$vbulletin->db->query_write("ALTER TABLE " . TABLE_PREFIX . "userfield DROP COLUMN field".$vl_ID_own.";");
}

$vbulletin->db->query_write("DROP TABLE IF EXISTS `" . TABLE_PREFIX . "viglink_link_insertion");

]]></uninstallcode>

I get the following error when I go to uninstall the product from the ACP:


Database error in vBulletin 3.8.8:

Invalid SQL:
ALTER TABLE userfield DROP COLUMN field29;;

MySQL Error : Can't DROP 'field29'; check that column/key exists


I get the error uninstalling it on my 3.8.8 forum, and my vb4 test platform as well. If I go to my user profile field manager, I see profile fields that go up to field25. My thought was that I'd just add field29 myself so it's there and "droppable", but when I add new a new field it shows up as field31.

What's my best bet here? Create field29 (somehow?) so that it can be dropped? Or is there a way that I can execute just that uninstall code and remove the field it's failing on?

I tried a reinstall of the Product itself with allow overwrite enabled, but even with the fresh install I still get this DB error when I try to remove it.