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
82f3b635
Unverified
Commit
82f3b635
authored
Mar 09, 2019
by
Armando Lüscher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prevent constraint errors when deleting only messages without edited messages.
parent
2791e1d6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
5 deletions
+10
-5
CHANGELOG.md
CHANGELOG.md
+1
-0
CleanupCommand.php
src/Commands/AdminCommands/CleanupCommand.php
+9
-5
No files found.
CHANGELOG.md
View file @
82f3b635
...
...
@@ -10,6 +10,7 @@ Exclamation symbols (:exclamation:) note something of importance e.g. breaking c
-
Botan.io service has been discontinued.
### Removed
### Fixed
-
Constraint errors in
`/cleanup`
command.
### Security
## [0.55.1] - 2019-01-06
...
...
src/Commands/AdminCommands/CleanupCommand.php
View file @
82f3b635
...
...
@@ -302,11 +302,9 @@ class CleanupCommand extends AdminCommand
if
(
in_array
(
'message'
,
$tables_to_clean
,
true
))
{
$queries
[]
=
sprintf
(
'DELETE FROM `%1$s`
WHERE id IN
(
SELECT id
FROM
(
WHERE id IN (
SELECT id
FROM (
SELECT id
FROM `message`
WHERE `date` < \'%2$s\'
...
...
@@ -320,6 +318,11 @@ class CleanupCommand extends AdminCommand
FROM `%4$s`
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`
...
...
@@ -330,6 +333,7 @@ class CleanupCommand extends AdminCommand
'
,
TB_MESSAGE
,
$clean_older_than
[
'message'
],
TB_EDITED_MESSAGE
,
TB_TELEGRAM_UPDATE
,
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