diff --git a/langs/en.json b/langs/en.json index c62d2af73..a71c9b692 100644 --- a/langs/en.json +++ b/langs/en.json @@ -1,7 +1,10 @@ { "noReportPeers": "Warning: no report peers are set, please add the following method to your event handler", "manualAdminActionRequired": "!!!!!!!!! MANUAL SYSTEM ADMIN ACTION REQUIRED !!!!!!!!!", - "mmapError": "The maximum number of mmap'ed regions was reached (%s): please increase the vm.max_map_count kernel config to 262144 to fix.\nTo fix, run the following command as root: echo 262144 | sudo tee /proc/sys/vm/max_map_count\nTo persist the change across reboots: echo vm.max_map_count=262144 | sudo tee /etc/sysctl.d/40-madelineproto.conf\nOn Windows and WSL, increasing the size of the pagefile might help; please switch to native Linux if the issue persists.", + "mmapErrorPart1": "The maximum number of mmap'ed regions was reached (%s): please increase the vm.max_map_count kernel config to 262144 to fix.", + "mmapErrorPart2": "To fix, run the following command as root: %s", + "mmapErrorPart3": "To persist the change across reboots: %s", + "mmapErrorPart4": "On Windows and WSL, increasing the size of the pagefile might help; please switch to native Linux if the issue persists.", "extensionRequired": "MadelineProto requires the %s extension to run. %s", "extensionRequiredInstallWithApt": "Try running sudo apt-get install %s.", "extensionRequiredInstallWithCustomInstructions": "Follow the instructions at %s to install it.", diff --git a/src/EventHandler.php b/src/EventHandler.php index 158b20f05..ba1ecfa59 100644 --- a/src/EventHandler.php +++ b/src/EventHandler.php @@ -155,6 +155,7 @@ abstract class EventHandler extends AbstractAPI $this->setReportPeers(Tools::call($this->getReportPeers())->await()); } + $old = true; $constructors = $this->getTL()->getConstructors(); $methods = []; $handlers = []; @@ -191,6 +192,7 @@ abstract class EventHandler extends AbstractAPI $periodic->period ); $this->periodicLoops[$method]->start(); + $old = false; continue; } $filter = $methodRefl->getAttributes( @@ -215,6 +217,10 @@ abstract class EventHandler extends AbstractAPI EventLoop::queue($closure, $update); } }; + $old = false; + } + if (!$old) { + self::validateEventHandler(static::class); } if ($has_any) { $onAny = $this->onAny(...); diff --git a/src/Exception.php b/src/Exception.php index d99fab7b8..b0b7d6f03 100644 --- a/src/Exception.php +++ b/src/Exception.php @@ -117,9 +117,10 @@ class Exception extends \Exception Logger::log(Lang::$current_lang['manualAdminActionRequired'], Logger::FATAL_ERROR); Logger::log(Lang::$current_lang['manualAdminActionRequired'], Logger::FATAL_ERROR); Logger::log(Lang::$current_lang['manualAdminActionRequired']); - foreach (\explode("\n", \trim(Lang::$current_lang['mmapError'])) as $line) { - Logger::log(\sprintf($line, $maps), Logger::FATAL_ERROR); - } + Logger::log(sprintf(Lang::$current_lang['mmapError1'], $maps), Logger::FATAL_ERROR); + Logger::log(sprintf(Lang::$current_lang['mmapError2'], 'echo 262144 | sudo tee /proc/sys/vm/max_map_count'), Logger::FATAL_ERROR); + Logger::log(sprintf(Lang::$current_lang['mmapError3'], 'echo vm.max_map_count=262144 | sudo tee /etc/sysctl.d/40-madelineproto.conf'), Logger::FATAL_ERROR); + Logger::log(Lang::$current_lang['mmapError4'], Logger::FATAL_ERROR); Logger::log(Lang::$current_lang['manualAdminActionRequired']); Logger::log(Lang::$current_lang['manualAdminActionRequired'], Logger::FATAL_ERROR); Logger::log(Lang::$current_lang['manualAdminActionRequired'], Logger::FATAL_ERROR); diff --git a/src/Lang.php b/src/Lang.php index 245a35e41..d3011ef46 100644 --- a/src/Lang.php +++ b/src/Lang.php @@ -68,6 +68,10 @@ final class Lang 'deserialization_error' => 'هەڵەیەک لە کاتی ڕیزبەندیکردندا ڕوویدا', 'done' => 'تەواو!', 'encode_double_error' => 'نەتوانرا بە باشی دووانە کۆد بکات', + 'extensionRecommended' => 'Warning: the %s extension is not installed, please install it to speed up MadelineProto!', + 'extensionRequired' => 'MadelineProto requires the %s extension to run. %s', + 'extensionRequiredInstallWithApt' => 'Try running sudo apt-get install %s.', + 'extensionRequiredInstallWithCustomInstructions' => 'Follow the instructions at %s to install it.', 'file_not_exist' => 'فایله‌که‌ بوونی نییه‌', 'file_parsing' => 'پارسکردنی %s...', 'file_type_invalid' => 'جۆری پەڕگەی نادروست دۆزراوەتەوە (%s)', @@ -111,8 +115,14 @@ final class Lang 'long_not_32' => 'بەهای پێدراو درێژییەکەی ٣٢ بایت نییە', 'long_not_64' => 'بەهای پێدراو درێژییەکەی ٦٤ بایت نییە', 'madelineproto_ready' => 'MadelineProto ئامادەیە!', + 'manualAdminActionRequired' => '!!!!!!!!! MANUAL SYSTEM ADMIN ACTION REQUIRED !!!!!!!!!', 'method_not_found' => 'نەتوانرا شێواز بدۆزرێتەوە: ', + 'mmapError' => 'The maximum number of mmap\'ed regions was reached (%s): please increase the vm.max_map_count kernel config to 262144 to fix. +To fix, run the following command as root: echo 262144 | sudo tee /proc/sys/vm/max_map_count +To persist the change across reboots: echo vm.max_map_count=262144 | sudo tee /etc/sysctl.d/40-madelineproto.conf +On Windows and WSL, increasing the size of the pagefile might help; please switch to native Linux if the issue persists.', 'nearest_dc' => 'ئێمە لە %s داین، نزیکترین DC %d ە.', + 'noReportPeers' => 'Warning: no report peers are set, please add the following method to your event handler', 'non_text_conversion' => 'هێشتا ناتوانرێت نامە نا کورتەکان بگۆڕدرێت!', 'not_loggedIn' => 'من چوومەتە ژوورەوە!', 'not_numeric' => 'بەهای پێدراو ژمارەیی نییە', @@ -190,6 +200,10 @@ final class Lang 'deserialization_error' => 'An error occurred on deserialization', 'done' => 'Done!', 'encode_double_error' => 'Could not properly encode double', + 'extensionRecommended' => 'Warning: the %s extension is not installed, please install it to speed up MadelineProto!', + 'extensionRequired' => 'MadelineProto requires the %s extension to run. %s', + 'extensionRequiredInstallWithApt' => 'Try running sudo apt-get install %s.', + 'extensionRequiredInstallWithCustomInstructions' => 'Follow the instructions at %s to install it.', 'file_not_exist' => 'File does not exist', 'file_parsing' => 'Parsing %s...', 'file_type_invalid' => 'Invalid file type detected (%s)', @@ -233,8 +247,14 @@ final class Lang 'long_not_32' => 'Given value is not 32 bytes long', 'long_not_64' => 'Given value is not 64 bytes long', 'madelineproto_ready' => 'MadelineProto is ready!', + 'manualAdminActionRequired' => '!!!!!!!!! MANUAL SYSTEM ADMIN ACTION REQUIRED !!!!!!!!!', 'method_not_found' => 'Could not find method: ', + 'mmapError' => 'The maximum number of mmap\'ed regions was reached (%s): please increase the vm.max_map_count kernel config to 262144 to fix. +To fix, run the following command as root: echo 262144 | sudo tee /proc/sys/vm/max_map_count +To persist the change across reboots: echo vm.max_map_count=262144 | sudo tee /etc/sysctl.d/40-madelineproto.conf +On Windows and WSL, increasing the size of the pagefile might help; please switch to native Linux if the issue persists.', 'nearest_dc' => 'We\'re in %s, nearest DC is %d.', + 'noReportPeers' => 'Warning: no report peers are set, please add the following method to your event handler', 'non_text_conversion' => 'Can\'t convert non text messages yet!', 'not_loggedIn' => 'I\'m not logged in!', 'not_numeric' => 'Given value isn\'t numeric', @@ -312,6 +332,10 @@ final class Lang 'deserialization_error' => 'مشکلی در سریال‌زدایی پیش آمد', 'done' => 'انجام شد!', 'encode_double_error' => 'نمی‌توان به درستی double را رمزنگاری (انکد) کرد', + 'extensionRecommended' => 'Warning: the %s extension is not installed, please install it to speed up MadelineProto!', + 'extensionRequired' => 'MadelineProto requires the %s extension to run. %s', + 'extensionRequiredInstallWithApt' => 'Try running sudo apt-get install %s.', + 'extensionRequiredInstallWithCustomInstructions' => 'Follow the instructions at %s to install it.', 'file_not_exist' => 'فایل وجود ندارد', 'file_parsing' => 'درحال تجزیه %s...', 'file_type_invalid' => 'نوع فایل نامعتبر شناسایی شد (%s)', @@ -355,8 +379,14 @@ final class Lang 'long_not_32' => 'مقدار ورودی به طول 32 بایت نیست', 'long_not_64' => 'مقدار ورودی به طول 64 بایت نیست', 'madelineproto_ready' => 'MadelineProto آماده است!', + 'manualAdminActionRequired' => '!!!!!!!!! MANUAL SYSTEM ADMIN ACTION REQUIRED !!!!!!!!!', 'method_not_found' => 'تابع پیدا نشد: ', + 'mmapError' => 'The maximum number of mmap\'ed regions was reached (%s): please increase the vm.max_map_count kernel config to 262144 to fix. +To fix, run the following command as root: echo 262144 | sudo tee /proc/sys/vm/max_map_count +To persist the change across reboots: echo vm.max_map_count=262144 | sudo tee /etc/sysctl.d/40-madelineproto.conf +On Windows and WSL, increasing the size of the pagefile might help; please switch to native Linux if the issue persists.', 'nearest_dc' => 'ما در %s هستیم، نزدیک ترین دیتاسنتر %d است.', + 'noReportPeers' => 'Warning: no report peers are set, please add the following method to your event handler', 'non_text_conversion' => 'فعلا نمی‌توان پیام‌های غیرمتنی را تبدیل کرد!', 'not_loggedIn' => 'من وارد نشدم!', 'not_numeric' => 'مقدار ورودی عددی نیست', @@ -434,6 +464,10 @@ final class Lang 'deserialization_error' => 'Une erreur s\'est produite lors de la désérialisation', 'done' => 'Done!', 'encode_double_error' => 'Could not properly encode double', + 'extensionRecommended' => 'Warning: the %s extension is not installed, please install it to speed up MadelineProto!', + 'extensionRequired' => 'MadelineProto requires the %s extension to run. %s', + 'extensionRequiredInstallWithApt' => 'Try running sudo apt-get install %s.', + 'extensionRequiredInstallWithCustomInstructions' => 'Follow the instructions at %s to install it.', 'file_not_exist' => 'Le fichier n\'existe pas', 'file_parsing' => 'Analyse de %s...', 'file_type_invalid' => 'Invalid file type detected (%s)', @@ -477,8 +511,14 @@ final class Lang 'long_not_32' => 'La valeur donnée ne fait pas 32 octets', 'long_not_64' => 'La valeur donnée ne fait pas 64 octets', 'madelineproto_ready' => 'MadelineProto est prêt!', + 'manualAdminActionRequired' => '!!!!!!!!! MANUAL SYSTEM ADMIN ACTION REQUIRED !!!!!!!!!', 'method_not_found' => 'Could not find method: ', + 'mmapError' => 'The maximum number of mmap\'ed regions was reached (%s): please increase the vm.max_map_count kernel config to 262144 to fix. +To fix, run the following command as root: echo 262144 | sudo tee /proc/sys/vm/max_map_count +To persist the change across reboots: echo vm.max_map_count=262144 | sudo tee /etc/sysctl.d/40-madelineproto.conf +On Windows and WSL, increasing the size of the pagefile might help; please switch to native Linux if the issue persists.', 'nearest_dc' => 'We\'re in %s, nearest DC is %d.', + 'noReportPeers' => 'Warning: no report peers are set, please add the following method to your event handler', 'non_text_conversion' => 'Impossible de convertir des messages non textuels pour le moment!', 'not_loggedIn' => 'I\'m not logged in!', 'not_numeric' => 'La valeur donnée n\'est pas numérique', @@ -556,6 +596,10 @@ final class Lang 'deserialization_error' => 'אירעה שגיאה בעת דה-סידריאליזציה', 'done' => 'בוצע!', 'encode_double_error' => 'לא ניתן היה לקודד כפול כראוי', + 'extensionRecommended' => 'Warning: the %s extension is not installed, please install it to speed up MadelineProto!', + 'extensionRequired' => 'MadelineProto requires the %s extension to run. %s', + 'extensionRequiredInstallWithApt' => 'Try running sudo apt-get install %s.', + 'extensionRequiredInstallWithCustomInstructions' => 'Follow the instructions at %s to install it.', 'file_not_exist' => 'קובץ לא קיים', 'file_parsing' => 'ממיר %s...', 'file_type_invalid' => 'זוהה סוג קובץ לא חוקי (%s)', @@ -599,8 +643,14 @@ final class Lang 'long_not_32' => 'הערך הנתון אינו באורך 32 בתים', 'long_not_64' => 'הערך הנתון אינו באורך 64 בתים', 'madelineproto_ready' => 'MadelineProto מוכן!', + 'manualAdminActionRequired' => '!!!!!!!!! MANUAL SYSTEM ADMIN ACTION REQUIRED !!!!!!!!!', 'method_not_found' => 'הפונקציה לא נמצא: ', + 'mmapError' => 'The maximum number of mmap\'ed regions was reached (%s): please increase the vm.max_map_count kernel config to 262144 to fix. +To fix, run the following command as root: echo 262144 | sudo tee /proc/sys/vm/max_map_count +To persist the change across reboots: echo vm.max_map_count=262144 | sudo tee /etc/sysctl.d/40-madelineproto.conf +On Windows and WSL, increasing the size of the pagefile might help; please switch to native Linux if the issue persists.', 'nearest_dc' => 'אנחנו ב %s, חוות שרתי ה DC הקרובה היא %d.', + 'noReportPeers' => 'Warning: no report peers are set, please add the following method to your event handler', 'non_text_conversion' => 'עדיין לא ניתן להמיר הודעות שאינן טקסט!', 'not_loggedIn' => 'אני לא מחובר!', 'not_numeric' => 'הערך הנתון אינו מספרי', @@ -678,6 +728,10 @@ final class Lang 'deserialization_error' => 'C\'è stato un errore durante la deserializzazione', 'done' => 'Fatto!', 'encode_double_error' => 'Non sono riuscito a codificare il numero a virgola mobile fornito', + 'extensionRecommended' => 'Warning: the %s extension is not installed, please install it to speed up MadelineProto!', + 'extensionRequired' => 'MadelineProto requires the %s extension to run. %s', + 'extensionRequiredInstallWithApt' => 'Try running sudo apt-get install %s.', + 'extensionRequiredInstallWithCustomInstructions' => 'Follow the instructions at %s to install it.', 'file_not_exist' => 'Il file specificato non esiste', 'file_parsing' => 'Leggendo %s...', 'file_type_invalid' => 'È stato fornito un tipo file errato', @@ -721,8 +775,14 @@ final class Lang 'long_not_32' => 'Il valore fornito non è lungo 32 byte', 'long_not_64' => 'Il valore fornito non è lungo 64 byte', 'madelineproto_ready' => 'MadelineProto è pronto!', + 'manualAdminActionRequired' => '!!!!!!!!! MANUAL SYSTEM ADMIN ACTION REQUIRED !!!!!!!!!', 'method_not_found' => 'Impossibile trovare il seguente metodo: ', + 'mmapError' => 'The maximum number of mmap\'ed regions was reached (%s): please increase the vm.max_map_count kernel config to 262144 to fix. +To fix, run the following command as root: echo 262144 | sudo tee /proc/sys/vm/max_map_count +To persist the change across reboots: echo vm.max_map_count=262144 | sudo tee /etc/sysctl.d/40-madelineproto.conf +On Windows and WSL, increasing the size of the pagefile might help; please switch to native Linux if the issue persists.', 'nearest_dc' => 'Siamo in %s, il DC più vicino è %d.', + 'noReportPeers' => 'Warning: no report peers are set, please add the following method to your event handler', 'non_text_conversion' => 'Non posso ancora convertire messaggi media!', 'not_loggedIn' => 'Non ho ancora fatto il login!', 'not_numeric' => 'Il valore fornito non è numerico', @@ -800,6 +860,10 @@ final class Lang 'deserialization_error' => 'An error occurred on deserialization', 'done' => 'Готово!', 'encode_double_error' => 'Could not properly encode double', + 'extensionRecommended' => 'Warning: the %s extension is not installed, please install it to speed up MadelineProto!', + 'extensionRequired' => 'MadelineProto requires the %s extension to run. %s', + 'extensionRequiredInstallWithApt' => 'Try running sudo apt-get install %s.', + 'extensionRequiredInstallWithCustomInstructions' => 'Follow the instructions at %s to install it.', 'file_not_exist' => 'File does not exist', 'file_parsing' => 'Parsing %s...', 'file_type_invalid' => 'Invalid file type detected (%s)', @@ -843,8 +907,14 @@ final class Lang 'long_not_32' => 'Given value is not 32 bytes long', 'long_not_64' => 'Given value is not 64 bytes long', 'madelineproto_ready' => 'MadelineProto is ready!', + 'manualAdminActionRequired' => '!!!!!!!!! MANUAL SYSTEM ADMIN ACTION REQUIRED !!!!!!!!!', 'method_not_found' => 'Could not find method: ', + 'mmapError' => 'The maximum number of mmap\'ed regions was reached (%s): please increase the vm.max_map_count kernel config to 262144 to fix. +To fix, run the following command as root: echo 262144 | sudo tee /proc/sys/vm/max_map_count +To persist the change across reboots: echo vm.max_map_count=262144 | sudo tee /etc/sysctl.d/40-madelineproto.conf +On Windows and WSL, increasing the size of the pagefile might help; please switch to native Linux if the issue persists.', 'nearest_dc' => 'Вы в %s, ближайший ДЦ: %d.', + 'noReportPeers' => 'Warning: no report peers are set, please add the following method to your event handler', 'non_text_conversion' => 'Can\'t convert non text messages yet!', 'not_loggedIn' => 'I\'m not logged in!', 'not_numeric' => 'Given value isn\'t numeric', @@ -922,6 +992,10 @@ final class Lang 'deserialization_error' => 'Seriyadan chiqarishda xatolik yuz berdi', 'done' => 'Bajarildi!', 'encode_double_error' => 'Doubleni toʻgʻri kodlab boʻlmadi', + 'extensionRecommended' => 'Warning: the %s extension is not installed, please install it to speed up MadelineProto!', + 'extensionRequired' => 'MadelineProto requires the %s extension to run. %s', + 'extensionRequiredInstallWithApt' => 'Try running sudo apt-get install %s.', + 'extensionRequiredInstallWithCustomInstructions' => 'Follow the instructions at %s to install it.', 'file_not_exist' => 'Fayl mavjud emas', 'file_parsing' => '%s tahlil qilinmoqda...', 'file_type_invalid' => 'Yaroqsiz fayl turi aniqlandi (%s)', @@ -965,8 +1039,14 @@ final class Lang 'long_not_32' => 'Berilgan qiymat 32 bayt emas', 'long_not_64' => 'Berilgan qiymat 64 bayt emas', 'madelineproto_ready' => 'MadelineProto tayyor!', + 'manualAdminActionRequired' => '!!!!!!!!! MANUAL SYSTEM ADMIN ACTION REQUIRED !!!!!!!!!', 'method_not_found' => 'Metodni topib bo\'lmadi: ', + 'mmapError' => 'The maximum number of mmap\'ed regions was reached (%s): please increase the vm.max_map_count kernel config to 262144 to fix. +To fix, run the following command as root: echo 262144 | sudo tee /proc/sys/vm/max_map_count +To persist the change across reboots: echo vm.max_map_count=262144 | sudo tee /etc/sysctl.d/40-madelineproto.conf +On Windows and WSL, increasing the size of the pagefile might help; please switch to native Linux if the issue persists.', 'nearest_dc' => 'Biz %s ichidamiz, eng yaqin shahar %d.', + 'noReportPeers' => 'Warning: no report peers are set, please add the following method to your event handler', 'non_text_conversion' => 'Matnli boʻlmagan xabarlarni oʻzgartirib boʻlmaydi!', 'not_loggedIn' => 'Kirish amalga oshirilmagan!', 'not_numeric' => 'Kiritilgan qiymat raqamlar emas', @@ -1046,6 +1126,10 @@ final class Lang 'deserialization_error' => 'An error occurred on deserialization', 'done' => 'Done!', 'encode_double_error' => 'Could not properly encode double', + 'extensionRecommended' => 'Warning: the %s extension is not installed, please install it to speed up MadelineProto!', + 'extensionRequired' => 'MadelineProto requires the %s extension to run. %s', + 'extensionRequiredInstallWithApt' => 'Try running sudo apt-get install %s.', + 'extensionRequiredInstallWithCustomInstructions' => 'Follow the instructions at %s to install it.', 'file_not_exist' => 'File does not exist', 'file_parsing' => 'Parsing %s...', 'file_type_invalid' => 'Invalid file type detected (%s)', @@ -1089,8 +1173,14 @@ final class Lang 'long_not_32' => 'Given value is not 32 bytes long', 'long_not_64' => 'Given value is not 64 bytes long', 'madelineproto_ready' => 'MadelineProto is ready!', + 'manualAdminActionRequired' => '!!!!!!!!! MANUAL SYSTEM ADMIN ACTION REQUIRED !!!!!!!!!', 'method_not_found' => 'Could not find method: ', + 'mmapError' => 'The maximum number of mmap\'ed regions was reached (%s): please increase the vm.max_map_count kernel config to 262144 to fix. +To fix, run the following command as root: echo 262144 | sudo tee /proc/sys/vm/max_map_count +To persist the change across reboots: echo vm.max_map_count=262144 | sudo tee /etc/sysctl.d/40-madelineproto.conf +On Windows and WSL, increasing the size of the pagefile might help; please switch to native Linux if the issue persists.', 'nearest_dc' => 'We\'re in %s, nearest DC is %d.', + 'noReportPeers' => 'Warning: no report peers are set, please add the following method to your event handler', 'non_text_conversion' => 'Can\'t convert non text messages yet!', 'not_loggedIn' => 'I\'m not logged in!', 'not_numeric' => 'Given value isn\'t numeric',