Skip to content
This repository has been archived by the owner on May 13, 2020. It is now read-only.

Commit

Permalink
Merge pull request #132 from Millon15/issue-129 FF
Browse files Browse the repository at this point in the history
[#129] FF
  • Loading branch information
Millon15 authored Apr 24, 2019
2 parents 4133338 + 1ce6be2 commit 003d867
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 16 deletions.
6 changes: 3 additions & 3 deletions config/db.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

return [
'class' => 'yii\db\Connection',
'dsn' => 'mysql:host=' . getenv('DB_HOST', 'mysql') . ';port=' . getenv('DB_PORT', '3306') .';dbname=' . getenv('DB_NAME', 'yii2') . ';',
'username' => getenv('DB_USERNAME', 'yii2'),
'password' => getenv('DB_PASSWORD', 'yii2'),
'dsn' => 'mysql:host=' . env('DB_HOST', 'mysql') . ';port=' . env('DB_PORT', '3306') .';dbname=' . env('DB_NAME', 'yii2') . ';',
'username' => env('DB_USERNAME', 'yii2'),
'password' => env('DB_PASSWORD', 'yii2'),
'charset' => 'utf8',
// Schema cache options (for production environment)
//'enableSchemaCache' => true,
Expand Down
6 changes: 3 additions & 3 deletions config/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
],
'components' => [
'request' => [
'cookieValidationKey' => getenv('VD_KEY'),
'cookieValidationKey' => env('VD_KEY'),
'enableCookieValidation' => true,
'enableCsrfValidation' => true,
'baseUrl' => '', //убрать frontend/web
Expand Down Expand Up @@ -76,8 +76,8 @@
'clients' => [
'auth42' => [
'class' => 'app\helpers\Auth42',
'clientId' => getenv('42_API_CI'),
'clientSecret' => getenv('42_API_CS'),
'clientId' => env('42_API_CI'),
'clientSecret' => env('42_API_CS'),
],
],
],
Expand Down
11 changes: 4 additions & 7 deletions helpers/RememberUserInfo/RememberHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ abstract protected function remember();
* __construct - method will done all work children of the class created for
* @param array $response - .json given from 42 RESTfull API converted to php array
* @see app\helpers\RememberUserInfo\RememberUserInfo
* @throws \Exception - in case of db error
*/
public function __construct(&$response)
{
Expand Down Expand Up @@ -124,13 +123,13 @@ public static function mergeChildArrByKey(&$arr, $key)

/**
* findARbyId
* @param array $arrToPutIntoDb
* @param array $id
* @return mixed|bool
*/
protected function findARbyId($arrToPutIntoDb)
protected function findARbyId($id)
{
foreach ($this->ARcollection as $key => $AR) {
if ($AR[$this->idcol] == $arrToPutIntoDb[$this->idcol]) {
if ($AR[$this->idcol] == $id) {
return $key;
}
}
Expand Down Expand Up @@ -186,7 +185,6 @@ protected function batchDelete()

/**
* updateDB
* @throws \Exception - in case of db error
*/
protected function updateDB()
{
Expand All @@ -198,7 +196,6 @@ protected function updateDB()
$transaction->commit();
} catch (\Exception $e) {
$transaction->rollBack();
throw $e;
}
}

Expand All @@ -208,7 +205,7 @@ protected function updateDB()
*/
protected function saveChangesToDB($arrToPutIntoDb)
{
$ARkey = $this->findARbyId($arrToPutIntoDb);
$ARkey = $this->findARbyId($arrToPutIntoDb[$this->idcol]);

if ($ARkey === false) {
$ARtoInsert = new $this->model();
Expand Down
2 changes: 1 addition & 1 deletion helpers/RememberUserInfo/RememberUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ protected function init()
*/
protected function remember()
{
$user = $this->ARcollection[$this->findARbyId($this->ARcollection)];
$user = $this->ARcollection[$this->findARbyId($this->xid)];

$this->responseSubset['lastloc'] = date('Y-m-d H:i:s');
$this->responseSubset['howach'] = count($this->responseSubset['achievements']);
Expand Down
1 change: 0 additions & 1 deletion helpers/RememberUserInfo/RememberUserInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ class RememberUserInfo
/**
* rememberAllToDB
* @param array $response - .json given from 42 RESTfull API converted to php array
* @throws \Exception - in case of db error
*/
public function __construct($response)
{
Expand Down
2 changes: 1 addition & 1 deletion yii
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ require(__DIR__ . '/helpers/helpers.php');
$dotenv = new \Dotenv\Dotenv(dirname(__DIR__));
$dotenv->load();

defined('YII_DEBUG') or define('YII_DEBUG', getenv('YII_DEBUG'));
defined('YII_DEBUG') or define('YII_DEBUG', env('YII_DEBUG'));

// fcgi doesn't have STDIN and STDOUT defined by default
defined('STDIN') or define('STDIN', fopen('php://stdin', 'r'));
Expand Down

0 comments on commit 003d867

Please sign in to comment.