Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

PHPDoc comment in MessageOriginChat mislead to wrong getter getChat(). #1472

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Always has cleanup errors in logs.
Because bot has channel functionality and cleanup of telegram_updates table didn't clean lines with links to tables messages and edited_messages by post columns.
  • Loading branch information
r3bers committed Jul 29, 2024
commit b7847fe61eae5ed83f6c693f6d9755289891b02c
24 changes: 20 additions & 4 deletions src/Commands/AdminCommands/CleanupCommand.php
Original file line number Diff line number Diff line change
@@ -69,7 +69,7 @@ class CleanupCommand extends AdminCommand
*
* @var array
*/
protected static $default_tables_to_clean = [
protected static array $default_tables_to_clean = [
'callback_query',
'chosen_inline_result',
'conversation',
@@ -85,7 +85,7 @@ class CleanupCommand extends AdminCommand
*
* @var array
*/
protected static $default_clean_older_than = [
protected static array $default_clean_older_than = [
'callback_query' => '30 days',
'chat' => '365 days',
'chosen_inline_result' => '30 days',
@@ -108,7 +108,7 @@ class CleanupCommand extends AdminCommand
*
* @return array
*/
private function getSettings($custom_time = ''): array
private function getSettings(string $custom_time = ''): array
{
$tables_to_clean = self::$default_tables_to_clean;
$user_tables_to_clean = $this->getConfig('tables_to_clean');
@@ -179,6 +179,14 @@ private function getQueries($settings): array
WHERE `date` < \'%2$s\'
)
)
OR (
`channel_post_id` IS NOT NULL
AND `channel_post_id` IN (
SELECT `id`
FROM `%5$s`
WHERE `date` < \'%2$s\'
)
)
OR (
`edited_message_id` IS NOT NULL
AND `edited_message_id` IN (
@@ -187,6 +195,14 @@ private function getQueries($settings): array
WHERE `edit_date` < \'%2$s\'
)
)
OR (
`edited_channel_post_id` IS NOT NULL
AND `edited_channel_post_id` IN (
SELECT `id`
FROM `%6$s`
WHERE `edit_date` < \'%2$s\'
)
)
OR (
`inline_query_id` IS NOT NULL
AND `inline_query_id` IN (
@@ -369,7 +385,7 @@ public function execute(): ServerResponse
$text = $message->getText(true);

// Dry run?
$dry_run = strpos($text, 'dry') !== false;
$dry_run = str_contains($text, 'dry');
$text = trim(str_replace('dry', '', $text));

$settings = $this->getSettings($text);
Loading