Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
TelegramBot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
TelegramBot
Commits
307c4cea
Commit
307c4cea
authored
May 23, 2016
by
MBoretto
Browse files
Options
Browse Files
Download
Plain Diff
resolve botan conflict
parents
8c66ba4e
09d4337e
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
104 additions
and
86 deletions
+104
-86
.travis.yml
.travis.yml
+10
-2
DB.php
src/DB.php
+70
-56
Telegram.php
src/Telegram.php
+2
-2
structure.sql
structure.sql
+21
-25
ConversationTest.php
tests/Unit/ConversationTest.php
+1
-1
No files found.
.travis.yml
View file @
307c4cea
sudo
:
false
dist
:
trusty
sudo
:
required
addons
:
apt
:
packages
:
-
mysql-server-5.6
-
mysql-client-core-5.6
-
mysql-client-5.6
language
:
php
...
...
@@ -27,7 +35,7 @@ install:
-
travis_retry composer install --no-interaction
before_script
:
-
mysql -e 'create database telegrambot; use telegrambot; source structure.sql;'
-
mysql -
u root -
e 'create database telegrambot; use telegrambot; source structure.sql;'
script
:
-
./vendor/bin/phpunit
...
...
src/DB.php
View file @
307c4cea
This diff is collapsed.
Click to expand it.
src/Telegram.php
View file @
307c4cea
...
...
@@ -181,9 +181,9 @@ class Telegram
*
* @return Telegram
*/
public
function
enableMySql
(
array
$credential
,
$table_prefix
=
null
)
public
function
enableMySql
(
array
$credential
,
$table_prefix
=
null
,
$encoding
=
'utf8mb4'
)
{
$this
->
pdo
=
DB
::
initialize
(
$credential
,
$this
,
$table_prefix
);
$this
->
pdo
=
DB
::
initialize
(
$credential
,
$this
,
$table_prefix
,
$encoding
);
ConversationDB
::
initializeConversation
();
$this
->
mysql_enabled
=
true
;
return
$this
;
...
...
structure.sql
View file @
307c4cea
...
...
@@ -7,7 +7,7 @@ CREATE TABLE IF NOT EXISTS `user` (
`updated_at`
timestamp
NULL
DEFAULT
NULL
COMMENT
'Entry date update'
,
PRIMARY
KEY
(
`id`
),
KEY
`username`
(
`username`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
COLLATE
=
utf8_general
_ci
;
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
mb4
COLLATE
=
utf8mb4_unicode_520
_ci
;
CREATE
TABLE
IF
NOT
EXISTS
`chat`
(
`id`
bigint
COMMENT
'Unique user or chat identifier'
,
...
...
@@ -18,7 +18,7 @@ CREATE TABLE IF NOT EXISTS `chat` (
`old_id`
bigint
DEFAULT
NULL
COMMENT
'Unique chat identifieri this is filled when a chat is converted to a superchat'
,
PRIMARY
KEY
(
`id`
),
KEY
`old_id`
(
`old_id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
COLLATE
=
utf8_general
_ci
;
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
mb4
COLLATE
=
utf8mb4_unicode_520
_ci
;
CREATE
TABLE
IF
NOT
EXISTS
`user_chat`
(
`user_id`
bigint
COMMENT
'Unique user identifier'
,
...
...
@@ -28,7 +28,7 @@ CREATE TABLE IF NOT EXISTS `user_chat` (
ON
DELETE
CASCADE
ON
UPDATE
CASCADE
,
FOREIGN
KEY
(
`chat_id`
)
REFERENCES
`chat`
(
`id`
)
ON
DELETE
CASCADE
ON
UPDATE
CASCADE
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
COLLATE
=
utf8_general
_ci
;
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
mb4
COLLATE
=
utf8mb4_unicode_520
_ci
;
CREATE
TABLE
IF
NOT
EXISTS
`inline_query`
(
`id`
bigint
UNSIGNED
COMMENT
'Unique identifier for this query.'
,
...
...
@@ -40,12 +40,11 @@ CREATE TABLE IF NOT EXISTS `inline_query` (
PRIMARY
KEY
(
`id`
),
KEY
`user_id`
(
`user_id`
),
FOREIGN
KEY
(
`user_id`
)
REFERENCES
`user`
(
`id`
)
FOREIGN
KEY
(
`user_id`
)
REFERENCES
`user`
(
`id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
COLLATE
=
utf8_general
_ci
;
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
mb4
COLLATE
=
utf8mb4_unicode_520
_ci
;
CREATE
TABLE
IF
NOT
EXISTS
`chosen_inline_
query
`
(
CREATE
TABLE
IF
NOT
EXISTS
`chosen_inline_
result
`
(
`id`
bigint
UNSIGNED
AUTO_INCREMENT
COMMENT
'Unique identifier for chosen query.'
,
`result_id`
CHAR
(
255
)
NOT
NULL
DEFAULT
''
COMMENT
'Id of the chosen result'
,
`user_id`
bigint
NULL
COMMENT
'Sender'
,
...
...
@@ -56,10 +55,9 @@ CREATE TABLE IF NOT EXISTS `chosen_inline_query` (
PRIMARY
KEY
(
`id`
),
KEY
`user_id`
(
`user_id`
),
FOREIGN
KEY
(
`user_id`
)
REFERENCES
`user`
(
`id`
)
FOREIGN
KEY
(
`user_id`
)
REFERENCES
`user`
(
`id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
COLLATE
=
utf8_general
_ci
;
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
mb4
COLLATE
=
utf8mb4_unicode_520
_ci
;
CREATE
TABLE
IF
NOT
EXISTS
`callback_query`
(
`id`
bigint
UNSIGNED
COMMENT
'Unique identifier for this query.'
,
...
...
@@ -71,10 +69,9 @@ CREATE TABLE IF NOT EXISTS `callback_query` (
PRIMARY
KEY
(
`id`
),
KEY
`user_id`
(
`user_id`
),
FOREIGN
KEY
(
`user_id`
)
REFERENCES
`user`
(
`id`
)
FOREIGN
KEY
(
`user_id`
)
REFERENCES
`user`
(
`id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
COLLATE
=
utf8_general
_ci
;
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
mb4
COLLATE
=
utf8mb4_unicode_520
_ci
;
CREATE
TABLE
IF
NOT
EXISTS
`message`
(
`chat_id`
bigint
COMMENT
'Chat identifier.'
,
...
...
@@ -86,7 +83,7 @@ CREATE TABLE IF NOT EXISTS `message` (
`forward_date`
timestamp
NULL
DEFAULT
NULL
COMMENT
'For forwarded messages, date the original message was sent in Unix time'
,
`reply_to_chat`
bigint
NULL
DEFAULT
NULL
COMMENT
'Chat identifier.'
,
`reply_to_message`
bigint
UNSIGNED
DEFAULT
NULL
COMMENT
'Message is a reply to another message.'
,
`text`
TEXT
DEFAULT
NULL
COMMENT
'For text messages, the actual UTF-8 text of the message max message length 4096 char utf8'
,
`text`
TEXT
DEFAULT
NULL
COMMENT
'For text messages, the actual UTF-8 text of the message max message length 4096 char utf8
mb4
'
,
`entities`
TEXT
DEFAULT
NULL
COMMENT
'For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text'
,
`audio`
TEXT
DEFAULT
NULL
COMMENT
'Audio object. Message is an audio file, information about the file'
,
`document`
TEXT
DEFAULT
NULL
COMMENT
'Document object. Message is a general file, information about the file'
,
...
...
@@ -129,27 +126,27 @@ CREATE TABLE IF NOT EXISTS `message` (
FOREIGN
KEY
(
`new_chat_member`
)
REFERENCES
`user`
(
`id`
),
FOREIGN
KEY
(
`left_chat_member`
)
REFERENCES
`user`
(
`id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
COLLATE
=
utf8_general
_ci
;
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
mb4
COLLATE
=
utf8mb4_unicode_520
_ci
;
CREATE
TABLE
IF
NOT
EXISTS
`telegram_update`
(
`id`
bigint
UNSIGNED
COMMENT
'The update
\'
s unique identifier.'
,
`chat_id`
bigint
NULL
DEFAULT
NULL
COMMENT
'Chat identifier.'
,
`message_id`
bigint
UNSIGNED
DEFAULT
NULL
COMMENT
'Unique message identifier'
,
`inline_query_id`
bigint
UNSIGNED
DEFAULT
NULL
COMMENT
'The inline query unique identifier.'
,
`chosen_inline_
query
_id`
bigint
UNSIGNED
DEFAULT
NULL
COMMENT
'The chosen query unique identifier.'
,
`chosen_inline_
result
_id`
bigint
UNSIGNED
DEFAULT
NULL
COMMENT
'The chosen query unique identifier.'
,
`callback_query_id`
bigint
UNSIGNED
DEFAULT
NULL
COMMENT
'The callback query unique identifier.'
,
PRIMARY
KEY
(
`id`
),
KEY
`message_id`
(
`chat_id`
,
`message_id`
),
KEY
`inline_query_id`
(
`inline_query_id`
),
KEY
`chosen_inline_
query_id`
(
`chosen_inline_query
_id`
),
KEY
`chosen_inline_
result_id`
(
`chosen_inline_result
_id`
),
KEY
`callback_query_id`
(
`callback_query_id`
),
FOREIGN
KEY
(
`chat_id`
,
`message_id`
)
REFERENCES
`message`
(
`chat_id`
,
`id`
),
FOREIGN
KEY
(
`inline_query_id`
)
REFERENCES
`inline_query`
(
`id`
),
FOREIGN
KEY
(
`chosen_inline_
query_id`
)
REFERENCES
`chosen_inline_query
`
(
`id`
),
FOREIGN
KEY
(
`chosen_inline_
result_id`
)
REFERENCES
`chosen_inline_result
`
(
`id`
),
FOREIGN
KEY
(
`callback_query_id`
)
REFERENCES
`callback_query`
(
`id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
COLLATE
=
utf8_general
_ci
;
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
mb4
COLLATE
=
utf8mb4_unicode_520
_ci
;
CREATE
TABLE
IF
NOT
EXISTS
`conversation`
(
`id`
bigint
(
20
)
unsigned
AUTO_INCREMENT
COMMENT
'Row unique id'
,
...
...
@@ -166,11 +163,9 @@ CREATE TABLE IF NOT EXISTS `conversation` (
KEY
`chat_id`
(
`chat_id`
),
KEY
`status`
(
`status`
),
FOREIGN
KEY
(
`user_id`
)
REFERENCES
`user`
(
`id`
),
FOREIGN
KEY
(
`chat_id`
)
REFERENCES
`chat`
(
`id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
COLLATE
=
utf8_general_ci
;
FOREIGN
KEY
(
`user_id`
)
REFERENCES
`user`
(
`id`
),
FOREIGN
KEY
(
`chat_id`
)
REFERENCES
`chat`
(
`id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
COLLATE
=
utf8mb4_unicode_520_ci
;
CREATE
TABLE
IF
NOT
EXISTS
`botan_shortener`
(
`id`
bigint
UNSIGNED
AUTO_INCREMENT
COMMENT
'Unique identifier for this entry.'
,
...
...
@@ -180,5 +175,6 @@ CREATE TABLE IF NOT EXISTS `botan_shortener` (
`created_at`
timestamp
NULL
DEFAULT
NULL
COMMENT
'Entry date creation'
,
PRIMARY
KEY
(
`id`
),
FOREIGN
KEY
(
`user_id`
)
REFERENCES
`user`
(
`id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
COLLATE
=
utf8_general
_ci
;
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
COLLATE
=
utf8mb4_unicode_520
_ci
;
tests/Unit/ConversationTest.php
View file @
307c4cea
...
...
@@ -35,7 +35,7 @@ class ConversationTest extends TestCase
{
$credentials
=
[
'host'
=>
'127.0.0.1'
,
'user'
=>
'
travis
'
,
'user'
=>
'
root
'
,
'password'
=>
''
,
'database'
=>
'telegrambot'
,
];
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment