Skip to content

New config session_path#58

Open
ChuckNorrison wants to merge 3 commits intoTestLinkOpenSourceTRMS:testlink_1_9from
ChuckNorrison:session_path
Open

New config session_path#58
ChuckNorrison wants to merge 3 commits intoTestLinkOpenSourceTRMS:testlink_1_9from
ChuckNorrison:session_path

Conversation

@ChuckNorrison
Copy link
Copy Markdown
Contributor

If more than one testlink is used on a webserver, it is possible now to
specify path to save sessions. In Default the new session_path will not
be used. If session_path is used the session files from php will be
saved to that path. So multiple testlink instances can be used at the
same time.

If more than one testlink is used on a webserver, it is possible now to
specify path to save sessions. In Default the new session_path will not
be used. If session_path is used the session files from php will be
saved to that path. So multiple testlink instances can be used at the
same time.
@ChuckNorrison
Copy link
Copy Markdown
Contributor Author

Cause of session_save_path is used, you have to delete old session files by yourself. Code added after session_save_path is set:

    //Cleanup old sessions files
    if (file_exists(config_get('session_path'))) {
        $CurrentTime = time();
        $MaxLifeTime = 2*24*60*60;
        foreach (new DirectoryIterator(config_get('session_path')) as $fileInfo) {
            if ($fileInfo->isDot()) {
                continue;
            }
            if ( ($CurrentTime - $fileInfo->getCTime()) >= $MaxLifeTime ) {
                if (substr($fileInfo->getFilename(),0,5) === "sess_") {
                    unlink($fileInfo->getRealPath());
                }
            }
        }
    }

@squash-labs
Copy link
Copy Markdown

squash-labs Bot commented Feb 25, 2020

Manage this branch in Squash

Test this branch here: https://session-path-nehj8.squash.io

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.

1 participant