Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
X Lib
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
XLibs
X Lib
Commits
555d8f48
Commit
555d8f48
authored
Nov 21, 2015
by
Alex Ne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Удаление лишнего
parent
494b351f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
61 deletions
+0
-61
ErrorWriter.php
ErrorWriter.php
+0
-61
No files found.
ErrorWriter.php
deleted
100644 → 0
View file @
494b351f
<?php
/**
*
*/
class
X_ErrorWriter
{
static
$AllErrorList
=
[];
public
$ErrorList
=
[];
function
__construct
(
$Type
,
$Message
,
$File
,
$Line
,
$StackTrace
=
false
,
$vars
=
""
)
{
$this
->
fixError
(
$Type
,
$Message
,
$File
,
$Line
,
$StackTrace
,
$vars
);
}
public
function
fixError
(
$Type
,
$Message
,
$File
,
$Line
,
$StackTrace
=
false
,
$vars
=
""
)
{
$File
=
str_replace
(
ROOT_DIR
,
""
,
$File
);
$Message
=
str_replace
(
ROOT_DIR
,
""
,
$Message
);
$StackTrace
=
str_replace
(
ROOT_DIR
,
""
,
$StackTrace
);
$ErrorIndex
=
md5
(
$Type
.
$Message
.
$File
.
$Line
);
if
(
isset
(
$this
->
ErrorList
[
$ErrorIndex
]))
$this
->
ErrorList
[
$ErrorIndex
][
'count'
]
++
;
else
{
$this
->
ErrorList
[
$ErrorIndex
][
'id'
]
=
$ErrorIndex
;
$this
->
ErrorList
[
$ErrorIndex
][
'count'
]
=
1
;
$this
->
ErrorList
[
$ErrorIndex
][
'number'
]
=
$Type
;
$this
->
ErrorList
[
$ErrorIndex
][
'message'
]
=
$StackTrace
?
$Message
.
"
\n
"
.
$StackTrace
:
$Message
;
$this
->
ErrorList
[
$ErrorIndex
][
'file'
]
=
$File
;
$this
->
ErrorList
[
$ErrorIndex
][
'line'
]
=
$Line
;
$this
->
ErrorList
[
$ErrorIndex
][
'vars'
]
=
$vars
;
$this
->
ErrorList
[
$ErrorIndex
][
'time'
]
=
time
();
}
X_ErrorWriter
::
$AllErrorList
[
$ErrorIndex
]
=
$this
->
ErrorList
[
$ErrorIndex
];
return
$this
;
}
public
function
tryWriteErrorToDB
()
{
if
(
count
(
$this
->
ErrorList
)
>
0
)
{
$DB
=
(
new
X_DB_MySQLi
(
"sw"
)
)
->
Connect
();
$lastErrors
=
$DB
->
get
(
"SELECT * from `error_log` where `id` in ('"
.
implode
(
"','"
,
array_keys
(
$this
->
ErrorList
)
)
.
"') order by `time` desc"
,
"id"
);
if
(
count
(
$lastErrors
)
>
0
)
{
foreach
(
$lastErrors
as
$key
=>
$value
)
{
$this
->
ErrorList
[
$key
][
'count'
]
=
$this
->
ErrorList
[
$key
][
'count'
]
+
$value
[
'count'
];
}
}
foreach
(
$this
->
ErrorList
as
$key
=>
$data
)
{
if
(
$DB
->
add
(
"error_log"
,
$data
,
true
)
)
unset
(
$this
->
ErrorList
[
$key
]);
}
}
}
function
__destruct
(){}
}
?>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment