Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
drupal
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
219
Merge Requests
219
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
drupal
Commits
5bbad8a4
Commit
5bbad8a4
authored
Dec 28, 2008
by
Dries
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Patch
#223298
by Dave Reid: change {dblog}.type VARCHAR limit from 16 to 64.
parent
1d14b0f8
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
68 additions
and
49 deletions
+68
-49
includes/bootstrap.inc
includes/bootstrap.inc
+3
-2
modules/dblog/dblog.install
modules/dblog/dblog.install
+10
-1
modules/dblog/dblog.module
modules/dblog/dblog.module
+16
-12
modules/syslog/syslog.module
modules/syslog/syslog.module
+5
-2
modules/system/system.api.php
modules/system/system.api.php
+34
-32
No files found.
includes/bootstrap.inc
View file @
5bbad8a4
...
...
@@ -887,6 +887,7 @@ function request_uri() {
* A link to associate with the message.
*
* @see watchdog_severity_levels()
* @see hook_watchdog()
*/
function
watchdog
(
$type
,
$message
,
$variables
=
array
(),
$severity
=
WATCHDOG_NOTICE
,
$link
=
NULL
)
{
global
$user
,
$base_root
;
...
...
@@ -899,7 +900,7 @@ function watchdog($type, $message, $variables = array(), $severity = WATCHDOG_NO
$in_error_state
=
TRUE
;
// Prepare the fields to be logged
$log_
message
=
array
(
$log_
entry
=
array
(
'type'
=>
$type
,
'message'
=>
$message
,
'variables'
=>
$variables
,
...
...
@@ -914,7 +915,7 @@ function watchdog($type, $message, $variables = array(), $severity = WATCHDOG_NO
// Call the logging hooks to log/process the message
foreach
(
module_implements
(
'watchdog'
,
TRUE
)
as
$module
)
{
module_invoke
(
$module
,
'watchdog'
,
$log_
message
);
module_invoke
(
$module
,
'watchdog'
,
$log_
entry
);
}
// It is critical that the semaphore is only cleared here, in the parent
...
...
modules/dblog/dblog.install
View file @
5bbad8a4
...
...
@@ -37,7 +37,7 @@ function dblog_schema() {
),
'type'
=>
array
(
'type'
=>
'varchar'
,
'length'
=>
16
,
'length'
=>
64
,
'not null'
=>
TRUE
,
'default'
=>
''
,
'description'
=>
'Type of log message, for example "user" or "page not found."'
,
...
...
@@ -121,3 +121,12 @@ function dblog_update_7002() {
db_add_index
(
$ret
,
'watchdog'
,
'uid'
,
array
(
'uid'
));
return
$ret
;
}
/**
* Allow longer type values.
*/
function
dblog_update_7003
()
{
$ret
=
array
();
db_change_field
(
$ret
,
'watchdog'
,
'type'
,
'type'
,
array
(
'type'
=>
'varchar'
,
'length'
=>
64
,
'not null'
=>
TRUE
,
'default'
=>
''
));
return
$ret
;
}
modules/dblog/dblog.module
View file @
5bbad8a4
...
...
@@ -118,19 +118,24 @@ function _dblog_get_message_types() {
return
$types
;
}
function
dblog_watchdog
(
$log
=
array
())
{
/**
* Implementation of hook_watchdog().
*
* Note some values may be truncated for database column size restrictions.
*/
function
dblog_watchdog
(
array
$log_entry
)
{
Database
::
getConnection
(
'default'
)
->
insert
(
'watchdog'
)
->
fields
(
array
(
'uid'
=>
$log
[
'user'
]
->
uid
,
'type'
=>
$log
[
'type'
]
,
'message'
=>
$log
[
'message'
],
'variables'
=>
serialize
(
$log
[
'variables'
]),
'severity'
=>
$log
[
'severity'
],
'link'
=>
$log
[
'link'
]
,
'location'
=>
$log
[
'request_uri'
],
'referer'
=>
$log
[
'referer'
],
'hostname'
=>
$log
[
'ip'
]
,
'timestamp'
=>
$log
[
'timestamp'
],
'uid'
=>
$log
_entry
[
'user'
]
->
uid
,
'type'
=>
substr
(
$log_entry
[
'type'
],
0
,
64
)
,
'message'
=>
$log
_entry
[
'message'
],
'variables'
=>
serialize
(
$log
_entry
[
'variables'
]),
'severity'
=>
$log
_entry
[
'severity'
],
'link'
=>
substr
(
$log_entry
[
'link'
],
0
,
255
)
,
'location'
=>
$log
_entry
[
'request_uri'
],
'referer'
=>
$log
_entry
[
'referer'
],
'hostname'
=>
substr
(
$log_entry
[
'ip'
],
0
,
128
)
,
'timestamp'
=>
$log
_entry
[
'timestamp'
],
))
->
execute
();
}
...
...
@@ -148,4 +153,3 @@ function theme_dblog_filters($form) {
$output
.
=
'<div id="dblog-admin-buttons">'
.
drupal_render
(
$form
[
'buttons'
])
.
'</div>'
;
return
$output
;
}
modules/syslog/syslog.module
View file @
5bbad8a4
...
...
@@ -68,7 +68,10 @@ function syslog_facility_list() {
return
$facility_list
;
}
function
syslog_watchdog
(
$entry
)
{
/**
* Implementation of hook_watchdog().
*/
function
syslog_watchdog
(
array
$log_entry
)
{
static
$log_init
=
FALSE
;
if
(
!
$log_init
)
{
...
...
@@ -76,7 +79,7 @@ function syslog_watchdog($entry) {
openlog
(
'drupal'
,
LOG_NDELAY
,
variable_get
(
'syslog_facility'
,
DEFAULT_SYSLOG_FACILITY
));
}
syslog
(
$
entry
[
'severity'
],
theme
(
'syslog_format'
,
$
entry
));
syslog
(
$
log_entry
[
'severity'
],
theme
(
'syslog_format'
,
$log_
entry
));
}
function
syslog_theme
()
{
...
...
modules/system/system.api.php
View file @
5bbad8a4
...
...
@@ -683,7 +683,7 @@ function hook_xmlrpc() {
* SMS, Email, pager, syslog, ...etc.
*
* @param $log_entry
*
The log_entry is a
n associative array containing the following keys:
*
A
n associative array containing the following keys:
* - type: The type of message for this entry. For contributed modules, this is
* normally the module name. Do not use 'debug', use severity WATCHDOG_DEBUG instead.
* - user: The user object for the user who was logged in when the event happened.
...
...
@@ -706,8 +706,8 @@ function hook_xmlrpc() {
* @return
* None.
*/
function
hook_watchdog
(
$log_msg
)
{
global
$base_url
;
function
hook_watchdog
(
array
$log_entry
)
{
global
$base_url
,
$language
;
$severity_list
=
array
(
WATCHDOG_EMERG
=>
t
(
'Emergency'
),
...
...
@@ -720,38 +720,40 @@ function hook_watchdog($log_msg) {
WATCHDOG_DEBUG
=>
t
(
'Debug'
),
);
$to
=
"someone@example.com"
;
$subject
=
t
(
'[@site_name] @severity_desc: Alert from your web site'
,
array
(
'@site_name'
=>
variable_get
(
'site_name'
,
'Drupal'
),
'@severity_desc'
=>
$severity_list
[
$log
[
'severity'
]]));
$message
=
"
\n
Site: @base_url"
;
$message
.
=
"
\n
Severity: (@severity) @severity_desc"
;
$message
.
=
"
\n
Timestamp: @timestamp"
;
$message
.
=
"
\n
Type: @type"
;
$message
.
=
"
\n
IP Address: @ip"
;
$message
.
=
"
\n
Request URI: @request_uri"
;
$message
.
=
"
\n
Referrer URI: @referer_uri"
;
$message
.
=
"
\n
User: (@uid) @name"
;
$message
.
=
"
\n
Link: @link"
;
$message
.
=
"
\n
Message:
\n\n
@message"
;
$message
=
t
(
$message
,
array
(
$to
=
'someone@example.com'
;
$params
=
array
();
$params
[
'subject'
]
=
t
(
'[@site_name] @severity_desc: Alert from your web site'
,
array
(
'@site_name'
=>
variable_get
(
'site_name'
,
'Drupal'
),
'@severity_desc'
=>
$severity_list
[
$log_entry
[
'severity'
]],
));
$params
[
'message'
]
=
"
\n
Site: @base_url"
;
$params
[
'message'
]
.
=
"
\n
Severity: (@severity) @severity_desc"
;
$params
[
'message'
]
.
=
"
\n
Timestamp: @timestamp"
;
$params
[
'message'
]
.
=
"
\n
Type: @type"
;
$params
[
'message'
]
.
=
"
\n
IP Address: @ip"
;
$params
[
'message'
]
.
=
"
\n
Request URI: @request_uri"
;
$params
[
'message'
]
.
=
"
\n
Referrer URI: @referer_uri"
;
$params
[
'message'
]
.
=
"
\n
User: (@uid) @name"
;
$params
[
'message'
]
.
=
"
\n
Link: @link"
;
$params
[
'message'
]
.
=
"
\n
Message:
\n\n
@message"
;
$params
[
'message'
]
=
t
(
$params
[
'message'
],
array
(
'@base_url'
=>
$base_url
,
'@severity'
=>
$log_
msg
[
'severity'
],
'@severity_desc'
=>
$severity_list
[
$log_
msg
[
'severity'
]],
'@timestamp'
=>
format_date
(
$log_
msg
[
'timestamp'
]),
'@type'
=>
$log_
msg
[
'type'
],
'@ip'
=>
$log_
msg
[
'ip'
],
'@request_uri'
=>
$log_
msg
[
'request_uri'
],
'@referer_uri'
=>
$log_
msg
[
'referer'
],
'@uid'
=>
$log_
msg
[
'user'
]
->
uid
,
'@name'
=>
$log_
msg
[
'user'
]
->
name
,
'@link'
=>
strip_tags
(
$log_
msg
[
'link'
]),
'@message'
=>
strip_tags
(
$log_
msg
[
'message'
]),
'@severity'
=>
$log_
entry
[
'severity'
],
'@severity_desc'
=>
$severity_list
[
$log_
entry
[
'severity'
]],
'@timestamp'
=>
format_date
(
$log_
entry
[
'timestamp'
]),
'@type'
=>
$log_
entry
[
'type'
],
'@ip'
=>
$log_
entry
[
'ip'
],
'@request_uri'
=>
$log_
entry
[
'request_uri'
],
'@referer_uri'
=>
$log_
entry
[
'referer'
],
'@uid'
=>
$log_
entry
[
'user'
]
->
uid
,
'@name'
=>
$log_
entry
[
'user'
]
->
name
,
'@link'
=>
strip_tags
(
$log_
entry
[
'link'
]),
'@message'
=>
strip_tags
(
$log_
entry
[
'message'
]),
));
drupal_mail
(
'emaillog'
,
$to
,
$subject
,
$body
,
$from
=
NULL
,
$headers
=
array
()
);
drupal_mail
(
'emaillog'
,
'entry'
,
$to
,
$language
,
$params
);
}
/**
...
...
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