protected function saveErrorInfo($exception, $status_code) { $errorLogEnabled = Yii::$app->getModule('core')->errorMonitorEnabled; if (null !== $errorLogEnabled && $errorLogEnabled == 1) { $errorUrl = ErrorUrl::find()->where(['url' => $_SERVER['REQUEST_URI']])->one(); if (is_null($errorUrl)) { $errorUrl = new ErrorUrl(); $errorUrl->url = $_SERVER['REQUEST_URI']; $errorUrl->save(); } $errorLog = new ErrorLog(); $errorLog->info = $exception->getMessage(); $errorLog->url_id = $errorUrl->id; $errorLog->http_code = $status_code; $errorLog->server_vars = print_r($_SERVER, true); $errorLog->request_vars = print_r(['request' => $_REQUEST, 'post' => $_POST, 'get' => $_GET], true); $errorLog->save(); $this->sendImmediateNotify($errorLog, $status_code); } }