From 73c98b9a326bcdc70d713aabf39b202e624d16e1 Mon Sep 17 00:00:00 2001 From: Yarik Date: Thu, 3 Dec 2015 13:05:52 +0200 Subject: [PATCH] Устранены баги, поменял базу на PostgreSQL --- common/config/main-local.php | 11 ++++++++--- common/models/User.php | 16 +++++++++++----- common/translation/ru/app.php | 4 ---- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/common/config/main-local.php b/common/config/main-local.php index c5c1a2b..d03cd55 100644 --- a/common/config/main-local.php +++ b/common/config/main-local.php @@ -3,10 +3,15 @@ return [ 'components' => [ 'db' => [ 'class' => 'yii\db\Connection', - 'dsn' => 'mysql:host=localhost;dbname=artbox_db', - 'username' => 'root', + 'dsn' => 'pgsql:host=localhost;port=5432;dbname=artbox_pg', + 'username' => 'postgres', 'password' => '', - 'charset' => 'utf8', + 'schemaMap' => [ + 'pgsql'=> [ + 'class'=>'yii\db\pgsql\Schema', + 'defaultSchema' => 'public' + ] + ], ], 'mailer' => [ 'class' => 'yii\swiftmailer\Mailer', diff --git a/common/models/User.php b/common/models/User.php index 720697a..26c9517 100644 --- a/common/models/User.php +++ b/common/models/User.php @@ -64,14 +64,20 @@ class User extends ActiveRecord implements IdentityInterface, UserRbacInterface /** * @inheritdoc */ - public static function findIdentity($id) { - if (Yii::$app->getSession()->has('user-'.$id)) { + public static function findIdentity($id) { + if(Yii::$app->getSession()->has('user-'.$id)) { + if (Yii::$app->getSession()->has('user-'.$id)) { return new self(Yii::$app->getSession()->get('user-'.$id)); - } + } + else { + return isset(self::$users[$id]) ? new self(self::$users[$id]) : null; + } + } else { - return isset(self::$users[$id]) ? new self(self::$users[$id]) : null; + return static::findOne(['id' => $id, 'status' => self::STATUS_ACTIVE]); } - } + + } /** * @param \nodge\eauth\ServiceBase $service * @return User diff --git a/common/translation/ru/app.php b/common/translation/ru/app.php index 7c35bc6..19c386e 100644 --- a/common/translation/ru/app.php +++ b/common/translation/ru/app.php @@ -11,9 +11,6 @@ return [ 'Make default' => 'Установить по умолчанию', 'Language Name' => 'Название языка', 'Lang Code' => 'Код языка', -<<<<<<< 1fd2bdb43fc5cfdcf100cac8b72e67fd81e7f0fa - 'Is Default' => 'По умолчанию' -======= 'Is Default' => 'По умолчанию', 'adress' => 'Адрес', 'adress_name' => 'Адрес', @@ -26,5 +23,4 @@ return [ 'one_name' => 'Имя', 'message' => 'Сообщение', 'Feedback' => 'Обратная связь' ->>>>>>> 0e0edb85a79343e4d020ff05378179e2323b21bd ]; \ No newline at end of file -- libgit2 0.21.4