@@ -33,61 +33,61 @@ |
||
33 | 33 | |
34 | 34 | class Version010000Date20200304152605 extends SimpleMigrationStep { |
35 | 35 | |
36 | - /** |
|
37 | - * @param IOutput $output |
|
38 | - * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
39 | - * @param array $options |
|
40 | - * |
|
41 | - * @return ISchemaWrapper |
|
42 | - */ |
|
43 | - public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ISchemaWrapper { |
|
44 | - /** @var ISchemaWrapper $schema */ |
|
45 | - $schema = $schemaClosure(); |
|
36 | + /** |
|
37 | + * @param IOutput $output |
|
38 | + * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
39 | + * @param array $options |
|
40 | + * |
|
41 | + * @return ISchemaWrapper |
|
42 | + */ |
|
43 | + public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ISchemaWrapper { |
|
44 | + /** @var ISchemaWrapper $schema */ |
|
45 | + $schema = $schemaClosure(); |
|
46 | 46 | |
47 | - $table = $schema->createTable(RecentContactMapper::TABLE_NAME); |
|
48 | - $table->addColumn('id', 'integer', [ |
|
49 | - 'autoincrement' => true, |
|
50 | - 'notnull' => true, |
|
51 | - 'length' => 4, |
|
52 | - ]); |
|
53 | - $table->addColumn('actor_uid', 'string', [ |
|
54 | - 'notnull' => true, |
|
55 | - 'length' => 64, |
|
56 | - ]); |
|
57 | - $table->addColumn('uid', 'string', [ |
|
58 | - 'notnull' => false, |
|
59 | - 'length' => 64, |
|
60 | - ]); |
|
61 | - $table->addColumn('email', 'string', [ |
|
62 | - 'notnull' => false, |
|
63 | - 'length' => 255, |
|
64 | - ]); |
|
65 | - $table->addColumn('federated_cloud_id', 'string', [ |
|
66 | - 'notnull' => false, |
|
67 | - 'length' => 255, |
|
68 | - ]); |
|
69 | - $table->addColumn('card', 'blob', [ |
|
70 | - 'notnull' => true, |
|
71 | - ]); |
|
72 | - $table->addColumn('last_contact', 'integer', [ |
|
73 | - 'notnull' => true, |
|
74 | - 'length' => 4, |
|
75 | - ]); |
|
76 | - $table->setPrimaryKey(['id']); |
|
77 | - // To find all recent entries |
|
78 | - $table->addIndex(['actor_uid'], RecentContactMapper::TABLE_NAME . '_actor_uid'); |
|
79 | - // To find a specific entry |
|
80 | - $table->addIndex(['id', 'actor_uid'], RecentContactMapper::TABLE_NAME . '_id_uid'); |
|
81 | - // To find all recent entries with a given UID |
|
82 | - $table->addIndex(['uid'], RecentContactMapper::TABLE_NAME . '_uid'); |
|
83 | - // To find all recent entries with a given email address |
|
84 | - $table->addIndex(['email'], RecentContactMapper::TABLE_NAME . '_email'); |
|
85 | - // To find all recent entries with a give federated cloud id |
|
86 | - $table->addIndex(['federated_cloud_id'], RecentContactMapper::TABLE_NAME . '_fed_id'); |
|
87 | - // For the cleanup |
|
88 | - $table->addIndex(['last_contact'], RecentContactMapper::TABLE_NAME . '_last_contact'); |
|
47 | + $table = $schema->createTable(RecentContactMapper::TABLE_NAME); |
|
48 | + $table->addColumn('id', 'integer', [ |
|
49 | + 'autoincrement' => true, |
|
50 | + 'notnull' => true, |
|
51 | + 'length' => 4, |
|
52 | + ]); |
|
53 | + $table->addColumn('actor_uid', 'string', [ |
|
54 | + 'notnull' => true, |
|
55 | + 'length' => 64, |
|
56 | + ]); |
|
57 | + $table->addColumn('uid', 'string', [ |
|
58 | + 'notnull' => false, |
|
59 | + 'length' => 64, |
|
60 | + ]); |
|
61 | + $table->addColumn('email', 'string', [ |
|
62 | + 'notnull' => false, |
|
63 | + 'length' => 255, |
|
64 | + ]); |
|
65 | + $table->addColumn('federated_cloud_id', 'string', [ |
|
66 | + 'notnull' => false, |
|
67 | + 'length' => 255, |
|
68 | + ]); |
|
69 | + $table->addColumn('card', 'blob', [ |
|
70 | + 'notnull' => true, |
|
71 | + ]); |
|
72 | + $table->addColumn('last_contact', 'integer', [ |
|
73 | + 'notnull' => true, |
|
74 | + 'length' => 4, |
|
75 | + ]); |
|
76 | + $table->setPrimaryKey(['id']); |
|
77 | + // To find all recent entries |
|
78 | + $table->addIndex(['actor_uid'], RecentContactMapper::TABLE_NAME . '_actor_uid'); |
|
79 | + // To find a specific entry |
|
80 | + $table->addIndex(['id', 'actor_uid'], RecentContactMapper::TABLE_NAME . '_id_uid'); |
|
81 | + // To find all recent entries with a given UID |
|
82 | + $table->addIndex(['uid'], RecentContactMapper::TABLE_NAME . '_uid'); |
|
83 | + // To find all recent entries with a given email address |
|
84 | + $table->addIndex(['email'], RecentContactMapper::TABLE_NAME . '_email'); |
|
85 | + // To find all recent entries with a give federated cloud id |
|
86 | + $table->addIndex(['federated_cloud_id'], RecentContactMapper::TABLE_NAME . '_fed_id'); |
|
87 | + // For the cleanup |
|
88 | + $table->addIndex(['last_contact'], RecentContactMapper::TABLE_NAME . '_last_contact'); |
|
89 | 89 | |
90 | - return $schema; |
|
91 | - } |
|
90 | + return $schema; |
|
91 | + } |
|
92 | 92 | |
93 | 93 | } |
@@ -33,49 +33,49 @@ |
||
33 | 33 | |
34 | 34 | class AddressBookProvider implements IAddressBookProvider { |
35 | 35 | |
36 | - /** @var RecentContactMapper */ |
|
37 | - private $mapper; |
|
36 | + /** @var RecentContactMapper */ |
|
37 | + private $mapper; |
|
38 | 38 | |
39 | - /** @var IL10N */ |
|
40 | - private $l10n; |
|
39 | + /** @var IL10N */ |
|
40 | + private $l10n; |
|
41 | 41 | |
42 | - public function __construct(RecentContactMapper $mapper, IL10N $l10n) { |
|
43 | - $this->mapper = $mapper; |
|
44 | - $this->l10n = $l10n; |
|
45 | - } |
|
42 | + public function __construct(RecentContactMapper $mapper, IL10N $l10n) { |
|
43 | + $this->mapper = $mapper; |
|
44 | + $this->l10n = $l10n; |
|
45 | + } |
|
46 | 46 | |
47 | - /** |
|
48 | - * @inheritDoc |
|
49 | - */ |
|
50 | - public function getAppId(): string { |
|
51 | - return Application::APP_ID; |
|
52 | - } |
|
47 | + /** |
|
48 | + * @inheritDoc |
|
49 | + */ |
|
50 | + public function getAppId(): string { |
|
51 | + return Application::APP_ID; |
|
52 | + } |
|
53 | 53 | |
54 | - /** |
|
55 | - * @inheritDoc |
|
56 | - */ |
|
57 | - public function fetchAllForAddressBookHome(string $principalUri): array { |
|
58 | - return [ |
|
59 | - new AddressBook($this->mapper, $this->l10n, $principalUri) |
|
60 | - ]; |
|
61 | - } |
|
54 | + /** |
|
55 | + * @inheritDoc |
|
56 | + */ |
|
57 | + public function fetchAllForAddressBookHome(string $principalUri): array { |
|
58 | + return [ |
|
59 | + new AddressBook($this->mapper, $this->l10n, $principalUri) |
|
60 | + ]; |
|
61 | + } |
|
62 | 62 | |
63 | - /** |
|
64 | - * @inheritDoc |
|
65 | - */ |
|
66 | - public function hasAddressBookInAddressBookHome(string $principalUri, string $uri): bool { |
|
67 | - return $uri === AddressBook::URI; |
|
68 | - } |
|
63 | + /** |
|
64 | + * @inheritDoc |
|
65 | + */ |
|
66 | + public function hasAddressBookInAddressBookHome(string $principalUri, string $uri): bool { |
|
67 | + return $uri === AddressBook::URI; |
|
68 | + } |
|
69 | 69 | |
70 | - /** |
|
71 | - * @inheritDoc |
|
72 | - */ |
|
73 | - public function getAddressBookInAddressBookHome(string $principalUri, string $uri): ?ExternalAddressBook { |
|
74 | - if ($uri === AddressBook::URI) { |
|
75 | - return new AddressBook($this->mapper, $this->l10n, $principalUri); |
|
76 | - } |
|
70 | + /** |
|
71 | + * @inheritDoc |
|
72 | + */ |
|
73 | + public function getAddressBookInAddressBookHome(string $principalUri, string $uri): ?ExternalAddressBook { |
|
74 | + if ($uri === AddressBook::URI) { |
|
75 | + return new AddressBook($this->mapper, $this->l10n, $principalUri); |
|
76 | + } |
|
77 | 77 | |
78 | - return null; |
|
79 | - } |
|
78 | + return null; |
|
79 | + } |
|
80 | 80 | |
81 | 81 | } |
@@ -32,23 +32,23 @@ |
||
32 | 32 | $limit = null; |
33 | 33 | $offset = null; |
34 | 34 | if (isset($_GET['pattern'])) { |
35 | - $pattern = (string)$_GET['pattern']; |
|
35 | + $pattern = (string)$_GET['pattern']; |
|
36 | 36 | } |
37 | 37 | if (isset($_GET['limit'])) { |
38 | - $limit = (int)$_GET['limit']; |
|
38 | + $limit = (int)$_GET['limit']; |
|
39 | 39 | } |
40 | 40 | if (isset($_GET['offset'])) { |
41 | - $offset = (int)$_GET['offset']; |
|
41 | + $offset = (int)$_GET['offset']; |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | $groups = []; |
45 | 45 | foreach (\OC::$server->getGroupManager()->search($pattern, $limit, $offset) as $group) { |
46 | - $groups[$group->getGID()] = $group->getDisplayName(); |
|
46 | + $groups[$group->getGID()] = $group->getDisplayName(); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | $users = []; |
50 | 50 | foreach (\OC::$server->getUserManager()->searchDisplayName($pattern, $limit, $offset) as $user) { |
51 | - $users[$user->getUID()] = $user->getDisplayName(); |
|
51 | + $users[$user->getUID()] = $user->getDisplayName(); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | $results = ['groups' => $groups, 'users' => $users]; |
@@ -35,76 +35,76 @@ |
||
35 | 35 | |
36 | 36 | class RemoveOrphanEventsAndContacts implements IRepairStep { |
37 | 37 | |
38 | - /** @var IDBConnection */ |
|
39 | - private $connection; |
|
40 | - |
|
41 | - public function __construct(IDBConnection $connection) { |
|
42 | - $this->connection = $connection; |
|
43 | - } |
|
44 | - |
|
45 | - /** |
|
46 | - * @inheritdoc |
|
47 | - */ |
|
48 | - public function getName(): string { |
|
49 | - return 'Clean up orphan event and contact data'; |
|
50 | - } |
|
51 | - |
|
52 | - /** |
|
53 | - * @inheritdoc |
|
54 | - */ |
|
55 | - public function run(IOutput $output) { |
|
56 | - $orphanItems = $this->removeOrphanChildren('calendarobjects', 'calendars', 'calendarid'); |
|
57 | - $output->info(sprintf('%d events without a calendar have been cleaned up', $orphanItems)); |
|
58 | - $orphanItems = $this->removeOrphanChildren('calendarobjects_props', 'calendarobjects', 'objectid'); |
|
59 | - $output->info(sprintf('%d properties without an events have been cleaned up', $orphanItems)); |
|
60 | - $orphanItems = $this->removeOrphanChildren('calendarchanges', 'calendars', 'calendarid'); |
|
61 | - $output->info(sprintf('%d changes without a calendar have been cleaned up', $orphanItems)); |
|
62 | - |
|
63 | - $orphanItems = $this->removeOrphanChildren('calendarobjects', 'calendarsubscriptions', 'calendarid'); |
|
64 | - $output->info(sprintf('%d cached events without a calendar subscription have been cleaned up', $orphanItems)); |
|
65 | - $orphanItems = $this->removeOrphanChildren('calendarchanges', 'calendarsubscriptions', 'calendarid'); |
|
66 | - $output->info(sprintf('%d changes without a calendar subscription have been cleaned up', $orphanItems)); |
|
67 | - |
|
68 | - $orphanItems = $this->removeOrphanChildren('cards', 'addressbooks', 'addressbookid'); |
|
69 | - $output->info(sprintf('%d contacts without an addressbook have been cleaned up', $orphanItems)); |
|
70 | - $orphanItems = $this->removeOrphanChildren('cards_properties', 'cards', 'cardid'); |
|
71 | - $output->info(sprintf('%d properties without a contact have been cleaned up', $orphanItems)); |
|
72 | - $orphanItems = $this->removeOrphanChildren('addressbookchanges', 'addressbooks', 'addressbookid'); |
|
73 | - $output->info(sprintf('%d changes without an addressbook have been cleaned up', $orphanItems)); |
|
74 | - } |
|
75 | - |
|
76 | - protected function removeOrphanChildren($childTable, $parentTable, $parentId): int { |
|
77 | - $qb = $this->connection->getQueryBuilder(); |
|
78 | - |
|
79 | - $qb->select('c.id') |
|
80 | - ->from($childTable, 'c') |
|
81 | - ->leftJoin('c', $parentTable, 'p', $qb->expr()->eq('c.' . $parentId, 'p.id')) |
|
82 | - ->where($qb->expr()->isNull('p.id')); |
|
83 | - |
|
84 | - if (\in_array($parentTable, ['calendars', 'calendarsubscriptions'], true)) { |
|
85 | - $calendarType = $parentTable === 'calendarsubscriptions' ? CalDavBackend::CALENDAR_TYPE_SUBSCRIPTION : CalDavBackend::CALENDAR_TYPE_CALENDAR; |
|
86 | - $qb->andWhere($qb->expr()->eq('c.calendartype', $qb->createNamedParameter($calendarType, IQueryBuilder::PARAM_INT), IQueryBuilder::PARAM_INT)); |
|
87 | - } |
|
88 | - |
|
89 | - $result = $qb->execute(); |
|
90 | - |
|
91 | - $orphanItems = []; |
|
92 | - while ($row = $result->fetch()) { |
|
93 | - $orphanItems[] = (int) $row['id']; |
|
94 | - } |
|
95 | - $result->closeCursor(); |
|
96 | - |
|
97 | - if (!empty($orphanItems)) { |
|
98 | - $qb->delete($childTable) |
|
99 | - ->where($qb->expr()->in('id', $qb->createParameter('ids'))); |
|
100 | - |
|
101 | - $orphanItemsBatch = array_chunk($orphanItems, 200); |
|
102 | - foreach ($orphanItemsBatch as $items) { |
|
103 | - $qb->setParameter('ids', $items, IQueryBuilder::PARAM_INT_ARRAY); |
|
104 | - $qb->execute(); |
|
105 | - } |
|
106 | - } |
|
107 | - |
|
108 | - return count($orphanItems); |
|
109 | - } |
|
38 | + /** @var IDBConnection */ |
|
39 | + private $connection; |
|
40 | + |
|
41 | + public function __construct(IDBConnection $connection) { |
|
42 | + $this->connection = $connection; |
|
43 | + } |
|
44 | + |
|
45 | + /** |
|
46 | + * @inheritdoc |
|
47 | + */ |
|
48 | + public function getName(): string { |
|
49 | + return 'Clean up orphan event and contact data'; |
|
50 | + } |
|
51 | + |
|
52 | + /** |
|
53 | + * @inheritdoc |
|
54 | + */ |
|
55 | + public function run(IOutput $output) { |
|
56 | + $orphanItems = $this->removeOrphanChildren('calendarobjects', 'calendars', 'calendarid'); |
|
57 | + $output->info(sprintf('%d events without a calendar have been cleaned up', $orphanItems)); |
|
58 | + $orphanItems = $this->removeOrphanChildren('calendarobjects_props', 'calendarobjects', 'objectid'); |
|
59 | + $output->info(sprintf('%d properties without an events have been cleaned up', $orphanItems)); |
|
60 | + $orphanItems = $this->removeOrphanChildren('calendarchanges', 'calendars', 'calendarid'); |
|
61 | + $output->info(sprintf('%d changes without a calendar have been cleaned up', $orphanItems)); |
|
62 | + |
|
63 | + $orphanItems = $this->removeOrphanChildren('calendarobjects', 'calendarsubscriptions', 'calendarid'); |
|
64 | + $output->info(sprintf('%d cached events without a calendar subscription have been cleaned up', $orphanItems)); |
|
65 | + $orphanItems = $this->removeOrphanChildren('calendarchanges', 'calendarsubscriptions', 'calendarid'); |
|
66 | + $output->info(sprintf('%d changes without a calendar subscription have been cleaned up', $orphanItems)); |
|
67 | + |
|
68 | + $orphanItems = $this->removeOrphanChildren('cards', 'addressbooks', 'addressbookid'); |
|
69 | + $output->info(sprintf('%d contacts without an addressbook have been cleaned up', $orphanItems)); |
|
70 | + $orphanItems = $this->removeOrphanChildren('cards_properties', 'cards', 'cardid'); |
|
71 | + $output->info(sprintf('%d properties without a contact have been cleaned up', $orphanItems)); |
|
72 | + $orphanItems = $this->removeOrphanChildren('addressbookchanges', 'addressbooks', 'addressbookid'); |
|
73 | + $output->info(sprintf('%d changes without an addressbook have been cleaned up', $orphanItems)); |
|
74 | + } |
|
75 | + |
|
76 | + protected function removeOrphanChildren($childTable, $parentTable, $parentId): int { |
|
77 | + $qb = $this->connection->getQueryBuilder(); |
|
78 | + |
|
79 | + $qb->select('c.id') |
|
80 | + ->from($childTable, 'c') |
|
81 | + ->leftJoin('c', $parentTable, 'p', $qb->expr()->eq('c.' . $parentId, 'p.id')) |
|
82 | + ->where($qb->expr()->isNull('p.id')); |
|
83 | + |
|
84 | + if (\in_array($parentTable, ['calendars', 'calendarsubscriptions'], true)) { |
|
85 | + $calendarType = $parentTable === 'calendarsubscriptions' ? CalDavBackend::CALENDAR_TYPE_SUBSCRIPTION : CalDavBackend::CALENDAR_TYPE_CALENDAR; |
|
86 | + $qb->andWhere($qb->expr()->eq('c.calendartype', $qb->createNamedParameter($calendarType, IQueryBuilder::PARAM_INT), IQueryBuilder::PARAM_INT)); |
|
87 | + } |
|
88 | + |
|
89 | + $result = $qb->execute(); |
|
90 | + |
|
91 | + $orphanItems = []; |
|
92 | + while ($row = $result->fetch()) { |
|
93 | + $orphanItems[] = (int) $row['id']; |
|
94 | + } |
|
95 | + $result->closeCursor(); |
|
96 | + |
|
97 | + if (!empty($orphanItems)) { |
|
98 | + $qb->delete($childTable) |
|
99 | + ->where($qb->expr()->in('id', $qb->createParameter('ids'))); |
|
100 | + |
|
101 | + $orphanItemsBatch = array_chunk($orphanItems, 200); |
|
102 | + foreach ($orphanItemsBatch as $items) { |
|
103 | + $qb->setParameter('ids', $items, IQueryBuilder::PARAM_INT_ARRAY); |
|
104 | + $qb->execute(); |
|
105 | + } |
|
106 | + } |
|
107 | + |
|
108 | + return count($orphanItems); |
|
109 | + } |
|
110 | 110 | } |
@@ -28,15 +28,15 @@ |
||
28 | 28 | $route = isset($_GET['download']) ? 'files_sharing.sharecontroller.downloadShare' : 'files_sharing.sharecontroller.showShare'; |
29 | 29 | |
30 | 30 | if ($token !== '') { |
31 | - $protocol = \OC::$server->getRequest()->getHttpProtocol(); |
|
32 | - if ($protocol == 'HTTP/1.0') { |
|
33 | - http_response_code(302); |
|
34 | - } else { |
|
35 | - http_response_code(307); |
|
36 | - } |
|
37 | - header('Location: ' . $urlGenerator->linkToRoute($route, ['token' => $token])); |
|
31 | + $protocol = \OC::$server->getRequest()->getHttpProtocol(); |
|
32 | + if ($protocol == 'HTTP/1.0') { |
|
33 | + http_response_code(302); |
|
34 | + } else { |
|
35 | + http_response_code(307); |
|
36 | + } |
|
37 | + header('Location: ' . $urlGenerator->linkToRoute($route, ['token' => $token])); |
|
38 | 38 | } else { |
39 | - http_response_code(404); |
|
40 | - $tmpl = new OCP\Template('', '404', 'guest'); |
|
41 | - print_unescaped($tmpl->fetchPage()); |
|
39 | + http_response_code(404); |
|
40 | + $tmpl = new OCP\Template('', '404', 'guest'); |
|
41 | + print_unescaped($tmpl->fetchPage()); |
|
42 | 42 | } |
@@ -35,7 +35,7 @@ |
||
35 | 35 | $connection = new \OCA\User_LDAP\Connection($ldapWrapper, $prefix); |
36 | 36 | $configuration = $connection->getConfiguration(); |
37 | 37 | if (isset($configuration['ldap_agent_password']) && $configuration['ldap_agent_password'] !== '') { |
38 | - // hide password |
|
39 | - $configuration['ldap_agent_password'] = '**PASSWORD SET**'; |
|
38 | + // hide password |
|
39 | + $configuration['ldap_agent_password'] = '**PASSWORD SET**'; |
|
40 | 40 | } |
41 | 41 | \OC_JSON::success(['configuration' => $configuration]); |
@@ -29,40 +29,40 @@ |
||
29 | 29 | * @deprecated 18.0.0 |
30 | 30 | */ |
31 | 31 | class TemplateManager { |
32 | - protected $templates = []; |
|
32 | + protected $templates = []; |
|
33 | 33 | |
34 | - public function registerTemplate($mimetype, $path) { |
|
35 | - $this->templates[$mimetype] = $path; |
|
36 | - } |
|
34 | + public function registerTemplate($mimetype, $path) { |
|
35 | + $this->templates[$mimetype] = $path; |
|
36 | + } |
|
37 | 37 | |
38 | - /** |
|
39 | - * get the path of the template for a mimetype |
|
40 | - * |
|
41 | - * @deprecated 18.0.0 |
|
42 | - * @param string $mimetype |
|
43 | - * @return string|null |
|
44 | - */ |
|
45 | - public function getTemplatePath($mimetype) { |
|
46 | - if (isset($this->templates[$mimetype])) { |
|
47 | - return $this->templates[$mimetype]; |
|
48 | - } else { |
|
49 | - return null; |
|
50 | - } |
|
51 | - } |
|
38 | + /** |
|
39 | + * get the path of the template for a mimetype |
|
40 | + * |
|
41 | + * @deprecated 18.0.0 |
|
42 | + * @param string $mimetype |
|
43 | + * @return string|null |
|
44 | + */ |
|
45 | + public function getTemplatePath($mimetype) { |
|
46 | + if (isset($this->templates[$mimetype])) { |
|
47 | + return $this->templates[$mimetype]; |
|
48 | + } else { |
|
49 | + return null; |
|
50 | + } |
|
51 | + } |
|
52 | 52 | |
53 | - /** |
|
54 | - * get the template content for a mimetype |
|
55 | - * |
|
56 | - * @deprecated 18.0.0 |
|
57 | - * @param string $mimetype |
|
58 | - * @return string |
|
59 | - */ |
|
60 | - public function getTemplate($mimetype) { |
|
61 | - $path = $this->getTemplatePath($mimetype); |
|
62 | - if ($path) { |
|
63 | - return file_get_contents($path); |
|
64 | - } else { |
|
65 | - return ''; |
|
66 | - } |
|
67 | - } |
|
53 | + /** |
|
54 | + * get the template content for a mimetype |
|
55 | + * |
|
56 | + * @deprecated 18.0.0 |
|
57 | + * @param string $mimetype |
|
58 | + * @return string |
|
59 | + */ |
|
60 | + public function getTemplate($mimetype) { |
|
61 | + $path = $this->getTemplatePath($mimetype); |
|
62 | + if ($path) { |
|
63 | + return file_get_contents($path); |
|
64 | + } else { |
|
65 | + return ''; |
|
66 | + } |
|
67 | + } |
|
68 | 68 | } |
@@ -26,14 +26,14 @@ discard block |
||
26 | 26 | use OC\DB\ConnectionFactory; |
27 | 27 | |
28 | 28 | class Sqlite extends AbstractDatabase { |
29 | - public $dbprettyname = 'Sqlite'; |
|
29 | + public $dbprettyname = 'Sqlite'; |
|
30 | 30 | |
31 | - public function validate($config) { |
|
32 | - return []; |
|
33 | - } |
|
31 | + public function validate($config) { |
|
32 | + return []; |
|
33 | + } |
|
34 | 34 | |
35 | - public function initialize($config) { |
|
36 | - /* |
|
35 | + public function initialize($config) { |
|
36 | + /* |
|
37 | 37 | * Web: When using web based installer its not possible to set dbname |
38 | 38 | * or dbtableprefix. Defaults used from ConnectionFactory and dbtype = 'sqlite' |
39 | 39 | * is written to config.php. |
@@ -44,32 +44,32 @@ discard block |
||
44 | 44 | * in connection factory configuration is obtained from config.php. |
45 | 45 | */ |
46 | 46 | |
47 | - $this->dbName = empty($config['dbname']) |
|
48 | - ? ConnectionFactory::DEFAULT_DBNAME |
|
49 | - : $config['dbname']; |
|
47 | + $this->dbName = empty($config['dbname']) |
|
48 | + ? ConnectionFactory::DEFAULT_DBNAME |
|
49 | + : $config['dbname']; |
|
50 | 50 | |
51 | - $this->tablePrefix = empty($config['dbtableprefix']) |
|
52 | - ? ConnectionFactory::DEFAULT_DBTABLEPREFIX |
|
53 | - : $config['dbtableprefix']; |
|
51 | + $this->tablePrefix = empty($config['dbtableprefix']) |
|
52 | + ? ConnectionFactory::DEFAULT_DBTABLEPREFIX |
|
53 | + : $config['dbtableprefix']; |
|
54 | 54 | |
55 | - if ($this->dbName !== ConnectionFactory::DEFAULT_DBNAME) { |
|
56 | - $this->config->setValue('dbname', $this->dbName); |
|
57 | - } |
|
55 | + if ($this->dbName !== ConnectionFactory::DEFAULT_DBNAME) { |
|
56 | + $this->config->setValue('dbname', $this->dbName); |
|
57 | + } |
|
58 | 58 | |
59 | - if ($this->tablePrefix !== ConnectionFactory::DEFAULT_DBTABLEPREFIX) { |
|
60 | - $this->config->setValue('dbtableprefix', $this->tablePrefix); |
|
61 | - } |
|
62 | - } |
|
59 | + if ($this->tablePrefix !== ConnectionFactory::DEFAULT_DBTABLEPREFIX) { |
|
60 | + $this->config->setValue('dbtableprefix', $this->tablePrefix); |
|
61 | + } |
|
62 | + } |
|
63 | 63 | |
64 | - public function setupDatabase($username) { |
|
65 | - $datadir = $this->config->getValue( |
|
66 | - 'datadirectory', |
|
67 | - \OC::$SERVERROOT . '/data' |
|
68 | - ); |
|
64 | + public function setupDatabase($username) { |
|
65 | + $datadir = $this->config->getValue( |
|
66 | + 'datadirectory', |
|
67 | + \OC::$SERVERROOT . '/data' |
|
68 | + ); |
|
69 | 69 | |
70 | - $sqliteFile = $datadir . '/' . $this->dbName . 'db'; |
|
71 | - if (file_exists($sqliteFile)) { |
|
72 | - unlink($sqliteFile); |
|
73 | - } |
|
74 | - } |
|
70 | + $sqliteFile = $datadir . '/' . $this->dbName . 'db'; |
|
71 | + if (file_exists($sqliteFile)) { |
|
72 | + unlink($sqliteFile); |
|
73 | + } |
|
74 | + } |
|
75 | 75 | } |
@@ -33,48 +33,48 @@ |
||
33 | 33 | |
34 | 34 | class WebAuthn implements ISettings { |
35 | 35 | |
36 | - /** @var PublicKeyCredentialMapper */ |
|
37 | - private $mapper; |
|
36 | + /** @var PublicKeyCredentialMapper */ |
|
37 | + private $mapper; |
|
38 | 38 | |
39 | - /** @var string */ |
|
40 | - private $uid; |
|
39 | + /** @var string */ |
|
40 | + private $uid; |
|
41 | 41 | |
42 | - /** @var IInitialStateService */ |
|
43 | - private $initialStateService; |
|
42 | + /** @var IInitialStateService */ |
|
43 | + private $initialStateService; |
|
44 | 44 | |
45 | - /** @var Manager */ |
|
46 | - private $manager; |
|
45 | + /** @var Manager */ |
|
46 | + private $manager; |
|
47 | 47 | |
48 | - public function __construct(PublicKeyCredentialMapper $mapper, |
|
49 | - string $UserId, |
|
50 | - IInitialStateService $initialStateService, |
|
51 | - Manager $manager) { |
|
52 | - $this->mapper = $mapper; |
|
53 | - $this->uid = $UserId; |
|
54 | - $this->initialStateService = $initialStateService; |
|
55 | - $this->manager = $manager; |
|
56 | - } |
|
48 | + public function __construct(PublicKeyCredentialMapper $mapper, |
|
49 | + string $UserId, |
|
50 | + IInitialStateService $initialStateService, |
|
51 | + Manager $manager) { |
|
52 | + $this->mapper = $mapper; |
|
53 | + $this->uid = $UserId; |
|
54 | + $this->initialStateService = $initialStateService; |
|
55 | + $this->manager = $manager; |
|
56 | + } |
|
57 | 57 | |
58 | - public function getForm() { |
|
59 | - $this->initialStateService->provideInitialState( |
|
60 | - Application::APP_ID, |
|
61 | - 'webauthn-devices', |
|
62 | - $this->mapper->findAllForUid($this->uid) |
|
63 | - ); |
|
58 | + public function getForm() { |
|
59 | + $this->initialStateService->provideInitialState( |
|
60 | + Application::APP_ID, |
|
61 | + 'webauthn-devices', |
|
62 | + $this->mapper->findAllForUid($this->uid) |
|
63 | + ); |
|
64 | 64 | |
65 | - return new TemplateResponse('settings', 'settings/personal/security/webauthn', [ |
|
66 | - ]); |
|
67 | - } |
|
65 | + return new TemplateResponse('settings', 'settings/personal/security/webauthn', [ |
|
66 | + ]); |
|
67 | + } |
|
68 | 68 | |
69 | - public function getSection(): ?string { |
|
70 | - if (!$this->manager->isWebAuthnAvailable()) { |
|
71 | - return null; |
|
72 | - } |
|
69 | + public function getSection(): ?string { |
|
70 | + if (!$this->manager->isWebAuthnAvailable()) { |
|
71 | + return null; |
|
72 | + } |
|
73 | 73 | |
74 | - return 'security'; |
|
75 | - } |
|
74 | + return 'security'; |
|
75 | + } |
|
76 | 76 | |
77 | - public function getPriority(): int { |
|
78 | - return 20; |
|
79 | - } |
|
77 | + public function getPriority(): int { |
|
78 | + return 20; |
|
79 | + } |
|
80 | 80 | } |