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

Fix ESI default ttl based on session.gc_maxlifetime #1429

Merged
merged 4 commits into from
Aug 21, 2018

Conversation

gianstraf
Copy link
Contributor

@@ -231,7 +231,11 @@ public function getCacheClearEvents() {
* @return string
*/
public function getDefaultEsiTtl() {
return trim(Mage::getStoreConfig('web/cookie/cookie_lifetime'));
$defaultLifeTime = trim(Mage::getStoreConfig('web/cookie/cookie_lifetime'));
if ($defaultLifeTime < 60) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand the 60 there, can you explain that please?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was based on Mage_Core_Model_Resource_Session:getLifeTime

public function getLifeTime()
    {
        if (is_null($this->_lifeTime)) {
            $configNode = Mage::app()->getStore()->isAdmin() ?
                    'admin/security/session_cookie_lifetime' : 'web/cookie/cookie_lifetime';
            $this->_lifeTime = (int) Mage::getStoreConfig($configNode);

            if ($this->_lifeTime < 60) {
                $this->_lifeTime = ini_get('session.gc_maxlifetime');
            }

            if ($this->_lifeTime < 60) {
                $this->_lifeTime = 3600; //one hour
            }

            if ($this->_lifeTime > self::SEESION_MAX_COOKIE_LIFETIME) {
                $this->_lifeTime = self::SEESION_MAX_COOKIE_LIFETIME; // 100 years
            }
        }
        return $this->_lifeTime;
    }

@miguelbalparda miguelbalparda self-assigned this Aug 21, 2018
@miguelbalparda miguelbalparda merged commit 7da8eb0 into nexcess:devel Aug 21, 2018
@miguelbalparda
Copy link
Contributor

Sorry for the quick turnaround and thank you!

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

Successfully merging this pull request may close these issues.

2 participants