|
@@ -55,10 +55,10 @@ class UpdateCalendarResourcesRoomsBackgroundJob extends TimedJob {
|
|
|
private $calDavBackend;
|
|
|
|
|
|
public function __construct(ITimeFactory $time,
|
|
|
- IResourceManager $resourceManager,
|
|
|
- IRoomManager $roomManager,
|
|
|
- IDBConnection $dbConnection,
|
|
|
- CalDavBackend $calDavBackend) {
|
|
|
+ IResourceManager $resourceManager,
|
|
|
+ IRoomManager $roomManager,
|
|
|
+ IDBConnection $dbConnection,
|
|
|
+ CalDavBackend $calDavBackend) {
|
|
|
parent::__construct($time);
|
|
|
$this->resourceManager = $resourceManager;
|
|
|
$this->roomManager = $roomManager;
|
|
@@ -101,10 +101,10 @@ class UpdateCalendarResourcesRoomsBackgroundJob extends TimedJob {
|
|
|
* @param string $principalPrefix
|
|
|
*/
|
|
|
private function runForBackend($backendManager,
|
|
|
- string $dbTable,
|
|
|
- string $dbTableMetadata,
|
|
|
- string $foreignKey,
|
|
|
- string $principalPrefix): void {
|
|
|
+ string $dbTable,
|
|
|
+ string $dbTableMetadata,
|
|
|
+ string $foreignKey,
|
|
|
+ string $principalPrefix): void {
|
|
|
$backends = $backendManager->getBackends();
|
|
|
|
|
|
foreach ($backends as $backend) {
|
|
@@ -194,8 +194,8 @@ class UpdateCalendarResourcesRoomsBackgroundJob extends TimedJob {
|
|
|
* @return int Insert id
|
|
|
*/
|
|
|
private function addToCache(string $table,
|
|
|
- string $backendId,
|
|
|
- $remote): int {
|
|
|
+ string $backendId,
|
|
|
+ $remote): int {
|
|
|
$query = $this->dbConnection->getQueryBuilder();
|
|
|
$query->insert($table)
|
|
|
->values([
|
|
@@ -219,9 +219,9 @@ class UpdateCalendarResourcesRoomsBackgroundJob extends TimedJob {
|
|
|
* @param array $metadata
|
|
|
*/
|
|
|
private function addMetadataToCache(string $table,
|
|
|
- string $foreignKey,
|
|
|
- int $foreignId,
|
|
|
- array $metadata): void {
|
|
|
+ string $foreignKey,
|
|
|
+ int $foreignId,
|
|
|
+ array $metadata): void {
|
|
|
foreach ($metadata as $key => $value) {
|
|
|
$query = $this->dbConnection->getQueryBuilder();
|
|
|
$query->insert($table)
|
|
@@ -241,7 +241,7 @@ class UpdateCalendarResourcesRoomsBackgroundJob extends TimedJob {
|
|
|
* @param int $id
|
|
|
*/
|
|
|
private function deleteFromCache(string $table,
|
|
|
- int $id): void {
|
|
|
+ int $id): void {
|
|
|
$query = $this->dbConnection->getQueryBuilder();
|
|
|
$query->delete($table)
|
|
|
->where($query->expr()->eq('id', $query->createNamedParameter($id)))
|
|
@@ -254,8 +254,8 @@ class UpdateCalendarResourcesRoomsBackgroundJob extends TimedJob {
|
|
|
* @param int $id
|
|
|
*/
|
|
|
private function deleteMetadataFromCache(string $table,
|
|
|
- string $foreignKey,
|
|
|
- int $id): void {
|
|
|
+ string $foreignKey,
|
|
|
+ int $id): void {
|
|
|
$query = $this->dbConnection->getQueryBuilder();
|
|
|
$query->delete($table)
|
|
|
->where($query->expr()->eq($foreignKey, $query->createNamedParameter($id)))
|
|
@@ -270,8 +270,8 @@ class UpdateCalendarResourcesRoomsBackgroundJob extends TimedJob {
|
|
|
* @param IResource|IRoom $remote
|
|
|
*/
|
|
|
private function updateCache(string $table,
|
|
|
- int $id,
|
|
|
- $remote): void {
|
|
|
+ int $id,
|
|
|
+ $remote): void {
|
|
|
$query = $this->dbConnection->getQueryBuilder();
|
|
|
$query->update($table)
|
|
|
->set('email', $query->createNamedParameter($remote->getEMail()))
|
|
@@ -292,10 +292,10 @@ class UpdateCalendarResourcesRoomsBackgroundJob extends TimedJob {
|
|
|
* @param array $cachedMetadata
|
|
|
*/
|
|
|
private function updateMetadataCache(string $dbTable,
|
|
|
- string $foreignKey,
|
|
|
- int $id,
|
|
|
- array $metadata,
|
|
|
- array $cachedMetadata): void {
|
|
|
+ string $foreignKey,
|
|
|
+ int $id,
|
|
|
+ array $metadata,
|
|
|
+ array $cachedMetadata): void {
|
|
|
$newMetadata = array_diff_key($metadata, $cachedMetadata);
|
|
|
$deletedMetadata = array_diff_key($cachedMetadata, $metadata);
|
|
|
|
|
@@ -371,8 +371,8 @@ class UpdateCalendarResourcesRoomsBackgroundJob extends TimedJob {
|
|
|
* @return array
|
|
|
*/
|
|
|
private function getAllMetadataOfCache(string $table,
|
|
|
- string $foreignKey,
|
|
|
- int $id): array {
|
|
|
+ string $foreignKey,
|
|
|
+ int $id): array {
|
|
|
$query = $this->dbConnection->getQueryBuilder();
|
|
|
$query->select(['key', 'value'])
|
|
|
->from($table)
|
|
@@ -398,7 +398,7 @@ class UpdateCalendarResourcesRoomsBackgroundJob extends TimedJob {
|
|
|
* @return array
|
|
|
*/
|
|
|
private function getAllCachedByBackend(string $tableName,
|
|
|
- string $backendId): array {
|
|
|
+ string $backendId): array {
|
|
|
$query = $this->dbConnection->getQueryBuilder();
|
|
|
$query->select('resource_id')
|
|
|
->from($tableName)
|
|
@@ -417,7 +417,7 @@ class UpdateCalendarResourcesRoomsBackgroundJob extends TimedJob {
|
|
|
* @param $principalUri
|
|
|
*/
|
|
|
private function deleteCalendarDataForResource(string $principalPrefix,
|
|
|
- string $principalUri): void {
|
|
|
+ string $principalUri): void {
|
|
|
$calendar = $this->calDavBackend->getCalendarByUri(
|
|
|
implode('/', [$principalPrefix, $principalUri]),
|
|
|
CalDavBackend::RESOURCE_BOOKING_CALENDAR_URI);
|
|
@@ -438,8 +438,8 @@ class UpdateCalendarResourcesRoomsBackgroundJob extends TimedJob {
|
|
|
* @return int
|
|
|
*/
|
|
|
private function getIdForBackendAndResource(string $table,
|
|
|
- string $backendId,
|
|
|
- string $resourceId): int {
|
|
|
+ string $backendId,
|
|
|
+ string $resourceId): int {
|
|
|
$query = $this->dbConnection->getQueryBuilder();
|
|
|
$query->select('id')
|
|
|
->from($table)
|