Error Info: Array ( [0] => HY000 [1] => 1203 [2] => User app_user already has more than 'max_user_connections' active connections )
in /var/www/html/vendor/yiisoft/yii2/db/Connection.php at line 722
if ($enableProfiling) { Yii::endProfile($token, __METHOD__); } } catch (\PDOException $e) { if ($enableProfiling) { Yii::endProfile($token, __METHOD__); } throw new Exception($e->getMessage(), $e->errorInfo, $e->getCode(), $e); } } /** * Closes the currently active DB connection. * It does nothing if the connection is already closed. */ public function close() {
* Returns the PDO instance for the currently active master connection. * This method will open the master DB connection and then return [[pdo]]. * @return PDO the PDO instance for the currently active master connection. */ public function getMasterPdo() { $this->open(); return $this->pdo; } /** * Returns the currently active slave connection. * If this method is called for the first time, it will try to open a slave connection when [[enableSlaves]] is true.
* is available and `$fallbackToMaster` is false. */ public function getSlavePdo($fallbackToMaster = true) { $db = $this->getSlave(false); if ($db === null) { return $fallbackToMaster ? $this->getMasterPdo() : null; } return $db->pdo; } /**
public function quoteValue($str) { if (!is_string($str)) { return $str; } if (mb_stripos((string)$this->db->dsn, 'odbc:') === false && ($value = $this->db->getSlavePdo(true)->quote($str)) !== false) { return $value; } // the driver doesn't support quote (e.g. oci) return "'" . addcslashes(str_replace("'", "''", $str), "\000\n\r\\\032") . "'"; }
* @param string $value string to be quoted * @return string the properly quoted string * @see https://www.php.net/manual/en/pdo.quote.php */ public function quoteValue($value) { return $this->getSchema()->quoteValue($value); } /** * Quotes a table name for use in a query. * If the table name contains schema prefix, the prefix will also be properly quoted. * If the table name is already quoted or contains special characters including '(', '[[' and '{{',
$params = []; foreach ($this->params as $name => $value) { if (is_string($name) && strncmp(':', $name, 1)) { $name = ':' . $name; } if (is_string($value) || $value instanceof Expression) { $params[$name] = $this->db->quoteValue((string)$value); } elseif (is_bool($value)) { $params[$name] = ($value ? 'TRUE' : 'FALSE'); } elseif ($value === null) { $params[$name] = 'NULL'; } elseif (!is_object($value) && !is_resource($value)) { $params[$name] = $value;
* @return array array of two elements, the first is boolean of whether profiling is enabled or not. * The second is the rawSql if it has been created. */ protected function logQuery($category) { if ($this->db->enableLogging) { $rawSql = $this->getRawSql(); Yii::info($rawSql, $category); } if (!$this->db->enableProfiling) { return [false, isset($rawSql) ? $rawSql : null]; }
* @return mixed the method execution result * @throws Exception if the query causes any problem * @since 2.0.1 this method is protected (was private before). */ protected function queryInternal($method, $fetchMode = null) { list($profile, $rawSql) = $this->logQuery('yii\db\Command::query'); if ($method !== '') { $info = $this->db->getQueryCacheInfo($this->queryCacheDuration, $this->queryCacheDependency); if (is_array($info)) { /* @var $cache \yii\caching\CacheInterface */ $cache = $info[0];
* @return array|false the first row (in terms of an array) of the query result. False is returned if the query * results in nothing. * @throws Exception execution failed */ public function queryOne($fetchMode = null) { return $this->queryInternal('fetch', $fetchMode); } /** * Executes the SQL statement and returns the value of the first column in the first row of data. * This method is best used when only a single value is needed for a query. * @return string|int|null|false the value of the first column in the first row of the query result.
public function one($db = null) { if ($this->emulateExecution) { return false; } return $this->createCommand($db)->queryOne(); } /** * Returns the query result as a scalar value. * The value returned will be the first column in the first row of the query results. * @param Connection|null $db the database connection used to generate the SQL statement.
* @return ActiveRecord|array|null a single row of query result. Depending on the setting of [[asArray]], * the query result may be either an array or an ActiveRecord object. `null` will be returned * if the query results in nothing. */ public function one($db = null) { $row = parent::one($db); if ($row !== false) { $models = $this->populate([$row]); return reset($models) ?: null; } return null;
$q->with('localization'); }, 'defaultLocalization', 'siteLocalization', 'bonusLocalization', 'timezone' ])->where(['name' => $hostName])->one(); }, null, Domain::setTagDependency()); } public static function getFolder() { $domain = self::checkDomain();
* @see noCache() */ public function cache(callable $callable, $duration = null, $dependency = null) { $this->_queryCacheInfo[] = [$duration === null ? $this->queryCacheDuration : $duration, $dependency]; try { $result = call_user_func($callable, $this); array_pop($this->_queryCacheInfo); return $result; } catch (\Exception $e) { array_pop($this->_queryCacheInfo); throw $e; } catch (\Throwable $e) {
}, 'defaultLocalization', 'siteLocalization', 'bonusLocalization', 'timezone' ])->where(['name' => $hostName])->one(); }, null, Domain::setTagDependency()); } public static function getFolder() { $domain = self::checkDomain();
->all(); }, null, Domain::setTagDependency()); } public static function checkDomain(): ?Domain { return Yii::$app->params['domainByHost'] ?? self::getDomainByHostName(); } public static function isLocal(): bool { $host = Yii::$app->request->hostName; $subdomain = explode('.', $host)[0];
$languages[Country::OTHER_COUNTRY_CODE] = Country::DEFAULT_INO_COUNTRY; return $languages[$folder] ?? Country::RUS_COUNTRY; } public static function getLocalizationCode() { $domain = self::checkDomain(); $localizationCode = ArrayHelper::getValue($domain, 'defaultLocalization.code'); return $localizationCode ?? self::DEFAULT_LOCALIZATION_CODE; } public static function getBonusLocalizationCode()
* @return array|bool|string * @throws \yii\base\InvalidConfigException */ public function parseRequest($manager, $request) { $route = parent::parseRequest($manager, $request); $language = Domain::getLocalizationCode(); if ($route && isset($route[1]) ) { $news = $route[1]['news'] ?? false; if ($news && $news != SiteTypesHelper::getRouteTranslationWithoutLang('news', $language)) { throw new NotFoundHttpException('Страница не найдена.'); }
*/ public function parseRequest($request) { if ($this->enablePrettyUrl) { /* @var $rule UrlRule */ foreach ($this->rules as $rule) { $result = $rule->parseRequest($this, $request); if (YII_DEBUG) { Yii::debug([ 'rule' => method_exists($rule, '__toString') ? $rule->__toString() : get_class($rule), 'match' => $result !== false, 'parent' => null, ], __METHOD__);
class UrlManager extends \yii\web\UrlManager { public function parseRequest($request) { $result = parent::parseRequest($request); if (is_array($result)) { Seo::setCanonical($request, $result); } return $result; }
* Resolves the current request into a route and the associated parameters. * @return array the first element is the route, and the second is the associated parameters. * @throws NotFoundHttpException if the request cannot be resolved. */ public function resolve() { $result = Yii::$app->getUrlManager()->parseRequest($this); if ($result !== false) { list($route, $params) = $result; if ($this->_queryParams === null) { $_GET = $params + $_GET; // preserve numeric keys } else { $this->_queryParams = $params + $this->_queryParams;
* @throws NotFoundHttpException if the requested route is invalid */ public function handleRequest($request) { if (empty($this->catchAll)) { try { list($route, $params) = $request->resolve(); } catch (UrlNormalizerRedirectException $e) { $url = $e->url; if (is_array($url)) { if (isset($url[0])) { // ensure the route is absolute $url[0] = '/' . ltrim($url[0], '/');
{ try { $this->state = self::STATE_BEFORE_REQUEST; $this->trigger(self::EVENT_BEFORE_REQUEST); $this->state = self::STATE_HANDLING_REQUEST; $response = $this->handleRequest($this->getRequest()); $this->state = self::STATE_AFTER_REQUEST; $this->trigger(self::EVENT_AFTER_REQUEST); $this->state = self::STATE_SENDING_RESPONSE; $response->send();
require(__DIR__ . '/../config/main-local.php') ); ini_set('display_errors', 1); error_reporting(1); (new yii\web\Application($config))->run();