Skip to content

Commit 7564a3a

Browse files
committed
Merge branch 'develop' into 811-helper_for_media_groups
2 parents 28624d8 + 0efd567 commit 7564a3a

19 files changed

+114
-39
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,13 @@ Exclamation symbols (:exclamation:) note something of importance e.g. breaking c
88
- Helper for sending `InputMedia` objects using `Request::sendMediaGroup()` and `Request::editMediaMessage()` methods.
99
- Allow passing absolute file path for InputFile fields, instead of `Request::encodeFile($path)`.
1010
### Changed
11+
- All Message field types dynamically search for an existing Command class that can handle them.
1112
### Deprecated
1213
- Botan.io service has been discontinued.
14+
- Most built-in System Commands will be handled by GenericmessageCommand by default in a future release and will require a custom implementation.
1315
### Removed
1416
### Fixed
17+
- Constraint errors in `/cleanup` command.
1518
- Return correct objects for requests.
1619
### Security
1720

src/Commands/AdminCommands/CleanupCommand.php

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ private function getQueries($settings)
164164
SELECT `id`
165165
FROM `%4$s`
166166
WHERE `chat_id` = `%4$s`.`id`
167+
AND `updated_at` < \'%1$s\'
167168
)
168169
AND (
169170
`message_id` IS NOT NULL
@@ -301,20 +302,38 @@ private function getQueries($settings)
301302
if (in_array('message', $tables_to_clean, true)) {
302303
$queries[] = sprintf(
303304
'DELETE FROM `%1$s`
304-
WHERE `date` < \'%2$s\'
305-
AND `id` NOT IN (
306-
SELECT `message_id`
307-
FROM `%3$s`
308-
WHERE `message_id` = `%1$s`.`id`
309-
)
310-
AND `id` NOT IN (
311-
SELECT `message_id`
312-
FROM `%4$s`
313-
WHERE `message_id` = `%1$s`.`id`
314-
)
305+
WHERE id IN (
306+
SELECT id
307+
FROM (
308+
SELECT id
309+
FROM `message`
310+
WHERE `date` < \'%2$s\'
311+
AND `id` NOT IN (
312+
SELECT `message_id`
313+
FROM `%3$s`
314+
WHERE `message_id` = `%1$s`.`id`
315+
)
316+
AND `id` NOT IN (
317+
SELECT `message_id`
318+
FROM `%4$s`
319+
WHERE `message_id` = `%1$s`.`id`
320+
)
321+
AND `id` NOT IN (
322+
SELECT `message_id`
323+
FROM `%5$s`
324+
WHERE `message_id` = `%1$s`.`id`
325+
)
326+
AND `id` NOT IN (
327+
SELECT a.`reply_to_message` FROM `%1$s` a
328+
INNER JOIN `%1$s` b ON b.`id` = a.`reply_to_message` AND b.`chat_id` = a.`reply_to_chat`
329+
)
330+
ORDER BY `id` DESC
331+
) a
332+
)
315333
',
316334
TB_MESSAGE,
317335
$clean_older_than['message'],
336+
TB_EDITED_MESSAGE,
318337
TB_TELEGRAM_UPDATE,
319338
TB_CALLBACK_QUERY
320339
);

src/Commands/SystemCommands/ChannelchatcreatedCommand.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
/**
1616
* Channel chat created command
17+
*
18+
* @todo Remove due to deprecation!
1719
*/
1820
class ChannelchatcreatedCommand extends SystemCommand
1921
{
@@ -43,6 +45,8 @@ public function execute()
4345
//$message = $this->getMessage();
4446
//$channel_chat_created = $message->getChannelChatCreated();
4547

48+
trigger_error(__CLASS__ . ' is deprecated and will be removed and handled by ' . GenericmessageCommand::class . ' by default in a future release.', E_USER_DEPRECATED);
49+
4650
return parent::execute();
4751
}
4852
}

src/Commands/SystemCommands/ChannelpostCommand.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
/**
1616
* Channel post command
17+
*
18+
* @todo Remove due to deprecation!
1719
*/
1820
class ChannelpostCommand extends SystemCommand
1921
{
@@ -42,6 +44,8 @@ public function execute()
4244
{
4345
//$channel_post = $this->getUpdate()->getChannelPost();
4446

47+
trigger_error(__CLASS__ . ' is deprecated and will be removed and handled by ' . GenericmessageCommand::class . ' by default in a future release.', E_USER_DEPRECATED);
48+
4549
return parent::execute();
4650
}
4751
}

src/Commands/SystemCommands/ChoseninlineresultCommand.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
/**
1616
* Chosen inline result command
17+
*
18+
* @todo Remove due to deprecation!
1719
*/
1820
class ChoseninlineresultCommand extends SystemCommand
1921
{
@@ -45,6 +47,8 @@ public function execute()
4547
//$inline_query = $update->getChosenInlineResult();
4648
//$query = $inline_query->getQuery();
4749

50+
trigger_error(__CLASS__ . ' is deprecated and will be removed and handled by ' . GenericmessageCommand::class . ' by default in a future release.', E_USER_DEPRECATED);
51+
4852
return parent::execute();
4953
}
5054
}

src/Commands/SystemCommands/DeletechatphotoCommand.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
/**
1616
* Delete chat photo command
17+
*
18+
* @todo Remove due to deprecation!
1719
*/
1820
class DeletechatphotoCommand extends SystemCommand
1921
{
@@ -43,6 +45,8 @@ public function execute()
4345
//$message = $this->getMessage();
4446
//$delete_chat_photo = $message->getDeleteChatPhoto();
4547

48+
trigger_error(__CLASS__ . ' is deprecated and will be removed and handled by ' . GenericmessageCommand::class . ' by default in a future release.', E_USER_DEPRECATED);
49+
4650
return parent::execute();
4751
}
4852
}

src/Commands/SystemCommands/EditedchannelpostCommand.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
/**
1616
* Edited channel post command
17+
*
18+
* @todo Remove due to deprecation!
1719
*/
1820
class EditedchannelpostCommand extends SystemCommand
1921
{
@@ -42,6 +44,8 @@ public function execute()
4244
{
4345
//$edited_channel_post = $this->getUpdate()->getEditedChannelPost();
4446

47+
trigger_error(__CLASS__ . ' is deprecated and will be removed and handled by ' . GenericmessageCommand::class . ' by default in a future release.', E_USER_DEPRECATED);
48+
4549
return parent::execute();
4650
}
4751
}

src/Commands/SystemCommands/EditedmessageCommand.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
/**
1616
* Edited message command
17+
*
18+
* @todo Remove due to deprecation!
1719
*/
1820
class EditedmessageCommand extends SystemCommand
1921
{
@@ -43,6 +45,8 @@ public function execute()
4345
//$update = $this->getUpdate();
4446
//$edited_message = $update->getEditedMessage();
4547

48+
trigger_error(__CLASS__ . ' is deprecated and will be removed and handled by ' . GenericmessageCommand::class . ' by default in a future release.', E_USER_DEPRECATED);
49+
4650
return parent::execute();
4751
}
4852
}

src/Commands/SystemCommands/GroupchatcreatedCommand.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
/**
1616
* Group chat created command
17+
*
18+
* @todo Remove due to deprecation!
1719
*/
1820
class GroupchatcreatedCommand extends SystemCommand
1921
{
@@ -43,6 +45,8 @@ public function execute()
4345
//$message = $this->getMessage();
4446
//$group_chat_created = $message->getGroupChatCreated();
4547

48+
trigger_error(__CLASS__ . ' is deprecated and will be removed and handled by ' . GenericmessageCommand::class . ' by default in a future release.', E_USER_DEPRECATED);
49+
4650
return parent::execute();
4751
}
4852
}

src/Commands/SystemCommands/LeftchatmemberCommand.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
/**
1616
* Left chat member command
17+
*
18+
* @todo Remove due to deprecation!
1719
*/
1820
class LeftchatmemberCommand extends SystemCommand
1921
{
@@ -43,6 +45,8 @@ public function execute()
4345
//$message = $this->getMessage();
4446
//$member = $message->getLeftChatMember();
4547

48+
trigger_error(__CLASS__ . ' is deprecated and will be removed and handled by ' . GenericmessageCommand::class . ' by default in a future release.', E_USER_DEPRECATED);
49+
4650
return parent::execute();
4751
}
4852
}

0 commit comments

Comments
 (0)