in /opt/v2/vendor/yiisoft/yii2/db/Connection.php at line 579
$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 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); $token = $rawSql; try { Yii::beginProfile($token, '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 integer $fetchMode the result fetch mode. Please refer to [PHP manual](http://www.php.net/manual/en/function.PDOStatement-setFetchMode.php)
$domainKey = $domain == $baseDomain?'domain':'host'; if($domain == $baseDomain){ $sql = 'SELECT `map_host` FROM (SELECT `host`, `map_host`, `ratio` FROM `'.$sameTable.'` WHERE `domain` = "'.$domain.'" AND `map_domain` != "'.$domain.'" AND `words_count` > 0 ORDER BY `ratio` DESC LIMIT 1000 ) t1 GROUP BY t1.`map_host` ORDER BY t1.`ratio` DESC LIMIT '.$limit.';'; }else{ $sql = 'SELECT DISTINCT map_host FROM `'.$sameTable.'` WHERE `host` = "'.$domain.'" AND `words_count` > 0 ORDER BY `ratio` DESC LIMIT '.$limit; } $infos = Yii::$app->baiduSameDb->createCommand($sql)->queryAll(); if($domain == $baseDomain){ $sql = 'SELECT COUNT(*) FROM `'.$sameTable.'` WHERE `domain` = "'.$domain.'" AND `map_domain` != "'.$domain.'" AND `words_count` > 0;'; }else{ $sql = 'SELECT COUNT(*) FROM `'.$sameTable.'` WHERE `host` = "'.$domain.'" AND `words_count` > 0 ORDER BY `ratio` DESC LIMIT '.$limit; }
$baiduInfos = Yii::$app->mainDb->createCommand($sql)->queryOne(); $sql = "SELECT site,baidu,baiduindex,baidu_1days,baidu_7days,baidu_30days FROM ap_siteinfo_se_0 WHERE site = '".$domain."' "; $siteInfos = Yii::$app->mainDb->createCommand($sql)->queryOne(); //关键词重合站点 $sameInfos = WordsBaiduRankSame::getSameInfos($domain,$platform); //百度历史 $baiduRankHis = $this->formatRankChangeData('baidu',$domain.'pc90_baidurank_trend2',$domain.'mobile90_baidurank_trend2'); // 获取搜索词 if($platform=='pc'){
$args = $this->controller->bindActionParams($this, $params); Yii::trace('Running action: ' . get_class($this->controller) . '::' . $this->actionMethod . '()', __METHOD__); if (Yii::$app->requestedParams === null) { Yii::$app->requestedParams = $args; } return call_user_func_array([$this->controller, $this->actionMethod], $args); } }
} $result = null; if ($runAction && $this->beforeAction($action)) { // run the action $result = $action->runWithParams($params); $result = $this->afterAction($action, $result); // call afterAction on modules foreach ($modules as $module) { /* @var $module Module */
$parts = $this->createController($route); if (is_array($parts)) { /* @var $controller Controller */ list($controller, $actionID) = $parts; $oldController = Yii::$app->controller; Yii::$app->controller = $controller; $result = $controller->runAction($actionID, $params); Yii::$app->controller = $oldController; return $result; } else { $id = $this->getUniqueId(); throw new InvalidRouteException('Unable to resolve the request "' . ($id === '' ? $route : $id . '/' . $route) . '".');
$params = $this->catchAll; unset($params[0]); } try { Yii::trace("Route requested: '$route'", __METHOD__); $this->requestedRoute = $route; $result = $this->runAction($route, $params); if ($result instanceof Response) { return $result; } else { $response = $this->getResponse(); if ($result !== null) { $response->data = $result;
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();
$config = yii\helpers\ArrayHelper::merge( require(__DIR__ . '/../../common/config/main.php'), require(__DIR__ . '/../config/main.php') ); $application = new yii\web\Application($config); $application->run();
$_GET = [ 'platform' => 'mobile', 'domain' => 'zhidao.baidu.com', 'path' => '-1', 'wordPages' => '0', 'pages' => '50', 'sortType' => 'position', 'order' => '1', ]; $_SERVER = [ 'USER' => 'nobody', 'HOME' => '/', 'FCGI_ROLE' => 'RESPONDER', 'HTTPS' => 'on', 'QUERY_STRING' => '', 'REQUEST_METHOD' => 'GET', 'CONTENT_TYPE' => '', 'CONTENT_LENGTH' => '', 'SCRIPT_NAME' => '/index.php', 'REQUEST_URI' => '/mobile/zhidao.baidu.com/-1/0/50/position/1/', 'DOCUMENT_URI' => '/index.php', 'DOCUMENT_ROOT' => '/opt/v2/baiduald.aizhan.com/web', 'SERVER_PROTOCOL' => 'HTTP/1.0', 'REQUEST_SCHEME' => 'http', 'GATEWAY_INTERFACE' => 'CGI/1.1', 'SERVER_SOFTWARE' => 'nginx/1.22.1', 'REMOTE_ADDR' => '192.168.1.37', 'REMOTE_PORT' => '31300', 'SERVER_ADDR' => '192.168.1.45', 'SERVER_PORT' => '8888', 'SERVER_NAME' => 'baiduald.aizhan.com', 'REDIRECT_STATUS' => '200', 'SCRIPT_FILENAME' => '/opt/v2/baiduald.aizhan.com/web/index.php', 'PATH_INFO' => '', 'PATH_TRANSLATED' => '/opt/v2/baiduald.aizhan.com/web/index.php', 'HTTP_HOST' => 'baiduald.aizhan.com', 'HTTP_X_REAL_IP' => '27.148.140.152', 'HTTP_X_FORWARDED_FOR' => '18.209.66.87, 27.148.140.152', 'HTTP_X_FORWARDED_PROTO' => 'https', 'HTTP_CONNECTION' => 'close', 'HTTP_ACCEPT' => '*/*', 'HTTP_USER_AGENT' => 'claudebot', 'HTTP_CDN_SRC_IP' => '18.209.66.87', 'HTTP_X_WS_REQUEST_ID' => '6605c46e_PSmgnyNY3aa36_25211-23582', 'HTTP_X_CDN_SRC_PORT' => '46822', 'HTTP_X_VIA' => '1.1 PSmgnyNY3xg48:15 (Cdn Cache Server V2.0), 1.1 PSxgHK5bd29:3 (Cdn Cache Server V2.0)', 'PHP_SELF' => '/index.php', 'REQUEST_TIME_FLOAT' => 1711653998.4737611, 'REQUEST_TIME' => 1711653998, ];