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
f28f9b02
Unverified
Commit
f28f9b02
authored
Aug 27, 2016
by
Armando Lüscher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify defineTables method.
parent
91717c7b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
29 deletions
+19
-29
DB.php
src/DB.php
+19
-29
No files found.
src/DB.php
View file @
f28f9b02
...
...
@@ -87,7 +87,7 @@ class DB
self
::
$mysql_credentials
=
$credentials
;
self
::
$table_prefix
=
$table_prefix
;
self
::
defineTable
();
self
::
defineTable
s
();
return
self
::
$pdo
;
}
...
...
@@ -115,7 +115,7 @@ class DB
self
::
$mysql_credentials
=
null
;
self
::
$table_prefix
=
$table_prefix
;
self
::
defineTable
();
self
::
defineTable
s
();
return
self
::
$pdo
;
}
...
...
@@ -123,34 +123,24 @@ class DB
/**
* Define all the table with the proper prefix
*/
protected
static
function
defineTable
()
protected
static
function
defineTable
s
()
{
if
(
!
defined
(
'TB_TELEGRAM_UPDATE'
))
{
define
(
'TB_TELEGRAM_UPDATE'
,
self
::
$table_prefix
.
'telegram_update'
);
}
if
(
!
defined
(
'TB_MESSAGE'
))
{
define
(
'TB_MESSAGE'
,
self
::
$table_prefix
.
'message'
);
}
if
(
!
defined
(
'TB_EDITED_MESSAGE'
))
{
define
(
'TB_EDITED_MESSAGE'
,
self
::
$table_prefix
.
'edited_message'
);
}
if
(
!
defined
(
'TB_INLINE_QUERY'
))
{
define
(
'TB_INLINE_QUERY'
,
self
::
$table_prefix
.
'inline_query'
);
}
if
(
!
defined
(
'TB_CHOSEN_INLINE_RESULT'
))
{
define
(
'TB_CHOSEN_INLINE_RESULT'
,
self
::
$table_prefix
.
'chosen_inline_result'
);
}
if
(
!
defined
(
'TB_CALLBACK_QUERY'
))
{
define
(
'TB_CALLBACK_QUERY'
,
self
::
$table_prefix
.
'callback_query'
);
}
if
(
!
defined
(
'TB_USER'
))
{
define
(
'TB_USER'
,
self
::
$table_prefix
.
'user'
);
}
if
(
!
defined
(
'TB_CHAT'
))
{
define
(
'TB_CHAT'
,
self
::
$table_prefix
.
'chat'
);
}
if
(
!
defined
(
'TB_USER_CHAT'
))
{
define
(
'TB_USER_CHAT'
,
self
::
$table_prefix
.
'user_chat'
);
$tables
=
[
'callback_query'
,
'chat'
,
'chosen_inline_result'
,
'edited_message'
,
'inline_query'
,
'message'
,
'telegram_update'
,
'user'
,
'user_chat'
,
];
foreach
(
$tables
as
$table
)
{
$table_name
=
'TB_'
.
strtoupper
(
$table
);
if
(
!
defined
(
$table_name
))
{
define
(
$table_name
,
self
::
$table_prefix
.
$table
);
}
}
}
...
...
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