Welcome Guest, Not a member yet? Register   Sign In
[SOLVED] Session as DatabaseHandler Driver
#1

(This post was last modified: 03-19-2023, 02:49 AM by superior.)

Hi,

A few days ago i've started to play with DigitalOcean's App Platform to see how CodeIgniter4 runs, all seems to be working fine except for a small thing.

The issue
DigitalOcean rebuilds the application on each publication, this means they will delete everything before publishing the newly commit.
Not an issue for me but the /writable/ folder and it's contents will also be delete, this said I need a different solution for my /session/ folder.

Other folders
The cache folder is only storing information for about 5 minutes so that's not a problem.
The uploads folder is an external bucket so that folder isn't being used on my side, i'm also storing some additional information there.

Solution
CodeIgniter does offer a DatabaseHandler that will use a table named 'ci_sessions' (or a name as you desire).
This will solve the issue for me so the content will not be deleted, i'm unable to find out how this is handled.
Looked through the spark command list but under "Housekeeping" there is no session:cleanup or somehting simulair.

Q: How does CodeIgniter run a cleanup, do i need a command for this?
Reply
#2

(This post was last modified: 03-19-2023, 11:31 PM by InsiteFX. Edit Reason: Spelliing error )

The session cleanup is usally handled by php.

To cleanup sessions it is recommened to use a CRON Job to clean them up.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

Thanks for the reply, does this also clean the table with sessions or do i need to create an additional cleanup task?
Reply
#4

I would create a cleanup method for it, this way if you need to make changes later it will be easier.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#5

Thank you for the reply!
I've created an additional task that will remove sessions older than 3 months.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB