From f33c686aab5327f82038605549f7dee8a98c7be2 Mon Sep 17 00:00:00 2001 From: Dmitriy Simushev Date: Fri, 11 Jul 2014 13:00:11 +0000 Subject: [PATCH] Lowercase database columns names --- src/mibew/configs/database_schema.yml | 18 +++++++++--------- .../Mibew/Controller/HistoryController.php | 4 ++-- src/mibew/libs/classes/Mibew/Thread.php | 16 ++++++++-------- src/mibew/libs/statistics.php | 6 +++--- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/mibew/configs/database_schema.yml b/src/mibew/configs/database_schema.yml index 368c32df..3c7d447b 100644 --- a/src/mibew/configs/database_schema.yml +++ b/src/mibew/configs/database_schema.yml @@ -25,13 +25,13 @@ chatthread: # ID of the thread. threadid: "int NOT NULL auto_increment PRIMARY KEY" # Name of the user in chat. - userName: "varchar(64) NOT NULL" + username: "varchar(64) NOT NULL" # ID of the user. This field is foreign key for {chatsitevisitor}.userid userid: "varchar(255)" # Name of the operator who took place in the chat. - agentName: "varchar(64)" + agentname: "varchar(64)" # ID of the operator who took place in the chat. - agentId: "int NOT NULL DEFAULT 0" + agentid: "int NOT NULL DEFAULT 0" # Unix timestamp of the moment when the thread was created. dtmcreated: "int NOT NULL DEFAULT 0" # Unix timestamp of the moment when chat actually started. @@ -62,15 +62,15 @@ chatthread: # Unix timestamp of the last request from operator's window to server. lastpingagent: "int NOT NULL DEFAULT 0" # Indicates if user typing or not. It can take two values 0 and 1. - userTyping: "int DEFAULT 0" + usertyping: "int DEFAULT 0" # Indicates if operator typing or not. It can take two values 0 and 1. - agentTyping: "int DEFAULT 0" + agenttyping: "int DEFAULT 0" # ID of shown message in the chat. shownmessageid: "int NOT NULL DEFAULT 0" # User agent description that took from 'User-Agent' HTTP header. - userAgent: "varchar(255)" + useragent: "varchar(255)" # Total count of user's messages related with the thread. - messageCount: "varchar(16)" + messagecount: "varchar(16)" # ID of the group at Mibew side related with the thread. groupid: "int references {chatgroup}(groupid)" @@ -152,7 +152,7 @@ chatmessage: ikind: "int NOT NULL" # ID of operator who sent the message. This value will be ignored for # system messages and messages which sent by users. - agentId: "int NOT NULL DEFAULT 0" + agentid: "int NOT NULL DEFAULT 0" # Message text body. tmessage: "text NOT NULL" # Name of the plugin which sent the message. If message was not sent by @@ -226,7 +226,7 @@ chatban: dtmtill: "int NOT NULL DEFAULT 0" address: "varchar(255)" comment: "varchar(255)" - blockedCount: "int DEFAULT 0" + blockedcount: "int DEFAULT 0" # Contains dynamic configs chatconfig: diff --git a/src/mibew/libs/classes/Mibew/Controller/HistoryController.php b/src/mibew/libs/classes/Mibew/Controller/HistoryController.php index 4335a571..922a6fb6 100644 --- a/src/mibew/libs/classes/Mibew/Controller/HistoryController.php +++ b/src/mibew/libs/classes/Mibew/Controller/HistoryController.php @@ -81,10 +81,10 @@ class HistoryController extends AbstractController } } if ($search_type == 'operator' || $search_type == 'all') { - $search_conditions[] = "({chatthread}.agentName LIKE :query)"; + $search_conditions[] = "({chatthread}.agentname LIKE :query)"; } if ($search_type == 'visitor' || $search_type == 'all') { - $search_conditions[] = "({chatthread}.userName LIKE :query)"; + $search_conditions[] = "({chatthread}.username LIKE :query)"; $search_conditions[] = "({chatthread}.remote LIKE :query)"; } diff --git a/src/mibew/libs/classes/Mibew/Thread.php b/src/mibew/libs/classes/Mibew/Thread.php index 7decee03..d8a71951 100644 --- a/src/mibew/libs/classes/Mibew/Thread.php +++ b/src/mibew/libs/classes/Mibew/Thread.php @@ -178,23 +178,23 @@ class Thread 'nextAgent' => 'nextagent', 'groupId' => 'groupid', 'shownMessageId' => 'shownmessageid', - 'messageCount' => 'messageCount', + 'messageCount' => 'messagecount', 'created' => 'dtmcreated', 'modified' => 'dtmmodified', 'chatStarted' => 'dtmchatstarted', 'closed' => 'dtmclosed', - 'agentId' => 'agentId', - 'agentName' => 'agentName', - 'agentTyping' => 'agentTyping', + 'agentId' => 'agentid', + 'agentName' => 'agentname', + 'agentTyping' => 'agenttyping', 'lastPingAgent' => 'lastpingagent', 'locale' => 'locale', 'userId' => 'userid', - 'userName' => 'userName', - 'userTyping' => 'userTyping', + 'userName' => 'username', + 'userTyping' => 'usertyping', 'lastPingUser' => 'lastpinguser', 'remote' => 'remote', 'referer' => 'referer', - 'userAgent' => 'userAgent', + 'userAgent' => 'useragent', ); /** @@ -1077,7 +1077,7 @@ class Thread // Prepare query $query = "INSERT INTO {chatmessage} (" - . "threadid, ikind, tmessage, tname, agentId, " + . "threadid, ikind, tmessage, tname, agentid, " . "dtmcreated, plugin, data" . ") VALUES (" . ":threadid, :kind, :message, :name, :agentid, " diff --git a/src/mibew/libs/statistics.php b/src/mibew/libs/statistics.php index f511e1a6..12160840 100644 --- a/src/mibew/libs/statistics.php +++ b/src/mibew/libs/statistics.php @@ -420,7 +420,7 @@ function calculate_operator_statistics() // Get base operator's info $db_results = $db->query( ("SELECT (FLOOR(m.dtmcreated / :interval) * :interval) AS date, " - . "m.agentId AS operator_id, " + . "m.agentid AS operator_id, " . "COUNT(distinct m.threadid) AS threads, " . "COUNT(m.messageid) AS messages, " . "AVG(CHAR_LENGTH(m.tmessage)) AS avg_msg_length " @@ -459,7 +459,7 @@ function calculate_operator_statistics() // Get info about invitations $db_results = $db->query( ("SELECT (FLOOR(dtmcreated / :interval) * :interval) AS date, " - . "agentId AS operator_id, " + . "agentid AS operator_id, " . "COUNT(threadid) AS invitations_sent, " . "SUM(invitationstate = :invitation_accepted) AS invitations_accepted, " . "SUM(invitationstate = :invitation_rejected) AS invitations_rejected, " @@ -470,7 +470,7 @@ function calculate_operator_statistics() // statistics_aggregation_interval . "AND (:today - dtmcreated) > :interval " // Check if thread has related operator - . "AND agentId != 0 " + . "AND agentid != 0 " // Ignore not accepted invitations . "AND (invitationstate = :invitation_accepted " . "OR invitationstate = :invitation_rejected "