session_gc example

if ($this->container->getParameter('shopware.session.save_handler') === 'file') {
            $io->error('Session save handler "file" is not supported');

            return 1;
        }

        /** @var Shop $shop */
        $shop = $this->container->get('models')->getRepository(Shop::class)->getDefault();
        $this->container->get('shopware.components.shop_registration_service')->registerShop($shop);

        $count = session_gc();
        session_destroy();

        $io->success(sprintf('Successfully removed %d expired sessions', $count));

        return 0;
    }
}
Home | Imprint | This part of the site doesn't use cookies.