From c3c94238bc16cdf9808ee89754fde867c3a29092 Mon Sep 17 00:00:00 2001 From: Marco Date: Wed, 4 Apr 2018 16:39:13 +0200 Subject: [PATCH 1/2] Prevent redefine constant BASE_PATH Add defined for not redefine constant BASE_PATH --- src/Telegram.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Telegram.php b/src/Telegram.php index 625cb16ed..9369379f5 100644 --- a/src/Telegram.php +++ b/src/Telegram.php @@ -10,7 +10,7 @@ namespace Longman\TelegramBot; -define('BASE_PATH', __DIR__); +defined('BASE_PATH') or define('BASE_PATH', __DIR__); define('BASE_COMMANDS_PATH', BASE_PATH . '/Commands'); use Exception; From ff9823b832616e1e02bea335146a0ecf14a3f2d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Armando=20L=C3=BCscher?= Date: Tue, 10 Apr 2018 22:16:57 +0200 Subject: [PATCH 2/2] Rename and prevent redefinition of path constants. --- CHANGELOG.md | 1 + src/Telegram.php | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f654f2a0e..3846e0aef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ Exclamation symbols (:exclamation:) note something of importance e.g. breaking c ## [Unreleased] ### Added ### Changed +- [:exclamation:][unreleased-bc-rename-constants] Rename and ensure no redefinition of constants: `BASE_PATH` -> `TB_BASE_PATH`, `BASE_COMMANDS_PATH` -> `TB_BASE_COMMANDS_PATH`. ### Deprecated ### Removed ### Fixed diff --git a/src/Telegram.php b/src/Telegram.php index 9369379f5..10d2a5087 100644 --- a/src/Telegram.php +++ b/src/Telegram.php @@ -10,8 +10,8 @@ namespace Longman\TelegramBot; -defined('BASE_PATH') or define('BASE_PATH', __DIR__); -define('BASE_COMMANDS_PATH', BASE_PATH . '/Commands'); +defined('TB_BASE_PATH') || define('TB_BASE_PATH', __DIR__); +defined('TB_BASE_COMMANDS_PATH') || define('TB_BASE_COMMANDS_PATH', TB_BASE_PATH . '/Commands'); use Exception; use Longman\TelegramBot\Commands\Command; @@ -177,7 +177,7 @@ public function __construct($api_key, $bot_username = '') } //Add default system commands path - $this->addCommandsPath(BASE_COMMANDS_PATH . '/SystemCommands'); + $this->addCommandsPath(TB_BASE_COMMANDS_PATH . '/SystemCommands'); Request::initialize($this); } @@ -461,7 +461,7 @@ public function processUpdate(Update $update) //Load admin commands if ($this->isAdmin()) { - $this->addCommandsPath(BASE_COMMANDS_PATH . '/AdminCommands', false); + $this->addCommandsPath(TB_BASE_COMMANDS_PATH . '/AdminCommands', false); } $type = $message->getType();