Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
TelegramBot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
TelegramBot
Commits
6837bb92
Unverified
Commit
6837bb92
authored
Mar 23, 2019
by
Armando Lüscher
Committed by
GitHub
Mar 23, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into 920-new_system_commands
parents
268d3bab
663acfcf
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
11 deletions
+31
-11
CHANGELOG.md
CHANGELOG.md
+1
-0
CleanupCommand.php
src/Commands/AdminCommands/CleanupCommand.php
+30
-11
No files found.
CHANGELOG.md
View file @
6837bb92
...
@@ -12,6 +12,7 @@ Exclamation symbols (:exclamation:) note something of importance e.g. breaking c
...
@@ -12,6 +12,7 @@ Exclamation symbols (:exclamation:) note something of importance e.g. breaking c
-
Most built-in System Commands will be handled by GenericmessageCommand by default in a future release and will require a custom implementation.
-
Most built-in System Commands will be handled by GenericmessageCommand by default in a future release and will require a custom implementation.
### Removed
### Removed
### Fixed
### Fixed
-
Constraint errors in
`/cleanup`
command.
### Security
### Security
## [0.55.1] - 2019-01-06
## [0.55.1] - 2019-01-06
...
...
src/Commands/AdminCommands/CleanupCommand.php
View file @
6837bb92
...
@@ -164,6 +164,7 @@ class CleanupCommand extends AdminCommand
...
@@ -164,6 +164,7 @@ class CleanupCommand extends AdminCommand
SELECT `id`
SELECT `id`
FROM `%4$s`
FROM `%4$s`
WHERE `chat_id` = `%4$s`.`id`
WHERE `chat_id` = `%4$s`.`id`
AND `updated_at` < \'%1$s\'
)
)
AND (
AND (
`message_id` IS NOT NULL
`message_id` IS NOT NULL
...
@@ -301,6 +302,11 @@ class CleanupCommand extends AdminCommand
...
@@ -301,6 +302,11 @@ class CleanupCommand extends AdminCommand
if
(
in_array
(
'message'
,
$tables_to_clean
,
true
))
{
if
(
in_array
(
'message'
,
$tables_to_clean
,
true
))
{
$queries
[]
=
sprintf
(
$queries
[]
=
sprintf
(
'DELETE FROM `%1$s`
'DELETE FROM `%1$s`
WHERE id IN (
SELECT id
FROM (
SELECT id
FROM `message`
WHERE `date` < \'%2$s\'
WHERE `date` < \'%2$s\'
AND `id` NOT IN (
AND `id` NOT IN (
SELECT `message_id`
SELECT `message_id`
...
@@ -312,9 +318,22 @@ class CleanupCommand extends AdminCommand
...
@@ -312,9 +318,22 @@ class CleanupCommand extends AdminCommand
FROM `%4$s`
FROM `%4$s`
WHERE `message_id` = `%1$s`.`id`
WHERE `message_id` = `%1$s`.`id`
)
)
AND `id` NOT IN (
SELECT `message_id`
FROM `%5$s`
WHERE `message_id` = `%1$s`.`id`
)
AND `id` NOT IN (
SELECT a.`reply_to_message` FROM `%1$s` a
INNER JOIN `%1$s` b ON b.`id` = a.`reply_to_message` AND b.`chat_id` = a.`reply_to_chat`
)
ORDER BY `id` DESC
) a
)
'
,
'
,
TB_MESSAGE
,
TB_MESSAGE
,
$clean_older_than
[
'message'
],
$clean_older_than
[
'message'
],
TB_EDITED_MESSAGE
,
TB_TELEGRAM_UPDATE
,
TB_TELEGRAM_UPDATE
,
TB_CALLBACK_QUERY
TB_CALLBACK_QUERY
);
);
...
...
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