@@ -31,68 +31,68 @@ |
||
31 | 31 | |
32 | 32 | class Version010401Date20181207190718 extends SimpleMigrationStep { |
33 | 33 | |
34 | - /** |
|
35 | - * @param IOutput $output |
|
36 | - * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
37 | - * @param array $options |
|
38 | - * @return null|ISchemaWrapper |
|
39 | - */ |
|
40 | - public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { |
|
41 | - /** @var ISchemaWrapper $schema */ |
|
42 | - $schema = $schemaClosure(); |
|
34 | + /** |
|
35 | + * @param IOutput $output |
|
36 | + * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
37 | + * @param array $options |
|
38 | + * @return null|ISchemaWrapper |
|
39 | + */ |
|
40 | + public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { |
|
41 | + /** @var ISchemaWrapper $schema */ |
|
42 | + $schema = $schemaClosure(); |
|
43 | 43 | |
44 | - if (!$schema->hasTable('oauth2_clients')) { |
|
45 | - $table = $schema->createTable('oauth2_clients'); |
|
46 | - $table->addColumn('id', 'integer', [ |
|
47 | - 'autoincrement' => true, |
|
48 | - 'notnull' => true, |
|
49 | - 'unsigned' => true, |
|
50 | - ]); |
|
51 | - $table->addColumn('name', 'string', [ |
|
52 | - 'notnull' => true, |
|
53 | - 'length' => 64, |
|
54 | - ]); |
|
55 | - $table->addColumn('redirect_uri', 'string', [ |
|
56 | - 'notnull' => true, |
|
57 | - 'length' => 2000, |
|
58 | - ]); |
|
59 | - $table->addColumn('client_identifier', 'string', [ |
|
60 | - 'notnull' => true, |
|
61 | - 'length' => 64, |
|
62 | - ]); |
|
63 | - $table->addColumn('secret', 'string', [ |
|
64 | - 'notnull' => true, |
|
65 | - 'length' => 64, |
|
66 | - ]); |
|
67 | - $table->setPrimaryKey(['id']); |
|
68 | - $table->addIndex(['client_identifier'], 'oauth2_client_id_idx'); |
|
69 | - } |
|
44 | + if (!$schema->hasTable('oauth2_clients')) { |
|
45 | + $table = $schema->createTable('oauth2_clients'); |
|
46 | + $table->addColumn('id', 'integer', [ |
|
47 | + 'autoincrement' => true, |
|
48 | + 'notnull' => true, |
|
49 | + 'unsigned' => true, |
|
50 | + ]); |
|
51 | + $table->addColumn('name', 'string', [ |
|
52 | + 'notnull' => true, |
|
53 | + 'length' => 64, |
|
54 | + ]); |
|
55 | + $table->addColumn('redirect_uri', 'string', [ |
|
56 | + 'notnull' => true, |
|
57 | + 'length' => 2000, |
|
58 | + ]); |
|
59 | + $table->addColumn('client_identifier', 'string', [ |
|
60 | + 'notnull' => true, |
|
61 | + 'length' => 64, |
|
62 | + ]); |
|
63 | + $table->addColumn('secret', 'string', [ |
|
64 | + 'notnull' => true, |
|
65 | + 'length' => 64, |
|
66 | + ]); |
|
67 | + $table->setPrimaryKey(['id']); |
|
68 | + $table->addIndex(['client_identifier'], 'oauth2_client_id_idx'); |
|
69 | + } |
|
70 | 70 | |
71 | - if (!$schema->hasTable('oauth2_access_tokens')) { |
|
72 | - $table = $schema->createTable('oauth2_access_tokens'); |
|
73 | - $table->addColumn('id', 'integer', [ |
|
74 | - 'autoincrement' => true, |
|
75 | - 'notnull' => true, |
|
76 | - 'unsigned' => true, |
|
77 | - ]); |
|
78 | - $table->addColumn('token_id', 'integer', [ |
|
79 | - 'notnull' => true, |
|
80 | - ]); |
|
81 | - $table->addColumn('client_id', 'integer', [ |
|
82 | - 'notnull' => true, |
|
83 | - ]); |
|
84 | - $table->addColumn('hashed_code', 'string', [ |
|
85 | - 'notnull' => true, |
|
86 | - 'length' => 128, |
|
87 | - ]); |
|
88 | - $table->addColumn('encrypted_token', 'string', [ |
|
89 | - 'notnull' => true, |
|
90 | - 'length' => 786, |
|
91 | - ]); |
|
92 | - $table->setPrimaryKey(['id']); |
|
93 | - $table->addUniqueIndex(['hashed_code'], 'oauth2_access_hash_idx'); |
|
94 | - $table->addIndex(['client_id'], 'oauth2_access_client_id_idx'); |
|
95 | - } |
|
96 | - return $schema; |
|
97 | - } |
|
71 | + if (!$schema->hasTable('oauth2_access_tokens')) { |
|
72 | + $table = $schema->createTable('oauth2_access_tokens'); |
|
73 | + $table->addColumn('id', 'integer', [ |
|
74 | + 'autoincrement' => true, |
|
75 | + 'notnull' => true, |
|
76 | + 'unsigned' => true, |
|
77 | + ]); |
|
78 | + $table->addColumn('token_id', 'integer', [ |
|
79 | + 'notnull' => true, |
|
80 | + ]); |
|
81 | + $table->addColumn('client_id', 'integer', [ |
|
82 | + 'notnull' => true, |
|
83 | + ]); |
|
84 | + $table->addColumn('hashed_code', 'string', [ |
|
85 | + 'notnull' => true, |
|
86 | + 'length' => 128, |
|
87 | + ]); |
|
88 | + $table->addColumn('encrypted_token', 'string', [ |
|
89 | + 'notnull' => true, |
|
90 | + 'length' => 786, |
|
91 | + ]); |
|
92 | + $table->setPrimaryKey(['id']); |
|
93 | + $table->addUniqueIndex(['hashed_code'], 'oauth2_access_hash_idx'); |
|
94 | + $table->addIndex(['client_id'], 'oauth2_access_client_id_idx'); |
|
95 | + } |
|
96 | + return $schema; |
|
97 | + } |
|
98 | 98 | } |
@@ -37,59 +37,59 @@ |
||
37 | 37 | |
38 | 38 | class ChunkCleanup implements IRepairStep { |
39 | 39 | |
40 | - /** @var IConfig */ |
|
41 | - private $config; |
|
42 | - /** @var IUserManager */ |
|
43 | - private $userManager; |
|
44 | - /** @var IRootFolder */ |
|
45 | - private $rootFolder; |
|
46 | - /** @var IJobList */ |
|
47 | - private $jobList; |
|
40 | + /** @var IConfig */ |
|
41 | + private $config; |
|
42 | + /** @var IUserManager */ |
|
43 | + private $userManager; |
|
44 | + /** @var IRootFolder */ |
|
45 | + private $rootFolder; |
|
46 | + /** @var IJobList */ |
|
47 | + private $jobList; |
|
48 | 48 | |
49 | - public function __construct(IConfig $config, |
|
50 | - IUserManager $userManager, |
|
51 | - IRootFolder $rootFolder, |
|
52 | - IJobList $jobList) { |
|
53 | - $this->config = $config; |
|
54 | - $this->userManager = $userManager; |
|
55 | - $this->rootFolder = $rootFolder; |
|
56 | - $this->jobList = $jobList; |
|
57 | - } |
|
49 | + public function __construct(IConfig $config, |
|
50 | + IUserManager $userManager, |
|
51 | + IRootFolder $rootFolder, |
|
52 | + IJobList $jobList) { |
|
53 | + $this->config = $config; |
|
54 | + $this->userManager = $userManager; |
|
55 | + $this->rootFolder = $rootFolder; |
|
56 | + $this->jobList = $jobList; |
|
57 | + } |
|
58 | 58 | |
59 | - public function getName(): string { |
|
60 | - return 'Chunk cleanup scheduler'; |
|
61 | - } |
|
59 | + public function getName(): string { |
|
60 | + return 'Chunk cleanup scheduler'; |
|
61 | + } |
|
62 | 62 | |
63 | - public function run(IOutput $output) { |
|
64 | - // If we already ran this onec there is no need to run it again |
|
65 | - if ($this->config->getAppValue('dav', 'chunks_migrated', '0') === '1') { |
|
66 | - $output->info('Cleanup not required'); |
|
67 | - } |
|
63 | + public function run(IOutput $output) { |
|
64 | + // If we already ran this onec there is no need to run it again |
|
65 | + if ($this->config->getAppValue('dav', 'chunks_migrated', '0') === '1') { |
|
66 | + $output->info('Cleanup not required'); |
|
67 | + } |
|
68 | 68 | |
69 | - $output->startProgress(); |
|
70 | - // Loop over all seen users |
|
71 | - $this->userManager->callForSeenUsers(function (IUser $user) use ($output) { |
|
72 | - try { |
|
73 | - $userFolder = $this->rootFolder->getUserFolder($user->getUID()); |
|
74 | - $userRoot = $userFolder->getParent(); |
|
75 | - /** @var Folder $uploadFolder */ |
|
76 | - $uploadFolder = $userRoot->get('uploads'); |
|
77 | - } catch (NotFoundException $e) { |
|
78 | - // No folder so skipping |
|
79 | - return; |
|
80 | - } |
|
69 | + $output->startProgress(); |
|
70 | + // Loop over all seen users |
|
71 | + $this->userManager->callForSeenUsers(function (IUser $user) use ($output) { |
|
72 | + try { |
|
73 | + $userFolder = $this->rootFolder->getUserFolder($user->getUID()); |
|
74 | + $userRoot = $userFolder->getParent(); |
|
75 | + /** @var Folder $uploadFolder */ |
|
76 | + $uploadFolder = $userRoot->get('uploads'); |
|
77 | + } catch (NotFoundException $e) { |
|
78 | + // No folder so skipping |
|
79 | + return; |
|
80 | + } |
|
81 | 81 | |
82 | - // Insert a cleanup job for each folder we find |
|
83 | - $uploads = $uploadFolder->getDirectoryListing(); |
|
84 | - foreach ($uploads as $upload) { |
|
85 | - $this->jobList->add(UploadCleanup::class, ['uid' => $user->getUID(), 'folder' => $upload->getName()]); |
|
86 | - } |
|
87 | - $output->advance(); |
|
88 | - }); |
|
89 | - $output->finishProgress(); |
|
82 | + // Insert a cleanup job for each folder we find |
|
83 | + $uploads = $uploadFolder->getDirectoryListing(); |
|
84 | + foreach ($uploads as $upload) { |
|
85 | + $this->jobList->add(UploadCleanup::class, ['uid' => $user->getUID(), 'folder' => $upload->getName()]); |
|
86 | + } |
|
87 | + $output->advance(); |
|
88 | + }); |
|
89 | + $output->finishProgress(); |
|
90 | 90 | |
91 | 91 | |
92 | - $this->config->setAppValue('dav', 'chunks_migrated', '1'); |
|
93 | - } |
|
92 | + $this->config->setAppValue('dav', 'chunks_migrated', '1'); |
|
93 | + } |
|
94 | 94 | |
95 | 95 | } |
@@ -29,21 +29,21 @@ |
||
29 | 29 | use OCP\IUserSession; |
30 | 30 | |
31 | 31 | class CleanupService { |
32 | - /** @var IUserSession */ |
|
33 | - private $userSession; |
|
34 | - /** @var IJobList */ |
|
35 | - private $jobList; |
|
32 | + /** @var IUserSession */ |
|
33 | + private $userSession; |
|
34 | + /** @var IJobList */ |
|
35 | + private $jobList; |
|
36 | 36 | |
37 | - public function __construct(IUserSession $userSession, IJobList $jobList) { |
|
38 | - $this->userSession = $userSession; |
|
39 | - $this->jobList = $jobList; |
|
40 | - } |
|
37 | + public function __construct(IUserSession $userSession, IJobList $jobList) { |
|
38 | + $this->userSession = $userSession; |
|
39 | + $this->jobList = $jobList; |
|
40 | + } |
|
41 | 41 | |
42 | - public function addJob(string $folder) { |
|
43 | - $this->jobList->add(UploadCleanup::class, ['uid' => $this->userSession->getUser()->getUID(), 'folder' => $folder]); |
|
44 | - } |
|
42 | + public function addJob(string $folder) { |
|
43 | + $this->jobList->add(UploadCleanup::class, ['uid' => $this->userSession->getUser()->getUID(), 'folder' => $folder]); |
|
44 | + } |
|
45 | 45 | |
46 | - public function removeJob(string $folder) { |
|
47 | - $this->jobList->remove(UploadCleanup::class, ['uid' => $this->userSession->getUser()->getUID(), 'folder' => $folder]); |
|
48 | - } |
|
46 | + public function removeJob(string $folder) { |
|
47 | + $this->jobList->remove(UploadCleanup::class, ['uid' => $this->userSession->getUser()->getUID(), 'folder' => $folder]); |
|
48 | + } |
|
49 | 49 | } |
@@ -33,57 +33,57 @@ |
||
33 | 33 | * @package OC\Http |
34 | 34 | */ |
35 | 35 | class Response implements IResponse { |
36 | - /** @var ResponseInterface */ |
|
37 | - private $response; |
|
36 | + /** @var ResponseInterface */ |
|
37 | + private $response; |
|
38 | 38 | |
39 | - /** |
|
40 | - * @var bool |
|
41 | - */ |
|
42 | - private $stream; |
|
39 | + /** |
|
40 | + * @var bool |
|
41 | + */ |
|
42 | + private $stream; |
|
43 | 43 | |
44 | - /** |
|
45 | - * @param ResponseInterface $response |
|
46 | - * @param bool $stream |
|
47 | - */ |
|
48 | - public function __construct(ResponseInterface $response, $stream = false) { |
|
49 | - $this->response = $response; |
|
50 | - $this->stream = $stream; |
|
51 | - } |
|
44 | + /** |
|
45 | + * @param ResponseInterface $response |
|
46 | + * @param bool $stream |
|
47 | + */ |
|
48 | + public function __construct(ResponseInterface $response, $stream = false) { |
|
49 | + $this->response = $response; |
|
50 | + $this->stream = $stream; |
|
51 | + } |
|
52 | 52 | |
53 | - /** |
|
54 | - * @return string|resource |
|
55 | - */ |
|
56 | - public function getBody() { |
|
57 | - return $this->stream ? |
|
58 | - $this->response->getBody()->detach(): |
|
59 | - $this->response->getBody()->getContents(); |
|
60 | - } |
|
53 | + /** |
|
54 | + * @return string|resource |
|
55 | + */ |
|
56 | + public function getBody() { |
|
57 | + return $this->stream ? |
|
58 | + $this->response->getBody()->detach(): |
|
59 | + $this->response->getBody()->getContents(); |
|
60 | + } |
|
61 | 61 | |
62 | - /** |
|
63 | - * @return int |
|
64 | - */ |
|
65 | - public function getStatusCode(): int { |
|
66 | - return $this->response->getStatusCode(); |
|
67 | - } |
|
62 | + /** |
|
63 | + * @return int |
|
64 | + */ |
|
65 | + public function getStatusCode(): int { |
|
66 | + return $this->response->getStatusCode(); |
|
67 | + } |
|
68 | 68 | |
69 | - /** |
|
70 | - * @param string $key |
|
71 | - * @return string |
|
72 | - */ |
|
73 | - public function getHeader(string $key): string { |
|
74 | - $headers = $this->response->getHeader($key); |
|
69 | + /** |
|
70 | + * @param string $key |
|
71 | + * @return string |
|
72 | + */ |
|
73 | + public function getHeader(string $key): string { |
|
74 | + $headers = $this->response->getHeader($key); |
|
75 | 75 | |
76 | - if (count($headers) === 0) { |
|
77 | - return ''; |
|
78 | - } |
|
76 | + if (count($headers) === 0) { |
|
77 | + return ''; |
|
78 | + } |
|
79 | 79 | |
80 | - return $headers[0]; |
|
81 | - } |
|
80 | + return $headers[0]; |
|
81 | + } |
|
82 | 82 | |
83 | - /** |
|
84 | - * @return array |
|
85 | - */ |
|
86 | - public function getHeaders(): array { |
|
87 | - return $this->response->getHeaders(); |
|
88 | - } |
|
83 | + /** |
|
84 | + * @return array |
|
85 | + */ |
|
86 | + public function getHeaders(): array { |
|
87 | + return $this->response->getHeaders(); |
|
88 | + } |
|
89 | 89 | } |
@@ -25,11 +25,11 @@ |
||
25 | 25 | use OpenStack\Identity\v2\Service; |
26 | 26 | |
27 | 27 | class SwiftV2CachingAuthService extends Service { |
28 | - public function authenticate(array $options = []): array { |
|
29 | - if (!empty($options['v2cachedToken'])) { |
|
30 | - return [$options['v2cachedToken'], $options['v2serviceUrl']]; |
|
31 | - } else { |
|
32 | - return parent::authenticate($options); |
|
33 | - } |
|
34 | - } |
|
28 | + public function authenticate(array $options = []): array { |
|
29 | + if (!empty($options['v2cachedToken'])) { |
|
30 | + return [$options['v2cachedToken'], $options['v2serviceUrl']]; |
|
31 | + } else { |
|
32 | + return parent::authenticate($options); |
|
33 | + } |
|
34 | + } |
|
35 | 35 | } |
@@ -29,104 +29,104 @@ |
||
29 | 29 | |
30 | 30 | class RemoveClassifiedEventActivity implements IRepairStep { |
31 | 31 | |
32 | - /** @var IDBConnection */ |
|
33 | - private $connection; |
|
34 | - |
|
35 | - public function __construct(IDBConnection $connection) { |
|
36 | - $this->connection = $connection; |
|
37 | - } |
|
38 | - |
|
39 | - /** |
|
40 | - * @inheritdoc |
|
41 | - */ |
|
42 | - public function getName() { |
|
43 | - return 'Remove activity entries of private events'; |
|
44 | - } |
|
45 | - |
|
46 | - /** |
|
47 | - * @inheritdoc |
|
48 | - */ |
|
49 | - public function run(IOutput $output) { |
|
50 | - if (!$this->connection->tableExists('activity')) { |
|
51 | - return; |
|
52 | - } |
|
53 | - |
|
54 | - $deletedEvents = $this->removePrivateEventActivity(); |
|
55 | - $deletedEvents += $this->removeConfidentialUncensoredEventActivity(); |
|
56 | - |
|
57 | - $output->info("Removed $deletedEvents activity entries"); |
|
58 | - } |
|
59 | - |
|
60 | - protected function removePrivateEventActivity(): int { |
|
61 | - $deletedEvents = 0; |
|
62 | - |
|
63 | - $delete = $this->connection->getQueryBuilder(); |
|
64 | - $delete->delete('activity') |
|
65 | - ->where($delete->expr()->neq('affecteduser', $delete->createParameter('owner'))) |
|
66 | - ->andWhere($delete->expr()->eq('object_type', $delete->createParameter('type'))) |
|
67 | - ->andWhere($delete->expr()->eq('object_id', $delete->createParameter('calendar_id'))) |
|
68 | - ->andWhere($delete->expr()->like('subjectparams', $delete->createParameter('event_uid'))); |
|
69 | - |
|
70 | - $query = $this->connection->getQueryBuilder(); |
|
71 | - $query->select('c.principaluri', 'o.calendarid', 'o.uid') |
|
72 | - ->from('calendarobjects', 'o') |
|
73 | - ->leftJoin('o', 'calendars', 'c', $query->expr()->eq('c.id', 'o.calendarid')) |
|
74 | - ->where($query->expr()->eq('o.classification', $query->createNamedParameter(CalDavBackend::CLASSIFICATION_PRIVATE))); |
|
75 | - $result = $query->execute(); |
|
76 | - |
|
77 | - while ($row = $result->fetch()) { |
|
78 | - if ($row['principaluri'] === null) { |
|
79 | - continue; |
|
80 | - } |
|
81 | - |
|
82 | - $delete->setParameter('owner', $this->getPrincipal($row['principaluri'])) |
|
83 | - ->setParameter('type', 'calendar') |
|
84 | - ->setParameter('calendar_id', $row['calendarid']) |
|
85 | - ->setParameter('event_uid', '%' . $this->connection->escapeLikeParameter('{"id":"' . $row['uid'] . '"') . '%'); |
|
86 | - $deletedEvents += $delete->execute(); |
|
87 | - } |
|
88 | - $result->closeCursor(); |
|
89 | - |
|
90 | - return $deletedEvents; |
|
91 | - } |
|
92 | - |
|
93 | - protected function removeConfidentialUncensoredEventActivity(): int { |
|
94 | - $deletedEvents = 0; |
|
95 | - |
|
96 | - $delete = $this->connection->getQueryBuilder(); |
|
97 | - $delete->delete('activity') |
|
98 | - ->where($delete->expr()->neq('affecteduser', $delete->createParameter('owner'))) |
|
99 | - ->andWhere($delete->expr()->eq('object_type', $delete->createParameter('type'))) |
|
100 | - ->andWhere($delete->expr()->eq('object_id', $delete->createParameter('calendar_id'))) |
|
101 | - ->andWhere($delete->expr()->like('subjectparams', $delete->createParameter('event_uid'))) |
|
102 | - ->andWhere($delete->expr()->notLike('subjectparams', $delete->createParameter('filtered_name'))); |
|
103 | - |
|
104 | - $query = $this->connection->getQueryBuilder(); |
|
105 | - $query->select('c.principaluri', 'o.calendarid', 'o.uid') |
|
106 | - ->from('calendarobjects', 'o') |
|
107 | - ->leftJoin('o', 'calendars', 'c', $query->expr()->eq('c.id', 'o.calendarid')) |
|
108 | - ->where($query->expr()->eq('o.classification', $query->createNamedParameter(CalDavBackend::CLASSIFICATION_CONFIDENTIAL))); |
|
109 | - $result = $query->execute(); |
|
110 | - |
|
111 | - while ($row = $result->fetch()) { |
|
112 | - if ($row['principaluri'] === null) { |
|
113 | - continue; |
|
114 | - } |
|
115 | - |
|
116 | - $delete->setParameter('owner', $this->getPrincipal($row['principaluri'])) |
|
117 | - ->setParameter('type', 'calendar') |
|
118 | - ->setParameter('calendar_id', $row['calendarid']) |
|
119 | - ->setParameter('event_uid', '%' . $this->connection->escapeLikeParameter('{"id":"' . $row['uid'] . '"') . '%') |
|
120 | - ->setParameter('filtered_name', '%' . $this->connection->escapeLikeParameter('{"id":"' . $row['uid'] . '","name":"Busy"') . '%'); |
|
121 | - $deletedEvents += $delete->execute(); |
|
122 | - } |
|
123 | - $result->closeCursor(); |
|
124 | - |
|
125 | - return $deletedEvents; |
|
126 | - } |
|
127 | - |
|
128 | - protected function getPrincipal(string $principalUri): string { |
|
129 | - $uri = explode('/', $principalUri); |
|
130 | - return array_pop($uri); |
|
131 | - } |
|
32 | + /** @var IDBConnection */ |
|
33 | + private $connection; |
|
34 | + |
|
35 | + public function __construct(IDBConnection $connection) { |
|
36 | + $this->connection = $connection; |
|
37 | + } |
|
38 | + |
|
39 | + /** |
|
40 | + * @inheritdoc |
|
41 | + */ |
|
42 | + public function getName() { |
|
43 | + return 'Remove activity entries of private events'; |
|
44 | + } |
|
45 | + |
|
46 | + /** |
|
47 | + * @inheritdoc |
|
48 | + */ |
|
49 | + public function run(IOutput $output) { |
|
50 | + if (!$this->connection->tableExists('activity')) { |
|
51 | + return; |
|
52 | + } |
|
53 | + |
|
54 | + $deletedEvents = $this->removePrivateEventActivity(); |
|
55 | + $deletedEvents += $this->removeConfidentialUncensoredEventActivity(); |
|
56 | + |
|
57 | + $output->info("Removed $deletedEvents activity entries"); |
|
58 | + } |
|
59 | + |
|
60 | + protected function removePrivateEventActivity(): int { |
|
61 | + $deletedEvents = 0; |
|
62 | + |
|
63 | + $delete = $this->connection->getQueryBuilder(); |
|
64 | + $delete->delete('activity') |
|
65 | + ->where($delete->expr()->neq('affecteduser', $delete->createParameter('owner'))) |
|
66 | + ->andWhere($delete->expr()->eq('object_type', $delete->createParameter('type'))) |
|
67 | + ->andWhere($delete->expr()->eq('object_id', $delete->createParameter('calendar_id'))) |
|
68 | + ->andWhere($delete->expr()->like('subjectparams', $delete->createParameter('event_uid'))); |
|
69 | + |
|
70 | + $query = $this->connection->getQueryBuilder(); |
|
71 | + $query->select('c.principaluri', 'o.calendarid', 'o.uid') |
|
72 | + ->from('calendarobjects', 'o') |
|
73 | + ->leftJoin('o', 'calendars', 'c', $query->expr()->eq('c.id', 'o.calendarid')) |
|
74 | + ->where($query->expr()->eq('o.classification', $query->createNamedParameter(CalDavBackend::CLASSIFICATION_PRIVATE))); |
|
75 | + $result = $query->execute(); |
|
76 | + |
|
77 | + while ($row = $result->fetch()) { |
|
78 | + if ($row['principaluri'] === null) { |
|
79 | + continue; |
|
80 | + } |
|
81 | + |
|
82 | + $delete->setParameter('owner', $this->getPrincipal($row['principaluri'])) |
|
83 | + ->setParameter('type', 'calendar') |
|
84 | + ->setParameter('calendar_id', $row['calendarid']) |
|
85 | + ->setParameter('event_uid', '%' . $this->connection->escapeLikeParameter('{"id":"' . $row['uid'] . '"') . '%'); |
|
86 | + $deletedEvents += $delete->execute(); |
|
87 | + } |
|
88 | + $result->closeCursor(); |
|
89 | + |
|
90 | + return $deletedEvents; |
|
91 | + } |
|
92 | + |
|
93 | + protected function removeConfidentialUncensoredEventActivity(): int { |
|
94 | + $deletedEvents = 0; |
|
95 | + |
|
96 | + $delete = $this->connection->getQueryBuilder(); |
|
97 | + $delete->delete('activity') |
|
98 | + ->where($delete->expr()->neq('affecteduser', $delete->createParameter('owner'))) |
|
99 | + ->andWhere($delete->expr()->eq('object_type', $delete->createParameter('type'))) |
|
100 | + ->andWhere($delete->expr()->eq('object_id', $delete->createParameter('calendar_id'))) |
|
101 | + ->andWhere($delete->expr()->like('subjectparams', $delete->createParameter('event_uid'))) |
|
102 | + ->andWhere($delete->expr()->notLike('subjectparams', $delete->createParameter('filtered_name'))); |
|
103 | + |
|
104 | + $query = $this->connection->getQueryBuilder(); |
|
105 | + $query->select('c.principaluri', 'o.calendarid', 'o.uid') |
|
106 | + ->from('calendarobjects', 'o') |
|
107 | + ->leftJoin('o', 'calendars', 'c', $query->expr()->eq('c.id', 'o.calendarid')) |
|
108 | + ->where($query->expr()->eq('o.classification', $query->createNamedParameter(CalDavBackend::CLASSIFICATION_CONFIDENTIAL))); |
|
109 | + $result = $query->execute(); |
|
110 | + |
|
111 | + while ($row = $result->fetch()) { |
|
112 | + if ($row['principaluri'] === null) { |
|
113 | + continue; |
|
114 | + } |
|
115 | + |
|
116 | + $delete->setParameter('owner', $this->getPrincipal($row['principaluri'])) |
|
117 | + ->setParameter('type', 'calendar') |
|
118 | + ->setParameter('calendar_id', $row['calendarid']) |
|
119 | + ->setParameter('event_uid', '%' . $this->connection->escapeLikeParameter('{"id":"' . $row['uid'] . '"') . '%') |
|
120 | + ->setParameter('filtered_name', '%' . $this->connection->escapeLikeParameter('{"id":"' . $row['uid'] . '","name":"Busy"') . '%'); |
|
121 | + $deletedEvents += $delete->execute(); |
|
122 | + } |
|
123 | + $result->closeCursor(); |
|
124 | + |
|
125 | + return $deletedEvents; |
|
126 | + } |
|
127 | + |
|
128 | + protected function getPrincipal(string $principalUri): string { |
|
129 | + $uri = explode('/', $principalUri); |
|
130 | + return array_pop($uri); |
|
131 | + } |
|
132 | 132 | } |
@@ -28,8 +28,8 @@ |
||
28 | 28 | use OCP\Template; |
29 | 29 | |
30 | 30 | class Personal implements IPersonalProviderSettings { |
31 | - public function getBody(): Template { |
|
32 | - return new Template('twofactor_backupcodes', 'personal'); |
|
33 | - } |
|
31 | + public function getBody(): Template { |
|
32 | + return new Template('twofactor_backupcodes', 'personal'); |
|
33 | + } |
|
34 | 34 | |
35 | 35 | } |
@@ -35,34 +35,34 @@ |
||
35 | 35 | * a reload but if the session variable is set we properly redirect to the login page. |
36 | 36 | */ |
37 | 37 | class ReloadExecutionMiddleware extends Middleware { |
38 | - /** @var ISession */ |
|
39 | - private $session; |
|
40 | - /** @var IURLGenerator */ |
|
41 | - private $urlGenerator; |
|
38 | + /** @var ISession */ |
|
39 | + private $session; |
|
40 | + /** @var IURLGenerator */ |
|
41 | + private $urlGenerator; |
|
42 | 42 | |
43 | - public function __construct(ISession $session, IURLGenerator $urlGenerator) { |
|
44 | - $this->session = $session; |
|
45 | - $this->urlGenerator = $urlGenerator; |
|
46 | - } |
|
43 | + public function __construct(ISession $session, IURLGenerator $urlGenerator) { |
|
44 | + $this->session = $session; |
|
45 | + $this->urlGenerator = $urlGenerator; |
|
46 | + } |
|
47 | 47 | |
48 | - public function beforeController($controller, $methodName) { |
|
49 | - if ($this->session->exists('clearingExecutionContexts')) { |
|
50 | - throw new ReloadExecutionException(); |
|
51 | - } |
|
52 | - } |
|
48 | + public function beforeController($controller, $methodName) { |
|
49 | + if ($this->session->exists('clearingExecutionContexts')) { |
|
50 | + throw new ReloadExecutionException(); |
|
51 | + } |
|
52 | + } |
|
53 | 53 | |
54 | - public function afterException($controller, $methodName, \Exception $exception) { |
|
55 | - if ($exception instanceof ReloadExecutionException) { |
|
56 | - $this->session->remove('clearingExecutionContexts'); |
|
54 | + public function afterException($controller, $methodName, \Exception $exception) { |
|
55 | + if ($exception instanceof ReloadExecutionException) { |
|
56 | + $this->session->remove('clearingExecutionContexts'); |
|
57 | 57 | |
58 | - return new RedirectResponse($this->urlGenerator->linkToRouteAbsolute( |
|
59 | - 'core.login.showLoginForm', |
|
60 | - ['clear' => true] // this param the the code in login.js may be removed when the "Clear-Site-Data" is working in the browsers |
|
61 | - )); |
|
62 | - } |
|
58 | + return new RedirectResponse($this->urlGenerator->linkToRouteAbsolute( |
|
59 | + 'core.login.showLoginForm', |
|
60 | + ['clear' => true] // this param the the code in login.js may be removed when the "Clear-Site-Data" is working in the browsers |
|
61 | + )); |
|
62 | + } |
|
63 | 63 | |
64 | - return parent::afterException($controller, $methodName, $exception); |
|
65 | - } |
|
64 | + return parent::afterException($controller, $methodName, $exception); |
|
65 | + } |
|
66 | 66 | |
67 | 67 | |
68 | 68 | } |
@@ -30,10 +30,10 @@ |
||
30 | 30 | * @since 16.0.0 |
31 | 31 | */ |
32 | 32 | interface IConfigHandler { |
33 | - /** |
|
34 | - * @param mixed $optionValue |
|
35 | - * @return mixed the same type as $optionValue |
|
36 | - * @since 16.0.0 |
|
37 | - */ |
|
38 | - public function handle($optionValue); |
|
33 | + /** |
|
34 | + * @param mixed $optionValue |
|
35 | + * @return mixed the same type as $optionValue |
|
36 | + * @since 16.0.0 |
|
37 | + */ |
|
38 | + public function handle($optionValue); |
|
39 | 39 | } |