Erich Mosier
Erich Mosier

Reputation: 33

PHP -Session files being automatically recreated when removed

I am doing some custom modifications to a dokuwiki site, but that may or may not have any bearing on the issue I am running into.

Here is the premise: The dokuwiki site is using Oauth to log users in. They login on a Parent site and are redirected back to dokuwiki. There is a text file where is stores users that are logged in, as well as having normal session data stored. I have a requirement that when a users status changes on the Parent site, they will be logged out of the dokuwiki site and need to log in again in order to update their permission levels.

I have written a plugin/webhook that: when it receives the JSON file (which may have one or more accounts to process) from the Parent site, it loops through the session files, finds the ones that match the accounts that were sent, deletes those files

unlink($session_file);

,destroys the session for those specific session_ids,

session_id($session_id_to_destroy);
session_start();
session_destroy();
session_commit();

and removes the record from dokuwiki's text file.

All of that works great, except something keeps recreating the session files as soon as I remove them, and I cannot figure out what is doing it.

Does anyone know if there is some process built into Dokuwiki, or PHP, or Apache, that would cause this, or any ideas how to stop it?

Thanks in advance.

If it helps, the way I am testing is:

  1. log the user in using OAuth
  2. From a terminal, using CURL, send JSON data to webhook
  3. I am var_dumping the list of files out in the session folder before it loops through
  4. It does its thing and I can see that the file for the session id has been removed and the user has been removed from the text file
  5. Look at the session folder again and see another file with a new session id has been created with the same users data in it that was just removed
  6. Bang my head on my keyboard and cry

Upvotes: 0

Views: 50

Answers (0)

Related Questions