I believe that there is a bug in an older version of this addon. I found a solution and am posting it here for the benefit of anyone else who might be in the same bind.
Originally, I thought that the problem was mine rather than with the addon, so I drafted a post about it in a general forum rather than here. I'm pasting that draft here:
Hello,
Everything seems to be working well on my forum, but when I recently tried to uninstall an addon I got a server error. I checked the specific line of code where the error was and I believe that the fault is mine rather than with the addon author, as the code being called is quite elementary.
Specifically, it looks like a security issue due to a misconfigured MySQL on my server. I recently migrated to a new server, and I bet that whatever script brought everything over didn't set things up properly.
I know that convention dictates that I am supposed to blame the addon developer for everything and try to get them solve all of my problems, but I really suspect the problem is on my end.
I hope I put this in the right subforum.
Anyway, here is the error from the XF error log:
Code:
Server Error Log
Error Info
ErrorException: Fatal Error: Call to a member function query() on a non-object - library/XfAddOns/BumpThread/Install/Install.php:31
Generated By: Forest, 57 minutes ago
Stack Trace
#0 [internal function]: XenForo_Application::handleFatalError()
#1 {main}
Request State
array(3) {
["url"] => string(69) "http://www.myforum.org/forum/admin.php?add-ons/xfa_bump_thread/delete"
["_GET"] => array(1) {
["add-ons/xfa_bump_thread/delete"] => string(0) ""
}
["_POST"] => array(2) {
["_xfConfirm"] => string(1) "1"
["_xfToken"] => string(8) "********"
}
}
Line 31 of Install.php is the one that does "$db->query("DROP TABLE xfa_bump_thread");" :
Code:
/**
* Deletes the privacy fields
*/
public static function uninstall()
{
$db->query("DROP TABLE xfa_bump_thread");
}
Pretty tame stuff, eh? The table in question also seems quite harmless:
Code:
mysql> select * from xfa_bump_thread;
+---------+------------------+----------------+
| user_id | last_bump_thread | last_bump_date |
+---------+------------------+----------------+
| 6 | 7030 | 1421249747 |
| 555 | 3711 | 1396631521 |
| 177 | 4711 | 1403167016 |
+---------+------------------+----------------+
3 rows in set (0.00 sec)
For the record, the addon in question worked very well. I just don't need it any more because AndyB's Change Date addon provides essentially the same functionality for my purposes.
Wait a second.... hmmm....
Why isn't there a "$db = XenForo_Application::getDb();" line in the uninstall method?
UPDATE: I added the getDb() line above and was able to uninstall the addon with no problem.
The bottom line is that I updated a PHP file and was able to uninstall with no problem. I'll paste the PHP file that I used below, but it comes with no warranties at all. It seems to have worked for a charm like me, but your mileage may vary. Hopefully the developer can investigate and provide a definitive answer.
Here is what I did. I replaced library/XfAddOns/BumpThread/Install/Install.php with the following:
Code:
<?php
class XfAddOns_BumpThread_Install_Install
{
/**
* Create the tables as needed by this hack
*/
public static function install($installedAddon)
{
$version = is_array($installedAddon) ? $installedAddon['version_id'] : 0;
if ($version < 110)
{
$db = XenForo_Application::getDb();
$db->query("
CREATE TABLE xfa_bump_thread
(
user_id int not null primary key,
last_bump_thread int not null,
last_bump_date int not null
)
");
}
}
/**
* Deletes the privacy fields
*/
public static function uninstall()
{
$db = XenForo_Application::getDb();
$db->query("DROP TABLE xfa_bump_thread");
}
}
After that, the addon uninstalled like a charm. Hopefully, there won't be problems down the road, but the line that I added, "$db = XenForo_Application::getDb();" seems "pretty tame." Famous last words...