@@ -89,8 +89,8 @@ |
||
89 | 89 | 'displayName' => $user->getDisplayName(), |
90 | 90 | 'uid' => $user->getUID(), |
91 | 91 | 'dn' => $user->getDN(), |
92 | - 'lastLogin' => $this->formatDate($user->getLastLogin(), '-', (bool)$input->getOption('short-date')), |
|
93 | - 'detectedOn' => $this->formatDate($user->getDetectedOn(), 'unknown', (bool)$input->getOption('short-date')), |
|
92 | + 'lastLogin' => $this->formatDate($user->getLastLogin(), '-', (bool) $input->getOption('short-date')), |
|
93 | + 'detectedOn' => $this->formatDate($user->getDetectedOn(), 'unknown', (bool) $input->getOption('short-date')), |
|
94 | 94 | 'homePath' => $user->getHomePath(), |
95 | 95 | 'sharer' => $user->getHasActiveShares() ? 'Y' : 'N', |
96 | 96 | ]; |
@@ -36,73 +36,73 @@ |
||
36 | 36 | use Symfony\Component\Console\Output\OutputInterface; |
37 | 37 | |
38 | 38 | class ShowRemnants extends Command { |
39 | - /** @var \OCA\User_LDAP\User\DeletedUsersIndex */ |
|
40 | - protected $dui; |
|
39 | + /** @var \OCA\User_LDAP\User\DeletedUsersIndex */ |
|
40 | + protected $dui; |
|
41 | 41 | |
42 | - /** @var \OCP\IDateTimeFormatter */ |
|
43 | - protected $dateFormatter; |
|
42 | + /** @var \OCP\IDateTimeFormatter */ |
|
43 | + protected $dateFormatter; |
|
44 | 44 | |
45 | - /** |
|
46 | - * @param DeletedUsersIndex $dui |
|
47 | - * @param IDateTimeFormatter $dateFormatter |
|
48 | - */ |
|
49 | - public function __construct(DeletedUsersIndex $dui, IDateTimeFormatter $dateFormatter) { |
|
50 | - $this->dui = $dui; |
|
51 | - $this->dateFormatter = $dateFormatter; |
|
52 | - parent::__construct(); |
|
53 | - } |
|
45 | + /** |
|
46 | + * @param DeletedUsersIndex $dui |
|
47 | + * @param IDateTimeFormatter $dateFormatter |
|
48 | + */ |
|
49 | + public function __construct(DeletedUsersIndex $dui, IDateTimeFormatter $dateFormatter) { |
|
50 | + $this->dui = $dui; |
|
51 | + $this->dateFormatter = $dateFormatter; |
|
52 | + parent::__construct(); |
|
53 | + } |
|
54 | 54 | |
55 | - protected function configure() { |
|
56 | - $this |
|
57 | - ->setName('ldap:show-remnants') |
|
58 | - ->setDescription('shows which users are not available on LDAP anymore, but have remnants in Nextcloud.') |
|
59 | - ->addOption('json', null, InputOption::VALUE_NONE, 'return JSON array instead of pretty table.') |
|
60 | - ->addOption('short-date', null, InputOption::VALUE_NONE, 'show dates in Y-m-d format'); |
|
61 | - } |
|
55 | + protected function configure() { |
|
56 | + $this |
|
57 | + ->setName('ldap:show-remnants') |
|
58 | + ->setDescription('shows which users are not available on LDAP anymore, but have remnants in Nextcloud.') |
|
59 | + ->addOption('json', null, InputOption::VALUE_NONE, 'return JSON array instead of pretty table.') |
|
60 | + ->addOption('short-date', null, InputOption::VALUE_NONE, 'show dates in Y-m-d format'); |
|
61 | + } |
|
62 | 62 | |
63 | - protected function formatDate(int $timestamp, string $default, bool $showShortDate) { |
|
64 | - if (!($timestamp > 0)) { |
|
65 | - return $default; |
|
66 | - } |
|
67 | - if ($showShortDate) { |
|
68 | - return date('Y-m-d', $timestamp); |
|
69 | - } |
|
70 | - return $this->dateFormatter->formatDate($timestamp); |
|
71 | - } |
|
63 | + protected function formatDate(int $timestamp, string $default, bool $showShortDate) { |
|
64 | + if (!($timestamp > 0)) { |
|
65 | + return $default; |
|
66 | + } |
|
67 | + if ($showShortDate) { |
|
68 | + return date('Y-m-d', $timestamp); |
|
69 | + } |
|
70 | + return $this->dateFormatter->formatDate($timestamp); |
|
71 | + } |
|
72 | 72 | |
73 | - /** |
|
74 | - * executes the command, i.e. creates and outputs a table of LDAP users marked as deleted |
|
75 | - * |
|
76 | - * {@inheritdoc} |
|
77 | - */ |
|
78 | - protected function execute(InputInterface $input, OutputInterface $output): int { |
|
79 | - /** @var \Symfony\Component\Console\Helper\Table $table */ |
|
80 | - $table = new Table($output); |
|
81 | - $table->setHeaders([ |
|
82 | - 'Nextcloud name', 'Display Name', 'LDAP UID', 'LDAP DN', 'Last Login', |
|
83 | - 'Detected on', 'Dir', 'Sharer' |
|
84 | - ]); |
|
85 | - $rows = []; |
|
86 | - $resultSet = $this->dui->getUsers(); |
|
87 | - foreach ($resultSet as $user) { |
|
88 | - $rows[] = [ |
|
89 | - 'ocName' => $user->getOCName(), |
|
90 | - 'displayName' => $user->getDisplayName(), |
|
91 | - 'uid' => $user->getUID(), |
|
92 | - 'dn' => $user->getDN(), |
|
93 | - 'lastLogin' => $this->formatDate($user->getLastLogin(), '-', (bool)$input->getOption('short-date')), |
|
94 | - 'detectedOn' => $this->formatDate($user->getDetectedOn(), 'unknown', (bool)$input->getOption('short-date')), |
|
95 | - 'homePath' => $user->getHomePath(), |
|
96 | - 'sharer' => $user->getHasActiveShares() ? 'Y' : 'N', |
|
97 | - ]; |
|
98 | - } |
|
73 | + /** |
|
74 | + * executes the command, i.e. creates and outputs a table of LDAP users marked as deleted |
|
75 | + * |
|
76 | + * {@inheritdoc} |
|
77 | + */ |
|
78 | + protected function execute(InputInterface $input, OutputInterface $output): int { |
|
79 | + /** @var \Symfony\Component\Console\Helper\Table $table */ |
|
80 | + $table = new Table($output); |
|
81 | + $table->setHeaders([ |
|
82 | + 'Nextcloud name', 'Display Name', 'LDAP UID', 'LDAP DN', 'Last Login', |
|
83 | + 'Detected on', 'Dir', 'Sharer' |
|
84 | + ]); |
|
85 | + $rows = []; |
|
86 | + $resultSet = $this->dui->getUsers(); |
|
87 | + foreach ($resultSet as $user) { |
|
88 | + $rows[] = [ |
|
89 | + 'ocName' => $user->getOCName(), |
|
90 | + 'displayName' => $user->getDisplayName(), |
|
91 | + 'uid' => $user->getUID(), |
|
92 | + 'dn' => $user->getDN(), |
|
93 | + 'lastLogin' => $this->formatDate($user->getLastLogin(), '-', (bool)$input->getOption('short-date')), |
|
94 | + 'detectedOn' => $this->formatDate($user->getDetectedOn(), 'unknown', (bool)$input->getOption('short-date')), |
|
95 | + 'homePath' => $user->getHomePath(), |
|
96 | + 'sharer' => $user->getHasActiveShares() ? 'Y' : 'N', |
|
97 | + ]; |
|
98 | + } |
|
99 | 99 | |
100 | - if ($input->getOption('json')) { |
|
101 | - $output->writeln(json_encode($rows)); |
|
102 | - } else { |
|
103 | - $table->setRows($rows); |
|
104 | - $table->render(); |
|
105 | - } |
|
106 | - return 0; |
|
107 | - } |
|
100 | + if ($input->getOption('json')) { |
|
101 | + $output->writeln(json_encode($rows)); |
|
102 | + } else { |
|
103 | + $table->setRows($rows); |
|
104 | + $table->render(); |
|
105 | + } |
|
106 | + return 0; |
|
107 | + } |
|
108 | 108 | } |
@@ -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 | } |
@@ -68,7 +68,7 @@ |
||
68 | 68 | |
69 | 69 | $output->startProgress(); |
70 | 70 | // Loop over all seen users |
71 | - $this->userManager->callForSeenUsers(function (IUser $user) use ($output) { |
|
71 | + $this->userManager->callForSeenUsers(function(IUser $user) use ($output) { |
|
72 | 72 | try { |
73 | 73 | $userFolder = $this->rootFolder->getUserFolder($user->getUID()); |
74 | 74 | $userRoot = $userFolder->getParent(); |
@@ -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 | } |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | $delete->setParameter('owner', $this->getPrincipal($row['principaluri'])) |
79 | 79 | ->setParameter('type', 'calendar') |
80 | 80 | ->setParameter('calendar_id', $row['calendarid']) |
81 | - ->setParameter('event_uid', '%' . $this->connection->escapeLikeParameter('{"id":"' . $row['uid'] . '"') . '%'); |
|
81 | + ->setParameter('event_uid', '%'.$this->connection->escapeLikeParameter('{"id":"'.$row['uid'].'"').'%'); |
|
82 | 82 | $deletedEvents += $delete->execute(); |
83 | 83 | } |
84 | 84 | $result->closeCursor(); |
@@ -108,8 +108,8 @@ discard block |
||
108 | 108 | $delete->setParameter('owner', $this->getPrincipal($row['principaluri'])) |
109 | 109 | ->setParameter('type', 'calendar') |
110 | 110 | ->setParameter('calendar_id', $row['calendarid']) |
111 | - ->setParameter('event_uid', '%' . $this->connection->escapeLikeParameter('{"id":"' . $row['uid'] . '"') . '%') |
|
112 | - ->setParameter('filtered_name', '%' . $this->connection->escapeLikeParameter('{"id":"' . $row['uid'] . '","name":"Busy"') . '%'); |
|
111 | + ->setParameter('event_uid', '%'.$this->connection->escapeLikeParameter('{"id":"'.$row['uid'].'"').'%') |
|
112 | + ->setParameter('filtered_name', '%'.$this->connection->escapeLikeParameter('{"id":"'.$row['uid'].'","name":"Busy"').'%'); |
|
113 | 113 | $deletedEvents += $delete->execute(); |
114 | 114 | } |
115 | 115 | $result->closeCursor(); |
@@ -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 | } |
@@ -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 | } |
@@ -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 | } |
@@ -52,8 +52,8 @@ discard block |
||
52 | 52 | private function mapTrashItems(array $items, IUser $user, ITrashItem $parent = null): array { |
53 | 53 | $parentTrashPath = ($parent instanceof ITrashItem) ? $parent->getTrashPath() : ''; |
54 | 54 | $isRoot = $parent === null; |
55 | - return array_map(function (FileInfo $file) use ($parent, $parentTrashPath, $isRoot, $user) { |
|
56 | - $originalLocation = $isRoot ? $file['extraData'] : $parent->getOriginalLocation() . '/' . $file->getName(); |
|
55 | + return array_map(function(FileInfo $file) use ($parent, $parentTrashPath, $isRoot, $user) { |
|
56 | + $originalLocation = $isRoot ? $file['extraData'] : $parent->getOriginalLocation().'/'.$file->getName(); |
|
57 | 57 | if (!$originalLocation) { |
58 | 58 | $originalLocation = $file->getName(); |
59 | 59 | } |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | $this, |
62 | 62 | $originalLocation, |
63 | 63 | $file->getMTime(), |
64 | - $parentTrashPath . '/' . $file->getName() . ($isRoot ? '.d' . $file->getMtime() : ''), |
|
64 | + $parentTrashPath.'/'.$file->getName().($isRoot ? '.d'.$file->getMtime() : ''), |
|
65 | 65 | $file, |
66 | 66 | $user |
67 | 67 | ); |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | public function listTrashFolder(ITrashItem $folder): array { |
77 | 77 | $user = $folder->getUser(); |
78 | 78 | $entries = Helper::getTrashFiles($folder->getTrashPath(), $user->getUID()); |
79 | - return $this->mapTrashItems($entries, $user ,$folder); |
|
79 | + return $this->mapTrashItems($entries, $user, $folder); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | public function restoreItem(ITrashItem $item) { |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | public function removeItem(ITrashItem $item) { |
87 | 87 | $user = $item->getUser(); |
88 | 88 | if ($item->isRootItem()) { |
89 | - $path = substr($item->getTrashPath(), 0, -strlen('.d' . $item->getDeletedTime())); |
|
89 | + $path = substr($item->getTrashPath(), 0, -strlen('.d'.$item->getDeletedTime())); |
|
90 | 90 | Trashbin::delete($path, $user->getUID(), $item->getDeletedTime()); |
91 | 91 | } else { |
92 | 92 | Trashbin::delete($item->getTrashPath(), $user->getUID(), null); |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | if (!$storage instanceof Storage) { |
99 | 99 | return false; |
100 | 100 | } |
101 | - $normalized = Filesystem::normalizePath($storage->getMountPoint() . '/' . $internalPath, true, false, true); |
|
101 | + $normalized = Filesystem::normalizePath($storage->getMountPoint().'/'.$internalPath, true, false, true); |
|
102 | 102 | $view = Filesystem::getView(); |
103 | 103 | if (!isset($this->deletedFiles[$normalized]) && $view instanceof View) { |
104 | 104 | $this->deletedFiles[$normalized] = $normalized; |
@@ -35,99 +35,99 @@ |
||
35 | 35 | use OCP\IUser; |
36 | 36 | |
37 | 37 | class LegacyTrashBackend implements ITrashBackend { |
38 | - /** @var array */ |
|
39 | - private $deletedFiles = []; |
|
38 | + /** @var array */ |
|
39 | + private $deletedFiles = []; |
|
40 | 40 | |
41 | - /** @var IRootFolder */ |
|
42 | - private $rootFolder; |
|
41 | + /** @var IRootFolder */ |
|
42 | + private $rootFolder; |
|
43 | 43 | |
44 | - public function __construct(IRootFolder $rootFolder) { |
|
45 | - $this->rootFolder = $rootFolder; |
|
46 | - } |
|
44 | + public function __construct(IRootFolder $rootFolder) { |
|
45 | + $this->rootFolder = $rootFolder; |
|
46 | + } |
|
47 | 47 | |
48 | - /** |
|
49 | - * @param array $items |
|
50 | - * @param IUser $user |
|
51 | - * @param ITrashItem $parent |
|
52 | - * @return ITrashItem[] |
|
53 | - */ |
|
54 | - private function mapTrashItems(array $items, IUser $user, ITrashItem $parent = null): array { |
|
55 | - $parentTrashPath = ($parent instanceof ITrashItem) ? $parent->getTrashPath() : ''; |
|
56 | - $isRoot = $parent === null; |
|
57 | - return array_map(function (FileInfo $file) use ($parent, $parentTrashPath, $isRoot, $user) { |
|
58 | - $originalLocation = $isRoot ? $file['extraData'] : $parent->getOriginalLocation() . '/' . $file->getName(); |
|
59 | - if (!$originalLocation) { |
|
60 | - $originalLocation = $file->getName(); |
|
61 | - } |
|
62 | - return new TrashItem( |
|
63 | - $this, |
|
64 | - $originalLocation, |
|
65 | - $file->getMTime(), |
|
66 | - $parentTrashPath . '/' . $file->getName() . ($isRoot ? '.d' . $file->getMtime() : ''), |
|
67 | - $file, |
|
68 | - $user |
|
69 | - ); |
|
70 | - }, $items); |
|
71 | - } |
|
48 | + /** |
|
49 | + * @param array $items |
|
50 | + * @param IUser $user |
|
51 | + * @param ITrashItem $parent |
|
52 | + * @return ITrashItem[] |
|
53 | + */ |
|
54 | + private function mapTrashItems(array $items, IUser $user, ITrashItem $parent = null): array { |
|
55 | + $parentTrashPath = ($parent instanceof ITrashItem) ? $parent->getTrashPath() : ''; |
|
56 | + $isRoot = $parent === null; |
|
57 | + return array_map(function (FileInfo $file) use ($parent, $parentTrashPath, $isRoot, $user) { |
|
58 | + $originalLocation = $isRoot ? $file['extraData'] : $parent->getOriginalLocation() . '/' . $file->getName(); |
|
59 | + if (!$originalLocation) { |
|
60 | + $originalLocation = $file->getName(); |
|
61 | + } |
|
62 | + return new TrashItem( |
|
63 | + $this, |
|
64 | + $originalLocation, |
|
65 | + $file->getMTime(), |
|
66 | + $parentTrashPath . '/' . $file->getName() . ($isRoot ? '.d' . $file->getMtime() : ''), |
|
67 | + $file, |
|
68 | + $user |
|
69 | + ); |
|
70 | + }, $items); |
|
71 | + } |
|
72 | 72 | |
73 | - public function listTrashRoot(IUser $user): array { |
|
74 | - $entries = Helper::getTrashFiles('/', $user->getUID()); |
|
75 | - return $this->mapTrashItems($entries, $user); |
|
76 | - } |
|
73 | + public function listTrashRoot(IUser $user): array { |
|
74 | + $entries = Helper::getTrashFiles('/', $user->getUID()); |
|
75 | + return $this->mapTrashItems($entries, $user); |
|
76 | + } |
|
77 | 77 | |
78 | - public function listTrashFolder(ITrashItem $folder): array { |
|
79 | - $user = $folder->getUser(); |
|
80 | - $entries = Helper::getTrashFiles($folder->getTrashPath(), $user->getUID()); |
|
81 | - return $this->mapTrashItems($entries, $user ,$folder); |
|
82 | - } |
|
78 | + public function listTrashFolder(ITrashItem $folder): array { |
|
79 | + $user = $folder->getUser(); |
|
80 | + $entries = Helper::getTrashFiles($folder->getTrashPath(), $user->getUID()); |
|
81 | + return $this->mapTrashItems($entries, $user ,$folder); |
|
82 | + } |
|
83 | 83 | |
84 | - public function restoreItem(ITrashItem $item) { |
|
85 | - Trashbin::restore($item->getTrashPath(), $item->getName(), $item->isRootItem() ? $item->getDeletedTime() : null); |
|
86 | - } |
|
84 | + public function restoreItem(ITrashItem $item) { |
|
85 | + Trashbin::restore($item->getTrashPath(), $item->getName(), $item->isRootItem() ? $item->getDeletedTime() : null); |
|
86 | + } |
|
87 | 87 | |
88 | - public function removeItem(ITrashItem $item) { |
|
89 | - $user = $item->getUser(); |
|
90 | - if ($item->isRootItem()) { |
|
91 | - $path = substr($item->getTrashPath(), 0, -strlen('.d' . $item->getDeletedTime())); |
|
92 | - Trashbin::delete($path, $user->getUID(), $item->getDeletedTime()); |
|
93 | - } else { |
|
94 | - Trashbin::delete($item->getTrashPath(), $user->getUID(), null); |
|
95 | - } |
|
96 | - } |
|
88 | + public function removeItem(ITrashItem $item) { |
|
89 | + $user = $item->getUser(); |
|
90 | + if ($item->isRootItem()) { |
|
91 | + $path = substr($item->getTrashPath(), 0, -strlen('.d' . $item->getDeletedTime())); |
|
92 | + Trashbin::delete($path, $user->getUID(), $item->getDeletedTime()); |
|
93 | + } else { |
|
94 | + Trashbin::delete($item->getTrashPath(), $user->getUID(), null); |
|
95 | + } |
|
96 | + } |
|
97 | 97 | |
98 | - public function moveToTrash(IStorage $storage, string $internalPath): bool { |
|
99 | - if (!$storage instanceof Storage) { |
|
100 | - return false; |
|
101 | - } |
|
102 | - $normalized = Filesystem::normalizePath($storage->getMountPoint() . '/' . $internalPath, true, false, true); |
|
103 | - $view = Filesystem::getView(); |
|
104 | - if (!isset($this->deletedFiles[$normalized]) && $view instanceof View) { |
|
105 | - $this->deletedFiles[$normalized] = $normalized; |
|
106 | - if ($filesPath = $view->getRelativePath($normalized)) { |
|
107 | - $filesPath = trim($filesPath, '/'); |
|
108 | - $result = \OCA\Files_Trashbin\Trashbin::move2trash($filesPath); |
|
109 | - } else { |
|
110 | - $result = false; |
|
111 | - } |
|
112 | - unset($this->deletedFiles[$normalized]); |
|
113 | - } else { |
|
114 | - $result = false; |
|
115 | - } |
|
98 | + public function moveToTrash(IStorage $storage, string $internalPath): bool { |
|
99 | + if (!$storage instanceof Storage) { |
|
100 | + return false; |
|
101 | + } |
|
102 | + $normalized = Filesystem::normalizePath($storage->getMountPoint() . '/' . $internalPath, true, false, true); |
|
103 | + $view = Filesystem::getView(); |
|
104 | + if (!isset($this->deletedFiles[$normalized]) && $view instanceof View) { |
|
105 | + $this->deletedFiles[$normalized] = $normalized; |
|
106 | + if ($filesPath = $view->getRelativePath($normalized)) { |
|
107 | + $filesPath = trim($filesPath, '/'); |
|
108 | + $result = \OCA\Files_Trashbin\Trashbin::move2trash($filesPath); |
|
109 | + } else { |
|
110 | + $result = false; |
|
111 | + } |
|
112 | + unset($this->deletedFiles[$normalized]); |
|
113 | + } else { |
|
114 | + $result = false; |
|
115 | + } |
|
116 | 116 | |
117 | - return $result; |
|
118 | - } |
|
117 | + return $result; |
|
118 | + } |
|
119 | 119 | |
120 | - public function getTrashNodeById(IUser $user, int $fileId) { |
|
121 | - try { |
|
122 | - $userFolder = $this->rootFolder->getUserFolder($user->getUID()); |
|
123 | - $trash = $userFolder->getParent()->get('files_trashbin/files'); |
|
124 | - $trashFiles = $trash->getById($fileId); |
|
125 | - if (!$trashFiles) { |
|
126 | - return null; |
|
127 | - } |
|
128 | - return $trashFiles ? array_pop($trashFiles) : null; |
|
129 | - } catch (NotFoundException $e) { |
|
130 | - return null; |
|
131 | - } |
|
132 | - } |
|
120 | + public function getTrashNodeById(IUser $user, int $fileId) { |
|
121 | + try { |
|
122 | + $userFolder = $this->rootFolder->getUserFolder($user->getUID()); |
|
123 | + $trash = $userFolder->getParent()->get('files_trashbin/files'); |
|
124 | + $trashFiles = $trash->getById($fileId); |
|
125 | + if (!$trashFiles) { |
|
126 | + return null; |
|
127 | + } |
|
128 | + return $trashFiles ? array_pop($trashFiles) : null; |
|
129 | + } catch (NotFoundException $e) { |
|
130 | + return null; |
|
131 | + } |
|
132 | + } |
|
133 | 133 | } |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | |
52 | 52 | |
53 | 53 | public function setName($name) { |
54 | - throw new Forbidden('Renaming ' . self::FILENAME . ' is forbidden'); |
|
54 | + throw new Forbidden('Renaming '.self::FILENAME.' is forbidden'); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | /** |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | * @throws Forbidden |
66 | 66 | */ |
67 | 67 | public function delete() { |
68 | - throw new Forbidden(self::FILENAME . ' may not be deleted.'); |
|
68 | + throw new Forbidden(self::FILENAME.' may not be deleted.'); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | /** |
@@ -86,6 +86,6 @@ discard block |
||
86 | 86 | * @throws Forbidden |
87 | 87 | */ |
88 | 88 | public function propPatch(PropPatch $propPatch) { |
89 | - throw new Forbidden(self::FILENAME . '\'s properties may not be altered.'); |
|
89 | + throw new Forbidden(self::FILENAME.'\'s properties may not be altered.'); |
|
90 | 90 | } |
91 | 91 | } |
@@ -30,61 +30,61 @@ |
||
30 | 30 | use Sabre\DAV\PropPatch; |
31 | 31 | |
32 | 32 | class AppleProvisioningNode implements INode, IProperties { |
33 | - public const FILENAME = 'apple-provisioning.mobileconfig'; |
|
33 | + public const FILENAME = 'apple-provisioning.mobileconfig'; |
|
34 | 34 | |
35 | - protected $timeFactory; |
|
35 | + protected $timeFactory; |
|
36 | 36 | |
37 | - /** |
|
38 | - * @param ITimeFactory $timeFactory |
|
39 | - */ |
|
40 | - public function __construct(ITimeFactory $timeFactory) { |
|
41 | - $this->timeFactory = $timeFactory; |
|
42 | - } |
|
37 | + /** |
|
38 | + * @param ITimeFactory $timeFactory |
|
39 | + */ |
|
40 | + public function __construct(ITimeFactory $timeFactory) { |
|
41 | + $this->timeFactory = $timeFactory; |
|
42 | + } |
|
43 | 43 | |
44 | - /** |
|
45 | - * @return string |
|
46 | - */ |
|
47 | - public function getName() { |
|
48 | - return self::FILENAME; |
|
49 | - } |
|
44 | + /** |
|
45 | + * @return string |
|
46 | + */ |
|
47 | + public function getName() { |
|
48 | + return self::FILENAME; |
|
49 | + } |
|
50 | 50 | |
51 | 51 | |
52 | - public function setName($name) { |
|
53 | - throw new Forbidden('Renaming ' . self::FILENAME . ' is forbidden'); |
|
54 | - } |
|
52 | + public function setName($name) { |
|
53 | + throw new Forbidden('Renaming ' . self::FILENAME . ' is forbidden'); |
|
54 | + } |
|
55 | 55 | |
56 | - /** |
|
57 | - * @return null |
|
58 | - */ |
|
59 | - public function getLastModified() { |
|
60 | - return null; |
|
61 | - } |
|
56 | + /** |
|
57 | + * @return null |
|
58 | + */ |
|
59 | + public function getLastModified() { |
|
60 | + return null; |
|
61 | + } |
|
62 | 62 | |
63 | - /** |
|
64 | - * @throws Forbidden |
|
65 | - */ |
|
66 | - public function delete() { |
|
67 | - throw new Forbidden(self::FILENAME . ' may not be deleted.'); |
|
68 | - } |
|
63 | + /** |
|
64 | + * @throws Forbidden |
|
65 | + */ |
|
66 | + public function delete() { |
|
67 | + throw new Forbidden(self::FILENAME . ' may not be deleted.'); |
|
68 | + } |
|
69 | 69 | |
70 | - /** |
|
71 | - * @param array $properties |
|
72 | - * @return array |
|
73 | - */ |
|
74 | - public function getProperties($properties) { |
|
75 | - $datetime = $this->timeFactory->getDateTime(); |
|
70 | + /** |
|
71 | + * @param array $properties |
|
72 | + * @return array |
|
73 | + */ |
|
74 | + public function getProperties($properties) { |
|
75 | + $datetime = $this->timeFactory->getDateTime(); |
|
76 | 76 | |
77 | - return [ |
|
78 | - '{DAV:}getcontentlength' => 42, |
|
79 | - '{DAV:}getlastmodified' => $datetime->format(\DateTimeInterface::RFC2822), |
|
80 | - ]; |
|
81 | - } |
|
77 | + return [ |
|
78 | + '{DAV:}getcontentlength' => 42, |
|
79 | + '{DAV:}getlastmodified' => $datetime->format(\DateTimeInterface::RFC2822), |
|
80 | + ]; |
|
81 | + } |
|
82 | 82 | |
83 | - /** |
|
84 | - * @param PropPatch $propPatch |
|
85 | - * @throws Forbidden |
|
86 | - */ |
|
87 | - public function propPatch(PropPatch $propPatch) { |
|
88 | - throw new Forbidden(self::FILENAME . '\'s properties may not be altered.'); |
|
89 | - } |
|
83 | + /** |
|
84 | + * @param PropPatch $propPatch |
|
85 | + * @throws Forbidden |
|
86 | + */ |
|
87 | + public function propPatch(PropPatch $propPatch) { |
|
88 | + throw new Forbidden(self::FILENAME . '\'s properties may not be altered.'); |
|
89 | + } |
|
90 | 90 | } |
@@ -90,8 +90,8 @@ discard block |
||
90 | 90 | * @return string short footer |
91 | 91 | */ |
92 | 92 | public function getShortFooter() { |
93 | - $footer = '© ' . date('Y') . ' <a href="' . $this->getBaseUrl() . '" target="_blank">' . $this->getEntity() . '</a>' . |
|
94 | - '<br/>' . $this->getSlogan(); |
|
93 | + $footer = '© '.date('Y').' <a href="'.$this->getBaseUrl().'" target="_blank">'.$this->getEntity().'</a>'. |
|
94 | + '<br/>'.$this->getSlogan(); |
|
95 | 95 | |
96 | 96 | return $footer; |
97 | 97 | } |
@@ -101,8 +101,8 @@ discard block |
||
101 | 101 | * @return string long footer |
102 | 102 | */ |
103 | 103 | public function getLongFooter() { |
104 | - $footer = '© ' . date('Y') . ' <a href="' . $this->getBaseUrl() . '" target="_blank">' . $this->getEntity() . '</a>' . |
|
105 | - '<br/>' . $this->getSlogan(); |
|
104 | + $footer = '© '.date('Y').' <a href="'.$this->getBaseUrl().'" target="_blank">'.$this->getEntity().'</a>'. |
|
105 | + '<br/>'.$this->getSlogan(); |
|
106 | 106 | |
107 | 107 | return $footer; |
108 | 108 | } |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | * @return string documentation link |
113 | 113 | */ |
114 | 114 | public function buildDocLinkToKey($key) { |
115 | - return $this->getDocBaseUrl() . '/server/15/go.php?to=' . $key; |
|
115 | + return $this->getDocBaseUrl().'/server/15/go.php?to='.$key; |
|
116 | 116 | } |
117 | 117 | |
118 | 118 |
@@ -20,108 +20,108 @@ |
||
20 | 20 | |
21 | 21 | class OC_Theme { |
22 | 22 | |
23 | - /** |
|
24 | - * Returns the base URL |
|
25 | - * @return string URL |
|
26 | - */ |
|
27 | - public function getBaseUrl() { |
|
28 | - return 'https://nextcloud.com'; |
|
29 | - } |
|
30 | - |
|
31 | - /** |
|
32 | - * Returns the documentation URL |
|
33 | - * @return string URL |
|
34 | - */ |
|
35 | - public function getDocBaseUrl() { |
|
36 | - return 'https://docs.nextcloud.com'; |
|
37 | - } |
|
38 | - |
|
39 | - /** |
|
40 | - * Returns the title |
|
41 | - * @return string title |
|
42 | - */ |
|
43 | - public function getTitle() { |
|
44 | - return 'Custom Cloud'; |
|
45 | - } |
|
46 | - |
|
47 | - /** |
|
48 | - * Returns the short name of the software |
|
49 | - * @return string title |
|
50 | - */ |
|
51 | - public function getName() { |
|
52 | - return 'Custom Cloud'; |
|
53 | - } |
|
54 | - |
|
55 | - /** |
|
56 | - * Returns the short name of the software containing HTML strings |
|
57 | - * @return string title |
|
58 | - */ |
|
59 | - public function getHTMLName() { |
|
60 | - return 'Custom Cloud'; |
|
61 | - } |
|
62 | - |
|
63 | - /** |
|
64 | - * Returns entity (e.g. company name) - used for footer, copyright |
|
65 | - * @return string entity name |
|
66 | - */ |
|
67 | - public function getEntity() { |
|
68 | - return 'Custom Cloud Co.'; |
|
69 | - } |
|
70 | - |
|
71 | - /** |
|
72 | - * Returns slogan |
|
73 | - * @return string slogan |
|
74 | - */ |
|
75 | - public function getSlogan() { |
|
76 | - return 'Your custom cloud, personalized for you!'; |
|
77 | - } |
|
78 | - |
|
79 | - /** |
|
80 | - * Returns short version of the footer |
|
81 | - * @return string short footer |
|
82 | - */ |
|
83 | - public function getShortFooter() { |
|
84 | - $footer = '© ' . date('Y') . ' <a href="' . $this->getBaseUrl() . '" target="_blank">' . $this->getEntity() . '</a>' . |
|
85 | - '<br/>' . $this->getSlogan(); |
|
86 | - |
|
87 | - return $footer; |
|
88 | - } |
|
89 | - |
|
90 | - /** |
|
91 | - * Returns long version of the footer |
|
92 | - * @return string long footer |
|
93 | - */ |
|
94 | - public function getLongFooter() { |
|
95 | - $footer = '© ' . date('Y') . ' <a href="' . $this->getBaseUrl() . '" target="_blank">' . $this->getEntity() . '</a>' . |
|
96 | - '<br/>' . $this->getSlogan(); |
|
97 | - |
|
98 | - return $footer; |
|
99 | - } |
|
100 | - |
|
101 | - /** |
|
102 | - * Generate a documentation link for a given key |
|
103 | - * @return string documentation link |
|
104 | - */ |
|
105 | - public function buildDocLinkToKey($key) { |
|
106 | - return $this->getDocBaseUrl() . '/server/15/go.php?to=' . $key; |
|
107 | - } |
|
108 | - |
|
109 | - |
|
110 | - /** |
|
111 | - * Returns mail header color |
|
112 | - * @return string |
|
113 | - */ |
|
114 | - public function getColorPrimary() { |
|
115 | - return '#745bca'; |
|
116 | - } |
|
117 | - |
|
118 | - /** |
|
119 | - * Returns variables to overload defaults from core/css/variables.scss |
|
120 | - * @return array |
|
121 | - */ |
|
122 | - public function getScssVariables() { |
|
123 | - return [ |
|
124 | - 'color-primary' => '#745bca' |
|
125 | - ]; |
|
126 | - } |
|
23 | + /** |
|
24 | + * Returns the base URL |
|
25 | + * @return string URL |
|
26 | + */ |
|
27 | + public function getBaseUrl() { |
|
28 | + return 'https://nextcloud.com'; |
|
29 | + } |
|
30 | + |
|
31 | + /** |
|
32 | + * Returns the documentation URL |
|
33 | + * @return string URL |
|
34 | + */ |
|
35 | + public function getDocBaseUrl() { |
|
36 | + return 'https://docs.nextcloud.com'; |
|
37 | + } |
|
38 | + |
|
39 | + /** |
|
40 | + * Returns the title |
|
41 | + * @return string title |
|
42 | + */ |
|
43 | + public function getTitle() { |
|
44 | + return 'Custom Cloud'; |
|
45 | + } |
|
46 | + |
|
47 | + /** |
|
48 | + * Returns the short name of the software |
|
49 | + * @return string title |
|
50 | + */ |
|
51 | + public function getName() { |
|
52 | + return 'Custom Cloud'; |
|
53 | + } |
|
54 | + |
|
55 | + /** |
|
56 | + * Returns the short name of the software containing HTML strings |
|
57 | + * @return string title |
|
58 | + */ |
|
59 | + public function getHTMLName() { |
|
60 | + return 'Custom Cloud'; |
|
61 | + } |
|
62 | + |
|
63 | + /** |
|
64 | + * Returns entity (e.g. company name) - used for footer, copyright |
|
65 | + * @return string entity name |
|
66 | + */ |
|
67 | + public function getEntity() { |
|
68 | + return 'Custom Cloud Co.'; |
|
69 | + } |
|
70 | + |
|
71 | + /** |
|
72 | + * Returns slogan |
|
73 | + * @return string slogan |
|
74 | + */ |
|
75 | + public function getSlogan() { |
|
76 | + return 'Your custom cloud, personalized for you!'; |
|
77 | + } |
|
78 | + |
|
79 | + /** |
|
80 | + * Returns short version of the footer |
|
81 | + * @return string short footer |
|
82 | + */ |
|
83 | + public function getShortFooter() { |
|
84 | + $footer = '© ' . date('Y') . ' <a href="' . $this->getBaseUrl() . '" target="_blank">' . $this->getEntity() . '</a>' . |
|
85 | + '<br/>' . $this->getSlogan(); |
|
86 | + |
|
87 | + return $footer; |
|
88 | + } |
|
89 | + |
|
90 | + /** |
|
91 | + * Returns long version of the footer |
|
92 | + * @return string long footer |
|
93 | + */ |
|
94 | + public function getLongFooter() { |
|
95 | + $footer = '© ' . date('Y') . ' <a href="' . $this->getBaseUrl() . '" target="_blank">' . $this->getEntity() . '</a>' . |
|
96 | + '<br/>' . $this->getSlogan(); |
|
97 | + |
|
98 | + return $footer; |
|
99 | + } |
|
100 | + |
|
101 | + /** |
|
102 | + * Generate a documentation link for a given key |
|
103 | + * @return string documentation link |
|
104 | + */ |
|
105 | + public function buildDocLinkToKey($key) { |
|
106 | + return $this->getDocBaseUrl() . '/server/15/go.php?to=' . $key; |
|
107 | + } |
|
108 | + |
|
109 | + |
|
110 | + /** |
|
111 | + * Returns mail header color |
|
112 | + * @return string |
|
113 | + */ |
|
114 | + public function getColorPrimary() { |
|
115 | + return '#745bca'; |
|
116 | + } |
|
117 | + |
|
118 | + /** |
|
119 | + * Returns variables to overload defaults from core/css/variables.scss |
|
120 | + * @return array |
|
121 | + */ |
|
122 | + public function getScssVariables() { |
|
123 | + return [ |
|
124 | + 'color-primary' => '#745bca' |
|
125 | + ]; |
|
126 | + } |
|
127 | 127 | } |