in /home/admin/web/rashod.ru/public_html/vendor/yiisoft/yii2/db/Connection.php at line 646
$token = 'Opening DB connection: ' . $this->dsn; try { Yii::info($token, __METHOD__); Yii::beginProfile($token, __METHOD__); $this->pdo = $this->createPdoInstance(); $this->initConnection(); Yii::endProfile($token, __METHOD__); } catch (\PDOException $e) { Yii::endProfile($token, __METHOD__); throw new Exception($e->getMessage(), $e->errorInfo, (int) $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; } else { return $db->pdo; } } /**
if ($this->db->getTransaction()) { // master is in a transaction. use the same connection. $forRead = false; } if ($forRead || $forRead === null && $this->db->getSchema()->isReadQuery($sql)) { $pdo = $this->db->getSlavePdo(); } else { $pdo = $this->db->getMasterPdo(); } try { $this->pdoStatement = $pdo->prepare($sql);
Yii::trace('Query result served from cache', 'yii\db\Command::query'); return $result[0]; } } } $this->prepare(true); try { $profile and Yii::beginProfile($rawSql, 'yii\db\Command::query'); $this->pdoStatement->execute();
* @return array all rows of the query result. Each array element is an array representing a row of data. * An empty array is returned if the query results in nothing. * @throws Exception execution failed */ public function queryAll($fetchMode = null) { return $this->queryInternal('fetchAll', $fetchMode); } /** * Executes the SQL statement and returns the first row of the result. * This method is best used when only the first row of result is needed for a query. * @param int $fetchMode the result fetch mode. Please refer to [PHP manual](http://php.net/manual/en/pdostatement.setfetchmode.php)
if (!$sName or !is_string($sName)) return null; $sTable = self::$sCurrentTable; if (is_null(self::$cache)){ self::$cache = \yii\helpers\ArrayHelper::map(\Yii::$app->db->createCommand("SELECT * FROM `$sTable` WHERE 1;" )->queryAll(), 'sv_name', 'sv_value'); } return \yii\helpers\ArrayHelper::getValue(self::$cache, $sName, $mDef); } /**
* или SysVar enableHTTPS */ public static function defineWebProtocol() { // Протокол доступа к сайту: http:// или https:// if (!defined('WEBPROTOCOL')) define('WEBPROTOCOL', ((isset($_SERVER['SERVER_PORT']) and ($_SERVER['SERVER_PORT'] == '443')) or (isset(\Yii::$app->components['db']) and \skewer\base\SysVar::get('enableHTTPS'))) ? 'https://' : 'http://'); } }
/** * @inheritDoc */ public function init() { self::defineWebProtocol(); \Yii::$app->session->open(); parent::init(); $this->setViewPath('@skewer/views'); }
*/ public function __construct($config = []) { if (!empty($config)) { Yii::configure($this, $config); } $this->init(); } /** * Initializes the object. * This method is invoked at the end of the constructor after the object is initialized with the * given configuration.
$this->state = self::STATE_BEGIN; $this->preInit($config); $this->registerErrorHandler($config); Component::__construct($config); } /** * Pre-initializes the application. * This method is called at the beginning of the application constructor. * It initializes several important application properties.
require_once(RELEASEPATH . '/../vendor/autoload.php'); require_once(RELEASEPATH . '/../skewer/app/Yii.php'); require_once(RELEASEPATH . '/../skewer/app/Application.php'); $config = require(RELEASEPATH. '/config/web.php'); $app = (new \skewer\app\Application($config))->run(); exit;