Unverified Commit 0f8e0275 authored by Armando Lüscher's avatar Armando Lüscher Committed by GitHub

Merge pull request #925 from jacklul/rip_botan

Deprecate Botan.io integration
parents 2cfb8a7e 71e9ef96
...@@ -7,6 +7,7 @@ Exclamation symbols (:exclamation:) note something of importance e.g. breaking c ...@@ -7,6 +7,7 @@ Exclamation symbols (:exclamation:) note something of importance e.g. breaking c
### Added ### Added
### Changed ### Changed
### Deprecated ### Deprecated
- Botan.io service has been discontinued.
### Removed ### Removed
### Fixed ### Fixed
### Security ### Security
......
...@@ -18,6 +18,8 @@ use Longman\TelegramBot\Exception\TelegramException; ...@@ -18,6 +18,8 @@ use Longman\TelegramBot\Exception\TelegramException;
/** /**
* Class Botan * Class Botan
* *
* @deprecated Botan.io service is no longer working
*
* Integration with http://botan.io statistics service for Telegram bots * Integration with http://botan.io statistics service for Telegram bots
*/ */
class Botan class Botan
...@@ -64,6 +66,8 @@ class Botan ...@@ -64,6 +66,8 @@ class Botan
*/ */
public static function initializeBotan($token, array $options = []) public static function initializeBotan($token, array $options = [])
{ {
trigger_error('Longman\TelegramBot\Botan::initializeBotan is deprecated and will be removed in future release.', E_USER_DEPRECATED);
if (empty($token)) { if (empty($token)) {
throw new TelegramException('Botan token is empty!'); throw new TelegramException('Botan token is empty!');
} }
......
...@@ -15,6 +15,8 @@ use Longman\TelegramBot\Exception\TelegramException; ...@@ -15,6 +15,8 @@ use Longman\TelegramBot\Exception\TelegramException;
/** /**
* Class BotanDB * Class BotanDB
*
* @deprecated Botan.io service is no longer working
*/ */
class BotanDB extends DB class BotanDB extends DB
{ {
......
...@@ -123,13 +123,6 @@ class Telegram ...@@ -123,13 +123,6 @@ class Telegram
*/ */
protected $last_command_response; protected $last_command_response;
/**
* Botan.io integration
*
* @var boolean
*/
protected $botan_enabled = false;
/** /**
* Check if runCommands() is running in this session * Check if runCommands() is running in this session
* *
...@@ -527,19 +520,9 @@ class Telegram ...@@ -527,19 +520,9 @@ class Telegram
//Handle a generic command or non existing one //Handle a generic command or non existing one
$this->last_command_response = $this->executeCommand('generic'); $this->last_command_response = $this->executeCommand('generic');
} else { } else {
//Botan.io integration, make sure only the actual command user executed is reported
if ($this->botan_enabled) {
Botan::lock($command);
}
//execute() method is executed after preExecute() //execute() method is executed after preExecute()
//This is to prevent executing a DB query without a valid connection //This is to prevent executing a DB query without a valid connection
$this->last_command_response = $command_obj->preExecute(); $this->last_command_response = $command_obj->preExecute();
//Botan.io integration, send report after executing the command
if ($this->botan_enabled) {
Botan::track($this->update, $command);
}
} }
return $this->last_command_response; return $this->last_command_response;
...@@ -905,16 +888,16 @@ class Telegram ...@@ -905,16 +888,16 @@ class Telegram
/** /**
* Enable Botan.io integration * Enable Botan.io integration
* *
* @deprecated Botan.io service is no longer working
*
* @param string $token * @param string $token
* @param array $options * @param array $options
* *
* @return \Longman\TelegramBot\Telegram * @return \Longman\TelegramBot\Telegram
* @throws \Longman\TelegramBot\Exception\TelegramException
*/ */
public function enableBotan($token, array $options = []) public function enableBotan($token, array $options = [])
{ {
Botan::initializeBotan($token, $options); trigger_error('Longman\TelegramBot\Telegram::enableBotan is deprecated and will be removed in future release.', E_USER_DEPRECATED);
$this->botan_enabled = true;
return $this; return $this;
} }
...@@ -947,7 +930,6 @@ class Telegram ...@@ -947,7 +930,6 @@ class Telegram
} }
$this->run_commands = true; $this->run_commands = true;
$this->botan_enabled = false; // Force disable Botan.io integration, we don't want to track self-executed commands!
$result = Request::getMe(); $result = Request::getMe();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment