implemented todo bug report, as well as coresponding api call
This commit is contained in:
parent
1926999f3e
commit
2bbebe581f
@ -19,4 +19,7 @@ class api_system extends api_login{
|
||||
\SYSTEM\locale::set($lang);}
|
||||
public static function static__result($result){
|
||||
\SYSTEM\CONFIG\config::set(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_DEFAULT_RESULT, $result);}
|
||||
|
||||
public static function call_bug($message,$data){
|
||||
return \SYSTEM\SAI\saimod_sys_todo::report($message,$data);}
|
||||
}
|
||||
@ -20,6 +20,13 @@ INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `nam
|
||||
|
||||
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (50, 0, 2, 10, 'pages', 'group', 'UINT');
|
||||
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (51, 0, 2, 10, 'pages', 'state', 'STRING');
|
||||
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (52, 0, 1, 50, NULL, 'js', NULL);
|
||||
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (53, 0, 2, 51, NULL, 'group', 'UINT');
|
||||
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (55, 0, 1, 50, NULL, 'css', NULL);
|
||||
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (56, 0, 2, 55, NULL, 'group', 'UINT');
|
||||
|
||||
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (60, 0, 2, 10, 'bug', 'message', 'STRING');
|
||||
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (61, 0, 2, 10, 'bug', 'data', 'JSON');
|
||||
|
||||
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (90, 0, 4, -1, NULL, '_lang', 'LANG');
|
||||
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (91, 0, 4, -1, NULL, '_result', 'RESULT');
|
||||
|
||||
@ -27,6 +27,8 @@ INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `nam
|
||||
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (53, 42, 2, 51, NULL, 'group', 'UINT');
|
||||
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (55, 42, 1, 50, NULL, 'css', NULL);
|
||||
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (56, 42, 2, 55, NULL, 'group', 'UINT');
|
||||
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (60, 42, 2, 10, 'bug', 'message', 'STRING');
|
||||
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (61, 42, 2, 10, 'bug', 'data', 'JSON');
|
||||
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (90, 42, 4, -1, NULL, '_lang', 'LANG');
|
||||
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (91, 42, 4, -1, NULL, '_result', 'RESULT');
|
||||
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (92, 42, 4, -1, NULL, '_escaped_fragment_', 'STRING');
|
||||
|
||||
@ -5,17 +5,7 @@ class SYS_SAIMOD_TODO_EXCEPTION_INSERT extends \SYSTEM\DB\QP {
|
||||
protected static function query(){
|
||||
return new \SYSTEM\DB\QQuery(get_class(),
|
||||
//pg
|
||||
'INSERT INTO '.\SYSTEM\DBD\system_todo::NAME_PG.
|
||||
'("'.\SYSTEM\DBD\system_todo::FIELD_CLASS.'","'.\SYSTEM\DBD\system_todo::FIELD_MESSAGE.'","'.
|
||||
\SYSTEM\DBD\system_todo::FIELD_CODE.'","'.\SYSTEM\DBD\system_todo::FIELD_FILE.'","'.
|
||||
\SYSTEM\DBD\system_todo::FIELD_LINE.'","'.\SYSTEM\DBD\system_todo::FIELD_TRACE.'","'.
|
||||
\SYSTEM\DBD\system_todo::FIELD_IP.'","'.\SYSTEM\DBD\system_todo::FIELD_QUERYTIME.'","'.
|
||||
\SYSTEM\DBD\system_todo::FIELD_SERVER_NAME.'","'.\SYSTEM\DBD\system_todo::FIELD_SERVER_PORT.'","'.
|
||||
\SYSTEM\DBD\system_todo::FIELD_REQUEST_URI.'","'.\SYSTEM\DBD\system_todo::FIELD_POST.'","'.
|
||||
\SYSTEM\DBD\system_todo::FIELD_HTTP_REFERER.'","'.\SYSTEM\DBD\system_todo::FIELD_HTTP_USER_AGENT.'","'.
|
||||
\SYSTEM\DBD\system_todo::FIELD_USER.'","'.\SYSTEM\DBD\system_todo::FIELD_THROWN.'","'.\SYSTEM\DBD\system_todo::FIELD_MESSAGE_HASH.'")'.
|
||||
'VALUES($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17)'.
|
||||
';',//'ON DUPLICATE KEY UPDATE '.\SYSTEM\DBD\system_todo::FIELD_COUNT.'='.\SYSTEM\DBD\system_todo::FIELD_COUNT.'+1, '.\SYSTEM\DBD\system_todo::FIELD_TIME.'=VALUES('.\SYSTEM\DBD\system_todo::FIELD_TIME.'), '.\SYSTEM\DBD\system_todo::FIELD_STATE.'='.\SYSTEM\DBD\system_todo::FIELD_STATE_OPEN.';',
|
||||
'todo',
|
||||
//mys
|
||||
'INSERT INTO '.\SYSTEM\DBD\system_todo::NAME_MYS.
|
||||
'('.\SYSTEM\DBD\system_todo::FIELD_CLASS.','.\SYSTEM\DBD\system_todo::FIELD_MESSAGE.','.
|
||||
@ -26,8 +16,9 @@ class SYS_SAIMOD_TODO_EXCEPTION_INSERT extends \SYSTEM\DB\QP {
|
||||
\SYSTEM\DBD\system_todo::FIELD_SERVER_PORT.','.\SYSTEM\DBD\system_todo::FIELD_REQUEST_URI.','.
|
||||
\SYSTEM\DBD\system_todo::FIELD_POST.','.\SYSTEM\DBD\system_todo::FIELD_HTTP_REFERER.','.
|
||||
\SYSTEM\DBD\system_todo::FIELD_HTTP_USER_AGENT.','.\SYSTEM\DBD\system_todo::FIELD_USER.','.
|
||||
\SYSTEM\DBD\system_todo::FIELD_THROWN.','.\SYSTEM\DBD\system_todo::FIELD_MESSAGE_HASH.')'.
|
||||
'VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, SHA1(?))'.
|
||||
\SYSTEM\DBD\system_todo::FIELD_THROWN.','.\SYSTEM\DBD\system_todo::FIELD_MESSAGE_HASH.','.
|
||||
\SYSTEM\DBD\system_todo::FIELD_TYPE.')'.
|
||||
'VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, SHA1(?),?)'.
|
||||
'ON DUPLICATE KEY '.
|
||||
' UPDATE '. \SYSTEM\DBD\system_todo::FIELD_COUNT.'='.\SYSTEM\DBD\system_todo::FIELD_COUNT.'+1, '.
|
||||
\SYSTEM\DBD\system_todo::FIELD_TIME.'=VALUES('.\SYSTEM\DBD\system_todo::FIELD_TIME.'), '.
|
||||
|
||||
@ -1,33 +0,0 @@
|
||||
<?php
|
||||
namespace SYSTEM\DBD;
|
||||
|
||||
class SYS_SAIMOD_TODO_USER_EXCEPTION_INSERT extends \SYSTEM\DB\QP {
|
||||
protected static function query(){
|
||||
return new \SYSTEM\DB\QQuery(get_class(),
|
||||
//pg
|
||||
'INSERT INTO '.\SYSTEM\DBD\system_todo::NAME_PG.
|
||||
'("'.\SYSTEM\DBD\system_todo::FIELD_CLASS.'","'.\SYSTEM\DBD\system_todo::FIELD_MESSAGE.'","'.
|
||||
\SYSTEM\DBD\system_todo::FIELD_CODE.'","'.\SYSTEM\DBD\system_todo::FIELD_FILE.'","'.
|
||||
\SYSTEM\DBD\system_todo::FIELD_LINE.'","'.\SYSTEM\DBD\system_todo::FIELD_TRACE.'","'.
|
||||
\SYSTEM\DBD\system_todo::FIELD_IP.'","'.\SYSTEM\DBD\system_todo::FIELD_QUERYTIME.'","'.
|
||||
\SYSTEM\DBD\system_todo::FIELD_SERVER_NAME.'","'.\SYSTEM\DBD\system_todo::FIELD_SERVER_PORT.'","'.
|
||||
\SYSTEM\DBD\system_todo::FIELD_REQUEST_URI.'","'.\SYSTEM\DBD\system_todo::FIELD_POST.'","'.
|
||||
\SYSTEM\DBD\system_todo::FIELD_HTTP_REFERER.'","'.\SYSTEM\DBD\system_todo::FIELD_HTTP_USER_AGENT.'","'.
|
||||
\SYSTEM\DBD\system_todo::FIELD_USER.'","'.\SYSTEM\DBD\system_todo::FIELD_THROWN.'","'.\SYSTEM\DBD\system_todo::FIELD_MESSAGE_HASH.'","'.\SYSTEM\DBD\system_todo::FIELD_TYPE.'")'.
|
||||
'VALUES($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, '.\SYSTEM\DBD\system_todo::FIELD_TYPE_USER.')'.
|
||||
';',//'ON DUPLICATE KEY UPDATE '.\SYSTEM\DBD\system_todo::FIELD_COUNT.'='.\SYSTEM\DBD\system_todo::FIELD_COUNT.'+1, '.\SYSTEM\DBD\system_todo::FIELD_TIME.'=VALUES('.\SYSTEM\DBD\system_todo::FIELD_TIME.'), '.\SYSTEM\DBD\system_todo::FIELD_STATE.'='.\SYSTEM\DBD\system_todo::FIELD_STATE_OPEN.';',
|
||||
//mys
|
||||
'INSERT INTO '.\SYSTEM\DBD\system_todo::NAME_MYS.
|
||||
'('.\SYSTEM\DBD\system_todo::FIELD_CLASS.','.\SYSTEM\DBD\system_todo::FIELD_MESSAGE.','.
|
||||
\SYSTEM\DBD\system_todo::FIELD_CODE.','.\SYSTEM\DBD\system_todo::FIELD_FILE.','.
|
||||
\SYSTEM\DBD\system_todo::FIELD_LINE.','.\SYSTEM\DBD\system_todo::FIELD_TRACE.','.
|
||||
\SYSTEM\DBD\system_todo::FIELD_IP.','.\SYSTEM\DBD\system_todo::FIELD_QUERYTIME.','.
|
||||
\SYSTEM\DBD\system_todo::FIELD_TIME.','.\SYSTEM\DBD\system_todo::FIELD_SERVER_NAME.','.
|
||||
\SYSTEM\DBD\system_todo::FIELD_SERVER_PORT.','.\SYSTEM\DBD\system_todo::FIELD_REQUEST_URI.','.
|
||||
\SYSTEM\DBD\system_todo::FIELD_POST.','.\SYSTEM\DBD\system_todo::FIELD_HTTP_REFERER.','.
|
||||
\SYSTEM\DBD\system_todo::FIELD_HTTP_USER_AGENT.','.\SYSTEM\DBD\system_todo::FIELD_USER.','.
|
||||
\SYSTEM\DBD\system_todo::FIELD_THROWN.','.\SYSTEM\DBD\system_todo::FIELD_MESSAGE_HASH.','.
|
||||
\SYSTEM\DBD\system_todo::FIELD_TYPE.')'.
|
||||
'VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, SHA1(?), '.\SYSTEM\DBD\system_todo::FIELD_TYPE_USER.')'.
|
||||
'ON DUPLICATE KEY UPDATE '.\SYSTEM\DBD\system_todo::FIELD_COUNT.'='.\SYSTEM\DBD\system_todo::FIELD_COUNT.'+1, '.\SYSTEM\DBD\system_todo::FIELD_TIME.'=VALUES('.\SYSTEM\DBD\system_todo::FIELD_TIME.'), '.\SYSTEM\DBD\system_todo::FIELD_STATE.'='.\SYSTEM\DBD\system_todo::FIELD_STATE_OPEN.';'
|
||||
);}}
|
||||
@ -29,7 +29,7 @@ class saimod_sys_todo extends \SYSTEM\SAI\SaiModule {
|
||||
\SYSTEM\DBD\SYS_SAIMOD_TODO_OPEN::QI(array($todo));
|
||||
return \SYSTEM\LOG\JsonResult::ok();}
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_todo_action_add($todo){
|
||||
self::exception(new \Exception($todo), false, true);
|
||||
self::exception(new \Exception($todo), false, \SYSTEM\DBD\system_todo::FIELD_TYPE_USER);
|
||||
return \SYSTEM\LOG\JsonResult::ok();}
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_todo_action_priority_up($todo){
|
||||
\SYSTEM\DBD\SYS_SAIMOD_TODO_PRIORITY::QI(array(+1,$todo));
|
||||
@ -226,41 +226,25 @@ class saimod_sys_todo extends \SYSTEM\SAI\SaiModule {
|
||||
public static function js(){
|
||||
return array(\SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_todo/js/saimod_sys_todo.js'));}
|
||||
|
||||
public static function exception(\Exception $E, $thrown, $user = false){
|
||||
public static function report($message,$data){
|
||||
$_POST = $data; //save data in post
|
||||
self::exception(new \Exception($message), false, \SYSTEM\DBD\system_todo::FIELD_TYPE_REPORT);
|
||||
return \SYSTEM\LOG\JsonResult::ok();}
|
||||
|
||||
public static function exception(\Exception $E, $thrown, $type = \SYSTEM\DBD\system_todo::FIELD_TYPE_EXCEPTION){
|
||||
try{
|
||||
if(\property_exists(get_class($E), 'todo_logged') && $E->todo_logged){
|
||||
return false;} //alrdy logged(this prevents proper thrown value for every system exception)
|
||||
if($user){
|
||||
\SYSTEM\DBD\SYS_SAIMOD_TODO_USER_EXCEPTION_INSERT::Q1( array( get_class($E), $E->getMessage(), $E->getCode(), $E->getFile(), $E->getLine(), $E->getTraceAsString(),
|
||||
getenv('REMOTE_ADDR'),round(microtime(true) - \SYSTEM\time::getStartTime(),5),
|
||||
$_SERVER["SERVER_NAME"],$_SERVER["SERVER_PORT"],$_SERVER['REQUEST_URI'], serialize($_POST),
|
||||
array_key_exists('HTTP_REFERER', $_SERVER) ? $_SERVER['HTTP_REFERER'] : null,
|
||||
array_key_exists('HTTP_USER_AGENT',$_SERVER) ? $_SERVER['HTTP_USER_AGENT'] : null,
|
||||
($user = \SYSTEM\SECURITY\Security::getUser()) ? $user->id : null, $thrown ? 1 : 0, sha1($E->getMessage())),
|
||||
array( get_class($E), $E->getMessage(), $E->getCode(), $E->getFile(), $E->getLine(), $E->getTraceAsString(),
|
||||
getenv('REMOTE_ADDR'),round(microtime(true) - \SYSTEM\time::getStartTime(),5),date('Y-m-d H:i:s', microtime(true)),
|
||||
$_SERVER["SERVER_NAME"],$_SERVER["SERVER_PORT"],$_SERVER['REQUEST_URI'], serialize($_POST),
|
||||
array_key_exists('HTTP_REFERER', $_SERVER) ? $_SERVER['HTTP_REFERER'] : null,
|
||||
array_key_exists('HTTP_USER_AGENT',$_SERVER) ? $_SERVER['HTTP_USER_AGENT'] : null,
|
||||
($user = \SYSTEM\SECURITY\Security::getUser()) ? $user->id : null,$thrown,$E->getMessage()));
|
||||
} else {
|
||||
\SYSTEM\DBD\SYS_SAIMOD_TODO_EXCEPTION_INSERT::Q1( array( get_class($E), $E->getMessage(), $E->getCode(), $E->getFile(), $E->getLine(), $E->getTraceAsString(),
|
||||
getenv('REMOTE_ADDR'),round(microtime(true) - \SYSTEM\time::getStartTime(),5),
|
||||
$_SERVER["SERVER_NAME"],$_SERVER["SERVER_PORT"],$_SERVER['REQUEST_URI'], serialize($_POST),
|
||||
array_key_exists('HTTP_REFERER', $_SERVER) ? $_SERVER['HTTP_REFERER'] : null,
|
||||
array_key_exists('HTTP_USER_AGENT',$_SERVER) ? $_SERVER['HTTP_USER_AGENT'] : null,
|
||||
($user = \SYSTEM\SECURITY\Security::getUser()) ? $user->id : null, $thrown ? 1 : 0, sha1($E->getMessage())),
|
||||
array( get_class($E), $E->getMessage(), $E->getCode(), $E->getFile(), $E->getLine(), $E->getTraceAsString(),
|
||||
getenv('REMOTE_ADDR'),round(microtime(true) - \SYSTEM\time::getStartTime(),5),date('Y-m-d H:i:s', microtime(true)),
|
||||
$_SERVER["SERVER_NAME"],$_SERVER["SERVER_PORT"],$_SERVER['REQUEST_URI'], serialize($_POST),
|
||||
array_key_exists('HTTP_REFERER', $_SERVER) ? $_SERVER['HTTP_REFERER'] : null,
|
||||
array_key_exists('HTTP_USER_AGENT',$_SERVER) ? $_SERVER['HTTP_USER_AGENT'] : null,
|
||||
($user = \SYSTEM\SECURITY\Security::getUser()) ? $user->id : null,$thrown,$E->getMessage()));
|
||||
}
|
||||
|
||||
\SYSTEM\DBD\SYS_SAIMOD_TODO_EXCEPTION_INSERT::Q1( array( get_class($E), $E->getMessage(), $E->getCode(), $E->getFile(), $E->getLine(), $E->getTraceAsString(),
|
||||
getenv('REMOTE_ADDR'),round(microtime(true) - \SYSTEM\time::getStartTime(),5),date('Y-m-d H:i:s', microtime(true)),
|
||||
$_SERVER["SERVER_NAME"],$_SERVER["SERVER_PORT"],$_SERVER['REQUEST_URI'], serialize($_POST),
|
||||
array_key_exists('HTTP_REFERER', $_SERVER) ? $_SERVER['HTTP_REFERER'] : null,
|
||||
array_key_exists('HTTP_USER_AGENT',$_SERVER) ? $_SERVER['HTTP_USER_AGENT'] : null,
|
||||
($user = \SYSTEM\SECURITY\Security::getUser()) ? $user->id : null,$thrown,$E->getMessage(),$type));
|
||||
if(\property_exists(get_class($E), 'logged')){
|
||||
$E->todo_logged = true;} //we just did log
|
||||
} catch (\Exception $E){return false;} //Error -> Ignore
|
||||
|
||||
return false; //We just log and do not handle the error!
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user