XF 1.4 ******* Credits Resource Integration preventing upgrade

Ferdinand

Well-known member
Hi so long story short, it's been 4-6 years since I've updated anything now coming round to do it and one addon dev isn't offering support to remove one of the old addons from him.

So I get the server error below when trying to uninstall via the admin CP.
Code:
Mysqli prepare error: Table 'edchatne_vB.xf_credits_action' doesn't exist

Zend_Db_Statement_Mysqli->_prepare() in Zend/Db/Statement.php at line 115
Zend_Db_Statement->__construct() in Zend/Db/Adapter/Mysqli.php at line 381
Zend_Db_Adapter_Mysqli->prepare() in Zend/Db/Adapter/Abstract.php at line 478
Zend_Db_Adapter_Abstract->query() in Zend/Db/Adapter/Abstract.php at line 753
Zend_Db_Adapter_Abstract->fetchRow() in *******/Credits/Model/Action.php at line 76
*******_Credits_Model_Action->getActionById() in *******/Credits/DataWriter/Action.php at line 79
*******_Credits_DataWriter_Action->_getExistingData() in XenForo/DataWriter.php at line 563
XenForo_DataWriter->setExistingData() in *******/CreResIntegration/Installer.php at line 49
*******_CreResIntegration_Installer::uninstall()
call_user_func() in XenForo/DataWriter/AddOn.php at line 200
XenForo_DataWriter_AddOn->_postDelete() in XenForo/DataWriter.php at line 1779
XenForo_DataWriter->delete() in XenForo/ControllerAdmin/AddOn.php at line 122
XenForo_ControllerAdmin_AddOn->actionDelete() in XenForo/FrontController.php at line 347
XenForo_FrontController->dispatch() in XenForo/FrontController.php at line 134
XenForo_FrontController->run() in /home/edchatne/public_html/admin.php at line 13

Below is the installer.php, I don't still have the XML. If anyone can help me get this off the site it would be much appreciated. I will not be using their addons again & would suggest the same to anyone considering credits or integration with RM switch to RM marketplace.
PHP:
<?php
class *******_CreResIntegration_Installer extends *******_*******Library_Installer
{
    public static function getTables()
    {
        $tables = array();
        $tables['xf_resource_purchased'] = "";
        return $tables;
    }
   
    public static function getAlters()
    {
        $alters = array();
        $alters['xf_resource'] = array(
            'credit_price'    =>    "",
            'currency_id'    =>    "",
        );
        return $alters;
    }
    public static function init()
    {
        self::$_tables = self::getTables();
        self::$_alters = self::getAlters();
        self::$_data = self::getData();
    }
    protected static function _installVersion_1030000()
    {
        self::$_data['xf_resource'] = "ALTER TABLE  `xf_resource` CHANGE  `currency_id`  `brcri_currency_id` INT( 10 ) UNSIGNED NOT NULL DEFAULT  '0'";
    }
    public static function install($existingAddOn, $addOnData)
    {
        $resAddon = XenForo_Model::create('XenForo_Model_AddOn')->getAddOnVersion('XenResource');
        if (!$resAddon) {
            throw new XenForo_Exception('XenForo Resource Manager Addon required', true);
        }
        $creditsAddon = XenForo_Model::create('XenForo_Model_AddOn')->getAddOnVersion('*******_Credits');
        if (!$creditsAddon) {
            throw new XenForo_Exception('******* Credits Addon required', true);
        }
        self::checkLicense($addOnData);
        if(!empty($existingAddOn['version_id']) && $existingAddOn['version_id'] < 1030000){
            self::_installVersion_1030000();
        }
        self::_install($existingAddOn);
    }
    public static function uninstall()
    {
        $dw = XenForo_DataWriter::create('*******_Credits_DataWriter_Action', XenForo_DataWriter::ERROR_SILENT);
        if ($dw->setExistingData('ResourceGetPurchased'))
        {
            $dw->delete();
        }
        $dw2 = XenForo_DataWriter::create('*******_Credits_DataWriter_Action', XenForo_DataWriter::ERROR_SILENT);
        if ($dw2->setExistingData('ResourcePurchased'))
        {
            $dw2->delete();
        }
        self::init();
        self::_uninstall();
    }
}

?>

Anyone get this off their site, know a command I can run, or have a php removal file for this < Perhaps @XenForo can make one to remove their products considering how they have treated XF.

EDIT: P.S. I uninstalled credits first. I don't have the xml file to reinstall and try to reverse the order of uninstall.
 

Ferdinand

Well-known member
This addon dev hasn't been around here for years and the account is banned, I had trouble a few years back but was resolved.Screen Shot 2020-05-29 at 9.43.40 am.png
Screen Shot 2020-05-29 at 9.44.04 am.png

There must be a way to remove this.
 

Chris D

XenForo developer
Staff member
I'm not sure all of the relevant code is there.

It's really the original author's responsibility to provide support for it in every circumstance. If we were being strict, we'd be asking you to hire some other developer or service provider for assistance.

That said, we appreciate it's not an ideal situation. The best I can recommend at the moment is to replace this entire function:

PHP:
    public static function uninstall()
    {
        $dw = XenForo_DataWriter::create('*******_Credits_DataWriter_Action', XenForo_DataWriter::ERROR_SILENT);
        if ($dw->setExistingData('ResourceGetPurchased'))
        {
            $dw->delete();
        }
        $dw2 = XenForo_DataWriter::create('*******_Credits_DataWriter_Action', XenForo_DataWriter::ERROR_SILENT);
        if ($dw2->setExistingData('ResourcePurchased'))
        {
            $dw2->delete();
        }
        self::init();
        self::_uninstall();
    }

With this:

PHP:
    public static function uninstall()
    {

    }

Presumably that will allow the uninstall to complete but it may not remove all data.
 

Ferdinand

Well-known member
Thanks Chris,

The resource manager is an important feature for me so this is important to get right.

The upgrade alone is costing me a fair bit so I appreciate it.

My main concern is any malicious code left by this dev causing issues with the database and I dont know how to find out what it had added, I'm sure theres a string of prefixes in the XML but none of this is available now.

This causes a 500 server error with the below in the error log.

I have ordered the upgrade service from Xenforo and am migrating from 1 to 2 this is the last thing left to remove.

What would happen if Brogan just upgrades it as is? I'd rather not have a permanent link to Briv in my admin cp.


Removal Error:
Code:
Error Info
ErrorException: Fatal Error: syntax error, unexpected '?>', expecting function (T_FUNCTION) - library/*******/CreResIntegration/Installer.php:51
Generated By: Ferdinand, 1 minute ago
Stack Trace
#0 [internal function]: XenForo_Application::handleFatalError()
#1 {main}
Request State
array(3) {
  ["url"] => string(69) "https://edchat.net/admin.php?add-ons/*******_CreResIntegration/delete"
  ["_GET"] => array(1) {
    ["add-ons/*******_CreResIntegration/delete"] => string(0) ""
  }
  ["_POST"] => array(0) {
  }
}
 

Chris D

XenForo developer
Staff member
Well, the good news is once you upgrade to XF2, there's literally no XF1 code that can execute anymore. There may end up being data left in the database, but that would generally do little more than take up a few bytes of storage.

Given the issues you're having with this uninstall, yeah it would probably make sense to just do the upgrade. All add-ons are disabled during upgrade and marked as "Legacy". Legacy add-ons can be removed after the upgrade is complete so there won't be any permanent link.
 
Top