Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
maillog
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
maillog
Commits
0e8fe3be
Commit
0e8fe3be
authored
1 year ago
by
Damien McKenna
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#1662752
by DamienMcKenna: Minor code cleanup.
parent
1d053f54
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CHANGELOG.txt
+1
-0
1 addition, 0 deletions
CHANGELOG.txt
maillog.module
+13
-10
13 additions, 10 deletions
maillog.module
with
14 additions
and
10 deletions
CHANGELOG.txt
+
1
−
0
View file @
0e8fe3be
...
@@ -8,6 +8,7 @@ Maillog 8.x-1.x-dev, 2023-xx-xx
...
@@ -8,6 +8,7 @@ Maillog 8.x-1.x-dev, 2023-xx-xx
Maillog->mail().
Maillog->mail().
#1662752 by Eduardo Morales Alberti, pluess, joe-b, miro_dietiker, seanr,
#1662752 by Eduardo Morales Alberti, pluess, joe-b, miro_dietiker, seanr,
DamienMcKenna, Maedi: Maillog log table size escalation.
DamienMcKenna, Maedi: Maillog log table size escalation.
#1662752 by DamienMcKenna: Minor code cleanup.
Maillog 8.x-1.1, 2023-06-01
Maillog 8.x-1.1, 2023-06-01
...
...
This diff is collapsed.
Click to expand it.
maillog.module
+
13
−
10
View file @
0e8fe3be
...
@@ -31,29 +31,32 @@ function maillog_help($route_name, RouteMatchInterface $route_match) {
...
@@ -31,29 +31,32 @@ function maillog_help($route_name, RouteMatchInterface $route_match) {
* Implements hook_cron().
* Implements hook_cron().
*/
*/
function
maillog_cron
()
{
function
maillog_cron
()
{
$cron_enabled
=
\Drupal
::
config
(
'maillog.settings'
)
->
get
(
'cron_enabled'
);
$config
=
\Drupal
::
config
(
'maillog.settings'
);
if
(
$cron_enabled
)
{
$logger
=
\Drupal
::
logger
(
'maillog'
);
$type
=
\Drupal
::
config
(
'maillog.settings'
)
->
get
(
'keep_limit_type'
)
??
''
;
$limit
=
\Drupal
::
config
(
'maillog.settings'
)
->
get
(
$type
)
??
0
;
if
(
$config
->
get
(
'cron_enabled'
))
{
$type
=
$config
->
get
(
'keep_limit_type'
)
??
''
;
$limit
=
$config
->
get
(
$type
)
??
0
;
$deleted_logs
=
0
;
$deleted_logs
=
0
;
try
{
try
{
$deleted_logs
=
\Drupal
::
service
(
'maillog.cleaner'
)
->
clearMaillogs
(
$type
,
(
int
)
$limit
);
$deleted_logs
=
\Drupal
::
service
(
'maillog.cleaner'
)
->
clearMaillogs
(
$type
,
(
int
)
$limit
);
}
}
catch
(
\Exception
$e
)
{
catch
(
\Exception
$e
)
{
\Drupal
::
logger
(
'maillog'
)
->
error
(
t
(
'Exception when tried to delete the mail logs, reason: @reason'
,
[
$logger
->
error
(
t
(
'Exception when tried to delete the mail logs, reason: @reason'
,
[
'@reason'
=>
$e
->
getMessage
(),
'@reason'
=>
$e
->
getMessage
(),
]));
]));
}
}
if
(
empty
(
$deleted_logs
))
{
if
(
empty
(
$deleted_logs
))
{
\Drupal
::
logger
(
'maillog'
)
->
info
(
t
(
'Any log deleted because any log meet the conditions'
));
$logger
->
info
(
t
(
'Any log deleted because any log meet the conditions'
));
}
}
else
{
else
{
\Drupal
::
logger
(
'maillog'
)
->
info
(
t
(
'Deleted @count mail logs from database'
,
[
'@count'
=>
$deleted_logs
]));
$logger
->
info
(
t
(
'Deleted @count mail logs from database'
,
[
'@count'
=>
$deleted_logs
,
]));
}
}
}
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment