HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Questions about the GDN_Session table

johntangjohntang New
edited May 2014 in General Banter

Hello there,

Everybody please help me, at GDN_Session table, its storage the session that generated by the vanilla, on our site, it takes over ~1, 5 GB :(, Can I remove this session table? what is module can remove it automatically? I wanna change this default session storage to Redis PHP, how I can do it?

Other stuff is, when I disable a plugin, it seems to exist in the database, how I can completed remove a plugin?

Many thanks
John

Comments

  • Can I remove this session table?

    you could empty entries over 30 days old or possibly all of it.

    Other stuff is, when I disable a plugin, it seems to exist in the database, how I can completed remove a plugin?

    disabling plugins does not destroy or remove data in your sql database. if it did, people would loose all their data if they temporarily disabled plugin.

    you have to manually clear out columns in permission table that are added by plugin.

    and any other columns or tables that the plugin created.

    see the structure statement in plugin to see what tables it added.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • LincLinc Admin

    You can truncate the table. The worst that'll happen is it'll log out everyone using the site at that moment.

  • @Linc the session is not used for verify user session, it used for session stash only.

    grep is your friend.

  • LincLinc Admin

    @x00 said:
    Linc the session is not used for verify user session, it used for session stash only.

    Shows what I know about our session use :)

  • I meant table. It is actually better not to have stored session ids. HMAC is a good system.

    There is actually a different ID used for stashed session variables, they are almost independent.

    grep is your friend.

  • Can we rename the title it is not very clear?

    grep is your friend.

  • @x00‌, yes you can rename.

    So, is there any ways to changes default session storage on GDN_Session to another, such as PHP Redis as session handler?

  • @johntang said:
    So, is there any ways to changes default session storage on GDN_Session to another, such as PHP Redis as session handler?

    Yes, it's definitely possible. You would have to do the following:

    • Implement your own session class, inheriting from Gdn_Session.
    • Rewrite all the public methods that store anything in the MySQL database, so that they use Redis instead.
    • Replace the global session object with an instance of yours, as follows:
    $OriginalFactoryOverwrite = Gdn::FactoryOverwrite(1);
    Gdn::FactoryInstall(Gdn::AliasSession, 'RedisSession');
    Gdn::FactoryOverwrite($OriginalFactoryOverwrite);
    
    • Test ad nauseam.
Sign In or Register to comment.