Link to database cannot be established: SQLSTATE[HY000] [2002] Operation not permitted
at line 127 in file classes/db/DbPDO.php
122. public function connect()
123. {
124. try {
125. $this->link = $this->getPDO($this->server, $this->user, $this->password, $this->database, 5);
126. } catch (PDOException $e) {
127. throw new PrestaShopException('Link to database cannot be established: ' . $e->getMessage());
128. }
129.
130. $this->link->exec('SET SESSION sql_mode = \'\'');
131.
132. return $this->link;
374. }
375.
376. $this->result = $this->_query($sql);
377.
378. if (!$this->result && $this->getNumberError() == 2006) {
379. if ($this->connect()) {
380. $this->result = $this->_query($sql);
381. }
382. }
383.
384. if (_PS_DEBUG_SQL_) {
608. }
609.
610. return $this->execute($sql, $use_cache);
611. }
612.
613. $this->result = $this->query($sql);
614.
615. if (!$this->result) {
616. $result = false;
617. } else {
618. if (!$array) {
Argument [0] SELECT * FROM `pskai_currency` c ORDER BY `iso_code` ASC
502. * @throws PrestaShopDatabaseException
503. */
504. public static function findAllInstalled()
505. {
506. $currencies = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(
507. 'SELECT * FROM `' . _DB_PREFIX_ . 'currency` c ORDER BY `iso_code` ASC'
508. );
509.
510. return $currencies;
511. }
512.
Argument [0] SELECT * FROM `pskai_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. */
87. *
88. * @return string[]
89. */
90. public function getAllInstalledCurrencyIsoCodes()
91. {
92. $currencies = $this->dataProvider->findAllInstalled();
93. $currencyIsoCodes = array_column($currencies, 'iso_code');
94.
95. return $currencyIsoCodes;
96. }
97. }
92. /**
93. * {@inheritdoc}
94. */
95. public function getAllInstalledCurrenciesData($localeCode)
96. {
97. return $this->formatCurrenciesData($this->installedDataLayer->getAllInstalledCurrencyIsoCodes(), $localeCode);
98. }
99.
100. /**
101. * @param array $currencyCodes
102. * @param string $localeCode
90. /**
91. * {@inheritdoc}
92. */
93. public function getAllInstalledCurrencies($localeCode)
94. {
95. return $this->formatCurrencies($this->dataSource->getAllInstalledCurrenciesData($localeCode));
96. }
97.
98. /**
99. * @param array $currenciesData
100. *
Argument [0] es-ES
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] es-ES
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] es-ES
184. $this->container = $this->buildContainer();
185. }
186.
187. $localeRepo = $this->get(self::SERVICE_LOCALE_REPOSITORY);
188. $this->context->currentLocale = $localeRepo->getLocale(
189. $this->context->language->getLocale()
190. );
191. }
192.
193. /**
194. * Do the page treatment: process input, process AJAX, etc.
Argument [0] es-ES
266. return;
267. }
268.
269. self::$initialized = true;
270.
271. parent::init();
272.
273. // enable Symfony error handler if debug mode enabled
274. $this->initDebugguer();
275.
276. // If current URL use SSL, set it true (used a lot for module redirect)
87.
88. if (!Validate::isLoadedObject($this->category) || !$this->category->active) {
89. Tools::redirect('index.php?controller=404');
90. }
91.
92. parent::init();
93.
94. if (!$this->category->checkAccess($this->context->customer->id)) {
95. header('HTTP/1.1 403 Forbidden');
96. header('Status: 403 Forbidden');
97. $this->errors[] = $this->trans('You do not have access to this category.', array(), 'Shop.Notifications.Error');
268. /**
269. * Starts the controller process (this method should not be overridden!).
270. */
271. public function run()
272. {
273. $this->init();
274. if ($this->checkAccess()) {
275. // setMedia MUST be called before postProcess
276. if (!$this->content_only && ($this->display_header || (isset($this->className) && $this->className))) {
277. $this->setMedia();
278. }
510. if (isset($params_hook_action_dispatcher)) {
511. Hook::exec('actionDispatcher', $params_hook_action_dispatcher);
512. }
513.
514. // Running controller
515. $controller->run();
516.
517. // Execute hook dispatcher after
518. if (isset($params_hook_action_dispatcher)) {
519. Hook::exec('actionDispatcherAfter', $params_hook_action_dispatcher);
520. }
23. * @license https://opensource.org/licenses/OSL-3.0 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();