Welcome Guest, Not a member yet? Register   Sign In
Running session GC from CLI
#1

Hello is there a better way to clean up sessions from CLI than the following example?


PHP Code:
public function clear_sessions():void{
    $this->session = \Config\Services::session();
    $rf = new ReflectionProperty($this->session'driver');
    $rf->setAccessible(true);
    $rf->getValue($this->session)->gc(env('app.sessionExpiration'));
    
C::print('Sessions Cleared');
    
C::newLine();

Reply




Theme © iAndrew 2016 - Forum software by © MyBB