Link to database cannot be established: SQLSTATE[HY000] [2002] Connection refused
at line 119 in file classes/db/DbPDO.php
114. public function connect()
115. {
116. try {
117. $this->link = $this->getPDO($this->server, $this->user, $this->password, $this->database, 5);
118. } catch (PDOException $e) {
119. throw new PrestaShopException('Link to database cannot be established: ' . $e->getMessage());
120. }
121.
122. $this->link->exec('SET SESSION sql_mode = \'\'');
123.
124. return $this->link;
375. }
376.
377. $this->result = $this->_query($sql);
378.
379. if (!$this->result && $this->getNumberError() == 2006) {
380. $this->connect();
381. $this->result = $this->_query($sql);
382. }
383.
384. if (_PS_DEBUG_SQL_) {
385. $this->displayError($sql);
605. // This method must be used only with queries which display results
606. if (!preg_match('#^\s*\(?\s*(select|show|explain|describe|desc|checksum)\s#i', $sql)) {
607. throw new PrestaShopDatabaseException('Db->executeS() must be used only with select, show, explain or describe queries');
608. }
609.
610. $this->result = $this->query($sql);
611.
612. if (!$this->result) {
613. $result = false;
614. } else {
615. if (!$array) {
Argument [0] SELECT * FROM `ps_4ftPiMT1_currency` c ORDER BY `iso_code` ASC
706. * @throws PrestaShopDatabaseException
707. */
708. public static function findAllInstalled()
709. {
710. $currencies = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(
711. 'SELECT * FROM `' . _DB_PREFIX_ . 'currency` c ORDER BY `iso_code` ASC'
712. );
713.
714. return $currencies;
715. }
716.
Argument [0] SELECT * FROM `ps_4ftPiMT1_currency` c ORDER BY `iso_code` ASC
79. /**
80. * {@inheritdoc}
81. */
82. public function findAllInstalled()
83. {
84. return Currency::findAllInstalled();
85. }
86.
87. /**
88. * {@inheritdoc}
89. */
85. *
86. * @return string[]
87. */
88. public function getAllInstalledCurrencyIsoCodes()
89. {
90. $currencies = $this->dataProvider->findAllInstalled();
91. $currencyIsoCodes = array_column($currencies, 'iso_code');
92.
93. return $currencyIsoCodes;
94. }
95. }
91. /**
92. * {@inheritdoc}
93. */
94. public function getAllInstalledCurrenciesData($localeCode)
95. {
96. return $this->formatCurrenciesData($this->installedDataLayer->getAllInstalledCurrencyIsoCodes(), $localeCode);
97. }
98.
99. /**
100. * @param array $currencyCodes
101. * @param string $localeCode
82. /**
83. * {@inheritdoc}
84. */
85. public function getAllInstalledCurrencies($localeCode)
86. {
87. return $this->createCurrenciesFromData($this->dataSource->getAllInstalledCurrenciesData($localeCode));
88. }
89.
90. /**
91. * @param array $currenciesData
92. *
Argument [0] en-US
202. $cldrLocale = $this->cldrLocaleRepository->getLocale($localeCode);
203. if (null === $cldrLocale) {
204. throw new LocalizationException('CLDR locale not found for locale code "' . $localeCode . '"');
205. }
206.
207. $currencies = $this->currencyRepository->getAllInstalledCurrencies($localeCode);
208.
209. $priceSpecifications = new PriceSpecificationMap();
210. foreach ($currencies as $currency) {
211. // Build the spec
212. $thisPriceSpecification = (new SpecificationFactory())->buildPriceSpecification(
Argument [0] en-US
145. {
146. if (!isset($this->locales[$localeCode])) {
147. $this->locales[$localeCode] = new Locale(
148. $localeCode,
149. $this->getNumberSpecification($localeCode),
150. $this->getPriceSpecifications($localeCode),
151. new NumberFormatter($this->roundingMode, $this->numberingSystem)
152. );
153. }
154.
155. return $this->locales[$localeCode];
Argument [0] en-US
204. $this->container = $this->buildContainer();
205. }
206.
207. $localeRepo = $this->get(self::SERVICE_LOCALE_REPOSITORY);
208. $this->context->currentLocale = $localeRepo->getLocale(
209. $this->context->language->getLocale()
210. );
211.
212. Hook::exec(
213. 'actionControllerInitAfter',
214. [
Argument [0] en-US
277. return;
278. }
279.
280. self::$initialized = true;
281.
282. parent::init();
283.
284. // If current URL use SSL, set it true (used a lot for module redirect)
285. if (Tools::usingSecureMode()) {
286. $useSSL = true;
287. }
76. $this->category = new Category(
77. $id_category,
78. $this->context->language->id
79. );
80.
81. parent::init();
82.
83. if (!Validate::isLoadedObject($this->category) || !$this->category->active) {
84. header('HTTP/1.1 404 Not Found');
85. header('Status: 404 Not Found');
86. $this->setTemplate('errors/404');
295. /**
296. * Starts the controller process (this method should not be overridden!).
297. */
298. public function run()
299. {
300. $this->init();
301. if ($this->checkAccess()) {
302. // setMedia MUST be called before postProcess
303. if (!$this->content_only && ($this->display_header || (isset($this->className) && $this->className))) {
304. $this->setMedia();
305. }
505.
506. // Execute hook dispatcher
507. Hook::exec('actionDispatcher', $params_hook_action_dispatcher);
508.
509. // Running controller
510. $controller->run();
511.
512. // Execute hook dispatcher after
513. Hook::exec('actionDispatcherAfter', $params_hook_action_dispatcher);
514. } catch (PrestaShopException $e) {
515. $e->displayMessage();
23. * @copyright Since 2007 PrestaShop SA and Contributors
24. * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
25. */
26.
27. require dirname(__FILE__).'/config/config.inc.php';
28. Dispatcher::getInstance()->dispatch();