Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

share session with yii #8

Open
condesignpoland opened this issue Sep 27, 2015 · 3 comments
Open

share session with yii #8

condesignpoland opened this issue Sep 27, 2015 · 3 comments

Comments

@condesignpoland
Copy link

Dear Sir,
In my backend config file (advanced app) I've set custom session
'session' => [
'name' => 'BACKENDSESSID',
'cookieParams' => [
'httpOnly' => true,
'path' => '/',
],
],
since then, I cant use KCFinder, because it uses different session.

I've tried to modify core/bootstrap.php in order to pass YII2 session ID, but i can't manage to do that.
As far as i know, the problem is that during the lifecycle of Yii Application, vendor files are initiated before Yii. In Yii1 I've used solution mentioned in this article http://www.yiiframework.com/wiki/421/syncing-sessions-between-yii-and-kcfinder/#c10743 but I can't manage to use it in this case.

What is the proper way to handle session between Yii and KCFinder?

@fightmyway
Copy link

@condesignpoland do you have solve it ? I am facing the same problem.

@condesignpoland
Copy link
Author

Yes, I've solved it. I don't know is this a best solution but it works and makes sense.
Check out my attachement.
components.zip

Problem was, that during the publishing of assets, CKEditor creates its own session file. I didn't want to modify any of vendor files in order to have ability to update package, so my function is overwriting existing asset session file.

Just check out function "prepareSession()" in CKEditor.php and You should understand how it works. Mby You'll be able to make it even better.

@doubleaceru
Copy link

doubleaceru commented Aug 14, 2018

@condesignpoland thank you! I used this, but in my bootstrap.php missed this
$search = ['$this->sessionName = "";', '$this->cookieName = "";'];
I replaced and used this
$search = ["\$this->sessionName = 'BACKENDSESSID';", "\$_COOKIE['BACKENDSESSID'];"]; instead and it work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants