Version 3.2.3

This commit is contained in:
Neo committed 2025-12-19 00:34:03 -08:00
1 parent ae5c01cc78
commit 78706903a2
2641 files changed
+228363 -201264

No files matched your search

@@ -1,21 +1,14 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.1.4
* Task: Prune old logs
* Last Updated: $LastChangedDate: 2010-06-08 20:53:45 -0400 (Tue, 08 Jun 2010) $
* </pre>
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/community/board/license.html
* @package IP.Board
* @subpackage Core
* @link http://www.invisionpower.com
* @since 27th January 2004
* @version $Rev: 6485 $
* @file logprune.php Task to prune old logs from the cache folder
*~TERABYTE_DOC_READY~
* $Copyright: (c) 2001 - 2011 Invision Power Services, Inc.$
* $License: This is NULLED!
* $Author: mmecham $
* @since -
* $LastChangedDate: 2011-04-19 11:20:55 -0400 (Tue, 19 Apr 2011) $
* @version v3.2.3
* $Revision: 8383 $
*/
if ( ! defined( 'IN_IPB' ) )
@@ -24,69 +17,65 @@ if ( ! defined( 'IN_IPB' ) )
exit();
}
/**
*
* @class task_item
* @brief Task to prune old logs from the cache folder
*
*/
class task_item
{
/**
* Parent task manager class
* Integer value (seconds) used to delete old records
* By default 1 month: 2592000 (60*60*24*30)
*
* @var $deleteTime
*/
protected $deleteTime = 2592000;
/**
* Object that stores the parent task manager class
*
* @access protected
* @var object
* @var $class
*/
protected $class;
/**
* This task data
*
* @access protected
* @var array
*/
protected $task = array();
/**
* Prevent logging
*
* @access protected
* @var boolean
*/
protected $restrict_log = false;
/**#@+
/**
* Array that stores the task data
*
* @var $task
*/
protected $task = array();
/**
* Registry Object Shortcuts
*
* @access protected
* @var object
* @var $registry
* @var $DB
* @var $settings
* @var $lang
*/
protected $registry;
protected $DB;
protected $settings;
protected $request;
protected $lang;
protected $member;
protected $cache;
/**#@-*/
/**
* Constructor
*
* @access public
* @param object ipsRegistry reference
* @param object Parent task class
* @param array This task data
* @return void
* @param object $registry Registry object
* @param object $class Task manager class object
* @param array $task Array with the task data
* @return @e void
*/
public function __construct( ipsRegistry $registry, $class, $task )
{
/* Make registry objects */
$this->registry = $registry;
$this->DB = $this->registry->DB();
$this->settings =& $this->registry->fetchSettings();
$this->request =& $this->registry->fetchRequest();
$this->settings =& $this->registry->fetchSettings();
$this->lang = $this->registry->getClass('class_localization');
$this->member = $this->registry->member();
$this->memberData =& $this->registry->member()->fetchMemberData();
$this->cache = $this->registry->cache();
$this->caches =& $this->registry->cache()->fetchCaches();
$this->class = $class;
$this->task = $task;
}
@@ -94,8 +83,7 @@ class task_item
/**
* Run this task
*
* @access public
* @return void
* @return @e void
*/
public function runTask()
{
@@ -103,84 +91,79 @@ class task_item
//-----------------------------------------
// Spider Logs
//-----------------------------------------
//-----------------------------------------
if( $this->settings['ipb_prune_spider'] )
{
$this->DB->delete( "spider_logs", "entry_date < " . (time() - (60*60*24*30)) );
$this->DB->delete( "spider_logs", "entry_date < " . (time() - $this->deleteTime) );
}
//-----------------------------------------
// Spam Logs
//-----------------------------------------
//-----------------------------------------
if( $this->settings['ipb_prune_spam'] )
{
$this->DB->delete( "spam_service_log", "log_date < " . (time() - $this->deleteTime) );
}
//-----------------------------------------
// Admin Login Logs
//-----------------------------------------
//-----------------------------------------
if( $this->settings['prune_admin_login_logs'] )
{
$this->DB->delete( "admin_login_logs", "admin_time < " . (time() - (60*60*24*30)) );
$this->DB->delete( "admin_login_logs", "admin_time < " . (time() - $this->deleteTime) );
}
//-----------------------------------------
// Task Logs
//-----------------------------------------
//-----------------------------------------
if( $this->settings['ipb_prune_task'] )
{
$this->DB->delete( "task_logs", "log_date < " . (time() - (60*60*24*30)) );
$this->DB->delete( "task_logs", "log_date < " . (time() - $this->deleteTime) );
}
//-----------------------------------------
// Admin Logs
//-----------------------------------------
//-----------------------------------------
if( $this->settings['ipb_prune_admin'] )
{
$this->DB->delete( "admin_logs", "ctime < " . (time() - (60*60*24*30)) );
$this->DB->delete( "admin_logs", "ctime < " . (time() - $this->deleteTime) );
}
//-----------------------------------------
// Mod Logs
//-----------------------------------------
//-----------------------------------------
if ( $this->settings['ipb_prune_mod'] )
{
$this->DB->delete( "moderator_logs", "ctime < " . (time() - (60*60*24*30)) );
}
//-----------------------------------------
// Email Logs
//-----------------------------------------
if ( $this->settings['ipb_prune_email'] )
{
$this->DB->delete( "email_logs", "email_date < " . (time() - (60*60*24*30)) );
$this->DB->delete( "moderator_logs", "ctime < " . (time() - $this->deleteTime) );
}
//-----------------------------------------
// Email Error Logs
//-----------------------------------------
//-----------------------------------------
if ( $this->settings['ipb_prune_emailerror'] )
{
$this->DB->delete( "mail_error_logs", "mlog_date < " . (time() - (60*60*24*30)) );
$this->DB->delete( "mail_error_logs", "mlog_date < " . (time() - $this->deleteTime) );
}
//-----------------------------------------
// Error Logs
//-----------------------------------------
//-----------------------------------------
if ( $this->settings['prune_error_logs'] )
{
$this->DB->delete( "error_logs", "log_date < " . (time() - (60*60*24*30)) );
$this->DB->delete( "error_logs", "log_date < " . (time() - $this->deleteTime) );
}
//-----------------------------------------
// SQL Error Logs
// --Only prune older than 30 days
//-----------------------------------------
// SQL Logs
//-----------------------------------------
if ( $this->settings['ipb_prune_sql'] )
{
@@ -193,9 +176,9 @@ class task_item
continue;
}
if( preg_match( "#^sql_error_log_(\d+)_(\d+)_(\d+).cgi$#", $file->getFilename(), $matches ) )
if( preg_match( "#^sql_(error|debug|upgrade)_log_(\d+)_(\d+)_(\d+).cgi$#", $file->getFilename(), $matches ) )
{
if( $file->getMTime() < (time() - (60*60*24*30)) )
if( $file->getMTime() < (time() - $this->deleteTime) )
{
@unlink( $file->getPathname() );
}
@@ -216,5 +199,4 @@ class task_item
$this->class->unlockTask( $this->task );
}
}