Jump to content

Error while updating and now everyhing is gone.


Recommended Posts

Hello, just tried to update with 1-click but there was an error with server I think. Now everyone of my product are gone. In debug mode I get this.

 

 

[PrestaShopDatabaseException]

Table 'u965624417_zydup.ps_smarty_last_flush' doesn't exist
 

SELECT UNIX_TIMESTAMP(last_flush) as last_flush FROM `ps_smarty_last_flush` WHERE type='compile' LIMIT 1
at line 765 in file classes/db/Db.php

 

760.             WebserviceRequest::getInstance()->setError(500, '
 '.$this->getMsgError().'. From '.(isset($dbg[3]['class']) ? $dbg[3]['class'] : '').'->'.$dbg[3]['function'].'() Query was : '.$sql, 97);
761.         }
762.         elseif (_PS_DEBUG_SQL_ && $errno && !defined('PS_INSTALLATION_IN_PROGRESS'))
763.         {
764.             if ($sql)
765.                 throw new PrestaShopDatabaseException($this->getMsgError().'<br /><br /><pre>'.$sql.'</pre>');
766.
767.             throw new PrestaShopDatabaseException($this->getMsgError());
768.         }
769.     }
770.
  • DbCore->displayError - [line 418 - classes/db/Db.php] - [1 Arguments]
    413.             if ($this->connect())
    414.                 $this->result = $this->_query($sql);
    415.         }
    416.
    417.         if (_PS_DEBUG_SQL_)
    418.             $this->displayError($sql);
    419.
    420.         return $this->result;
    421.     }
    422.
    423.     /**
  • DbCore->query - [line 669 - classes/db/Db.php] - [1 Arguments]
    664.                 $this->last_cached = true;
    665.                 return $result;
    666.             }
    667.         }
    668.
    669.         $this->result = $this->query($sql);
    670.         if (!$this->result)
    671.             $result = false;
    672.         else
    673.             $result = $this->nextRow($this->result);
    674.
  • DbCore->getRow - [line 698 - classes/db/Db.php] - [2 Arguments]
    693.     public function getValue($sql, $use_cache = true)
    694.     {
    695.         if ($sql instanceof DbQuery)
    696.             $sql = $sql->build();
    697.
    698.         if (!$result = $this->getRow($sql, $use_cache))
    699.             return false;
    700.
    701.         return array_shift($result);
    702.     }
    703.
  • DbCore->getValue - [line 99 - classes/SmartyCustom.php] - [2 Arguments]
    94.         elseif (defined('_DB_PREFIX_'))
    95.         {
    96.             if ($last_flush === null)
    97.             {
    98.                 $sql = 'SELECT UNIX_TIMESTAMP(last_flush) as last_flush FROM `'._DB_PREFIX_.'smarty_last_flush` WHERE type=\'compile\'';
    99.                 $last_flush = Db::getInstance()->getValue($sql, false);
    100.             }
    101.             if ((int)$last_flush && @filemtime($this->getCompileDir().'last_flush') < $last_flush)
    102.             {
    103.                 @touch($this->getCompileDir().'last_flush');
    104.                 parent::clearCompiledTemplate();
  • SmartyCustomCore->check_compile_cache_invalidation - [line 123 - classes/SmartyCustom.php]
    118.     /**
    119.      * {@inheritDoc}
    120.      */
    121.     public function createTemplate($template, $cache_id = null, $compile_id = null, $parent = null, $do_clone = true)
    122.     {
    123.         $this->check_compile_cache_invalidation();
    124.         if ($this->caching)
    125.         {
    126.             $this->check_template_invalidation($template, $cache_id, $compile_id);
    127.             return parent::createTemplate($template, $cache_id, $compile_id, $parent, $do_clone);
    128.         }
  • SmartyCustomCore->createTemplate - [line 2270 - classes/module/Module.php] - [4 Arguments]
    2265.             $this->current_subtemplate[$template.'_'.$cache_id.'_'.$compile_id] = $this->context->smarty->createTemplate(
    2266.                 $this->getTemplatePath($template),
    2267.                 $cache_id,
    2268.                 $compile_id,
    2269.                 $this->smarty
    2270.             );
    2271.         }
    2272.         return $this->current_subtemplate[$template.'_'.$cache_id.'_'.$compile_id];
    2273.     }
    2274.
    2275.     protected function resetCurrentSubTemplate($template, $cache_id, $compile_id)
  • ModuleCore->getCurrentSubTemplate - [line 2244 - classes/module/Module.php] - [3 Arguments]
    2239.             ));
    2240.
    2241.             if ($cache_id !== null)
    2242.                 Tools::enableCache();
    2243.
    2244.             $result = $this->getCurrentSubTemplate($template, $cache_id, $compile_id)->fetch();
    2245.
    2246.             if ($cache_id !== null)
    2247.                 Tools::restoreCacheSettings();
    2248.
    2249.             $this->resetCurrentSubTemplate($template, $cache_id, $compile_id);
  • ModuleCore->display - [line 131 - modules/yotpo/yotpo.php] - [2 Arguments]
    126.             $smarty = $this->context->smarty;
    127.             $smarty->assign(array('yotpoAppkey' => $app_key,
    128.                                  'yotpoDomain' => $this->getShopDomain(),
    129.                                  'yotpoLanguage' => $this->getLanguage()));
    130.             
    131.             return $this->display(__FILE__, 'views/templates/front/header.tpl');
    132.         }
    133.     }
    134.
    135.     public function hookproductfooter($params)
    136.     {
  • Yotpo->hookheader - [line 569 - classes/Hook.php] - [1 Arguments]
    564.                 Module::$_log_modules_perfs_session = mt_rand();
    565.         }
    566.
    567.         // Immediately return the result if we do not log performances
    568.         if (!Module::$_log_modules_perfs)
    569.             return $module->{$method}($params);
    570.
    571.         // Store time and memory before and after hook call and save the result in the database
    572.         $time_start = microtime(true);
    573.         $memory_start = memory_get_usage(true);
    574.
  • HookCore::coreCallHook - [line 526 - classes/Hook.php] - [3 Arguments]
    521.
    522.                 // Call hook method
    523.                 if ($hook_callable)
    524.                     $display = Hook::coreCallHook($moduleInstance, 'hook'.$hook_name, $hook_args);
    525.                 elseif ($hook_retro_callable)
    526.                     $display = Hook::coreCallHook($moduleInstance, 'hook'.$retro_hook_name, $hook_args);
    527.
    528.                 // Live edit
    529.                 if (!$array_return && $array['live_edit'] && Tools::isSubmit('live_edit') && Tools::getValue('ad')
    530.                     && Tools::getValue('liveToken') == Tools::getAdminToken('AdminModulesPositions'
    531.                         .(int)Tab::getIdFromClassName('AdminModulesPositions').(int)Tools::getValue('id_employee')))
  • HookCore::exec - [line 579 - classes/controller/FrontController.php] - [1 Arguments]
    574.         if (!$this->useMobileTheme())
    575.         {
    576.             // These hooks aren't used for the mobile theme.
    577.             // Needed hooks are called in the tpl files.
    578.             $this->context->smarty->assign(array(
    579.                 'HOOK_HEADER' => Hook::exec('displayHeader'),
    580.                 'HOOK_TOP' => Hook::exec('displayTop'),
    581.                 'HOOK_LEFT_COLUMN' => ($this->display_column_left ? Hook::exec('displayLeftColumn') : ''),
    582.                 'HOOK_RIGHT_COLUMN' => ($this->display_column_right ? Hook::exec('displayRightColumn', array('cart' => $this->context->cart)) : ''),
    583.             ));
    584.         }
  • FrontControllerCore->initContent - [line 37 - controllers/front/IndexController.php]
    32.      * Assign template vars related to page content
    33.      * @see FrontController::initContent()
    34.      */
    35.     public function initContent()
    36.     {
    37.         parent::initContent();
    38.         $this->addJS(_THEME_JS_DIR_.'index.js');
    39.
    40.         $this->context->smarty->assign(array('HOOK_HOME' => Hook::exec('displayHome'),
    41.             'HOOK_HOME_TAB' => Hook::exec('displayHomeTab'),
    42.             'HOOK_HOME_TAB_CONTENT' => Hook::exec('displayHomeTabContent')
  • IndexControllerCore->initContent - [line 180 - classes/controller/Controller.php]
    175.
    176.             if (!$this->content_only && ($this->display_header || (isset($this->className) && $this->className)))
    177.                 $this->initHeader();
    178.
    179.             if ($this->viewAccess())
    180.                 $this->initContent();
    181.             else
    182.                 $this->errors[] = Tools::displayError('Access denied.');
    183.
    184.             if (!$this->content_only && ($this->display_footer || (isset($this->className) && $this->className)))
    185.                 $this->initFooter();
  • ControllerCore->run - [line 373 - classes/Dispatcher.php]
    368.             // Execute hook dispatcher
    369.             if (isset($params_hook_action_dispatcher))
    370.                 Hook::exec('actionDispatcher', $params_hook_action_dispatcher);
    371.
    372.             // Running controller
    373.             $controller->run();
    374.         }
    375.         catch (PrestaShopException $e)
    376.         {
    377.             $e->displayMessage();
    378.         }
  • DispatcherCore->dispatch - [line 28 - index.php]
    23. * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
    24. * International Registered Trademark & Property of PrestaShop SA
    25. */
    26.
    27. require(dirname(__FILE__).'/config/config.inc.php');
    28. Dispatcher::getInstance()->dispatch();

 

 

 

Please help me get my store back.

Edited by MatiDLV (see edit history)
Link to comment
Share on other sites

You should back-up your FTP and database from a back-up made by you or at least your provider.

 

From which version to which one did you tried to make an upgrade ?  You never should upgrade live shops without to test on a clone before. From what I can see on the error list your store is something very special using webservice ?

 

Are you using non-native modules and theme ? The table ps_smarty_last_flush is not a native one.

 

If your are trying an upgrade to PS 1.6.1.0 you should before upgrade:

 

1) disable cache (APC, xCache, etc)

2) disable all non native overrides and modules (this is a setting on the 1-click upgrade module).

3) upgrade default theme and mails (also a setting on the 1-click upügrade module).

 

 

Good Luck.

Link to comment
Share on other sites

Thank you all for your reply. Already tried to restore database from backup, but same problem remains. For what I believe I think will need to setup the store again. Is there a way to not loose everything? Backing up all files fRon server would be any good?

thank you

Link to comment
Share on other sites

MatiDLV:
If you are still having the problem, try the following: 

1. Restore your database back to where it was right before you did the 1-click update.

2. Make sure you get the same error as you described above by going to your website.

SELECT UNIX_TIMESTAMP(last_flush) as last_flush FROM `ps_smarty_last_flush` WHERE type='compile' LIMIT 1

at line 765 in file classes/db/Db.php

3. I did the one-click update on a local box. And then used git to copy to test box. However, the database also needs to be updated.

Couple of things worked for me. Going back in and turning on the cache on local box.

This created the ps_smarty tables locally.

4. However, on the test box, the database needs to be updated.

Export/Import the smarty tables - they are probably empty. There were for me.

5. I will include the SQL in case you cannot export.

 

-- phpMyAdmin SQL Dump

-- version 4.1.14
--
-- Host: 127.0.0.1:3306
-- Generation Time: Jul 10, 2015 at 01:27 AM
-- Server version: 5.6.17
-- PHP Version: 5.5.12
 
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
 
 
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=[spam-filter]CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=[spam-filter]CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=[spam-filter]COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
 
--
-- Database: `presta161`
--
 
-- --------------------------------------------------------
 
--
-- Table structure for table `ps_smarty_cache`
--
 
DROP TABLE IF EXISTS `ps_smarty_cache`;
CREATE TABLE IF NOT EXISTS `ps_smarty_cache` (
  `id_smarty_cache` char(40) NOT NULL,
  `name` char(40) NOT NULL,
  `cache_id` varchar(254) DEFAULT NULL,
  `modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `content` longtext NOT NULL,
  PRIMARY KEY (`id_smarty_cache`),
  KEY `name` (`name`),
  KEY `cache_id` (`cache_id`),
  KEY `modified` (`modified`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
-- --------------------------------------------------------
 
--
-- Table structure for table `ps_smarty_last_flush`
--
 
DROP TABLE IF EXISTS `ps_smarty_last_flush`;
CREATE TABLE IF NOT EXISTS `ps_smarty_last_flush` (
  `type` enum('compile','template') NOT NULL DEFAULT 'compile',
  `last_flush` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
-- --------------------------------------------------------
 
--
-- Table structure for table `ps_smarty_lazy_cache`
--
 
DROP TABLE IF EXISTS `ps_smarty_lazy_cache`;
CREATE TABLE IF NOT EXISTS `ps_smarty_lazy_cache` (
  `template_hash` varchar(32) NOT NULL DEFAULT '',
  `cache_id` varchar(255) NOT NULL DEFAULT '',
  `compile_id` varchar(32) NOT NULL DEFAULT '',
  `filepath` varchar(255) NOT NULL DEFAULT '',
  `last_update` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`template_hash`,`cache_id`,`compile_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
 

Hope this helps.

It did for me.

  • Like 1
Link to comment
Share on other sites

Hello!

Im very glad to tell you that I found a solution for my problem. After manually upgrading I still had the same problem so I figured that all the problem was in the database. So I created a new one, and exported ps_smarty_last_lush form the new one and imported into the old one. With that everything worked out.

Thank you all for your replys!

Link to comment
Share on other sites

  • 8 months later...

MatiDLV:

If you are still having the problem, try the following: 

1. Restore your database back to where it was right before you did the 1-click update.

2. Make sure you get the same error as you described above by going to your website.

SELECT UNIX_TIMESTAMP(last_flush) as last_flush FROM `ps_smarty_last_flush` WHERE type='compile' LIMIT 1

at line 765 in file classes/db/Db.php

3. I did the one-click update on a local box. And then used git to copy to test box. However, the database also needs to be updated.

Couple of things worked for me. Going back in and turning on the cache on local box.

This created the ps_smarty tables locally.

4. However, on the test box, the database needs to be updated.

Export/Import the smarty tables - they are probably empty. There were for me.

5. I will include the SQL in case you cannot export.

 

-- phpMyAdmin SQL Dump

-- version 4.1.14
--
-- Host: 127.0.0.1:3306
-- Generation Time: Jul 10, 2015 at 01:27 AM
-- Server version: 5.6.17
-- PHP Version: 5.5.12
 
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
 
 
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=[spam-filter]CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=[spam-filter]CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=[spam-filter]COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
 
--
-- Database: `presta161`
--
 
-- --------------------------------------------------------
 
--
-- Table structure for table `ps_smarty_cache`
--
 
DROP TABLE IF EXISTS `ps_smarty_cache`;
CREATE TABLE IF NOT EXISTS `ps_smarty_cache` (
  `id_smarty_cache` char(40) NOT NULL,
  `name` char(40) NOT NULL,
  `cache_id` varchar(254) DEFAULT NULL,
  `modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `content` longtext NOT NULL,
  PRIMARY KEY (`id_smarty_cache`),
  KEY `name` (`name`),
  KEY `cache_id` (`cache_id`),
  KEY `modified` (`modified`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
-- --------------------------------------------------------
 
--
-- Table structure for table `ps_smarty_last_flush`
--
 
DROP TABLE IF EXISTS `ps_smarty_last_flush`;
CREATE TABLE IF NOT EXISTS `ps_smarty_last_flush` (
  `type` enum('compile','template') NOT NULL DEFAULT 'compile',
  `last_flush` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
-- --------------------------------------------------------
 
--
-- Table structure for table `ps_smarty_lazy_cache`
--
 
DROP TABLE IF EXISTS `ps_smarty_lazy_cache`;
CREATE TABLE IF NOT EXISTS `ps_smarty_lazy_cache` (
  `template_hash` varchar(32) NOT NULL DEFAULT '',
  `cache_id` varchar(255) NOT NULL DEFAULT '',
  `compile_id` varchar(32) NOT NULL DEFAULT '',
  `filepath` varchar(255) NOT NULL DEFAULT '',
  `last_update` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`template_hash`,`cache_id`,`compile_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
 

Hope this helps.

It did for me.

Worked like a charm  :D  :D

Everything back to normal after running the query that created the missing tables.

Link to comment
Share on other sites

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...