mirror of
https://github.com/e107inc/e107.git
synced 2025-01-17 12:48:24 +01:00
Tweak tables around a bit, make db logging compatible
This commit is contained in:
parent
70b38c9cbe
commit
2ce90063c5
@ -11,8 +11,8 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_admin/admin_log.php,v $
|
||||
| $Revision: 1.3 $
|
||||
| $Date: 2007-12-15 15:06:40 $
|
||||
| $Revision: 1.4 $
|
||||
| $Date: 2007-12-18 20:57:37 $
|
||||
| $Author: e107steved $
|
||||
|
|
||||
| Preferences:
|
||||
@ -99,7 +99,7 @@ if (isset($_POST['confirmdeleteold']))
|
||||
$old_string = strftime("%d %B %Y",$old_date);
|
||||
$qry = "dblog_datestamp < ".$old_date;
|
||||
// $message = "Back delete, oldest date = {$old_string} Query = {$qry}";
|
||||
if ($del_count = $sql -> db_Delete("dblog",$qry))
|
||||
if ($del_count = $sql -> db_Delete("admin_log",$qry))
|
||||
{
|
||||
// Add in a log event
|
||||
$admin_log->log_event ("db_Delete - earlier than {$old_string} (past {$qs[2]} days)", $qry, 4);
|
||||
@ -158,7 +158,7 @@ if($action == "confdel")
|
||||
}
|
||||
|
||||
// Arrays of options for the various logs
|
||||
$log_db_table = array('adminlog' => 'dblog', 'auditlog' => 'audit_log', 'rolllog' => 'rl_history');
|
||||
$log_db_table = array('adminlog' => 'admin_log', 'auditlog' => 'audit_log', 'rolllog' => 'dblog');
|
||||
$back_day_count = array('adminlog' => 30, 'auditlog' => 30, 'rolllog' => max(intval($pref['roll_log_days']),1));
|
||||
$page_title = array('adminlog' => RL_LAN_030, 'auditlog' => RL_LAN_062, 'rolllog' => RL_LAN_002);
|
||||
$col_count = array('adminlog' => 8, 'auditlog' => 8, 'rolllog' => 9);
|
||||
|
@ -11,8 +11,8 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_admin/update_routines.php,v $
|
||||
| $Revision: 1.11 $
|
||||
| $Date: 2007-12-08 15:11:43 $
|
||||
| $Revision: 1.12 $
|
||||
| $Date: 2007-12-18 20:57:37 $
|
||||
| $Author: e107steved $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
@ -28,7 +28,8 @@ require_once(e_HANDLER.'db_table_admin_class.php');
|
||||
|
||||
// To do - how do we handle multi-language tables?
|
||||
|
||||
$update_debug = FALSE; // TRUE gives extra messages in places
|
||||
//$update_debug = FALSE; // TRUE gives extra messages in places
|
||||
$update_debug = TRUE; // TRUE gives extra messages in places
|
||||
|
||||
|
||||
if (!defined("LAN_UPDATE_8")) { define("LAN_UPDATE_8", ""); }
|
||||
@ -189,12 +190,12 @@ function update_706_to_800($type='')
|
||||
|
||||
|
||||
// List of DB tables newly required (defined in core_sql.php)
|
||||
$new_tables = array('audit_log', 'rl_history');
|
||||
$new_tables = array('admin_log','audit_log');
|
||||
|
||||
|
||||
// List of changed DB tables (defined in core_sql.php)
|
||||
// (primarily those which have changed significantly; for the odd field write some explicit code - it'll run faster)
|
||||
$changed_tables = array('dblog','rl_history', 'userclass_classes', 'banlist');
|
||||
$changed_tables = array('dblog','admin_log', 'userclass_classes', 'banlist');
|
||||
|
||||
|
||||
// List of DB tables (key) and field (value) which need changing to accommodate IPV6 addresses
|
||||
@ -322,6 +323,22 @@ function update_706_to_800($type='')
|
||||
// Tables defined in core_sql.php
|
||||
//---------------------------------
|
||||
|
||||
if (mysql_table_exists('dblog') && !mysql_table_exists('admin_log'))
|
||||
{
|
||||
if ($just_check) return update_needed('Rename dblog to admin_log');
|
||||
$sql->db_Select_gen('ALTER TABLE `'.MPREFIX.'dblog` RENAME `'.MPREFIX.'admin_log`');
|
||||
catch_error();
|
||||
}
|
||||
|
||||
// Next bit will be needed only by the brave souls who used an early CVS - probably delete before release
|
||||
if (mysql_table_exists('rl_history') && !mysql_table_exists('dblog'))
|
||||
{
|
||||
if ($just_check) return update_needed('Rename rl_history to dblog');
|
||||
$sql->db_Select_gen('ALTER TABLE `'.MPREFIX.'rl_history` RENAME `'.MPREFIX.'dblog`');
|
||||
catch_error();
|
||||
}
|
||||
|
||||
|
||||
// New tables required (list at top. Definitions in core_sql.php)
|
||||
foreach ($new_tables as $nt)
|
||||
{
|
||||
|
@ -12,8 +12,8 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_handlers/admin_log_class.php,v $
|
||||
| $Revision: 1.5 $
|
||||
| $Date: 2007-12-15 15:06:40 $
|
||||
| $Revision: 1.6 $
|
||||
| $Date: 2007-12-18 20:57:37 $
|
||||
| $Author: e107steved $
|
||||
|
||||
To do:
|
||||
@ -158,7 +158,7 @@ class e_admin_log {
|
||||
if ($target_logs & LOG_TO_ADMIN)
|
||||
{ // Admin log - assume all fields valid
|
||||
$qry = " 0, ".intval($time_sec).','.intval($time_usec).", '{$importance}', '{$eventcode}', {$userid}, '{$userIP}', '{$event_title}', '{$explain}' ";
|
||||
$this->rldb->db_Insert("dblog",$qry);
|
||||
$this->rldb->db_Insert("admin_log",$qry);
|
||||
}
|
||||
|
||||
|
||||
@ -215,10 +215,10 @@ class e_admin_log {
|
||||
// else $source_call is a string
|
||||
|
||||
// Save new rolling log record
|
||||
$this->rldb->db_Insert("rl_history","0, ".intval($time_sec).', '.intval($time_usec).", '{$importance}', '{$eventcode}', {$userid}, '{$userstring}', '{$userIP}', '{$source_call}', '{$event_title}', '{$explain}' ");
|
||||
$this->rldb->db_Insert("dblog","0, ".intval($time_sec).', '.intval($time_usec).", '{$importance}', '{$eventcode}', {$userid}, '{$userstring}', '{$userIP}', '{$source_call}', '{$event_title}', '{$explain}' ");
|
||||
|
||||
// Now delete any old stuff
|
||||
$this->rldb->db_Delete("rl_history", "dblog_datestamp < '".intval(time() - (varset($pref['roll_log_days'],7)*86400))."' ");
|
||||
$this->rldb->db_Delete("dblog", "dblog_datestamp < '".intval(time() - (varset($pref['roll_log_days'],7)*86400))."' ");
|
||||
}
|
||||
|
||||
if ($finished) exit; // Optional abort for all logs
|
||||
|
@ -12,9 +12,9 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_handlers/mysql_class.php,v $
|
||||
| $Revision: 1.19 $
|
||||
| $Date: 2007-10-15 11:03:29 $
|
||||
| $Author: e107coders $
|
||||
| $Revision: 1.20 $
|
||||
| $Date: 2007-12-18 20:57:37 $
|
||||
| $Author: e107steved $
|
||||
|
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
@ -30,8 +30,8 @@ $db_ConnectionID = NULL;
|
||||
* MySQL Abstraction class
|
||||
*
|
||||
* @package e107
|
||||
* @version $Revision: 1.19 $
|
||||
* @author $Author: e107coders $
|
||||
* @version $Revision: 1.20 $
|
||||
* @author $Author: e107steved $
|
||||
*/
|
||||
class db {
|
||||
|
||||
@ -151,11 +151,12 @@ class db {
|
||||
*/
|
||||
function db_Write_log($log_type = '', $log_remark = '', $log_query = '') {
|
||||
global $tp, $e107;
|
||||
$d = time();
|
||||
list($time_usec, $time_sec) = explode(" ", microtime());
|
||||
$uid = (USER) ? USERID : '0';
|
||||
$userstring = ( USER === true ? USERNAME : "LAN_ANONYMOUS");
|
||||
$ip = $e107->getip();
|
||||
$qry = $tp->toDB($log_query);
|
||||
$this->db_Insert('dblog', "0, '{$log_type}', {$d}, {$uid}, '{$ip}', '{$qry}', '{$log_remark}'");
|
||||
$this->db_Insert('dblog', "0, {$time_sec}, {$time_usec}, '{$log_type}', 'DBDEBUG', {$uid}, '{$userstring}', '{$ip}', '', '{$log_remark}', '{$qry}'");
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user