Advertisement:

Author Topic: SOLVED Logs in database  (Read 1051 times)

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 1652
  • "BE GRATEFUL TO THOSE THAT SUPPORTED YOU"
Re: Logs in database
« Reply #15 on: December 10, 2017, 12:38:13 am »
So.

oc-includes/osclass/model/Log.php
Add
Code: [Select]
        }
       
        /**
         * Delete logs older than 2 weeks for users and older than 1 month for admins.
         *
         * @access public
         * @return boolean
         */
        public function deleteOldLogs()
        {
           return $this->dao->delete(DB_TABLE_PREFIX.'t_log', "(TIMESTAMPDIFF(WEEK, dt_date, NOW()) >= 2 AND s_who = 'user' ) OR (TIMESTAMPDIFF(MONTH, dt_date, NOW()) >= 1 AND s_who = 'admin')");

        }
    }

    /* file end: ./oc-includes/osclass/model/Log.php */
?>


instead of

Code: [Select]
        }
    }

    /* file end: ./oc-includes/osclass/model/Log.php */
?>

and

/oc-includes/osclass/cron.php

add

Code: [Select]
            //DELETE OLD LOGS
            Log::newInstance()->deleteOldLogs();
            osc_run_hook('cron_weekly');

instead of

Code: [Select]
            osc_run_hook('cron_weekly');