haylau Posted March 9, 2021 Posted March 9, 2021 Trying to uninstall an old module, dating back to our prestashop days But getting a 500 error. Can anyone advise how to either fix, or uninstall manually? Decoded exception Too few arguments to function ConfigurationCore::updateValue(), 1 passed in /home/uboltsrus/marketplaces.u-bolts-r-us.co.uk/modules/opartdevis/opartdevis.php on line 87 and at least 2 expected in file classes/Configuration.php at line 623 Source file: classes/Configuration.php Stack trace 1. modules/opartdevis/opartdevis.php:87 source ConfigurationCore::updateValue(arguments) #1 "OPARTDEVIS_SHOWFREEFORM" 2. controllers/admin/AdminModulesController.php:1653 source Opartdevis->uninstall() 1634: } 1635: } 1636: //retrocompatibility 1637: if (Tools::getValue('controller') != '') { 1638: $_POST['tab'] = Tools::safeOutput(Tools::getValue('controller')); 1639: } 1640: $echo = ''; 1641: if ($key != 'update' && $key != 'updateAll' && $key != 'checkAndUpdate' && $key != 'delete') { 1642: // We check if method of module exists 1643: if (!method_exists($module, $method)) { 1644: throw new PrestaShopException(sprintf('Method %s of module cannot be found', $method)); 1645: } 1646: if ($key == 'uninstall' && !Module::getPermissionStatic($module->id, 'uninstall')) { 1647: $this->errors[] = Tools::displayError('You do not have permission to uninstall this module.'); 1648: } 1649: if (count($this->errors)) { 1650: continue; 1651: } 1652: // Get the return value of current method 1653: $echo = $module->{$method}(); 1654: // After a successful install of a single module that has a configuration method, to the configuration page 1655: if ($key == 'install' && $echo === true && strpos(Tools::getValue('install'), '|') === false && method_exists($module, 'getContent')) { 1656: Tools::redirectAdmin(static::$currentIndex.'&token='.$this->token.'&configure='.$module->name.'&conf=12'); 1657: } 1658: } 1659: // If the method called is "configure" (getContent method), we show the html code of configure page 1660: if ($key == 'configure' && Module::isInstalled($module->name)) { 1661: $this->bootstrap = (isset($module->bootstrap) && $module->bootstrap); 1662: if (isset($module->multishop_context)) { 1663: $this->multishop_context = $module->multishop_context; 3. controllers/admin/AdminModulesController.php:1516 source AdminModulesControllerCore->postProcessCallback() 1497: if (Tools::getValue('redirect') == 'config' && Tools::getValue('module_name') != '' && Module::isInstalled(pSQL(Tools::getValue('module_name')))) { 1498: Tools::redirectAdmin('index.php?controller=adminmodules&configure='.Tools::getValue('module_name').'&token='.Tools::getValue('token').'&module_name='.Tools::getValue('module_name')); 1499: } 1500: 1501: // Execute filter or callback methods 1502: $filterMethods = ['filterModules', 'resetFilterModules', 'filterCategory', 'unfilterCategory']; 1503: $callbackMethods = ['reset', 'download', 'enable', 'delete', 'enable_device', 'disable_device']; 1504: $postProcessMethodsList = array_merge((array) $filterMethods, (array) $callbackMethods); 1505: foreach ($postProcessMethodsList as $ppm) { 1506: if (Tools::isSubmit($ppm)) { 1507: $ppm = 'postProcess'.ucfirst($ppm); 1508: if (method_exists($this, $ppm)) { 1509: $ppmReturn = $this->$ppm(); 1510: } 1511: } 1512: } 1513: 1514: // Call appropriate module callback 1515: if (!isset($ppmReturn)) { 1516: $this->postProcessCallback(); 1517: } 1518: 1519: if ($back = Tools::getValue('back')) { 1520: Tools::redirectAdmin($back); 1521: } 1522: } 1523: 1524: /** 1525: * @return void 1526: * 4. classes/controller/Controller.php:197 source AdminModulesControllerCore->postProcess() 178: } else { 179: $this->$property = $value; 180: } 181: } 182: 183: /** 184: * Starts the controller process 185: * 186: * @since 1.0.0 187: * @version 1.0.0 Initial version 188: */ 189: public function run() 190: { 191: $this->init(); 192: if ($this->checkAccess()) { 193: if (!$this->content_only && ($this->display_header || (isset($this->className) && $this->className))) { 194: $this->setMedia(); 195: } 196: 197: $this->postProcess(); 198: 199: if (!empty($this->redirect_after)) { 200: $this->redirect(); 201: } 202: 203: if (!$this->content_only && ($this->display_header || (isset($this->className) && $this->className))) { 204: $this->initHeader(); 205: } 206: 207: if ($this->viewAccess()) { 5. classes/Dispatcher.php:852 source ControllerCore->run() 833: return; 834: } 835: break; 836: 837: default: 838: throw new PrestaShopException('Bad front controller chosen'); 839: } 840: 841: // Instantiate controller 842: try { 843: // Loading controller 844: $controller = Controller::getController($controllerClass); 845: 846: // Execute hook dispatcher 847: if (isset($paramsHookActionDispatcher)) { 848: Hook::exec('actionDispatcher', $paramsHookActionDispatcher); 849: } 850: 851: // Running controller 852: $controller->run(); 853: } catch (PrestaShopException $e) { 854: $e->displayMessage(); 855: } 856: } 857: 858: /** 859: * Retrieve the controller from url or request uri if routes are activated 860: * 861: * @param int|null $idShop 862: * 6. nimda/index.php:63 source DispatcherCore->dispatch() 44://small test to clear cache after upgrade 45:if (Configuration::get('PS_UPGRADE_CLEAR_CACHE')) { 46: header('Cache-Control: max-age=0, must-revalidate'); 47: header('Expires: Mon, 06 Jun 1985 06:06:00 GMT+1'); 48: Configuration::updateValue('PS_UPGRADE_CLEAR_CACHE', 0); 49:} 50: 51:// For retrocompatibility with "tab" parameter 52:if (!isset($_GET['controller']) && isset($_GET['tab'])) { 53: $_GET['controller'] = strtolower($_GET['tab']); 54:} 55:if (!isset($_POST['controller']) && isset($_POST['tab'])) { 56: $_POST['controller'] = strtolower($_POST['tab']); 57:} 58:if (!isset($_REQUEST['controller']) && isset($_REQUEST['tab'])) { 59: $_REQUEST['controller'] = strtolower($_REQUEST['tab']); 60:} 61: 62:// Prepare and trigger admin dispatcher 63:Dispatcher::getInstance()->dispatch();
SLiCK_303 Posted March 9, 2021 Posted March 9, 2021 Do you recall if there are any overrides associated with the opartdevis module? What about the db structure for the same module? If you know these things you should be able to delete the opartdevis folder, delete any entries it uses in your db, and remove any overrides. Backup both the db and files before doing anytihng..... ;) Might be helpful to know the few lines surrounding line 87 in /modules/opartdevis/opartdevis.php
datakick Posted March 9, 2021 Posted March 9, 2021 Try to edit file /modules/opartdevis/opartdevis.php, line 87, and change Configuration::updateValue('OPARTDEVIS_SHOWFREEFORM') to Configuration::deleteByName('OPARTDEVIS_SHOWFREEFORM');
haylau Posted March 9, 2021 Author Posted March 9, 2021 13 minutes ago, datakick said: Try to edit file /modules/opartdevis/opartdevis.php, line 87, and change Configuration::updateValue('OPARTDEVIS_SHOWFREEFORM') to Configuration::deleteByName('OPARTDEVIS_SHOWFREEFORM'); Perfect. Thanks 👍
Traumflug Posted March 10, 2021 Posted March 10, 2021 Many many modules don't even try to uninstall properly, I fixed more than a dozen already. The probably only way to get this done right is to look into the install() method and undo everything done there. That said, core does a few things automatically: unregistering hooks and removing everything module related installed by core.
AndyC Posted March 10, 2021 Posted March 10, 2021 Can you not just remove them from your database.. I've seen a few old modules showing in mine ,but haven't deleted them incase something goes wrong
Traumflug Posted March 10, 2021 Posted March 10, 2021 36 minutes ago, AndyC said: Can you not just remove them from your database. One has to find out what 'the database' is. This is where looking into install() helps. If there's no longer any code touching this database table, the table can get removed, of course. It gets a bit more complicated with modules putting their stuff into the general configuration table. To clean this, one literally has to grep through the code for calls to Configuration::updateValue() and Configuration::updateGlobalValue() to find them. Such stuff is often not initialized in install(). No rules without exceptions: payment modules often create their own order status, like 'Waiting for Bitcoin payment'. Order states can be still in use after module uninstallation, so the safe way is to just mark such states with 'active' = false and 'deleted' = true.
nickz Posted March 10, 2021 Posted March 10, 2021 23 hours ago, haylau said: Trying to uninstall an old module, dating back to our prestashop days Do you have root access to your server?
haylau Posted March 10, 2021 Author Posted March 10, 2021 24 minutes ago, nickz said: Do you have root access to your server? Yes - but we are sorted thanks to datakick’ s tip 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now