in /www/web/onfancy/vendor/yiisoft/yii2-mongodb/Connection.php at line 247
$options['connect'] = true; if ($this->defaultDatabaseName !== null) { $options['db'] = $this->defaultDatabaseName; } $this->mongoClient = new \MongoClient($this->dsn, $options); $this->initConnection(); Yii::endProfile($token, __METHOD__); } catch (\Exception $e) { Yii::endProfile($token, __METHOD__); throw new Exception($e->getMessage(), (int) $e->getCode(), $e); } } } /** * Closes the currently active DB connection. * It does nothing if the connection is already closed. */ public function close()
return $this->getDatabase()->getCollection($name, $refresh); } } protected function selectDatabase($name) { $this->open(); return Yii::createObject([ 'class' => 'common\models\core\mongodb\CMdatabase', 'mongoDb' => $this->mongoClient->selectDB($name) ]); }
public function getDatabase($name = null, $refresh = false) { if ($name === null) { $name = $this->fetchDefaultDatabaseName(); } if ($refresh || !array_key_exists($name, $this->_databases)) { $this->_databases[$name] = $this->selectDatabase($name); } return $this->_databases[$name]; } /**
{ if (is_array($name)) { list ($dbName, $collectionName) = $name; return $this->getDatabase($dbName)->getCollection($collectionName, $refresh); } else { return $this->getDatabase()->getCollection($name, $refresh); } } protected function selectDatabase($name) { $this->open();
protected function getCustomUrl($uri){ if(substr($uri,0,1) == "/"){ $uri = substr($uri,1); } $url_rewrite_coll = \Yii::$app->mongodb->getCollection('url_rewrite'); $one = $url_rewrite_coll->findOneConvert(['request_path' => $uri]); if($one['_id']){ $type = $one['type']; $type_data_id = $one['type_data_id']; Global $page_handle; if($type == 'product'){
$arr = explode("#",$requestUri); $front_requestUri = $arr[0]; $dh_requestUri = $arr[1]; }else{ $front_requestUri = $requestUri; } if($custom_uri = $this->getCustomUrl($front_requestUri)){ if($wh_requestUri){ return $custom_uri."?".$wh_requestUri; }else if($dh_requestUri){ return $custom_uri."#".$dh_requestUri; }else{ return $custom_uri;
throw new InvalidConfigException('Unable to determine the request URI.'); } //echo $requestUri."<br/>" ;exit; //$requestUri = "system/account/manager"; //echo $this->getRewriteUri($requestUri);exit; $requestUri = $this->getRewriteUri($requestUri); $ip = Help::get_real_ip(); $myfile = fopen("logs/".$ip.".txt", "a+") or die("Unable to open file!"); fwrite($myfile, "#".session_id()."#".date('Y-m-d H:i:s')." "); fwrite($myfile, $requestUri."\n"); fclose($myfile);
* @return string the currently requested relative URL. Note that the URI returned is URL-encoded. * @throws InvalidConfigException if the URL cannot be determined due to unusual server configuration */ public function getUrl() { if ($this->_url === null) { $this->_url = $this->resolveRequestUri(); } return $this->_url; } /**
* @return string part of the request URL that is after the entry script and before the question mark. * Note, the returned path info is decoded. * @throws InvalidConfigException if the path info cannot be determined due to unexpected server configuration */ protected function resolvePathInfo() { $pathInfo = $this->getUrl(); if (($pos = strpos($pathInfo, '?')) !== false) { $pathInfo = substr($pathInfo, 0, $pos); } $pathInfo = urldecode($pathInfo);
* Note, the returned path info is already URL-decoded. * @throws InvalidConfigException if the path info cannot be determined due to unexpected server configuration */ public function getPathInfo() { if ($this->_pathInfo === null) { $this->_pathInfo = $this->resolvePathInfo(); } return $this->_pathInfo; } /**
* @return array|boolean the route and the associated parameters. The latter is always empty * if [[enablePrettyUrl]] is false. False is returned if the current request cannot be successfully parsed. */ public function parseRequest($request) { if ($this->enablePrettyUrl) { $pathInfo = $request->getPathInfo(); /* @var $rule UrlRule */ foreach ($this->rules as $rule) { if (($result = $rule->parseRequest($this, $request)) !== false) { 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 HttpException if the request cannot be resolved. */ public function resolve() { $result = Yii::$app->getUrlManager()->parseRequest($this); if ($result !== false) { list ($route, $params) = $result; $_GET = array_merge($_GET, $params); return [$route, $_GET]; } else {
* @return Response the resulting response * @throws NotFoundHttpException if the requested route is invalid */ public function handleRequest($request) { if (empty($this->catchAll)) { list ($route, $params) = $request->resolve(); } else { $route = $this->catchAll[0]; $params = array_splice($this->catchAll, 1); } try { Yii::trace("Route requested: '$route'", __METHOD__);
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();
//var_dump($config);exit; #这个用来保存cms-->page页面的信息,在request通过url rewrite匹配后,得到对应的,handle,然后保存到这个变量中, #/home/index/page 通过变量获取出来这个值。 $cms_page_content = ''; $application = new yii\web\Application($config); $application->run();
$_SERVER = [ 'USER' => 'www-data', 'HOME' => '/home/www-data', 'FCGI_ROLE' => 'RESPONDER', 'GATEWAY_INTERFACE' => 'CGI/1.1', 'SERVER_SOFTWARE' => 'nginx', 'QUERY_STRING' => '', 'REQUEST_METHOD' => 'GET', 'CONTENT_TYPE' => '', 'CONTENT_LENGTH' => '', 'SCRIPT_FILENAME' => '/www/web/onfancy/frontend/web/index.php', 'SCRIPT_NAME' => '/index.php', 'REQUEST_URI' => '/retro-style-frog-shape-silver-tone-alloy-open-ring.html', 'DOCUMENT_URI' => '/index.php', 'DOCUMENT_ROOT' => '/www/web/onfancy/frontend/web', 'SERVER_PROTOCOL' => 'HTTP/1.1', 'REMOTE_ADDR' => '35.171.22.220', 'REMOTE_PORT' => '56788', 'SERVER_ADDR' => '85.195.99.50', 'SERVER_PORT' => '443', 'SERVER_NAME' => 'onfancy.fr', 'REDIRECT_STATUS' => '200', 'HTTP_ACCEPT' => '*/*', 'HTTP_USER_AGENT' => 'claudebot', 'HTTP_HOST' => 'www.onfancy.fr', 'PHP_SELF' => '/index.php', 'REQUEST_TIME_FLOAT' => 1711677667.884017, 'REQUEST_TIME' => 1711677667, ];