зеркало из https://github.com/nextcloud/spreed.git
replace execute by executeQuery of QueryBuilder
Signed-off-by: Vitor Mattos <vitor@php.rio>
This commit is contained in:
Родитель
d6c536d545
Коммит
dc518c46a7
|
@ -57,7 +57,7 @@ class ActiveCalls extends Base {
|
|||
->from('talk_rooms')
|
||||
->where($query->expr()->isNotNull('active_since'));
|
||||
|
||||
$result = $query->execute();
|
||||
$result = $query->executeQuery();
|
||||
$numCalls = (int) $result->fetchColumn();
|
||||
$result->closeCursor();
|
||||
|
||||
|
@ -72,7 +72,7 @@ class ActiveCalls extends Base {
|
|||
->where($query->expr()->gt('in_call', $query->createNamedParameter(Participant::FLAG_DISCONNECTED)))
|
||||
->andWhere($query->expr()->gt('last_ping', $query->createNamedParameter(time() - 60)));
|
||||
|
||||
$result = $query->execute();
|
||||
$result = $query->executeQuery();
|
||||
$numParticipants = (int) $result->fetchColumn();
|
||||
$result->closeCursor();
|
||||
|
||||
|
|
|
@ -126,7 +126,7 @@ class Manager {
|
|||
$helper->selectRoomsTable($query);
|
||||
$query->from('talk_rooms', 'r');
|
||||
|
||||
$result = $query->execute();
|
||||
$result = $query->executeQuery();
|
||||
while ($row = $result->fetch()) {
|
||||
if ($row['token'] === null) {
|
||||
// FIXME Temporary solution for the Talk6 release
|
||||
|
@ -251,7 +251,7 @@ class Manager {
|
|||
$query->from('talk_rooms', 'r')
|
||||
->where($query->expr()->isNotNull('r.assigned_hpb'));
|
||||
|
||||
$result = $query->execute();
|
||||
$result = $query->executeQuery();
|
||||
while ($row = $result->fetch()) {
|
||||
$room = $this->createRoomObject($row);
|
||||
if (!$this->participantService->hasActiveSessions($room)) {
|
||||
|
@ -284,7 +284,7 @@ class Manager {
|
|||
$query->setMaxResults($limit)
|
||||
->setFirstResult($offset)
|
||||
->orderBy('r.token', 'ASC');
|
||||
$result = $query->execute();
|
||||
$result = $query->executeQuery();
|
||||
|
||||
$rooms = [];
|
||||
while ($row = $result->fetch()) {
|
||||
|
@ -342,7 +342,7 @@ class Manager {
|
|||
$this->loadLastMessageInfo($query);
|
||||
}
|
||||
|
||||
$result = $query->execute();
|
||||
$result = $query->executeQuery();
|
||||
$rooms = [];
|
||||
while ($row = $result->fetch()) {
|
||||
if ($row['token'] === null) {
|
||||
|
@ -373,7 +373,7 @@ class Manager {
|
|||
->where($query->expr()->eq('r.type', $query->createNamedParameter(Room::TYPE_ONE_TO_ONE)))
|
||||
->andWhere($query->expr()->like('r.name', $query->createNamedParameter('%' . $this->db->escapeLikeParameter(json_encode($userId)) . '%')));
|
||||
|
||||
$result = $query->execute();
|
||||
$result = $query->executeQuery();
|
||||
$rooms = [];
|
||||
while ($row = $result->fetch()) {
|
||||
if ($row['token'] === null) {
|
||||
|
@ -401,7 +401,7 @@ class Manager {
|
|||
->where($query->expr()->eq('a.actor_id', $query->createNamedParameter($userId)))
|
||||
->andWhere($query->expr()->eq('a.actor_type', $query->createNamedParameter(Attendee::ACTOR_USERS)));
|
||||
|
||||
$result = $query->execute();
|
||||
$result = $query->executeQuery();
|
||||
$roomTokens = [];
|
||||
while ($row = $result->fetch()) {
|
||||
if ($row['token'] === null) {
|
||||
|
@ -450,7 +450,7 @@ class Manager {
|
|||
);
|
||||
}
|
||||
|
||||
$result = $query->execute();
|
||||
$result = $query->executeQuery();
|
||||
$rooms = [];
|
||||
while ($row = $result->fetch()) {
|
||||
$room = $this->createRoomObject($row);
|
||||
|
@ -487,7 +487,7 @@ class Manager {
|
|||
->andWhere($query->expr()->isNotNull('a.id'));
|
||||
}
|
||||
|
||||
$result = $query->execute();
|
||||
$result = $query->executeQuery();
|
||||
$row = $result->fetch();
|
||||
$result->closeCursor();
|
||||
|
||||
|
@ -558,7 +558,7 @@ class Manager {
|
|||
$this->loadLastMessageInfo($query);
|
||||
}
|
||||
|
||||
$result = $query->execute();
|
||||
$result = $query->executeQuery();
|
||||
$row = $result->fetch();
|
||||
$result->closeCursor();
|
||||
|
||||
|
@ -608,7 +608,7 @@ class Manager {
|
|||
$query->from('talk_rooms', 'r')
|
||||
->where($query->expr()->eq('r.id', $query->createNamedParameter($roomId, IQueryBuilder::PARAM_INT)));
|
||||
|
||||
$result = $query->execute();
|
||||
$result = $query->executeQuery();
|
||||
$row = $result->fetch();
|
||||
$result->closeCursor();
|
||||
|
||||
|
@ -659,7 +659,7 @@ class Manager {
|
|||
));
|
||||
}
|
||||
|
||||
$result = $query->execute();
|
||||
$result = $query->executeQuery();
|
||||
$row = $result->fetch();
|
||||
$result->closeCursor();
|
||||
|
||||
|
@ -705,7 +705,7 @@ class Manager {
|
|||
}
|
||||
|
||||
|
||||
$result = $query->execute();
|
||||
$result = $query->executeQuery();
|
||||
$row = $result->fetch();
|
||||
$result->closeCursor();
|
||||
|
||||
|
@ -735,7 +735,7 @@ class Manager {
|
|||
->where($query->expr()->eq('r.object_type', $query->createNamedParameter($objectType)))
|
||||
->andWhere($query->expr()->eq('r.object_id', $query->createNamedParameter($objectId)));
|
||||
|
||||
$result = $query->execute();
|
||||
$result = $query->executeQuery();
|
||||
$row = $result->fetch();
|
||||
$result->closeCursor();
|
||||
|
||||
|
@ -773,7 +773,7 @@ class Manager {
|
|||
->where($query->expr()->eq('s.session_id', $query->createNamedParameter($sessionId)))
|
||||
->setMaxResults(1);
|
||||
|
||||
$result = $query->execute();
|
||||
$result = $query->executeQuery();
|
||||
$row = $result->fetch();
|
||||
$result->closeCursor();
|
||||
|
||||
|
@ -825,7 +825,7 @@ class Manager {
|
|||
->where($query->expr()->eq('r.type', $query->createNamedParameter(Room::TYPE_ONE_TO_ONE, IQueryBuilder::PARAM_INT)))
|
||||
->andWhere($query->expr()->eq('r.name', $query->createNamedParameter($name)));
|
||||
|
||||
$result = $query->execute();
|
||||
$result = $query->executeQuery();
|
||||
$row = $result->fetch();
|
||||
$result->closeCursor();
|
||||
|
||||
|
@ -855,7 +855,7 @@ class Manager {
|
|||
->where($query->expr()->eq('r.type', $query->createNamedParameter(Room::TYPE_CHANGELOG, IQueryBuilder::PARAM_INT)))
|
||||
->andWhere($query->expr()->eq('r.name', $query->createNamedParameter($userId)));
|
||||
|
||||
$result = $query->execute();
|
||||
$result = $query->executeQuery();
|
||||
$row = $result->fetch();
|
||||
$result->closeCursor();
|
||||
|
||||
|
@ -899,23 +899,23 @@ class Manager {
|
|||
public function createRoom(int $type, string $name = '', string $objectType = '', string $objectId = ''): Room {
|
||||
$token = $this->getNewToken();
|
||||
|
||||
$query = $this->db->getQueryBuilder();
|
||||
$query->insert('talk_rooms')
|
||||
$insert = $this->db->getQueryBuilder();
|
||||
$insert->insert('talk_rooms')
|
||||
->values(
|
||||
[
|
||||
'name' => $query->createNamedParameter($name),
|
||||
'type' => $query->createNamedParameter($type, IQueryBuilder::PARAM_INT),
|
||||
'token' => $query->createNamedParameter($token),
|
||||
'name' => $insert->createNamedParameter($name),
|
||||
'type' => $insert->createNamedParameter($type, IQueryBuilder::PARAM_INT),
|
||||
'token' => $insert->createNamedParameter($token),
|
||||
]
|
||||
);
|
||||
|
||||
if (!empty($objectType) && !empty($objectId)) {
|
||||
$query->setValue('object_type', $query->createNamedParameter($objectType))
|
||||
->setValue('object_id', $query->createNamedParameter($objectId));
|
||||
$insert->setValue('object_type', $insert->createNamedParameter($objectType))
|
||||
->setValue('object_id', $insert->createNamedParameter($objectId));
|
||||
}
|
||||
|
||||
$query->execute();
|
||||
$roomId = $query->getLastInsertId();
|
||||
$insert->executeStatement();
|
||||
$roomId = $insert->getLastInsertId();
|
||||
|
||||
$room = $this->getRoomById($roomId);
|
||||
|
||||
|
@ -1118,7 +1118,7 @@ class Manager {
|
|||
}
|
||||
|
||||
$query->setParameter('token', $token);
|
||||
$result = $query->execute();
|
||||
$result = $query->executeQuery();
|
||||
$row = $result->fetch();
|
||||
$result->closeCursor();
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ class CacheUserDisplayNames implements IRepairStep {
|
|||
->andWhere($query->expr()->eq('display_name', $query->createNamedParameter('')))
|
||||
->groupBy('actor_id');
|
||||
|
||||
$result = $query->execute();
|
||||
$result = $query->executeQuery();
|
||||
while ($row = $result->fetch()) {
|
||||
$user = $this->userManager->get($row['actor_id']);
|
||||
if (!$user instanceof IUser) {
|
||||
|
@ -71,7 +71,7 @@ class CacheUserDisplayNames implements IRepairStep {
|
|||
$update->setParameter('displayName', $user->getDisplayName())
|
||||
->setParameter('actorType', Attendee::ACTOR_USERS)
|
||||
->setParameter('actorId', $row['actor_id']);
|
||||
$update->execute();
|
||||
$update->executeStatement();
|
||||
}
|
||||
$result->closeCursor();
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ class FixNamespaceInDatabaseTables implements IRepairStep {
|
|||
'%' . $this->connection->escapeLikeParameter('Spreed'). '%'
|
||||
)));
|
||||
|
||||
$result = $query->execute();
|
||||
$result = $query->executeQuery();
|
||||
while ($row = $result->fetch()) {
|
||||
$oldClass = $row['class'];
|
||||
if (strpos($oldClass, 'OCA\\Spreed\\') !== 0) {
|
||||
|
@ -64,7 +64,7 @@ class FixNamespaceInDatabaseTables implements IRepairStep {
|
|||
|
||||
$update->setParameter('newClass', $newClass)
|
||||
->setParameter('id', $row['id']);
|
||||
$update->execute();
|
||||
$update->executeStatement();
|
||||
}
|
||||
$result->closeCursor();
|
||||
}
|
||||
|
|
|
@ -204,7 +204,7 @@ class Version10000Date20201015134000 extends SimpleMigrationStep {
|
|||
->andWhere($query->expr()->isNotNull('user_id'));
|
||||
|
||||
|
||||
$result = $query->execute();
|
||||
$result = $query->executeQuery();
|
||||
while ($row = $result->fetch()) {
|
||||
$lastJoinedCall = 0;
|
||||
if (!empty($row['last_joined_call'])) {
|
||||
|
@ -224,7 +224,7 @@ class Version10000Date20201015134000 extends SimpleMigrationStep {
|
|||
;
|
||||
|
||||
try {
|
||||
$insert->execute();
|
||||
$insert->executeStatement();
|
||||
} catch (\Exception $e) {
|
||||
if (class_exists(UniqueConstraintViolationException::class)
|
||||
&& $e instanceof UniqueConstraintViolationException) {
|
||||
|
|
|
@ -84,7 +84,7 @@ class Version11000Date20200922161218 extends SimpleMigrationStep {
|
|||
$bridges = [];
|
||||
$query->select('id', 'json_values')
|
||||
->from('talk_bridges');
|
||||
$result = $query->execute();
|
||||
$result = $query->executeQuery();
|
||||
while ($row = $result->fetch()) {
|
||||
$bridges[] = [
|
||||
'id' => $row['id'],
|
||||
|
@ -97,12 +97,12 @@ class Version11000Date20200922161218 extends SimpleMigrationStep {
|
|||
return;
|
||||
}
|
||||
|
||||
$query = $this->connection->getQueryBuilder();
|
||||
$query->update('talk_bridges')
|
||||
->set('enabled', $query->createParameter('enabled'))
|
||||
->set('pid', $query->createParameter('pid'))
|
||||
->set('json_values', $query->createParameter('json_values'))
|
||||
->where($query->expr()->eq('id', $query->createParameter('id')));
|
||||
$update = $this->connection->getQueryBuilder();
|
||||
$update->update('talk_bridges')
|
||||
->set('enabled', $update->createParameter('enabled'))
|
||||
->set('pid', $update->createParameter('pid'))
|
||||
->set('json_values', $update->createParameter('json_values'))
|
||||
->where($update->expr()->eq('id', $update->createParameter('id')));
|
||||
|
||||
foreach ($bridges as $bridge) {
|
||||
$values = json_decode($bridge['json_values'], true);
|
||||
|
@ -111,11 +111,11 @@ class Version11000Date20200922161218 extends SimpleMigrationStep {
|
|||
$newValues = $values['parts'] ?: [];
|
||||
$encodedNewValues = json_encode($newValues);
|
||||
|
||||
$query->setParameter('enabled', $intEnabled, IQueryBuilder::PARAM_INT)
|
||||
$update->setParameter('enabled', $intEnabled, IQueryBuilder::PARAM_INT)
|
||||
->setParameter('pid', $values['pid'], IQueryBuilder::PARAM_INT)
|
||||
->setParameter('json_values', $encodedNewValues, IQueryBuilder::PARAM_STR)
|
||||
->setParameter('id', $bridge['id'], IQueryBuilder::PARAM_INT);
|
||||
$query->execute();
|
||||
$update->executeStatement();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ class Version2000Date20171026140256 extends SimpleMigrationStep {
|
|||
$query = $this->connection->getQueryBuilder();
|
||||
$query->select('*')
|
||||
->from('spreedme_rooms');
|
||||
$result = $query->execute();
|
||||
$result = $query->executeQuery();
|
||||
|
||||
$output->startProgress();
|
||||
while ($row = $result->fetch()) {
|
||||
|
@ -81,7 +81,7 @@ class Version2000Date20171026140256 extends SimpleMigrationStep {
|
|||
}
|
||||
|
||||
$update->setParameter('room_id', (int) $row['id'], IQueryBuilder::PARAM_INT)
|
||||
->execute();
|
||||
->executeStatement();
|
||||
}
|
||||
$output->finishProgress();
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@ class Version2000Date20171026140257 extends SimpleMigrationStep {
|
|||
->from('spreedme_rooms')
|
||||
->where($query->expr()->emptyString('token'))
|
||||
->orWhere($query->expr()->isNull('token'));
|
||||
$result = $query->execute();
|
||||
$result = $query->executeQuery();
|
||||
|
||||
$output->startProgress();
|
||||
while ($row = $result->fetch()) {
|
||||
|
@ -89,7 +89,7 @@ class Version2000Date20171026140257 extends SimpleMigrationStep {
|
|||
|
||||
$update->setParameter('token', $token)
|
||||
->setParameter('room_id', (int) $row['id'], IQueryBuilder::PARAM_INT)
|
||||
->execute();
|
||||
->executeStatement();
|
||||
}
|
||||
$output->finishProgress();
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ class Version2001Date20170707115443 extends SimpleMigrationStep {
|
|||
|
||||
$query->selectAlias($query->createFunction('COUNT(*)'), 'num_rooms')
|
||||
->from('spreedme_rooms');
|
||||
$result = $query->execute();
|
||||
$result = $query->executeQuery();
|
||||
$return = (int) $result->fetch();
|
||||
$result->closeCursor();
|
||||
$numRooms = (int) $return['num_rooms'];
|
||||
|
@ -100,7 +100,7 @@ class Version2001Date20170707115443 extends SimpleMigrationStep {
|
|||
$query->select('id')
|
||||
->from('spreedme_rooms')
|
||||
->where($query->expr()->eq('type', $query->createNamedParameter(Room::TYPE_ONE_TO_ONE)));
|
||||
$result = $query->execute();
|
||||
$result = $query->executeQuery();
|
||||
|
||||
$one2oneRooms = [];
|
||||
while ($row = $result->fetch()) {
|
||||
|
@ -136,7 +136,7 @@ class Version2001Date20170707115443 extends SimpleMigrationStep {
|
|||
->where($update->expr()->in('roomId', $update->createNamedParameter($one2oneRooms, IQueryBuilder::PARAM_INT_ARRAY)));
|
||||
}
|
||||
|
||||
return (int) $update->execute();
|
||||
return (int) $update->executeStatement();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -160,6 +160,6 @@ class Version2001Date20170707115443 extends SimpleMigrationStep {
|
|||
$update->andWhere($update->expr()->notIn('roomId', $update->createNamedParameter($one2oneRooms, IQueryBuilder::PARAM_INT_ARRAY)));
|
||||
}
|
||||
|
||||
return (int) $update->execute();
|
||||
return (int) $update->executeStatement();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -195,14 +195,14 @@ class Version2001Date20171026134605 extends SimpleMigrationStep {
|
|||
$query->select('*')
|
||||
->from('spreedme_rooms');
|
||||
|
||||
$result = $query->execute();
|
||||
$result = $query->executeQuery();
|
||||
while ($row = $result->fetch()) {
|
||||
$insert
|
||||
->setParameter('name', $row['name'])
|
||||
->setParameter('token', $row['token'])
|
||||
->setParameter('type', (int) $row['type'], IQueryBuilder::PARAM_INT)
|
||||
->setParameter('password', $row['password']);
|
||||
$insert->execute();
|
||||
$insert->executeStatement();
|
||||
|
||||
$roomIdMap[(int)$row['id']] = $insert->getLastInsertId();
|
||||
}
|
||||
|
@ -240,7 +240,7 @@ class Version2001Date20171026134605 extends SimpleMigrationStep {
|
|||
$query->select('*')
|
||||
->from('spreedme_room_participants');
|
||||
|
||||
$result = $query->execute();
|
||||
$result = $query->executeQuery();
|
||||
while ($row = $result->fetch()) {
|
||||
if (!isset($roomIdMap[(int) $row['roomId']])) {
|
||||
continue;
|
||||
|
@ -257,7 +257,7 @@ class Version2001Date20171026134605 extends SimpleMigrationStep {
|
|||
} else {
|
||||
$insert->setParameter('participantType', (int) $row['participanttype'], IQueryBuilder::PARAM_INT);
|
||||
}
|
||||
$insert->execute();
|
||||
$insert->executeStatement();
|
||||
}
|
||||
$result->closeCursor();
|
||||
}
|
||||
|
@ -282,7 +282,7 @@ class Version2001Date20171026134605 extends SimpleMigrationStep {
|
|||
->andWhere($query->expr()->eq('object_type', $query->createNamedParameter('room')));
|
||||
|
||||
try {
|
||||
$result = $query->execute();
|
||||
$result = $query->executeQuery();
|
||||
} catch (TableNotFoundException $e) {
|
||||
return;
|
||||
}
|
||||
|
@ -292,7 +292,7 @@ class Version2001Date20171026134605 extends SimpleMigrationStep {
|
|||
$delete
|
||||
->setParameter('id', (int) $row['notification_id'])
|
||||
;
|
||||
$delete->execute();
|
||||
$delete->executeStatement();
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -300,7 +300,7 @@ class Version2001Date20171026134605 extends SimpleMigrationStep {
|
|||
->setParameter('id', (int) $row['notification_id'])
|
||||
->setParameter('newId', $roomIdMap[(int) $row['object_id']])
|
||||
;
|
||||
$update->execute();
|
||||
$update->executeStatement();
|
||||
}
|
||||
$result->closeCursor();
|
||||
}
|
||||
|
@ -327,7 +327,7 @@ class Version2001Date20171026134605 extends SimpleMigrationStep {
|
|||
->andWhere($query->expr()->eq('object_type', $query->createNamedParameter('room')));
|
||||
|
||||
try {
|
||||
$result = $query->execute();
|
||||
$result = $query->executeQuery();
|
||||
} catch (TableNotFoundException $e) {
|
||||
return;
|
||||
} catch (InvalidFieldNameException $e) {
|
||||
|
@ -339,7 +339,7 @@ class Version2001Date20171026134605 extends SimpleMigrationStep {
|
|||
$delete
|
||||
->setParameter('id', (int) $row['activity_id'])
|
||||
;
|
||||
$delete->execute();
|
||||
$delete->executeStatement();
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -349,7 +349,7 @@ class Version2001Date20171026134605 extends SimpleMigrationStep {
|
|||
$delete
|
||||
->setParameter('id', (int) $row['activity_id'])
|
||||
;
|
||||
$delete->execute();
|
||||
$delete->executeStatement();
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -360,7 +360,7 @@ class Version2001Date20171026134605 extends SimpleMigrationStep {
|
|||
->setParameter('newId', $roomIdMap[(int) $row['object_id']])
|
||||
->setParameter('subjectParams', json_encode($params))
|
||||
;
|
||||
$update->execute();
|
||||
$update->executeStatement();
|
||||
}
|
||||
$result->closeCursor();
|
||||
}
|
||||
|
@ -385,7 +385,7 @@ class Version2001Date20171026134605 extends SimpleMigrationStep {
|
|||
->andWhere($query->expr()->eq('amq_type', $query->createNamedParameter('spreed')));
|
||||
|
||||
try {
|
||||
$result = $query->execute();
|
||||
$result = $query->executeQuery();
|
||||
} catch (TableNotFoundException $e) {
|
||||
return;
|
||||
} catch (InvalidFieldNameException $e) {
|
||||
|
@ -399,7 +399,7 @@ class Version2001Date20171026134605 extends SimpleMigrationStep {
|
|||
$delete
|
||||
->setParameter('id', (int) $row['mail_id'])
|
||||
;
|
||||
$delete->execute();
|
||||
$delete->executeStatement();
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -409,7 +409,7 @@ class Version2001Date20171026134605 extends SimpleMigrationStep {
|
|||
->setParameter('id', (int) $row['mail_id'])
|
||||
->setParameter('subjectParams', json_encode($params))
|
||||
;
|
||||
$update->execute();
|
||||
$update->executeStatement();
|
||||
}
|
||||
$result->closeCursor();
|
||||
}
|
||||
|
|
|
@ -127,7 +127,7 @@ class Version2001Date20180103144447 extends SimpleMigrationStep {
|
|||
$update->update('talk_rooms')
|
||||
->set('active_since', 'activeSince')
|
||||
->set('active_guests', 'activeGuests');
|
||||
$update->execute();
|
||||
$update->executeStatement();
|
||||
|
||||
$update = $this->connection->getQueryBuilder();
|
||||
$update->update('talk_participants')
|
||||
|
@ -137,13 +137,13 @@ class Version2001Date20180103144447 extends SimpleMigrationStep {
|
|||
->set('session_id', 'sessionId')
|
||||
->set('participant_type', 'participantType')
|
||||
->set('in_call', 'inCall');
|
||||
$update->execute();
|
||||
$update->executeStatement();
|
||||
} else {
|
||||
$update = $this->connection->getQueryBuilder();
|
||||
$update->update('talk_rooms')
|
||||
->set('active_since', 'activesince')
|
||||
->set('active_guests', 'activeguests');
|
||||
$update->execute();
|
||||
$update->executeStatement();
|
||||
|
||||
$update = $this->connection->getQueryBuilder();
|
||||
$update->update('talk_participants')
|
||||
|
@ -153,7 +153,7 @@ class Version2001Date20180103144447 extends SimpleMigrationStep {
|
|||
->set('session_id', 'sessionid')
|
||||
->set('participant_type', 'participanttype')
|
||||
->set('in_call', 'incall');
|
||||
$update->execute();
|
||||
$update->executeStatement();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -82,12 +82,12 @@ class Version3003Date20180718112436 extends SimpleMigrationStep {
|
|||
->where($query->expr()->eq('object_type', $query->createNamedParameter('chat')))
|
||||
->groupBy('object_id');
|
||||
|
||||
$result = $query->execute();
|
||||
$result = $query->executeQuery();
|
||||
while ($row = $result->fetch()) {
|
||||
$lastActivity = new \DateTime($row['last_activity']);
|
||||
$update->setParameter('activity', $lastActivity, IQueryBuilder::PARAM_DATE)
|
||||
->setParameter('room', $row['object_id']);
|
||||
$update->execute();
|
||||
$update->executeStatement();
|
||||
}
|
||||
$result->closeCursor();
|
||||
}
|
||||
|
|
|
@ -79,11 +79,11 @@ class Version3003Date20180718133519 extends SimpleMigrationStep {
|
|||
->where($query->expr()->eq('object_type', $query->createNamedParameter('chat')))
|
||||
->groupBy('object_id');
|
||||
|
||||
$result = $query->execute();
|
||||
$result = $query->executeQuery();
|
||||
while ($row = $result->fetch()) {
|
||||
$update->setParameter('message', $row['message'])
|
||||
->setParameter('room', $row['object_id']);
|
||||
$update->execute();
|
||||
$update->executeStatement();
|
||||
}
|
||||
$result->closeCursor();
|
||||
}
|
||||
|
|
|
@ -96,12 +96,12 @@ class Version7000Date20190724121136 extends SimpleMigrationStep {
|
|||
->where($update->expr()->eq('user_id', $update->createParameter('user_id')))
|
||||
->andWhere($update->expr()->eq('room_id', $update->createParameter('room_id')));
|
||||
|
||||
$result = $query->execute();
|
||||
$result = $query->executeQuery();
|
||||
while ($row = $result->fetch()) {
|
||||
$update->setParameter('message_id', (int) $row['last_comment'], IQueryBuilder::PARAM_INT)
|
||||
->setParameter('user_id', $row['user_id'])
|
||||
->setParameter('room_id', (int) $row['object_id'], IQueryBuilder::PARAM_INT);
|
||||
$update->execute();
|
||||
$update->executeStatement();
|
||||
}
|
||||
$result->closeCursor();
|
||||
|
||||
|
@ -110,11 +110,11 @@ class Version7000Date20190724121136 extends SimpleMigrationStep {
|
|||
* as the comment was posted (author only), we set the read marker to -1
|
||||
* for all users and in case of -1 we calculate the marker on the next request.
|
||||
*/
|
||||
$default = $this->connection->getQueryBuilder();
|
||||
$default->update('talk_participants')
|
||||
->set('last_read_message', $default->createNamedParameter(-1))
|
||||
->where($default->expr()->isNotNull('user_id'))
|
||||
->andWhere($default->expr()->eq('last_read_message', $default->createNamedParameter(0)));
|
||||
$default->execute();
|
||||
$update = $this->connection->getQueryBuilder();
|
||||
$update->update('talk_participants')
|
||||
->set('last_read_message', $update->createNamedParameter(-1))
|
||||
->where($update->expr()->isNotNull('user_id'))
|
||||
->andWhere($update->expr()->eq('last_read_message', $update->createNamedParameter(0)));
|
||||
$update->executeStatement();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,12 +63,12 @@ class Version7000Date20190724121137 extends SimpleMigrationStep {
|
|||
->where($update->expr()->eq('user_id', $update->createParameter('user_id')))
|
||||
->andWhere($update->expr()->eq('room_id', $update->createParameter('room_id')));
|
||||
|
||||
$result = $query->execute();
|
||||
$result = $query->executeQuery();
|
||||
while ($row = $result->fetch()) {
|
||||
$update->setParameter('message_id', (int) $row['last_mention_message'], IQueryBuilder::PARAM_INT)
|
||||
->setParameter('user_id', $row['user_id'])
|
||||
->setParameter('room_id', (int) $row['room_id'], IQueryBuilder::PARAM_INT);
|
||||
$update->execute();
|
||||
$update->executeStatement();
|
||||
}
|
||||
$result->closeCursor();
|
||||
}
|
||||
|
|
|
@ -152,7 +152,7 @@ class AttendeeMapper extends QBMapper {
|
|||
$query->andWhere($query->expr()->gte('last_joined_call', $query->createNamedParameter($lastJoinedCall, IQueryBuilder::PARAM_INT)));
|
||||
}
|
||||
|
||||
$result = $query->execute();
|
||||
$result = $query->executeQuery();
|
||||
$count = (int) $result->fetchOne();
|
||||
$result->closeCursor();
|
||||
|
||||
|
@ -178,7 +178,7 @@ class AttendeeMapper extends QBMapper {
|
|||
$query->andWhere($query->expr()->in('participant_type', $query->createNamedParameter($participantType, IQueryBuilder::PARAM_INT_ARRAY)));
|
||||
}
|
||||
|
||||
$result = $query->execute();
|
||||
$result = $query->executeQuery();
|
||||
$row = $result->fetch();
|
||||
$result->closeCursor();
|
||||
|
||||
|
@ -190,11 +190,11 @@ class AttendeeMapper extends QBMapper {
|
|||
* @return int Number of deleted entities
|
||||
*/
|
||||
public function deleteByIds(array $ids): int {
|
||||
$query = $this->db->getQueryBuilder();
|
||||
$query->delete($this->getTableName())
|
||||
->where($query->expr()->in('id', $query->createNamedParameter($ids, IQueryBuilder::PARAM_INT_ARRAY)));
|
||||
$delete = $this->db->getQueryBuilder();
|
||||
$delete->delete($this->getTableName())
|
||||
->where($delete->expr()->in('id', $delete->createNamedParameter($ids, IQueryBuilder::PARAM_INT_ARRAY)));
|
||||
|
||||
return (int) $query->execute();
|
||||
return (int) $delete->executeStatement();
|
||||
}
|
||||
|
||||
public function modifyPermissions(int $roomId, string $mode, int $newState): void {
|
||||
|
|
|
@ -71,11 +71,11 @@ class SessionMapper extends QBMapper {
|
|||
* @return int Number of deleted entities
|
||||
*/
|
||||
public function deleteByAttendeeId(int $attendeeId): int {
|
||||
$query = $this->db->getQueryBuilder();
|
||||
$query->delete($this->getTableName())
|
||||
->where($query->expr()->eq('attendee_id', $query->createNamedParameter($attendeeId, IQueryBuilder::PARAM_INT)));
|
||||
$delete = $this->db->getQueryBuilder();
|
||||
$delete->delete($this->getTableName())
|
||||
->where($delete->expr()->eq('attendee_id', $delete->createNamedParameter($attendeeId, IQueryBuilder::PARAM_INT)));
|
||||
|
||||
return (int) $query->execute();
|
||||
return (int) $delete->executeStatement();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -83,11 +83,11 @@ class SessionMapper extends QBMapper {
|
|||
* @return int Number of deleted entities
|
||||
*/
|
||||
public function deleteByIds(array $ids): int {
|
||||
$query = $this->db->getQueryBuilder();
|
||||
$query->delete($this->getTableName())
|
||||
->where($query->expr()->in('id', $query->createNamedParameter($ids, IQueryBuilder::PARAM_INT_ARRAY)));
|
||||
$delete = $this->db->getQueryBuilder();
|
||||
$delete->delete($this->getTableName())
|
||||
->where($delete->expr()->in('id', $delete->createNamedParameter($ids, IQueryBuilder::PARAM_INT_ARRAY)));
|
||||
|
||||
return (int) $query->execute();
|
||||
return (int) $delete->executeStatement();
|
||||
}
|
||||
|
||||
public function createSessionFromRow(array $row): Session {
|
||||
|
|
210
lib/Room.php
210
lib/Room.php
|
@ -485,7 +485,7 @@ class Room {
|
|||
}
|
||||
}
|
||||
|
||||
$result = $query->execute();
|
||||
$result = $query->executeQuery();
|
||||
$row = $result->fetch();
|
||||
$result->closeCursor();
|
||||
|
||||
|
@ -520,7 +520,7 @@ class Room {
|
|||
->where($query->expr()->eq('s.session_id', $query->createNamedParameter($sessionId)))
|
||||
->andWhere($query->expr()->eq('a.room_id', $query->createNamedParameter($this->getId())))
|
||||
->setMaxResults(1);
|
||||
$result = $query->execute();
|
||||
$result = $query->executeQuery();
|
||||
$row = $result->fetch();
|
||||
$result->closeCursor();
|
||||
|
||||
|
@ -544,7 +544,7 @@ class Room {
|
|||
->where($query->expr()->eq('a.pin', $query->createNamedParameter($pin)))
|
||||
->andWhere($query->expr()->eq('a.room_id', $query->createNamedParameter($this->getId())))
|
||||
->setMaxResults(1);
|
||||
$result = $query->execute();
|
||||
$result = $query->executeQuery();
|
||||
$row = $result->fetch();
|
||||
$result->closeCursor();
|
||||
|
||||
|
@ -586,7 +586,7 @@ class Room {
|
|||
}
|
||||
}
|
||||
|
||||
$result = $query->execute();
|
||||
$result = $query->executeQuery();
|
||||
$row = $result->fetch();
|
||||
$result->closeCursor();
|
||||
|
||||
|
@ -634,7 +634,7 @@ class Room {
|
|||
}
|
||||
}
|
||||
|
||||
$result = $query->execute();
|
||||
$result = $query->executeQuery();
|
||||
$row = $result->fetch();
|
||||
$result->closeCursor();
|
||||
|
||||
|
@ -648,17 +648,17 @@ class Room {
|
|||
public function deleteRoom(): void {
|
||||
$event = new RoomEvent($this);
|
||||
$this->dispatcher->dispatch(self::EVENT_BEFORE_ROOM_DELETE, $event);
|
||||
$query = $this->db->getQueryBuilder();
|
||||
$delete = $this->db->getQueryBuilder();
|
||||
|
||||
// Delete attendees
|
||||
$query->delete('talk_attendees')
|
||||
->where($query->expr()->eq('room_id', $query->createNamedParameter($this->getId(), IQueryBuilder::PARAM_INT)));
|
||||
$query->execute();
|
||||
$delete->delete('talk_attendees')
|
||||
->where($delete->expr()->eq('room_id', $delete->createNamedParameter($this->getId(), IQueryBuilder::PARAM_INT)));
|
||||
$delete->executeStatement();
|
||||
|
||||
// Delete room
|
||||
$query->delete('talk_rooms')
|
||||
->where($query->expr()->eq('id', $query->createNamedParameter($this->getId(), IQueryBuilder::PARAM_INT)));
|
||||
$query->execute();
|
||||
$delete->delete('talk_rooms')
|
||||
->where($delete->expr()->eq('id', $delete->createNamedParameter($this->getId(), IQueryBuilder::PARAM_INT)));
|
||||
$delete->executeStatement();
|
||||
|
||||
$this->dispatcher->dispatch(self::EVENT_AFTER_ROOM_DELETE, $event);
|
||||
if (class_exists(CriticalActionPerformedEvent::class)) {
|
||||
|
@ -683,11 +683,11 @@ class Room {
|
|||
$event = new ModifyRoomEvent($this, 'name', $newName, $oldName);
|
||||
$this->dispatcher->dispatch(self::EVENT_BEFORE_NAME_SET, $event);
|
||||
|
||||
$query = $this->db->getQueryBuilder();
|
||||
$query->update('talk_rooms')
|
||||
->set('name', $query->createNamedParameter($newName))
|
||||
->where($query->expr()->eq('id', $query->createNamedParameter($this->getId(), IQueryBuilder::PARAM_INT)));
|
||||
$query->execute();
|
||||
$update = $this->db->getQueryBuilder();
|
||||
$update->update('talk_rooms')
|
||||
->set('name', $update->createNamedParameter($newName))
|
||||
->where($update->expr()->eq('id', $update->createNamedParameter($this->getId(), IQueryBuilder::PARAM_INT)));
|
||||
$update->executeStatement();
|
||||
$this->name = $newName;
|
||||
|
||||
$this->dispatcher->dispatch(self::EVENT_AFTER_NAME_SET, $event);
|
||||
|
@ -715,11 +715,11 @@ class Room {
|
|||
$event = new ModifyRoomEvent($this, 'description', $description, $oldDescription);
|
||||
$this->dispatcher->dispatch(self::EVENT_BEFORE_DESCRIPTION_SET, $event);
|
||||
|
||||
$query = $this->db->getQueryBuilder();
|
||||
$query->update('talk_rooms')
|
||||
->set('description', $query->createNamedParameter($description))
|
||||
->where($query->expr()->eq('id', $query->createNamedParameter($this->getId(), IQueryBuilder::PARAM_INT)));
|
||||
$query->execute();
|
||||
$update = $this->db->getQueryBuilder();
|
||||
$update->update('talk_rooms')
|
||||
->set('description', $update->createNamedParameter($description))
|
||||
->where($update->expr()->eq('id', $update->createNamedParameter($this->getId(), IQueryBuilder::PARAM_INT)));
|
||||
$update->executeStatement();
|
||||
$this->description = $description;
|
||||
|
||||
$this->dispatcher->dispatch(self::EVENT_AFTER_DESCRIPTION_SET, $event);
|
||||
|
@ -741,11 +741,11 @@ class Room {
|
|||
$event = new ModifyRoomEvent($this, 'password', $password);
|
||||
$this->dispatcher->dispatch(self::EVENT_BEFORE_PASSWORD_SET, $event);
|
||||
|
||||
$query = $this->db->getQueryBuilder();
|
||||
$query->update('talk_rooms')
|
||||
->set('password', $query->createNamedParameter($hash))
|
||||
->where($query->expr()->eq('id', $query->createNamedParameter($this->getId(), IQueryBuilder::PARAM_INT)));
|
||||
$query->execute();
|
||||
$update = $this->db->getQueryBuilder();
|
||||
$update->update('talk_rooms')
|
||||
->set('password', $update->createNamedParameter($hash))
|
||||
->where($update->expr()->eq('id', $update->createNamedParameter($this->getId(), IQueryBuilder::PARAM_INT)));
|
||||
$update->executeStatement();
|
||||
$this->password = $hash;
|
||||
|
||||
$this->dispatcher->dispatch(self::EVENT_AFTER_PASSWORD_SET, $event);
|
||||
|
@ -758,11 +758,11 @@ class Room {
|
|||
* @return bool
|
||||
*/
|
||||
public function setLastActivity(\DateTime $now): bool {
|
||||
$query = $this->db->getQueryBuilder();
|
||||
$query->update('talk_rooms')
|
||||
->set('last_activity', $query->createNamedParameter($now, 'datetime'))
|
||||
->where($query->expr()->eq('id', $query->createNamedParameter($this->getId(), IQueryBuilder::PARAM_INT)));
|
||||
$query->execute();
|
||||
$update = $this->db->getQueryBuilder();
|
||||
$update->update('talk_rooms')
|
||||
->set('last_activity', $update->createNamedParameter($now, 'datetime'))
|
||||
->where($update->expr()->eq('id', $update->createNamedParameter($this->getId(), IQueryBuilder::PARAM_INT)));
|
||||
$update->executeStatement();
|
||||
|
||||
$this->lastActivity = $now;
|
||||
|
||||
|
@ -777,38 +777,38 @@ class Room {
|
|||
*/
|
||||
public function setActiveSince(\DateTime $since, int $callFlag, bool $isGuest): bool {
|
||||
if ($isGuest && $this->getType() === self::TYPE_PUBLIC) {
|
||||
$query = $this->db->getQueryBuilder();
|
||||
$query->update('talk_rooms')
|
||||
->set('active_guests', $query->createFunction($query->getColumnName('active_guests') . ' + 1'))
|
||||
$update = $this->db->getQueryBuilder();
|
||||
$update->update('talk_rooms')
|
||||
->set('active_guests', $update->createFunction($update->getColumnName('active_guests') . ' + 1'))
|
||||
->set(
|
||||
'call_flag',
|
||||
$query->expr()->bitwiseOr('call_flag', $callFlag)
|
||||
$update->expr()->bitwiseOr('call_flag', $callFlag)
|
||||
)
|
||||
->where($query->expr()->eq('id', $query->createNamedParameter($this->getId(), IQueryBuilder::PARAM_INT)));
|
||||
$query->execute();
|
||||
->where($update->expr()->eq('id', $update->createNamedParameter($this->getId(), IQueryBuilder::PARAM_INT)));
|
||||
$update->executeStatement();
|
||||
|
||||
$this->activeGuests++;
|
||||
} elseif (!$isGuest) {
|
||||
$query = $this->db->getQueryBuilder();
|
||||
$query->update('talk_rooms')
|
||||
$update = $this->db->getQueryBuilder();
|
||||
$update->update('talk_rooms')
|
||||
->set(
|
||||
'call_flag',
|
||||
$query->expr()->bitwiseOr('call_flag', $callFlag)
|
||||
$update->expr()->bitwiseOr('call_flag', $callFlag)
|
||||
)
|
||||
->where($query->expr()->eq('id', $query->createNamedParameter($this->getId(), IQueryBuilder::PARAM_INT)));
|
||||
$query->execute();
|
||||
->where($update->expr()->eq('id', $update->createNamedParameter($this->getId(), IQueryBuilder::PARAM_INT)));
|
||||
$update->executeStatement();
|
||||
}
|
||||
|
||||
if ($this->activeSince instanceof \DateTime) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$query = $this->db->getQueryBuilder();
|
||||
$query->update('talk_rooms')
|
||||
->set('active_since', $query->createNamedParameter($since, IQueryBuilder::PARAM_DATE))
|
||||
->where($query->expr()->eq('id', $query->createNamedParameter($this->getId(), IQueryBuilder::PARAM_INT)))
|
||||
->andWhere($query->expr()->isNull('active_since'));
|
||||
$query->execute();
|
||||
$update = $this->db->getQueryBuilder();
|
||||
$update->update('talk_rooms')
|
||||
->set('active_since', $update->createNamedParameter($since, IQueryBuilder::PARAM_DATE))
|
||||
->where($update->expr()->eq('id', $update->createNamedParameter($this->getId(), IQueryBuilder::PARAM_INT)))
|
||||
->andWhere($update->expr()->isNull('active_since'));
|
||||
$update->executeStatement();
|
||||
|
||||
$this->activeSince = $since;
|
||||
|
||||
|
@ -816,43 +816,43 @@ class Room {
|
|||
}
|
||||
|
||||
public function setLastMessage(IComment $message): void {
|
||||
$query = $this->db->getQueryBuilder();
|
||||
$query->update('talk_rooms')
|
||||
->set('last_message', $query->createNamedParameter((int) $message->getId()))
|
||||
->where($query->expr()->eq('id', $query->createNamedParameter($this->getId(), IQueryBuilder::PARAM_INT)));
|
||||
$query->execute();
|
||||
$update = $this->db->getQueryBuilder();
|
||||
$update->update('talk_rooms')
|
||||
->set('last_message', $update->createNamedParameter((int) $message->getId()))
|
||||
->where($update->expr()->eq('id', $update->createNamedParameter($this->getId(), IQueryBuilder::PARAM_INT)));
|
||||
$update->executeStatement();
|
||||
|
||||
$this->lastMessage = $message;
|
||||
$this->lastMessageId = (int) $message->getId();
|
||||
}
|
||||
|
||||
public function resetActiveSince(): bool {
|
||||
$query = $this->db->getQueryBuilder();
|
||||
$query->update('talk_rooms')
|
||||
->set('active_guests', $query->createNamedParameter(0, IQueryBuilder::PARAM_INT))
|
||||
->set('active_since', $query->createNamedParameter(null, IQueryBuilder::PARAM_DATE))
|
||||
->set('call_flag', $query->createNamedParameter(0, IQueryBuilder::PARAM_INT))
|
||||
->set('call_permissions', $query->createNamedParameter(Attendee::PERMISSIONS_DEFAULT, IQueryBuilder::PARAM_INT))
|
||||
->where($query->expr()->eq('id', $query->createNamedParameter($this->getId(), IQueryBuilder::PARAM_INT)))
|
||||
->andWhere($query->expr()->isNotNull('active_since'));
|
||||
$update = $this->db->getQueryBuilder();
|
||||
$update->update('talk_rooms')
|
||||
->set('active_guests', $update->createNamedParameter(0, IQueryBuilder::PARAM_INT))
|
||||
->set('active_since', $update->createNamedParameter(null, IQueryBuilder::PARAM_DATE))
|
||||
->set('call_flag', $update->createNamedParameter(0, IQueryBuilder::PARAM_INT))
|
||||
->set('call_permissions', $update->createNamedParameter(Attendee::PERMISSIONS_DEFAULT, IQueryBuilder::PARAM_INT))
|
||||
->where($update->expr()->eq('id', $update->createNamedParameter($this->getId(), IQueryBuilder::PARAM_INT)))
|
||||
->andWhere($update->expr()->isNotNull('active_since'));
|
||||
|
||||
$this->activeGuests = 0;
|
||||
$this->activeSince = null;
|
||||
|
||||
return (bool) $query->execute();
|
||||
return (bool) $update->executeStatement();
|
||||
}
|
||||
|
||||
public function setAssignedSignalingServer(?int $signalingServer): bool {
|
||||
$query = $this->db->getQueryBuilder();
|
||||
$query->update('talk_rooms')
|
||||
->set('assigned_hpb', $query->createNamedParameter($signalingServer))
|
||||
->where($query->expr()->eq('id', $query->createNamedParameter($this->getId(), IQueryBuilder::PARAM_INT)));
|
||||
$update = $this->db->getQueryBuilder();
|
||||
$update->update('talk_rooms')
|
||||
->set('assigned_hpb', $update->createNamedParameter($signalingServer))
|
||||
->where($update->expr()->eq('id', $update->createNamedParameter($this->getId(), IQueryBuilder::PARAM_INT)));
|
||||
|
||||
if ($signalingServer !== null) {
|
||||
$query->andWhere($query->expr()->isNull('assigned_hpb'));
|
||||
$update->andWhere($update->expr()->isNull('assigned_hpb'));
|
||||
}
|
||||
|
||||
return (bool) $query->execute();
|
||||
return (bool) $update->executeStatement();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -877,21 +877,21 @@ class Room {
|
|||
$event = new ModifyRoomEvent($this, 'type', $newType, $oldType);
|
||||
$this->dispatcher->dispatch(self::EVENT_BEFORE_TYPE_SET, $event);
|
||||
|
||||
$query = $this->db->getQueryBuilder();
|
||||
$query->update('talk_rooms')
|
||||
->set('type', $query->createNamedParameter($newType, IQueryBuilder::PARAM_INT))
|
||||
->where($query->expr()->eq('id', $query->createNamedParameter($this->getId(), IQueryBuilder::PARAM_INT)));
|
||||
$query->execute();
|
||||
$update = $this->db->getQueryBuilder();
|
||||
$update->update('talk_rooms')
|
||||
->set('type', $update->createNamedParameter($newType, IQueryBuilder::PARAM_INT))
|
||||
->where($update->expr()->eq('id', $update->createNamedParameter($this->getId(), IQueryBuilder::PARAM_INT)));
|
||||
$update->executeStatement();
|
||||
|
||||
$this->type = $newType;
|
||||
|
||||
if ($oldType === self::TYPE_PUBLIC) {
|
||||
// Kick all guests and users that were not invited
|
||||
$query = $this->db->getQueryBuilder();
|
||||
$query->delete('talk_attendees')
|
||||
->where($query->expr()->eq('room_id', $query->createNamedParameter($this->getId(), IQueryBuilder::PARAM_INT)))
|
||||
->andWhere($query->expr()->in('participant_type', $query->createNamedParameter([Participant::GUEST, Participant::GUEST_MODERATOR, Participant::USER_SELF_JOINED], IQueryBuilder::PARAM_INT_ARRAY)));
|
||||
$query->execute();
|
||||
$delete = $this->db->getQueryBuilder();
|
||||
$delete->delete('talk_attendees')
|
||||
->where($delete->expr()->eq('room_id', $delete->createNamedParameter($this->getId(), IQueryBuilder::PARAM_INT)))
|
||||
->andWhere($delete->expr()->in('participant_type', $delete->createNamedParameter([Participant::GUEST, Participant::GUEST_MODERATOR, Participant::USER_SELF_JOINED], IQueryBuilder::PARAM_INT_ARRAY)));
|
||||
$delete->executeStatement();
|
||||
}
|
||||
|
||||
$this->dispatcher->dispatch(self::EVENT_AFTER_TYPE_SET, $event);
|
||||
|
@ -923,11 +923,11 @@ class Room {
|
|||
$event = new ModifyRoomEvent($this, 'readOnly', $newState, $oldState);
|
||||
$this->dispatcher->dispatch(self::EVENT_BEFORE_READONLY_SET, $event);
|
||||
|
||||
$query = $this->db->getQueryBuilder();
|
||||
$query->update('talk_rooms')
|
||||
->set('read_only', $query->createNamedParameter($newState, IQueryBuilder::PARAM_INT))
|
||||
->where($query->expr()->eq('id', $query->createNamedParameter($this->getId(), IQueryBuilder::PARAM_INT)));
|
||||
$query->execute();
|
||||
$update = $this->db->getQueryBuilder();
|
||||
$update->update('talk_rooms')
|
||||
->set('read_only', $update->createNamedParameter($newState, IQueryBuilder::PARAM_INT))
|
||||
->where($update->expr()->eq('id', $update->createNamedParameter($this->getId(), IQueryBuilder::PARAM_INT)));
|
||||
$update->executeStatement();
|
||||
|
||||
$this->readOnly = $newState;
|
||||
|
||||
|
@ -963,11 +963,11 @@ class Room {
|
|||
$event = new ModifyRoomEvent($this, 'listable', $newState, $oldState);
|
||||
$this->dispatcher->dispatch(self::EVENT_BEFORE_LISTABLE_SET, $event);
|
||||
|
||||
$query = $this->db->getQueryBuilder();
|
||||
$query->update('talk_rooms')
|
||||
->set('listable', $query->createNamedParameter($newState, IQueryBuilder::PARAM_INT))
|
||||
->where($query->expr()->eq('id', $query->createNamedParameter($this->getId(), IQueryBuilder::PARAM_INT)));
|
||||
$query->execute();
|
||||
$update = $this->db->getQueryBuilder();
|
||||
$update->update('talk_rooms')
|
||||
->set('listable', $update->createNamedParameter($newState, IQueryBuilder::PARAM_INT))
|
||||
->where($update->expr()->eq('id', $update->createNamedParameter($this->getId(), IQueryBuilder::PARAM_INT)));
|
||||
$update->executeStatement();
|
||||
|
||||
$this->listable = $newState;
|
||||
|
||||
|
@ -1003,12 +1003,12 @@ class Room {
|
|||
$event = new ModifyLobbyEvent($this, 'lobby', $newState, $oldState, $dateTime, $timerReached);
|
||||
$this->dispatcher->dispatch(self::EVENT_BEFORE_LOBBY_STATE_SET, $event);
|
||||
|
||||
$query = $this->db->getQueryBuilder();
|
||||
$query->update('talk_rooms')
|
||||
->set('lobby_state', $query->createNamedParameter($newState, IQueryBuilder::PARAM_INT))
|
||||
->set('lobby_timer', $query->createNamedParameter($dateTime, IQueryBuilder::PARAM_DATE))
|
||||
->where($query->expr()->eq('id', $query->createNamedParameter($this->getId(), IQueryBuilder::PARAM_INT)));
|
||||
$query->execute();
|
||||
$update = $this->db->getQueryBuilder();
|
||||
$update->update('talk_rooms')
|
||||
->set('lobby_state', $update->createNamedParameter($newState, IQueryBuilder::PARAM_INT))
|
||||
->set('lobby_timer', $update->createNamedParameter($dateTime, IQueryBuilder::PARAM_DATE))
|
||||
->where($update->expr()->eq('id', $update->createNamedParameter($this->getId(), IQueryBuilder::PARAM_INT)));
|
||||
$update->executeStatement();
|
||||
|
||||
$this->lobbyState = $newState;
|
||||
|
||||
|
@ -1039,11 +1039,11 @@ class Room {
|
|||
$event = new ModifyRoomEvent($this, 'sipEnabled', $newSipEnabled, $oldSipEnabled);
|
||||
$this->dispatcher->dispatch(self::EVENT_BEFORE_SIP_ENABLED_SET, $event);
|
||||
|
||||
$query = $this->db->getQueryBuilder();
|
||||
$query->update('talk_rooms')
|
||||
->set('sip_enabled', $query->createNamedParameter($newSipEnabled, IQueryBuilder::PARAM_INT))
|
||||
->where($query->expr()->eq('id', $query->createNamedParameter($this->getId(), IQueryBuilder::PARAM_INT)));
|
||||
$query->execute();
|
||||
$update = $this->db->getQueryBuilder();
|
||||
$update->update('talk_rooms')
|
||||
->set('sip_enabled', $update->createNamedParameter($newSipEnabled, IQueryBuilder::PARAM_INT))
|
||||
->where($update->expr()->eq('id', $update->createNamedParameter($this->getId(), IQueryBuilder::PARAM_INT)));
|
||||
$update->executeStatement();
|
||||
|
||||
$this->sipEnabled = $newSipEnabled;
|
||||
|
||||
|
@ -1057,11 +1057,11 @@ class Room {
|
|||
return false;
|
||||
}
|
||||
|
||||
$query = $this->db->getQueryBuilder();
|
||||
$query->update('talk_rooms')
|
||||
->set($level . '_permissions', $query->createNamedParameter($newPermissions, IQueryBuilder::PARAM_INT))
|
||||
->where($query->expr()->eq('id', $query->createNamedParameter($this->getId(), IQueryBuilder::PARAM_INT)));
|
||||
$query->executeStatement();
|
||||
$update = $this->db->getQueryBuilder();
|
||||
$update->update('talk_rooms')
|
||||
->set($level . '_permissions', $update->createNamedParameter($newPermissions, IQueryBuilder::PARAM_INT))
|
||||
->where($update->expr()->eq('id', $update->createNamedParameter($this->getId(), IQueryBuilder::PARAM_INT)));
|
||||
$update->executeStatement();
|
||||
|
||||
if ($level === 'default') {
|
||||
$this->defaultPermissions = $newPermissions;
|
||||
|
|
|
@ -855,7 +855,7 @@ class ParticipantService {
|
|||
->andWhere($query->expr()->lte('s.last_ping', $query->createNamedParameter($this->timeFactory->getTime() - Session::SESSION_TIMEOUT_KILL, IQueryBuilder::PARAM_INT)));
|
||||
|
||||
$sessionTableIds = [];
|
||||
$result = $query->execute();
|
||||
$result = $query->executeQuery();
|
||||
while ($row = $result->fetch()) {
|
||||
$sessionTableIds[] = (int) $row['s_id'];
|
||||
}
|
||||
|
@ -874,7 +874,7 @@ class ParticipantService {
|
|||
|
||||
$attendeeIds = [];
|
||||
$attendees = [];
|
||||
$result = $query->execute();
|
||||
$result = $query->executeQuery();
|
||||
while ($row = $result->fetch()) {
|
||||
$attendeeIds[] = (int) $row['a_id'];
|
||||
$attendees[] = $this->attendeeMapper->createAttendeeFromRow($row);
|
||||
|
@ -958,51 +958,51 @@ class ParticipantService {
|
|||
}
|
||||
|
||||
public function markUsersAsMentioned(Room $room, array $userIds, int $messageId, array $usersDirectlyMentioned): void {
|
||||
$query = $this->connection->getQueryBuilder();
|
||||
$query->update('talk_attendees')
|
||||
->set('last_mention_message', $query->createNamedParameter($messageId, IQueryBuilder::PARAM_INT))
|
||||
->where($query->expr()->eq('room_id', $query->createNamedParameter($room->getId(), IQueryBuilder::PARAM_INT)))
|
||||
->andWhere($query->expr()->eq('actor_type', $query->createNamedParameter(Attendee::ACTOR_USERS)))
|
||||
->andWhere($query->expr()->in('actor_id', $query->createNamedParameter($userIds, IQueryBuilder::PARAM_STR_ARRAY)));
|
||||
$query->execute();
|
||||
$update = $this->connection->getQueryBuilder();
|
||||
$update->update('talk_attendees')
|
||||
->set('last_mention_message', $update->createNamedParameter($messageId, IQueryBuilder::PARAM_INT))
|
||||
->where($update->expr()->eq('room_id', $update->createNamedParameter($room->getId(), IQueryBuilder::PARAM_INT)))
|
||||
->andWhere($update->expr()->eq('actor_type', $update->createNamedParameter(Attendee::ACTOR_USERS)))
|
||||
->andWhere($update->expr()->in('actor_id', $update->createNamedParameter($userIds, IQueryBuilder::PARAM_STR_ARRAY)));
|
||||
$update->executeStatement();
|
||||
|
||||
if (!empty($usersDirectlyMentioned)) {
|
||||
$query = $this->connection->getQueryBuilder();
|
||||
$query->update('talk_attendees')
|
||||
->set('last_mention_direct', $query->createNamedParameter($messageId, IQueryBuilder::PARAM_INT))
|
||||
->where($query->expr()->eq('room_id', $query->createNamedParameter($room->getId(), IQueryBuilder::PARAM_INT)))
|
||||
->andWhere($query->expr()->eq('actor_type', $query->createNamedParameter(Attendee::ACTOR_USERS)))
|
||||
->andWhere($query->expr()->in('actor_id', $query->createNamedParameter($usersDirectlyMentioned, IQueryBuilder::PARAM_STR_ARRAY)));
|
||||
$query->execute();
|
||||
$update = $this->connection->getQueryBuilder();
|
||||
$update->update('talk_attendees')
|
||||
->set('last_mention_direct', $update->createNamedParameter($messageId, IQueryBuilder::PARAM_INT))
|
||||
->where($update->expr()->eq('room_id', $update->createNamedParameter($room->getId(), IQueryBuilder::PARAM_INT)))
|
||||
->andWhere($update->expr()->eq('actor_type', $update->createNamedParameter(Attendee::ACTOR_USERS)))
|
||||
->andWhere($update->expr()->in('actor_id', $update->createNamedParameter($usersDirectlyMentioned, IQueryBuilder::PARAM_STR_ARRAY)));
|
||||
$update->executeStatement();
|
||||
}
|
||||
}
|
||||
|
||||
public function resetChatDetails(Room $room): void {
|
||||
$query = $this->connection->getQueryBuilder();
|
||||
$query->update('talk_attendees')
|
||||
->set('last_read_message', $query->createNamedParameter(0, IQueryBuilder::PARAM_INT))
|
||||
->set('last_mention_message', $query->createNamedParameter(0, IQueryBuilder::PARAM_INT))
|
||||
->set('last_mention_direct', $query->createNamedParameter(0, IQueryBuilder::PARAM_INT))
|
||||
->where($query->expr()->eq('room_id', $query->createNamedParameter($room->getId(), IQueryBuilder::PARAM_INT)));
|
||||
$query->executeStatement();
|
||||
$update = $this->connection->getQueryBuilder();
|
||||
$update->update('talk_attendees')
|
||||
->set('last_read_message', $update->createNamedParameter(0, IQueryBuilder::PARAM_INT))
|
||||
->set('last_mention_message', $update->createNamedParameter(0, IQueryBuilder::PARAM_INT))
|
||||
->set('last_mention_direct', $update->createNamedParameter(0, IQueryBuilder::PARAM_INT))
|
||||
->where($update->expr()->eq('room_id', $update->createNamedParameter($room->getId(), IQueryBuilder::PARAM_INT)));
|
||||
$update->executeStatement();
|
||||
}
|
||||
|
||||
public function updateReadPrivacyForActor(string $actorType, string $actorId, int $readPrivacy): void {
|
||||
$query = $this->connection->getQueryBuilder();
|
||||
$query->update('talk_attendees')
|
||||
->set('read_privacy', $query->createNamedParameter($readPrivacy, IQueryBuilder::PARAM_INT))
|
||||
->where($query->expr()->eq('actor_type', $query->createNamedParameter($actorType)))
|
||||
->andWhere($query->expr()->eq('actor_id', $query->createNamedParameter($actorId)));
|
||||
$query->execute();
|
||||
$update = $this->connection->getQueryBuilder();
|
||||
$update->update('talk_attendees')
|
||||
->set('read_privacy', $update->createNamedParameter($readPrivacy, IQueryBuilder::PARAM_INT))
|
||||
->where($update->expr()->eq('actor_type', $update->createNamedParameter($actorType)))
|
||||
->andWhere($update->expr()->eq('actor_id', $update->createNamedParameter($actorId)));
|
||||
$update->executeStatement();
|
||||
}
|
||||
|
||||
public function updateDisplayNameForActor(string $actorType, string $actorId, string $displayName): void {
|
||||
$query = $this->connection->getQueryBuilder();
|
||||
$query->update('talk_attendees')
|
||||
->set('display_name', $query->createNamedParameter($displayName))
|
||||
->where($query->expr()->eq('actor_type', $query->createNamedParameter($actorType)))
|
||||
->andWhere($query->expr()->eq('actor_id', $query->createNamedParameter($actorId)));
|
||||
$query->execute();
|
||||
$update = $this->connection->getQueryBuilder();
|
||||
$update->update('talk_attendees')
|
||||
->set('display_name', $update->createNamedParameter($displayName))
|
||||
->where($update->expr()->eq('actor_type', $update->createNamedParameter($actorType)))
|
||||
->andWhere($update->expr()->eq('actor_id', $update->createNamedParameter($actorId)));
|
||||
$update->executeStatement();
|
||||
}
|
||||
|
||||
public function getLastCommonReadChatMessage(Room $room): int {
|
||||
|
@ -1013,7 +1013,7 @@ class ParticipantService {
|
|||
->andWhere($query->expr()->eq('room_id', $query->createNamedParameter($room->getId(), IQueryBuilder::PARAM_INT)))
|
||||
->andWhere($query->expr()->eq('read_privacy', $query->createNamedParameter(Participant::PRIVACY_PUBLIC, IQueryBuilder::PARAM_INT)));
|
||||
|
||||
$result = $query->execute();
|
||||
$result = $query->executeQuery();
|
||||
$row = $result->fetch();
|
||||
$result->closeCursor();
|
||||
|
||||
|
@ -1036,7 +1036,7 @@ class ParticipantService {
|
|||
->groupBy('room_id');
|
||||
|
||||
$commonReads = array_fill_keys($roomIds, 0);
|
||||
$result = $query->execute();
|
||||
$result = $query->executeQuery();
|
||||
while ($row = $result->fetch()) {
|
||||
$commonReads[(int) $row['room_id']] = (int) $row['last_common_read_message'];
|
||||
}
|
||||
|
@ -1167,7 +1167,7 @@ class ParticipantService {
|
|||
*/
|
||||
protected function getParticipantsFromQuery(IQueryBuilder $query, Room $room): array {
|
||||
$participants = [];
|
||||
$result = $query->execute();
|
||||
$result = $query->executeQuery();
|
||||
while ($row = $result->fetch()) {
|
||||
$attendee = $this->attendeeMapper->createAttendeeFromRow($row);
|
||||
if (isset($row['s_id'])) {
|
||||
|
@ -1236,7 +1236,7 @@ class ParticipantService {
|
|||
->andWhere($query->expr()->isNull('s.in_call'));
|
||||
|
||||
$userIds = [];
|
||||
$result = $query->execute();
|
||||
$result = $query->executeQuery();
|
||||
while ($row = $result->fetch()) {
|
||||
$userIds[] = $row['actor_id'];
|
||||
}
|
||||
|
@ -1295,7 +1295,7 @@ class ParticipantService {
|
|||
->where($query->expr()->eq('a.room_id', $query->createNamedParameter($room->getId(), IQueryBuilder::PARAM_INT)))
|
||||
->andWhere($query->expr()->isNotNull('s.id'))
|
||||
->setMaxResults(1);
|
||||
$result = $query->execute();
|
||||
$result = $query->executeQuery();
|
||||
$row = $result->fetch();
|
||||
$result->closeCursor();
|
||||
|
||||
|
@ -1318,7 +1318,7 @@ class ParticipantService {
|
|||
->andWhere($query->expr()->neq('s.in_call', $query->createNamedParameter(Participant::FLAG_DISCONNECTED)))
|
||||
->andWhere($query->expr()->gte('s.last_ping', $query->createNamedParameter($this->timeFactory->getTime() - Session::SESSION_TIMEOUT, IQueryBuilder::PARAM_INT)))
|
||||
->setMaxResults(1);
|
||||
$result = $query->execute();
|
||||
$result = $query->executeQuery();
|
||||
$row = $result->fetch();
|
||||
$result->closeCursor();
|
||||
|
||||
|
|
|
@ -58,12 +58,12 @@ class SessionService {
|
|||
* @param int $lastPing
|
||||
*/
|
||||
public function updateMultipleLastPings(array $sessionIds, int $lastPing): void {
|
||||
$query = $this->connection->getQueryBuilder();
|
||||
$query->update('talk_sessions')
|
||||
->set('last_ping', $query->createNamedParameter($lastPing, IQueryBuilder::PARAM_INT))
|
||||
->where($query->expr()->in('session_id', $query->createNamedParameter($sessionIds, IQueryBuilder::PARAM_STR_ARRAY)));
|
||||
$update = $this->connection->getQueryBuilder();
|
||||
$update->update('talk_sessions')
|
||||
->set('last_ping', $update->createNamedParameter($lastPing, IQueryBuilder::PARAM_INT))
|
||||
->where($update->expr()->in('session_id', $update->createNamedParameter($sessionIds, IQueryBuilder::PARAM_STR_ARRAY)));
|
||||
|
||||
$query->execute();
|
||||
$update->executeStatement();
|
||||
}
|
||||
|
||||
public function updateLastPing(Session $session, int $lastPing): void {
|
||||
|
|
|
@ -238,26 +238,26 @@ class RoomShareProvider implements IShareProvider {
|
|||
string $token,
|
||||
?\DateTime $expirationDate
|
||||
): int {
|
||||
$qb = $this->dbConnection->getQueryBuilder();
|
||||
$qb->insert('share')
|
||||
->setValue('share_type', $qb->createNamedParameter(IShare::TYPE_ROOM))
|
||||
->setValue('share_with', $qb->createNamedParameter($shareWith))
|
||||
->setValue('uid_initiator', $qb->createNamedParameter($sharedBy))
|
||||
->setValue('uid_owner', $qb->createNamedParameter($shareOwner))
|
||||
->setValue('item_type', $qb->createNamedParameter($itemType))
|
||||
->setValue('item_source', $qb->createNamedParameter($itemSource))
|
||||
->setValue('file_source', $qb->createNamedParameter($itemSource))
|
||||
->setValue('file_target', $qb->createNamedParameter($target))
|
||||
->setValue('permissions', $qb->createNamedParameter($permissions))
|
||||
->setValue('token', $qb->createNamedParameter($token))
|
||||
->setValue('stime', $qb->createNamedParameter($this->timeFactory->getTime()));
|
||||
$insert = $this->dbConnection->getQueryBuilder();
|
||||
$insert->insert('share')
|
||||
->setValue('share_type', $insert->createNamedParameter(IShare::TYPE_ROOM))
|
||||
->setValue('share_with', $insert->createNamedParameter($shareWith))
|
||||
->setValue('uid_initiator', $insert->createNamedParameter($sharedBy))
|
||||
->setValue('uid_owner', $insert->createNamedParameter($shareOwner))
|
||||
->setValue('item_type', $insert->createNamedParameter($itemType))
|
||||
->setValue('item_source', $insert->createNamedParameter($itemSource))
|
||||
->setValue('file_source', $insert->createNamedParameter($itemSource))
|
||||
->setValue('file_target', $insert->createNamedParameter($target))
|
||||
->setValue('permissions', $insert->createNamedParameter($permissions))
|
||||
->setValue('token', $insert->createNamedParameter($token))
|
||||
->setValue('stime', $insert->createNamedParameter($this->timeFactory->getTime()));
|
||||
|
||||
if ($expirationDate !== null) {
|
||||
$qb->setValue('expiration', $qb->createNamedParameter($expirationDate, 'datetime'));
|
||||
$insert->setValue('expiration', $insert->createNamedParameter($expirationDate, 'datetime'));
|
||||
}
|
||||
|
||||
$qb->execute();
|
||||
$id = $qb->getLastInsertId();
|
||||
$insert->executeStatement();
|
||||
$id = $insert->getLastInsertId();
|
||||
|
||||
return $id;
|
||||
}
|
||||
|
@ -275,7 +275,7 @@ class RoomShareProvider implements IShareProvider {
|
|||
->from('share')
|
||||
->where($qb->expr()->eq('id', $qb->createNamedParameter($id)));
|
||||
|
||||
$cursor = $qb->execute();
|
||||
$cursor = $qb->executeQuery();
|
||||
$data = $cursor->fetch();
|
||||
$cursor->closeCursor();
|
||||
|
||||
|
@ -339,39 +339,39 @@ class RoomShareProvider implements IShareProvider {
|
|||
* @return IShare The share object
|
||||
*/
|
||||
public function update(IShare $share): IShare {
|
||||
$qb = $this->dbConnection->getQueryBuilder();
|
||||
$qb->update('share')
|
||||
->where($qb->expr()->eq('id', $qb->createNamedParameter($share->getId())))
|
||||
->set('uid_owner', $qb->createNamedParameter($share->getShareOwner()))
|
||||
->set('uid_initiator', $qb->createNamedParameter($share->getSharedBy()))
|
||||
->set('permissions', $qb->createNamedParameter($share->getPermissions()))
|
||||
->set('item_source', $qb->createNamedParameter($share->getNode()->getId()))
|
||||
->set('file_source', $qb->createNamedParameter($share->getNode()->getId()))
|
||||
->set('expiration', $qb->createNamedParameter($share->getExpirationDate(), IQueryBuilder::PARAM_DATE))
|
||||
->execute();
|
||||
$update = $this->dbConnection->getQueryBuilder();
|
||||
$update->update('share')
|
||||
->where($update->expr()->eq('id', $update->createNamedParameter($share->getId())))
|
||||
->set('uid_owner', $update->createNamedParameter($share->getShareOwner()))
|
||||
->set('uid_initiator', $update->createNamedParameter($share->getSharedBy()))
|
||||
->set('permissions', $update->createNamedParameter($share->getPermissions()))
|
||||
->set('item_source', $update->createNamedParameter($share->getNode()->getId()))
|
||||
->set('file_source', $update->createNamedParameter($share->getNode()->getId()))
|
||||
->set('expiration', $update->createNamedParameter($share->getExpirationDate(), IQueryBuilder::PARAM_DATE))
|
||||
->executeStatement();
|
||||
|
||||
/*
|
||||
* Update all user defined group shares
|
||||
*/
|
||||
$qb = $this->dbConnection->getQueryBuilder();
|
||||
$qb->update('share')
|
||||
->where($qb->expr()->eq('parent', $qb->createNamedParameter($share->getId())))
|
||||
->set('uid_owner', $qb->createNamedParameter($share->getShareOwner()))
|
||||
->set('uid_initiator', $qb->createNamedParameter($share->getSharedBy()))
|
||||
->set('item_source', $qb->createNamedParameter($share->getNode()->getId()))
|
||||
->set('file_source', $qb->createNamedParameter($share->getNode()->getId()))
|
||||
->set('expiration', $qb->createNamedParameter($share->getExpirationDate(), IQueryBuilder::PARAM_DATE))
|
||||
->execute();
|
||||
$update = $this->dbConnection->getQueryBuilder();
|
||||
$update->update('share')
|
||||
->where($update->expr()->eq('parent', $update->createNamedParameter($share->getId())))
|
||||
->set('uid_owner', $update->createNamedParameter($share->getShareOwner()))
|
||||
->set('uid_initiator', $update->createNamedParameter($share->getSharedBy()))
|
||||
->set('item_source', $update->createNamedParameter($share->getNode()->getId()))
|
||||
->set('file_source', $update->createNamedParameter($share->getNode()->getId()))
|
||||
->set('expiration', $update->createNamedParameter($share->getExpirationDate(), IQueryBuilder::PARAM_DATE))
|
||||
->executeStatement();
|
||||
|
||||
/*
|
||||
* Now update the permissions for all children that have not set it to 0
|
||||
*/
|
||||
$qb = $this->dbConnection->getQueryBuilder();
|
||||
$qb->update('share')
|
||||
->where($qb->expr()->eq('parent', $qb->createNamedParameter($share->getId())))
|
||||
->andWhere($qb->expr()->neq('permissions', $qb->createNamedParameter(0)))
|
||||
->set('permissions', $qb->createNamedParameter($share->getPermissions()))
|
||||
->execute();
|
||||
$update = $this->dbConnection->getQueryBuilder();
|
||||
$update->update('share')
|
||||
->where($update->expr()->eq('parent', $update->createNamedParameter($share->getId())))
|
||||
->andWhere($update->expr()->neq('permissions', $update->createNamedParameter(0)))
|
||||
->set('permissions', $update->createNamedParameter($share->getPermissions()))
|
||||
->executeStatement();
|
||||
|
||||
return $share;
|
||||
}
|
||||
|
@ -382,13 +382,13 @@ class RoomShareProvider implements IShareProvider {
|
|||
* @param IShare $share
|
||||
*/
|
||||
public function delete(IShare $share): void {
|
||||
$qb = $this->dbConnection->getQueryBuilder();
|
||||
$qb->delete('share')
|
||||
->where($qb->expr()->eq('id', $qb->createNamedParameter($share->getId())));
|
||||
$delete = $this->dbConnection->getQueryBuilder();
|
||||
$delete->delete('share')
|
||||
->where($delete->expr()->eq('id', $delete->createNamedParameter($share->getId())));
|
||||
|
||||
$qb->orWhere($qb->expr()->eq('parent', $qb->createNamedParameter($share->getId())));
|
||||
$delete->orWhere($delete->expr()->eq('parent', $delete->createNamedParameter($share->getId())));
|
||||
|
||||
$qb->execute();
|
||||
$delete->executeStatement();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -412,7 +412,7 @@ class RoomShareProvider implements IShareProvider {
|
|||
$qb->expr()->eq('item_type', $qb->createNamedParameter('file')),
|
||||
$qb->expr()->eq('item_type', $qb->createNamedParameter('folder'))
|
||||
))
|
||||
->execute();
|
||||
->executeQuery();
|
||||
|
||||
$data = $stmt->fetch();
|
||||
$stmt->closeCursor();
|
||||
|
@ -433,14 +433,14 @@ class RoomShareProvider implements IShareProvider {
|
|||
'file_target' => $qb->createNamedParameter($share->getTarget()),
|
||||
'permissions' => $qb->createNamedParameter(0),
|
||||
'stime' => $qb->createNamedParameter($share->getShareTime()->getTimestamp()),
|
||||
])->execute();
|
||||
])->executeStatement();
|
||||
} elseif ($data['permissions'] !== 0) {
|
||||
// Already a userroom share. Update it.
|
||||
$qb = $this->dbConnection->getQueryBuilder();
|
||||
$qb->update('share')
|
||||
->set('permissions', $qb->createNamedParameter(0))
|
||||
->where($qb->expr()->eq('id', $qb->createNamedParameter($data['id'])))
|
||||
->execute();
|
||||
->executeStatement();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -459,24 +459,24 @@ class RoomShareProvider implements IShareProvider {
|
|||
->where(
|
||||
$qb->expr()->eq('id', $qb->createNamedParameter($share->getId()))
|
||||
);
|
||||
$cursor = $qb->execute();
|
||||
$cursor = $qb->executeQuery();
|
||||
$data = $cursor->fetch();
|
||||
$cursor->closeCursor();
|
||||
|
||||
$originalPermission = $data['permissions'];
|
||||
|
||||
$qb = $this->dbConnection->getQueryBuilder();
|
||||
$qb->update('share')
|
||||
->set('permissions', $qb->createNamedParameter($originalPermission))
|
||||
$update = $this->dbConnection->getQueryBuilder();
|
||||
$update->update('share')
|
||||
->set('permissions', $update->createNamedParameter($originalPermission))
|
||||
->where(
|
||||
$qb->expr()->eq('parent', $qb->createNamedParameter($share->getId()))
|
||||
$update->expr()->eq('parent', $update->createNamedParameter($share->getId()))
|
||||
)->andWhere(
|
||||
$qb->expr()->eq('share_type', $qb->createNamedParameter(self::SHARE_TYPE_USERROOM))
|
||||
$update->expr()->eq('share_type', $update->createNamedParameter(self::SHARE_TYPE_USERROOM))
|
||||
)->andWhere(
|
||||
$qb->expr()->eq('share_with', $qb->createNamedParameter($recipient))
|
||||
$update->expr()->eq('share_with', $update->createNamedParameter($recipient))
|
||||
);
|
||||
|
||||
$qb->execute();
|
||||
$update->executeStatement();
|
||||
|
||||
return $this->getShareById($share->getId(), $recipient);
|
||||
}
|
||||
|
@ -505,7 +505,7 @@ class RoomShareProvider implements IShareProvider {
|
|||
$qb->expr()->eq('item_type', $qb->createNamedParameter('folder'))
|
||||
))
|
||||
->setMaxResults(1)
|
||||
->execute();
|
||||
->executeQuery();
|
||||
|
||||
$data = $stmt->fetch();
|
||||
$stmt->closeCursor();
|
||||
|
@ -526,14 +526,14 @@ class RoomShareProvider implements IShareProvider {
|
|||
'file_target' => $qb->createNamedParameter($share->getTarget()),
|
||||
'permissions' => $qb->createNamedParameter($share->getPermissions()),
|
||||
'stime' => $qb->createNamedParameter($share->getShareTime()->getTimestamp()),
|
||||
])->execute();
|
||||
])->executeStatement();
|
||||
} else {
|
||||
// Already a userroom share. Update it.
|
||||
$qb = $this->dbConnection->getQueryBuilder();
|
||||
$qb->update('share')
|
||||
->set('file_target', $qb->createNamedParameter($share->getTarget()))
|
||||
->where($qb->expr()->eq('id', $qb->createNamedParameter($data['id'])))
|
||||
->execute();
|
||||
->executeStatement();
|
||||
}
|
||||
|
||||
return $share;
|
||||
|
@ -579,7 +579,7 @@ class RoomShareProvider implements IShareProvider {
|
|||
|
||||
$qb->orderBy('s.id');
|
||||
|
||||
$cursor = $qb->execute();
|
||||
$cursor = $qb->executeQuery();
|
||||
$shares = [];
|
||||
while ($data = $cursor->fetch()) {
|
||||
$shares[$data['fileid']][] = $this->createShareObject($data);
|
||||
|
@ -632,7 +632,7 @@ class RoomShareProvider implements IShareProvider {
|
|||
$qb->setFirstResult($offset);
|
||||
$qb->orderBy('id');
|
||||
|
||||
$cursor = $qb->execute();
|
||||
$cursor = $qb->executeQuery();
|
||||
$shares = [];
|
||||
while ($data = $cursor->fetch()) {
|
||||
$shares[] = $this->createShareObject($data);
|
||||
|
@ -664,7 +664,7 @@ class RoomShareProvider implements IShareProvider {
|
|||
->where($qb->expr()->eq('s.id', $qb->createNamedParameter($id)))
|
||||
->andWhere($qb->expr()->eq('s.share_type', $qb->createNamedParameter(IShare::TYPE_ROOM)));
|
||||
|
||||
$cursor = $qb->execute();
|
||||
$cursor = $qb->executeQuery();
|
||||
$data = $cursor->fetch();
|
||||
$cursor->closeCursor();
|
||||
|
||||
|
@ -729,7 +729,7 @@ class RoomShareProvider implements IShareProvider {
|
|||
$qb->expr()->eq('item_type', $qb->createNamedParameter('folder'))
|
||||
));
|
||||
|
||||
$stmt = $query->execute();
|
||||
$stmt = $query->executeQuery();
|
||||
|
||||
while ($data = $stmt->fetch()) {
|
||||
$shareMap[$data['parent']]->setPermissions((int)$data['permissions']);
|
||||
|
@ -759,7 +759,7 @@ class RoomShareProvider implements IShareProvider {
|
|||
->from('share')
|
||||
->andWhere($qb->expr()->eq('file_source', $qb->createNamedParameter($path->getId())))
|
||||
->andWhere($qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_ROOM)))
|
||||
->execute();
|
||||
->executeQuery();
|
||||
|
||||
$shares = [];
|
||||
while ($data = $cursor->fetch()) {
|
||||
|
@ -826,7 +826,7 @@ class RoomShareProvider implements IShareProvider {
|
|||
$qb->expr()->eq('s.item_type', $qb->createNamedParameter('folder'))
|
||||
));
|
||||
|
||||
$cursor = $qb->execute();
|
||||
$cursor = $qb->executeQuery();
|
||||
while ($data = $cursor->fetch()) {
|
||||
if (!$this->isAccessibleResult($data)) {
|
||||
continue;
|
||||
|
@ -879,7 +879,7 @@ class RoomShareProvider implements IShareProvider {
|
|||
->from('share')
|
||||
->where($qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_ROOM)))
|
||||
->andWhere($qb->expr()->eq('token', $qb->createNamedParameter($token)))
|
||||
->execute();
|
||||
->executeQuery();
|
||||
|
||||
$data = $cursor->fetch();
|
||||
|
||||
|
@ -964,7 +964,7 @@ class RoomShareProvider implements IShareProvider {
|
|||
$qb->expr()->eq('item_type', $qb->createNamedParameter('file')),
|
||||
$qb->expr()->eq('item_type', $qb->createNamedParameter('folder'))
|
||||
));
|
||||
$cursor = $qb->execute();
|
||||
$cursor = $qb->executeQuery();
|
||||
|
||||
$users = [];
|
||||
while ($row = $cursor->fetch()) {
|
||||
|
@ -1054,7 +1054,7 @@ class RoomShareProvider implements IShareProvider {
|
|||
->andWhere($qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_ROOM)))
|
||||
->orderBy('id');
|
||||
|
||||
$cursor = $qb->execute();
|
||||
$cursor = $qb->executeQuery();
|
||||
while ($data = $cursor->fetch()) {
|
||||
$children[] = $this->createShareObject($data);
|
||||
}
|
||||
|
@ -1087,7 +1087,7 @@ class RoomShareProvider implements IShareProvider {
|
|||
$qb->andWhere($qb->expr()->eq('uid_initiator', $qb->createNamedParameter($user)));
|
||||
}
|
||||
|
||||
$cursor = $qb->execute();
|
||||
$cursor = $qb->executeQuery();
|
||||
$ids = [];
|
||||
while ($row = $cursor->fetch()) {
|
||||
$ids[] = (int)$row['id'];
|
||||
|
@ -1100,31 +1100,31 @@ class RoomShareProvider implements IShareProvider {
|
|||
$qb->delete('share')
|
||||
->where($qb->expr()->eq('share_type', $qb->createNamedParameter(self::SHARE_TYPE_USERROOM)))
|
||||
->andWhere($qb->expr()->in('parent', $qb->createNamedParameter($chunk, IQueryBuilder::PARAM_INT_ARRAY)));
|
||||
$qb->execute();
|
||||
$qb->executeStatement();
|
||||
}
|
||||
}
|
||||
|
||||
// Now delete all the original room shares
|
||||
$qb = $this->dbConnection->getQueryBuilder();
|
||||
$qb->delete('share')
|
||||
->where($qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_ROOM)))
|
||||
->andWhere($qb->expr()->eq('share_with', $qb->createNamedParameter($roomToken)));
|
||||
$delete = $this->dbConnection->getQueryBuilder();
|
||||
$delete->delete('share')
|
||||
->where($delete->expr()->eq('share_type', $delete->createNamedParameter(IShare::TYPE_ROOM)))
|
||||
->andWhere($delete->expr()->eq('share_with', $delete->createNamedParameter($roomToken)));
|
||||
|
||||
if ($user !== null) {
|
||||
$qb->andWhere($qb->expr()->eq('uid_initiator', $qb->createNamedParameter($user)));
|
||||
$delete->andWhere($delete->expr()->eq('uid_initiator', $delete->createNamedParameter($user)));
|
||||
}
|
||||
|
||||
$qb->execute();
|
||||
$delete->executeStatement();
|
||||
|
||||
// Finally delete all custom room shares leftovers for the given user
|
||||
if ($user !== null) {
|
||||
$qb = $this->dbConnection->getQueryBuilder();
|
||||
$qb->select('id')
|
||||
$query = $this->dbConnection->getQueryBuilder();
|
||||
$query->select('id')
|
||||
->from('share')
|
||||
->where($qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_ROOM)))
|
||||
->andWhere($qb->expr()->eq('share_with', $qb->createNamedParameter($roomToken)));
|
||||
->where($query->expr()->eq('share_type', $query->createNamedParameter(IShare::TYPE_ROOM)))
|
||||
->andWhere($query->expr()->eq('share_with', $query->createNamedParameter($roomToken)));
|
||||
|
||||
$cursor = $qb->execute();
|
||||
$cursor = $query->executeQuery();
|
||||
$ids = [];
|
||||
while ($row = $cursor->fetch()) {
|
||||
$ids[] = (int)$row['id'];
|
||||
|
@ -1134,11 +1134,11 @@ class RoomShareProvider implements IShareProvider {
|
|||
if (!empty($ids)) {
|
||||
$chunks = array_chunk($ids, 100);
|
||||
foreach ($chunks as $chunk) {
|
||||
$qb->delete('share')
|
||||
->where($qb->expr()->eq('share_type', $qb->createNamedParameter(self::SHARE_TYPE_USERROOM)))
|
||||
->andWhere($qb->expr()->in('share_with', $qb->createNamedParameter($user)))
|
||||
->andWhere($qb->expr()->in('parent', $qb->createNamedParameter($chunk, IQueryBuilder::PARAM_INT_ARRAY)));
|
||||
$qb->execute();
|
||||
$delete->delete('share')
|
||||
->where($delete->expr()->eq('share_type', $delete->createNamedParameter(self::SHARE_TYPE_USERROOM)))
|
||||
->andWhere($delete->expr()->in('share_with', $delete->createNamedParameter($user)))
|
||||
->andWhere($delete->expr()->in('parent', $delete->createNamedParameter($chunk, IQueryBuilder::PARAM_INT_ARRAY)));
|
||||
$delete->executeStatement();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1162,7 +1162,7 @@ class RoomShareProvider implements IShareProvider {
|
|||
)
|
||||
);
|
||||
|
||||
$cursor = $qb->execute();
|
||||
$cursor = $qb->executeQuery();
|
||||
while ($data = $cursor->fetch()) {
|
||||
$share = $this->createShareObject($data);
|
||||
|
||||
|
|
|
@ -53,11 +53,11 @@ class Messages {
|
|||
* @param string[] $sessionIds
|
||||
*/
|
||||
public function deleteMessages(array $sessionIds): void {
|
||||
$query = $this->db->getQueryBuilder();
|
||||
$query->delete('talk_internalsignaling')
|
||||
->where($query->expr()->in('recipient', $query->createNamedParameter($sessionIds, IQueryBuilder::PARAM_STR_ARRAY)))
|
||||
->orWhere($query->expr()->in('sender', $query->createNamedParameter($sessionIds, IQueryBuilder::PARAM_STR_ARRAY)));
|
||||
$query->execute();
|
||||
$delete = $this->db->getQueryBuilder();
|
||||
$delete->delete('talk_internalsignaling')
|
||||
->where($delete->expr()->in('recipient', $delete->createNamedParameter($sessionIds, IQueryBuilder::PARAM_STR_ARRAY)))
|
||||
->orWhere($delete->expr()->in('sender', $delete->createNamedParameter($sessionIds, IQueryBuilder::PARAM_STR_ARRAY)));
|
||||
$delete->executeStatement();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -66,17 +66,17 @@ class Messages {
|
|||
* @param string $message
|
||||
*/
|
||||
public function addMessage(string $senderSessionId, string $recipientSessionId, string $message): void {
|
||||
$query = $this->db->getQueryBuilder();
|
||||
$query->insert('talk_internalsignaling')
|
||||
$insert = $this->db->getQueryBuilder();
|
||||
$insert->insert('talk_internalsignaling')
|
||||
->values(
|
||||
[
|
||||
'sender' => $query->createNamedParameter($senderSessionId),
|
||||
'recipient' => $query->createNamedParameter($recipientSessionId),
|
||||
'timestamp' => $query->createNamedParameter($this->timeFactory->getTime()),
|
||||
'message' => $query->createNamedParameter($message),
|
||||
'sender' => $insert->createNamedParameter($senderSessionId),
|
||||
'recipient' => $insert->createNamedParameter($recipientSessionId),
|
||||
'timestamp' => $insert->createNamedParameter($this->timeFactory->getTime()),
|
||||
'message' => $insert->createNamedParameter($message),
|
||||
]
|
||||
);
|
||||
$query->execute();
|
||||
$insert->executeStatement();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -84,14 +84,14 @@ class Messages {
|
|||
* @param string $message
|
||||
*/
|
||||
public function addMessageForAllParticipants(Room $room, string $message): void {
|
||||
$query = $this->db->getQueryBuilder();
|
||||
$query->insert('talk_internalsignaling')
|
||||
$insert = $this->db->getQueryBuilder();
|
||||
$insert->insert('talk_internalsignaling')
|
||||
->values(
|
||||
[
|
||||
'sender' => $query->createParameter('sender'),
|
||||
'recipient' => $query->createParameter('recipient'),
|
||||
'timestamp' => $query->createNamedParameter($this->timeFactory->getTime()),
|
||||
'message' => $query->createNamedParameter($message),
|
||||
'sender' => $insert->createParameter('sender'),
|
||||
'recipient' => $insert->createParameter('recipient'),
|
||||
'timestamp' => $insert->createNamedParameter($this->timeFactory->getTime()),
|
||||
'message' => $insert->createNamedParameter($message),
|
||||
]
|
||||
);
|
||||
|
||||
|
@ -99,9 +99,9 @@ class Messages {
|
|||
foreach ($participants as $participant) {
|
||||
$session = $participant->getSession();
|
||||
if ($session instanceof Session) {
|
||||
$query->setParameter('sender', $session->getSessionId())
|
||||
$insert->setParameter('sender', $session->getSessionId())
|
||||
->setParameter('recipient', $session->getSessionId())
|
||||
->execute();
|
||||
->executeStatement();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ class Messages {
|
|||
->from('talk_internalsignaling')
|
||||
->where($query->expr()->eq('recipient', $query->createNamedParameter($sessionId)))
|
||||
->andWhere($query->expr()->lte('timestamp', $query->createNamedParameter($time)));
|
||||
$result = $query->execute();
|
||||
$result = $query->executeQuery();
|
||||
|
||||
while ($row = $result->fetch()) {
|
||||
$messages[] = ['type' => 'message', 'data' => $row['message']];
|
||||
|
@ -137,7 +137,7 @@ class Messages {
|
|||
$query->delete('talk_internalsignaling')
|
||||
->where($query->expr()->eq('recipient', $query->createNamedParameter($sessionId)))
|
||||
->andWhere($query->expr()->lte('timestamp', $query->createNamedParameter($time)));
|
||||
$query->execute();
|
||||
$query->executeQuery();
|
||||
|
||||
return $messages;
|
||||
}
|
||||
|
@ -150,9 +150,9 @@ class Messages {
|
|||
public function expireOlderThan(int $olderThan): void {
|
||||
$time = $this->timeFactory->getTime() - $olderThan;
|
||||
|
||||
$query = $this->db->getQueryBuilder();
|
||||
$query->delete('talk_internalsignaling')
|
||||
->where($query->expr()->lt('timestamp', $query->createNamedParameter($time)));
|
||||
$query->execute();
|
||||
$delete = $this->db->getQueryBuilder();
|
||||
$delete->delete('talk_internalsignaling')
|
||||
->where($delete->expr()->lt('timestamp', $delete->createNamedParameter($time)));
|
||||
$delete->executeStatement();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,25 +50,25 @@ class ApiController extends OCSController {
|
|||
* @return DataResponse
|
||||
*/
|
||||
public function resetSpreed(): DataResponse {
|
||||
$query = $this->db->getQueryBuilder();
|
||||
$query->delete('talk_internalsignaling')->execute();
|
||||
$delete = $this->db->getQueryBuilder();
|
||||
$delete->delete('talk_internalsignaling')->executeStatement();
|
||||
|
||||
$query = $this->db->getQueryBuilder();
|
||||
$query->delete('talk_rooms')->execute();
|
||||
$delete = $this->db->getQueryBuilder();
|
||||
$delete->delete('talk_rooms')->executeStatement();
|
||||
|
||||
$query = $this->db->getQueryBuilder();
|
||||
$query->delete('talk_attendees')->execute();
|
||||
$delete = $this->db->getQueryBuilder();
|
||||
$delete->delete('talk_attendees')->executeStatement();
|
||||
|
||||
$query = $this->db->getQueryBuilder();
|
||||
$query->delete('talk_sessions')->execute();
|
||||
$delete = $this->db->getQueryBuilder();
|
||||
$delete->delete('talk_sessions')->executeStatement();
|
||||
|
||||
$query = $this->db->getQueryBuilder();
|
||||
$query->delete('share')
|
||||
->where($query->expr()->orX(
|
||||
$query->expr()->eq('share_type', $query->createNamedParameter(IShare::TYPE_ROOM)),
|
||||
$query->expr()->eq('share_type', $query->createNamedParameter(11 /*RoomShareProvider::SHARE_TYPE_USERROOM*/))
|
||||
$delete = $this->db->getQueryBuilder();
|
||||
$delete->delete('share')
|
||||
->where($delete->expr()->orX(
|
||||
$delete->expr()->eq('share_type', $delete->createNamedParameter(IShare::TYPE_ROOM)),
|
||||
$delete->expr()->eq('share_type', $delete->createNamedParameter(11 /*RoomShareProvider::SHARE_TYPE_USERROOM*/))
|
||||
))
|
||||
->execute();
|
||||
->executeStatement();
|
||||
|
||||
return new DataResponse();
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче