*

Alej

  • ***
  • 78 posts
/oc-content/tmp folder fills up with "sess_" files
« on: December 17, 2025, 10:35:53 PM »
Hello, I've been having a problem with osclass for a while now. The /oc-content/tmp folder fills up with "sess_" files, and I have to delete them manually because they exhaust the server's inode capacity. This didn't always happen; it started recently, but I can't identify what's causing it. Is it possible that this is an osclass bug? Thanks

*

149health

  • ***
  • 52 posts
Re: /oc-content/tmp folder fills up with "sess_" files
« Reply #1 on: December 18, 2025, 08:53:00 PM »
Most likely, this is a bot running on your new/item and creating a bunch of sessions. Create an additional cron file that checks this folder, and if there are many files, it cleans them up. That’s how I solved the problem. Plus, I set up Cloudflare on this directory, and the creation of sessions in large quantities disappeared.

*

MB Themes

Re: /oc-content/tmp folder fills up with "sess_" files
« Reply #2 on: December 18, 2025, 10:02:12 PM »
I do not think these are from osclass.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

149health

  • ***
  • 52 posts
Re: /oc-content/tmp folder fills up with "sess_" files
« Reply #3 on: December 21, 2025, 04:15:03 PM »
I do not think these are from osclass.
But I would still like to know what causes the session spam in the tmp/ folder.
.sess file code
Quote
messages|a:0:{}keepForm|a:0:{}form|a:0:{}alert_private_key|s:32:"FqubDzLthItqQseIrCqUwtoMu3AaNAGh";alert_public_key|s:32:"Qpfwh3cZ8cPIqMuLnCHD2zv8tT/Z1bxA";alert_signature|s:28:"LceaubTeGiT2qdabI4r4UfkKMEo=";
Quote
messages|a:0:{}keepForm|a:0:{}form|a:0:{}userLocale|s:5:"ru_RU";alert_private_key|s:32:"A1kEA8p0kBoIl/PQeSph2NwWsZGlzv28";alert_public_key|s:32:"GHF23p20mPtnW6IiHKKFE8Fo8Ua36WSn";alert_signature|s:28:"ENGMkB3HGwaI9i5m05j5/Vk0gyY=";

*

MB Themes

Re: /oc-content/tmp folder fills up with "sess_" files
« Reply #4 on: December 21, 2025, 05:07:38 PM »
Try to put this function with hook to your oc-includes/osclass/functions.php

Code: [Select]
function osc_clean_temp_folder() {
  $path = UPLOADS_PATH . 'temp';
 
  if(!is_dir($path)) {
    return;
  }

  $files = new RecursiveIteratorIterator(
    new RecursiveDirectoryIterator($path, RecursiveDirectoryIterator::SKIP_DOTS),
    RecursiveIteratorIterator::CHILD_FIRST
  );

  foreach($files as $fileinfo) {
    if($fileinfo->isDir()) {
      rmdir($fileinfo->getRealPath());
    } else {
      unlink($fileinfo->getRealPath());
    }
  }
}

osc_add_hook('cron_daily', 'osc_clean_temp_folder');
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

MB Themes

Re: /oc-content/tmp folder fills up with "sess_" files
« Reply #5 on: December 21, 2025, 05:10:10 PM »
if it's not path where sess_ files are getting created, I would discuss with hosting to configure session path and have them cleaned periodically.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots