mirror of
https://github.com/nerzhul/ocsms.git
synced 2025-06-07 07:56:23 +00:00
Add missing database indices
This commit is contained in:
parent
eea860d919
commit
852c0835fa
@ -26,8 +26,16 @@
|
||||
<length>64</length>
|
||||
<notnull>true</notnull>
|
||||
</field>
|
||||
<index>
|
||||
<name>user_datas_user_datakey</name>
|
||||
<field>
|
||||
<name>user_id</name>
|
||||
</field>
|
||||
<field>
|
||||
<name>datakey</name>
|
||||
</field>
|
||||
</index>
|
||||
</declaration>
|
||||
|
||||
</table>
|
||||
<table>
|
||||
<name>*dbprefix*ocsms_smsdatas</name>
|
||||
@ -102,6 +110,54 @@
|
||||
<notnull>true</notnull>
|
||||
<length>1</length>
|
||||
</field>
|
||||
<index>
|
||||
<name>smsdata_user_mailbox</name>
|
||||
<field>
|
||||
<name>user_id</name>
|
||||
</field>
|
||||
<field>
|
||||
<name>sms_mailbox</name>
|
||||
</field>
|
||||
</index>
|
||||
<index>
|
||||
<name>smsdata_user_mailbox_date</name>
|
||||
<field>
|
||||
<name>user_id</name>
|
||||
</field>
|
||||
<field>
|
||||
<name>sms_mailbox</name>
|
||||
</field>
|
||||
<field>
|
||||
<name>sms_date</name>
|
||||
</field>
|
||||
</index>
|
||||
<index>
|
||||
<name>smsdata_user_mailbox_address</name>
|
||||
<field>
|
||||
<name>user_id</name>
|
||||
</field>
|
||||
<field>
|
||||
<name>sms_mailbox</name>
|
||||
</field>
|
||||
<field>
|
||||
<name>sms_address</name>
|
||||
</field>
|
||||
</index>
|
||||
<index>
|
||||
<name>smsdata_user_mailbox_address_date</name>
|
||||
<field>
|
||||
<name>user_id</name>
|
||||
</field>
|
||||
<field>
|
||||
<name>sms_mailbox</name>
|
||||
</field>
|
||||
<field>
|
||||
<name>sms_address</name>
|
||||
</field>
|
||||
<field>
|
||||
<name>sms_date</name>
|
||||
</field>
|
||||
</index>
|
||||
</declaration>
|
||||
</table>
|
||||
<table>
|
||||
@ -157,6 +213,15 @@
|
||||
<notnull>false</notnull>
|
||||
<length>10240</length>
|
||||
</field>
|
||||
<index>
|
||||
<name>config_user_key</name>
|
||||
<field>
|
||||
<name>user</name>
|
||||
</field>
|
||||
<field>
|
||||
<name>key</name>
|
||||
</field>
|
||||
</index>
|
||||
</declaration>
|
||||
</table>
|
||||
</database>
|
||||
|
@ -6,7 +6,7 @@
|
||||
<description>A app to sync SMS with your ownCloud</description>
|
||||
<licence>agpl</licence>
|
||||
<author>Loic Blot</author>
|
||||
<version>1.8.3</version>
|
||||
<version>1.8.5</version>
|
||||
<dependencies>
|
||||
<owncloud min-version="8.1" max-version="9.2" />
|
||||
<nextcloud min-version="9.0" />
|
||||
|
@ -197,7 +197,7 @@ class SmsMapper extends Mapper {
|
||||
}
|
||||
|
||||
public function getLastMessageTimestampForAllPhonesNumbers ($userId, $order = true) {
|
||||
$sql = 'SELECT sms_address,MAX(sms_date) as mx FROM ' .
|
||||
$sql = 'SELECT sms_address, MAX(sms_date) AS mx FROM ' .
|
||||
'*PREFIX*ocsms_smsdatas WHERE user_id = ? AND sms_mailbox IN (?,?) ' .
|
||||
'GROUP BY sms_address';
|
||||
|
||||
@ -210,7 +210,7 @@ class SmsMapper extends Mapper {
|
||||
|
||||
$phoneList = array();
|
||||
while ($row = $result->fetchRow()) {
|
||||
$phoneNumber = $row["sms_address"];
|
||||
$phoneNumber = preg_replace("#[ ]#", "", $row["sms_address"]);
|
||||
if (!in_array($phoneNumber, $phoneList)) {
|
||||
$phoneList[$phoneNumber] = $row["mx"];
|
||||
}
|
||||
@ -221,7 +221,7 @@ class SmsMapper extends Mapper {
|
||||
public function getNewMessagesCountForAllPhonesNumbers($userId, $lastDate) {
|
||||
$ld = ($lastDate == '') ? 0 : $lastDate;
|
||||
|
||||
$sql = 'SELECT sms_address,count(sms_date) as ct FROM ' .
|
||||
$sql = 'SELECT sms_address, COUNT(sms_date) AS ct FROM ' .
|
||||
'*PREFIX*ocsms_smsdatas WHERE user_id = ? AND sms_mailbox IN (?,?) ' .
|
||||
'AND sms_date > ? GROUP BY sms_address';
|
||||
|
||||
|
@ -204,10 +204,9 @@ app.controller('OcSmsController', ['$scope', '$interval', '$timeout', '$compile'
|
||||
var bufferedContacts = [];
|
||||
|
||||
$.each(jsondata['phonelist'], function(id, val) {
|
||||
var fn, peerLabel, idxVal;
|
||||
idxVal = id.replace(/\//g,'');
|
||||
var fn, peerLabel;
|
||||
if (typeof jsondata['contacts'][id] == 'undefined') {
|
||||
peerLabel = idxVal;
|
||||
peerLabel = id;
|
||||
}
|
||||
else {
|
||||
fn = jsondata['contacts'][id];
|
||||
@ -217,7 +216,7 @@ app.controller('OcSmsController', ['$scope', '$interval', '$timeout', '$compile'
|
||||
if (!inArray(peerLabel, bufferedContacts)) {
|
||||
var contactObj = {
|
||||
'label': peerLabel,
|
||||
'nav': idxVal,
|
||||
'nav': id,
|
||||
'unread': val
|
||||
};
|
||||
|
||||
@ -229,8 +228,8 @@ app.controller('OcSmsController', ['$scope', '$interval', '$timeout', '$compile'
|
||||
bufferedContacts.push(peerLabel);
|
||||
|
||||
// Re-set conversation because we reload the element
|
||||
if (idxVal == $scope.selectedContact.nav) {
|
||||
changeSelectedConversation($("a[mailbox-navigation='" + idxVal + "']"));
|
||||
if (id == $scope.selectedContact.nav) {
|
||||
changeSelectedConversation($("a[mailbox-navigation='" + id + "']"));
|
||||
}
|
||||
|
||||
g_unreadCountAllConv += parseInt(val);
|
||||
@ -363,11 +362,9 @@ app.controller('OcSmsController', ['$scope', '$interval', '$timeout', '$compile'
|
||||
$scope.photoVersion = jsondata["photo_version"];
|
||||
|
||||
$.each(jsondata['phonelist'], function(id, val) {
|
||||
var peerLabel, idxVal, idxVal2;
|
||||
idxVal = id.replace(/\//g,' ');
|
||||
idxVal2 = idxVal.replace('/ /g','');
|
||||
var peerLabel;
|
||||
if (typeof jsondata['contacts'][id] == 'undefined') {
|
||||
peerLabel = idxVal;
|
||||
peerLabel = id;
|
||||
}
|
||||
else {
|
||||
peerLabel = jsondata['contacts'][id];
|
||||
@ -375,7 +372,7 @@ app.controller('OcSmsController', ['$scope', '$interval', '$timeout', '$compile'
|
||||
if (!inArray(peerLabel, bufferedContacts)) {
|
||||
var contactObj = {
|
||||
'label': peerLabel,
|
||||
'nav': idxVal2,
|
||||
'nav': id,
|
||||
'unread' : 0,
|
||||
'lastmsg': val
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user