Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: rcane on July 23, 2024, 12:54:06 PM

Title: trying to learn how the admin logs work
Post by: rcane on July 23, 2024, 12:54:06 PM
So, i just noticed that there's a 24 hour wait on clearing logs.

I wanted to know where/how it all gets processed.


Is modlog.php the spot?

This is what caught my eye.

if (isset($_POST['removeall']) && $context['can_delete'])
{
checkSession();

$smcFunc['db_query']('', '
DELETE FROM {db_prefix}log_actions
WHERE id_log = {int:moderate_log}
AND log_time < {int:twenty_four_hours_wait}' . (!empty($context['uneditable_actions']) ? '
AND action NOT IN ({array_string:uneditable})' : ''),
array(
'twenty_four_hours_wait' => time() - $context['hoursdisable'] * 3600,
'moderate_log' => $context['log_type'],
'uneditable' => $context['uneditable_actions'],
)
);
}
elseif (!empty($_POST['remove']) && isset($_POST['delete']) && $context['can_delete'])
{
checkSession();
$smcFunc['db_query']('', '
DELETE FROM {db_prefix}log_actions
WHERE id_log = {int:moderate_log}
AND id_action IN ({array_string:delete_actions})
AND log_time < {int:twenty_four_hours_wait}' . (!empty($context['uneditable_actions']) ? '
AND action NOT IN ({array_string:uneditable})' : ''),
array(
'twenty_four_hours_wait' => time() - $context['hoursdisable'] * 3600,
'delete_actions' => array_unique($_POST['delete']),
'moderate_log' => $context['log_type'],
'uneditable' => $context['uneditable_actions'],
)
);
}
Title: Re: trying to learn how the admin logs work
Post by: Doug Heffernan on July 23, 2024, 12:59:02 PM
Quote from: rcane on July 23, 2024, 12:54:06 PMWhere is $context defined?

That's a gobal variable within smf.

https://wiki.simplemachines.org/smf/Global_variables


 
Title: Re: trying to learn how the admin logs work
Post by: rcane on July 23, 2024, 01:07:29 PM
Thanks,

And I think i found what I was looking for
Title: Re: trying to learn how the admin logs work
Post by: Arantor on July 23, 2024, 01:19:08 PM
What were you looking for exactly? If it's the 24 hours wait, there is a good reason it's there...
Title: Re: trying to learn how the admin logs work
Post by: rcane on July 23, 2024, 09:15:51 PM
Quote from: Arantor on July 23, 2024, 01:19:08 PMWhat were you looking for exactly? If it's the 24 hours wait, there is a good reason it's there...

It was actually.  What's the design-intent?
Title: Re: trying to learn how the admin logs work
Post by: Arantor on July 24, 2024, 02:25:13 AM
It used to be the case that if you cleared the logs, it would leave no trace - meaning that on a site with multiple admins, one of them could do something they shouldn't, then clear the log to remove any trace of having done so.

This way, it's impossible for an admin to clear the logs without leaving a record of having done so (without direct database access and suitable knowledge).

So the next question is why does it matter? For most people this is a non-issue that this is there, and people that feel the need to change it always set off alarm bells in my head.
Title: Re: trying to learn how the admin logs work
Post by: rcane on July 24, 2024, 11:06:59 AM
Oh it's just me—no one else. 

And I just like to know how things work.

But, doesn't this only put things off for 24 hours?  Or was the idea that another admin would see things before the safeties were removed?
Title: Re: trying to learn how the admin logs work
Post by: Arantor on July 24, 2024, 12:15:04 PM
But the clearing of the log *puts an item in*. So if they clear it, even if they clear it every day, there will still be a trace left for any other admin to see.

I'm sorry, I have distinct distrust of "I just like to know how things work" because every single time I've ever heard it, it's a prelude to changing something with a bad outcome.

If you don't care about the logs, turn them off rather than worrying about this.
Title: Re: trying to learn how the admin logs work
Post by: rcane on July 24, 2024, 12:21:38 PM
Quote from: Arantor on July 24, 2024, 12:15:04 PMBut the clearing of the log *puts an item in*. So if they clear it, even if they clear it every day, there will still be a trace left for any other admin to see.

I'm sorry, I have distinct distrust of "I just like to know how things work" because every single time I've ever heard it, it's a prelude to changing something with a bad outcome.

If you don't care about the logs, turn them off rather than worrying about this.

Ha, I appreciate your concern/experience.  No, I like to know how things work.  And yeah, you're always going to be leaving a mark of "was here" so you're only cleaning the screen up to that point. 

I didn't think logs could be turned off--just for these reasons.  I hadn't gone to the core features page since install.