2016-09-01 23:13:23 +02:00
|
|
|
<?php
|
|
|
|
/*****************************************************************************
|
|
|
|
* ErrorLog.php
|
|
|
|
* Contains key class ErrorLog.
|
|
|
|
*
|
|
|
|
* Kabuki CMS (C) 2013-2015, Aaron van Geffen
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
class ErrorLog
|
|
|
|
{
|
|
|
|
public static function log(array $data)
|
|
|
|
{
|
|
|
|
if (!Registry::has('db'))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return Registry::get('db')->query('
|
|
|
|
INSERT INTO log_errors
|
|
|
|
(id_user, message, debug_info, file, line, request_uri, time, ip_address)
|
|
|
|
VALUES
|
|
|
|
({int:id_user}, {string:message}, {string:debug_info}, {string:file}, {int:line},
|
|
|
|
{string:request_uri}, CURRENT_TIMESTAMP, {string:ip_address})',
|
|
|
|
$data);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static function flush()
|
|
|
|
{
|
2024-12-22 15:35:50 +01:00
|
|
|
return Registry::get('db')->query('DELETE FROM log_errors');
|
2016-09-01 23:13:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public static function getCount()
|
|
|
|
{
|
|
|
|
return Registry::get('db')->queryValue('
|
|
|
|
SELECT COUNT(*)
|
|
|
|
FROM log_errors');
|
|
|
|
}
|
|
|
|
}
|