XF 2.2 Help understanding xf_session and xf_session_activity

CStrategies

Member
I want to build an addon to query the xf_session / xf_session_activity tables and determine whether any users with shared IPs to the current user have visited this user's profile page or interacted with any of this user's content. This is in an attempt to help identify duplicate accounts of banned or problematic users.

For example, banned users will often return to the website, create a new account, and then visit their old profile. I guess they want to "see" if they are still banned. I want to capture that activity.

We also have users who will artificially "bump" their own content, by leaving fake ratings or reactions, or generally interacting with the content as if they are a different and unique user. Being able to query the activity table would allow us to, for example, quickly search content interactions for any users with shared IPs to the content's author.

I can't seem to find any development documentation about the session tables, however. I do see that the SessionActivity entity is used to, for example, display the "latest activity" information on a member's profile. I can't find any settings in the ACP for how long this activity gets recorded, or what activities specifically are recorded. I also can't seem to find any information or documentation about understanding the structure of the data in the tables that would help me to design the queries I'll need to make this addon work correctly.
 
So it looks like at least part of my solution involves the news feed. However, it appears the news feed only goes back so far. It appears, at least on our site, that it ends at about 90 days back. I can't find any settings for news feed history length in the ACP.

Edit: This answers the news feed question at least:

Code:
    public function cleanUpNewsFeedItems($dateCut = null)
    {
        if ($dateCut === null)
        {
            // TODO: make this an option
            $dateCut = time() - 90 * 86400;
        }
        $this->db()->delete('xf_news_feed', 'event_date < ?', $dateCut);
    }

Question for devs: Would extending this cutoff to a year or two create any significant performance impacts, do you think?
 
Back
Top Bottom