Jump to content
thirty bees forum
  • 0

While updating modules in TB v1.08 my back office was knocked out by cron module.


Question

Posted (edited)

So i migrated from ps 1.6.10 to tb 1.08 which went well. I deleted the migration module and updated all the modules that TB wanted to. Which in turn knocked out my back office. Here is what i have atm.

[ThirtyBeesDatabaseException]
Table 'xxx_thirty.cronjobs' doesn't exist


ALTER TABLE `cronjobs` ADD `minute` INTEGER DEFAULT '-1' AFTER `task`

at line 844 in file classes/db/Db.php
839.         if ($webserviceCall && $errno) {
840.             $dbg = debug_backtrace();
841.             WebserviceRequest::getInstance()->setError(500, '[SQL Error] '.$this->getMsgError().'. From '.(isset($dbg[3]['class']) ? $dbg[3]['class'] : '').'->'.$dbg[3]['function'].'() Query was : '.$sql, 97);
842.         } elseif (_PS_DEBUG_SQL_ && $errno && !defined('TB_INSTALLATION_IN_PROGRESS')) {
843.             if ($sql) {
844.                 throw new PrestaShopDatabaseException($this->getMsgError().'<br /><br /><pre>'.$sql.'</pre>');
845.             }
846. 
847.             throw new PrestaShopDatabaseException($this->getMsgError());
848.         }
849.     }
DbCore->displayError - [line 488 - classes/db/Db.php] - [1 Arguments]
483.                 $this->result = $this->_query($sql);
484.             }
485.         }
486. 
487.         if (_PS_DEBUG_SQL_) {
488.             $this->displayError($sql);
489.         }
490. 
491.         return $this->result;
492.     }
493. 
DbCore->query - [line 675 - classes/db/Db.php] - [1 Arguments]
670.     {
671.         if ($sql instanceof DbQuery) {
672.             $sql = $sql->build();
673.         }
674. 
675.         $this->result = $this->query($sql);
676. 
677.         return (bool) $this->result;
678.     }
679. 
680.     /**
DbCore->execute - [line 32 - modules/cronjobs/upgrade/upgrade-2.1.0.php] - [1 Arguments]
27.     exit;
28. }
29. 
30. function upgrade_module_2_1_0()
31. {
32.     Db::getInstance()->execute('ALTER TABLE `cronjobs` ADD `minute` INTEGER DEFAULT \'-1\' AFTER `task`');
33. 
34.     return true;
35. }
upgrade_module_2_1_0 - [line 2212 - classes/module/Module.php] - [1 Arguments]
2207. 
2208.             // Call the upgrade function if defined
2209.             $upgrade['success'] = false;
2210.             foreach ($fileDetail['upgrade_function'] as $item) {
2211.                 if (function_exists($item)) {
2212.                     $upgrade['success'] = $item($this);
2213.                 }
2214.             }
2215. 
2216.             // Set detail when an upgrade succeed or failed
2217.             if ($upgrade['success']) {
ModuleCore->runUpgradeModule - [line 389 - controllers/admin/AdminModulesController.php]
384.                     require_once(_PS_MODULE_DIR_.$module->name.'/'.$module->name.'.php');
385.                 }
386. 
387.                 if ($object = Adapter_ServiceLocator::get($module->name)) {
388.                     /** @var Module $object */
389.                     $object->runUpgradeModule();
390.                     if ((count($errorsModuleList = $object->getErrors()))) {
391.                         $moduleErrors[] = ['name' => $module->displayName, 'message' => $errorsModuleList];
392.                     } elseif ((count($confModuleList = $object->getConfirmations()))) {
393.                         $moduleSuccess[] = ['name' => $module->displayName, 'message' => $confModuleList];
394.                     }
AdminModulesControllerCore->initContent - [line 262 - classes/controller/Controller.php]
257.             if (!$this->content_only && ($this->display_header || (isset($this->className) && $this->className))) {
258.                 $this->initHeader();
259.             }
260. 
261.             if ($this->viewAccess()) {
262.                 $this->initContent();
263.             } else {
264.                 $this->errors[] = Tools::displayError('Access denied.');
265.             }
266. 
267.             if (!$this->content_only && ($this->display_footer || (isset($this->className) && $this->className))) {
ControllerCore->run - [line 837 - classes/Dispatcher.php]
832.             if (isset($paramsHookActionDispatcher)) {
833.                 Hook::exec('actionDispatcher', $paramsHookActionDispatcher);
834.             }
835. 
836.             // Running controller
837.             $controller->run();
838.         } catch (PrestaShopException $e) {
839.             $e->displayMessage();
840.         }
841.     }
842. 
DispatcherCore->dispatch - [line 63 - admin/index.php]
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();

What direction should i take? Thanks in advance.

ThirtyBeesDatabaseException.jpg

Edited by Script-Fu
More Info

4 answers to this question

Recommended Posts

  • 0
Posted

Obviously some trouble with module cronjobs.

Table 'xxx_thirty.cronjobs' doesn't exist

Very odd table name. And looking at this database upgrade script: https://github.com/thirtybees/cronjobs/blob/master/upgrade/upgrade-2.1.0.php#L32, somebody apparently forgot the table name prefix.

Regarding shop recovery, is the shop actually broken? I'd try to go to back office using a new browser tab/window, it should work.

To recover the module, it might be necessary to execute this one line in the upgrade script manually, using phpMyAdmin and the actual table name.

  • 0
Posted (edited)

Thanks for the response Traumflug. I changed the table name in this post so i wouldn't give away my database name. So yea i can see why that might seem odd. Anyway i deleted that site as it was a clone of the main site and tried again to migrate to thirtybees from presta 1.6.10. I have learned what steps to take by trial and error when doing the migration. Then of course updating all the new modules inside of that fresh migration to thirtybees.

I seem to have a pretty solid thirtybees website now after getting over some hurdles. The first couple as i remember are in the thirtybees migration module. Again before i say what they are i am talking about a clone of my main website. I had to move forward with presta because because php 5.6 went EOL as you all are well aware of. My clone is now running on php 7.1

Here are a few things i learned to check and or un-check inside the migration module. Your mileage might very as mine did when i started this project.

1) I kept all my custom modules active.

2) I did not switch my custom theme to the default thirtybees theme.

3) I did not backup my database etc during the migration.

For some reason all those issue above i had to learn the hard way as the migration for me would not work. Now it seems that i am able to make a clone at will and update everything with out any errors. Of course i half to go back and correct my errors & warnings inside my custom modules once i switch over to php 7.1.  

Now back on topic: What solved the issue of updating all the modules in thirtybees after migration was to delete the cron module before doing the migration. Thus not getting this error that killed the site in the first place. That module from prestashop was version "Cron tasks manager module v1.4.0 - by PrestaShop"

Btw thanks for pointing out the upgrade script for the thirtybees cron module also what one would need to do to fix the table.

So thanks again Traumflug for the solution to my post. I went the other direction and did 10x the work making another clone.

Anyway i'm trying to get better at posting on this site for help. I know i need to provide better information when posting. It's hard to help anyone if they can't understand the post. I'm working on it as i'm rusty and haven't been in the game in many years. _best

Edited by Script-Fu
Better clarification

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...