@@ -25,120 +25,120 @@ |
||
25 | 25 | |
26 | 26 | class Todo extends Event { |
27 | 27 | |
28 | - /** |
|
29 | - * @param string $language |
|
30 | - * @param IEvent $event |
|
31 | - * @param IEvent|null $previousEvent |
|
32 | - * @return IEvent |
|
33 | - * @throws \InvalidArgumentException |
|
34 | - * @since 11.0.0 |
|
35 | - */ |
|
36 | - public function parse($language, IEvent $event, IEvent $previousEvent = null) { |
|
37 | - if ($event->getApp() !== 'dav' || $event->getType() !== 'calendar_todo') { |
|
38 | - throw new \InvalidArgumentException(); |
|
39 | - } |
|
28 | + /** |
|
29 | + * @param string $language |
|
30 | + * @param IEvent $event |
|
31 | + * @param IEvent|null $previousEvent |
|
32 | + * @return IEvent |
|
33 | + * @throws \InvalidArgumentException |
|
34 | + * @since 11.0.0 |
|
35 | + */ |
|
36 | + public function parse($language, IEvent $event, IEvent $previousEvent = null) { |
|
37 | + if ($event->getApp() !== 'dav' || $event->getType() !== 'calendar_todo') { |
|
38 | + throw new \InvalidArgumentException(); |
|
39 | + } |
|
40 | 40 | |
41 | - $this->l = $this->languageFactory->get('dav', $language); |
|
41 | + $this->l = $this->languageFactory->get('dav', $language); |
|
42 | 42 | |
43 | - if ($this->activityManager->getRequirePNG()) { |
|
44 | - $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/checkmark.png'))); |
|
45 | - } else { |
|
46 | - $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/checkmark.svg'))); |
|
47 | - } |
|
43 | + if ($this->activityManager->getRequirePNG()) { |
|
44 | + $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/checkmark.png'))); |
|
45 | + } else { |
|
46 | + $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/checkmark.svg'))); |
|
47 | + } |
|
48 | 48 | |
49 | - if ($event->getSubject() === self::SUBJECT_OBJECT_ADD . '_todo') { |
|
50 | - $subject = $this->l->t('{actor} created todo {todo} in list {calendar}'); |
|
51 | - } else if ($event->getSubject() === self::SUBJECT_OBJECT_ADD . '_todo_self') { |
|
52 | - $subject = $this->l->t('You created todo {todo} in list {calendar}'); |
|
53 | - } else if ($event->getSubject() === self::SUBJECT_OBJECT_DELETE . '_todo') { |
|
54 | - $subject = $this->l->t('{actor} deleted todo {todo} from list {calendar}'); |
|
55 | - } else if ($event->getSubject() === self::SUBJECT_OBJECT_DELETE . '_todo_self') { |
|
56 | - $subject = $this->l->t('You deleted todo {todo} from list {calendar}'); |
|
57 | - } else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_todo') { |
|
58 | - $subject = $this->l->t('{actor} updated todo {todo} in list {calendar}'); |
|
59 | - } else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_todo_self') { |
|
60 | - $subject = $this->l->t('You updated todo {todo} in list {calendar}'); |
|
49 | + if ($event->getSubject() === self::SUBJECT_OBJECT_ADD . '_todo') { |
|
50 | + $subject = $this->l->t('{actor} created todo {todo} in list {calendar}'); |
|
51 | + } else if ($event->getSubject() === self::SUBJECT_OBJECT_ADD . '_todo_self') { |
|
52 | + $subject = $this->l->t('You created todo {todo} in list {calendar}'); |
|
53 | + } else if ($event->getSubject() === self::SUBJECT_OBJECT_DELETE . '_todo') { |
|
54 | + $subject = $this->l->t('{actor} deleted todo {todo} from list {calendar}'); |
|
55 | + } else if ($event->getSubject() === self::SUBJECT_OBJECT_DELETE . '_todo_self') { |
|
56 | + $subject = $this->l->t('You deleted todo {todo} from list {calendar}'); |
|
57 | + } else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_todo') { |
|
58 | + $subject = $this->l->t('{actor} updated todo {todo} in list {calendar}'); |
|
59 | + } else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_todo_self') { |
|
60 | + $subject = $this->l->t('You updated todo {todo} in list {calendar}'); |
|
61 | 61 | |
62 | - } else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_todo_completed') { |
|
63 | - $subject = $this->l->t('{actor} solved todo {todo} in list {calendar}'); |
|
64 | - } else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_todo_completed_self') { |
|
65 | - $subject = $this->l->t('You solved todo {todo} in list {calendar}'); |
|
66 | - } else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_todo_needs_action') { |
|
67 | - $subject = $this->l->t('{actor} reopened todo {todo} in list {calendar}'); |
|
68 | - } else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_todo_needs_action_self') { |
|
69 | - $subject = $this->l->t('You reopened todo {todo} in list {calendar}'); |
|
70 | - } else { |
|
71 | - throw new \InvalidArgumentException(); |
|
72 | - } |
|
62 | + } else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_todo_completed') { |
|
63 | + $subject = $this->l->t('{actor} solved todo {todo} in list {calendar}'); |
|
64 | + } else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_todo_completed_self') { |
|
65 | + $subject = $this->l->t('You solved todo {todo} in list {calendar}'); |
|
66 | + } else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_todo_needs_action') { |
|
67 | + $subject = $this->l->t('{actor} reopened todo {todo} in list {calendar}'); |
|
68 | + } else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_todo_needs_action_self') { |
|
69 | + $subject = $this->l->t('You reopened todo {todo} in list {calendar}'); |
|
70 | + } else { |
|
71 | + throw new \InvalidArgumentException(); |
|
72 | + } |
|
73 | 73 | |
74 | - $parsedParameters = $this->getParameters($event); |
|
75 | - $this->setSubjects($event, $subject, $parsedParameters); |
|
74 | + $parsedParameters = $this->getParameters($event); |
|
75 | + $this->setSubjects($event, $subject, $parsedParameters); |
|
76 | 76 | |
77 | - $event = $this->eventMerger->mergeEvents('todo', $event, $previousEvent); |
|
77 | + $event = $this->eventMerger->mergeEvents('todo', $event, $previousEvent); |
|
78 | 78 | |
79 | - return $event; |
|
80 | - } |
|
79 | + return $event; |
|
80 | + } |
|
81 | 81 | |
82 | - /** |
|
83 | - * @param IEvent $event |
|
84 | - * @return array |
|
85 | - */ |
|
86 | - protected function getParameters(IEvent $event) { |
|
87 | - $subject = $event->getSubject(); |
|
88 | - $parameters = $event->getSubjectParameters(); |
|
82 | + /** |
|
83 | + * @param IEvent $event |
|
84 | + * @return array |
|
85 | + */ |
|
86 | + protected function getParameters(IEvent $event) { |
|
87 | + $subject = $event->getSubject(); |
|
88 | + $parameters = $event->getSubjectParameters(); |
|
89 | 89 | |
90 | - // Nextcloud 13+ |
|
91 | - if (isset($parameters['calendar'])) { |
|
92 | - switch ($subject) { |
|
93 | - case self::SUBJECT_OBJECT_ADD . '_todo': |
|
94 | - case self::SUBJECT_OBJECT_DELETE . '_todo': |
|
95 | - case self::SUBJECT_OBJECT_UPDATE . '_todo': |
|
96 | - case self::SUBJECT_OBJECT_UPDATE . '_todo_completed': |
|
97 | - case self::SUBJECT_OBJECT_UPDATE . '_todo_needs_action': |
|
98 | - return [ |
|
99 | - 'actor' => $this->generateUserParameter($parameters['actor']), |
|
100 | - 'calendar' => $this->generateCalendarParameter($parameters['calendar'], $this->l), |
|
101 | - 'todo' => $this->generateObjectParameter($parameters['object']), |
|
102 | - ]; |
|
103 | - case self::SUBJECT_OBJECT_ADD . '_todo_self': |
|
104 | - case self::SUBJECT_OBJECT_DELETE . '_todo_self': |
|
105 | - case self::SUBJECT_OBJECT_UPDATE . '_todo_self': |
|
106 | - case self::SUBJECT_OBJECT_UPDATE . '_todo_completed_self': |
|
107 | - case self::SUBJECT_OBJECT_UPDATE . '_todo_needs_action_self': |
|
108 | - return [ |
|
109 | - 'calendar' => $this->generateCalendarParameter($parameters['calendar'], $this->l), |
|
110 | - 'todo' => $this->generateObjectParameter($parameters['object']), |
|
111 | - ]; |
|
112 | - } |
|
113 | - } |
|
90 | + // Nextcloud 13+ |
|
91 | + if (isset($parameters['calendar'])) { |
|
92 | + switch ($subject) { |
|
93 | + case self::SUBJECT_OBJECT_ADD . '_todo': |
|
94 | + case self::SUBJECT_OBJECT_DELETE . '_todo': |
|
95 | + case self::SUBJECT_OBJECT_UPDATE . '_todo': |
|
96 | + case self::SUBJECT_OBJECT_UPDATE . '_todo_completed': |
|
97 | + case self::SUBJECT_OBJECT_UPDATE . '_todo_needs_action': |
|
98 | + return [ |
|
99 | + 'actor' => $this->generateUserParameter($parameters['actor']), |
|
100 | + 'calendar' => $this->generateCalendarParameter($parameters['calendar'], $this->l), |
|
101 | + 'todo' => $this->generateObjectParameter($parameters['object']), |
|
102 | + ]; |
|
103 | + case self::SUBJECT_OBJECT_ADD . '_todo_self': |
|
104 | + case self::SUBJECT_OBJECT_DELETE . '_todo_self': |
|
105 | + case self::SUBJECT_OBJECT_UPDATE . '_todo_self': |
|
106 | + case self::SUBJECT_OBJECT_UPDATE . '_todo_completed_self': |
|
107 | + case self::SUBJECT_OBJECT_UPDATE . '_todo_needs_action_self': |
|
108 | + return [ |
|
109 | + 'calendar' => $this->generateCalendarParameter($parameters['calendar'], $this->l), |
|
110 | + 'todo' => $this->generateObjectParameter($parameters['object']), |
|
111 | + ]; |
|
112 | + } |
|
113 | + } |
|
114 | 114 | |
115 | - // Legacy - Do NOT Remove unless necessary |
|
116 | - // Removing this will break parsing of activities that were created on |
|
117 | - // Nextcloud 12, so we should keep this as long as it's acceptable. |
|
118 | - // Otherwise if people upgrade over multiple releases in a short period, |
|
119 | - // they will get the dead entries in their stream. |
|
120 | - switch ($subject) { |
|
121 | - case self::SUBJECT_OBJECT_ADD . '_todo': |
|
122 | - case self::SUBJECT_OBJECT_DELETE . '_todo': |
|
123 | - case self::SUBJECT_OBJECT_UPDATE . '_todo': |
|
124 | - case self::SUBJECT_OBJECT_UPDATE . '_todo_completed': |
|
125 | - case self::SUBJECT_OBJECT_UPDATE . '_todo_needs_action': |
|
126 | - return [ |
|
127 | - 'actor' => $this->generateUserParameter($parameters[0]), |
|
128 | - 'calendar' => $this->generateLegacyCalendarParameter((int)$event->getObjectId(), $parameters[1]), |
|
129 | - 'todo' => $this->generateObjectParameter($parameters[2]), |
|
130 | - ]; |
|
131 | - case self::SUBJECT_OBJECT_ADD . '_todo_self': |
|
132 | - case self::SUBJECT_OBJECT_DELETE . '_todo_self': |
|
133 | - case self::SUBJECT_OBJECT_UPDATE . '_todo_self': |
|
134 | - case self::SUBJECT_OBJECT_UPDATE . '_todo_completed_self': |
|
135 | - case self::SUBJECT_OBJECT_UPDATE . '_todo_needs_action_self': |
|
136 | - return [ |
|
137 | - 'calendar' => $this->generateLegacyCalendarParameter((int)$event->getObjectId(), $parameters[1]), |
|
138 | - 'todo' => $this->generateObjectParameter($parameters[2]), |
|
139 | - ]; |
|
140 | - } |
|
115 | + // Legacy - Do NOT Remove unless necessary |
|
116 | + // Removing this will break parsing of activities that were created on |
|
117 | + // Nextcloud 12, so we should keep this as long as it's acceptable. |
|
118 | + // Otherwise if people upgrade over multiple releases in a short period, |
|
119 | + // they will get the dead entries in their stream. |
|
120 | + switch ($subject) { |
|
121 | + case self::SUBJECT_OBJECT_ADD . '_todo': |
|
122 | + case self::SUBJECT_OBJECT_DELETE . '_todo': |
|
123 | + case self::SUBJECT_OBJECT_UPDATE . '_todo': |
|
124 | + case self::SUBJECT_OBJECT_UPDATE . '_todo_completed': |
|
125 | + case self::SUBJECT_OBJECT_UPDATE . '_todo_needs_action': |
|
126 | + return [ |
|
127 | + 'actor' => $this->generateUserParameter($parameters[0]), |
|
128 | + 'calendar' => $this->generateLegacyCalendarParameter((int)$event->getObjectId(), $parameters[1]), |
|
129 | + 'todo' => $this->generateObjectParameter($parameters[2]), |
|
130 | + ]; |
|
131 | + case self::SUBJECT_OBJECT_ADD . '_todo_self': |
|
132 | + case self::SUBJECT_OBJECT_DELETE . '_todo_self': |
|
133 | + case self::SUBJECT_OBJECT_UPDATE . '_todo_self': |
|
134 | + case self::SUBJECT_OBJECT_UPDATE . '_todo_completed_self': |
|
135 | + case self::SUBJECT_OBJECT_UPDATE . '_todo_needs_action_self': |
|
136 | + return [ |
|
137 | + 'calendar' => $this->generateLegacyCalendarParameter((int)$event->getObjectId(), $parameters[1]), |
|
138 | + 'todo' => $this->generateObjectParameter($parameters[2]), |
|
139 | + ]; |
|
140 | + } |
|
141 | 141 | |
142 | - throw new \InvalidArgumentException(); |
|
143 | - } |
|
142 | + throw new \InvalidArgumentException(); |
|
143 | + } |
|
144 | 144 | } |
@@ -29,19 +29,19 @@ |
||
29 | 29 | |
30 | 30 | class AddLogRotateJob implements IRepairStep { |
31 | 31 | |
32 | - /** @var IJobList */ |
|
33 | - private $jobList; |
|
32 | + /** @var IJobList */ |
|
33 | + private $jobList; |
|
34 | 34 | |
35 | - public function __construct(IJobList $jobList) { |
|
36 | - $this->jobList = $jobList; |
|
37 | - } |
|
35 | + public function __construct(IJobList $jobList) { |
|
36 | + $this->jobList = $jobList; |
|
37 | + } |
|
38 | 38 | |
39 | - public function getName() { |
|
40 | - return 'Add log rotate job'; |
|
41 | - } |
|
39 | + public function getName() { |
|
40 | + return 'Add log rotate job'; |
|
41 | + } |
|
42 | 42 | |
43 | - public function run(IOutput $output) { |
|
44 | - $this->jobList->add(Rotate::class); |
|
45 | - } |
|
43 | + public function run(IOutput $output) { |
|
44 | + $this->jobList->add(Rotate::class); |
|
45 | + } |
|
46 | 46 | |
47 | 47 | } |
@@ -31,22 +31,22 @@ |
||
31 | 31 | |
32 | 32 | class Hooks { |
33 | 33 | |
34 | - /** |
|
35 | - * clean up user specific settings if user gets deleted |
|
36 | - * @param array $params array with uid |
|
37 | - * |
|
38 | - * This function is connected to the pre_deleteUser signal of OC_Users |
|
39 | - * to remove the used space for the trash bin stored in the database |
|
40 | - */ |
|
41 | - public static function deleteUser_hook($params) { |
|
42 | - $uid = $params['uid']; |
|
43 | - Trashbin::deleteUser($uid); |
|
44 | - } |
|
34 | + /** |
|
35 | + * clean up user specific settings if user gets deleted |
|
36 | + * @param array $params array with uid |
|
37 | + * |
|
38 | + * This function is connected to the pre_deleteUser signal of OC_Users |
|
39 | + * to remove the used space for the trash bin stored in the database |
|
40 | + */ |
|
41 | + public static function deleteUser_hook($params) { |
|
42 | + $uid = $params['uid']; |
|
43 | + Trashbin::deleteUser($uid); |
|
44 | + } |
|
45 | 45 | |
46 | - public static function post_write_hook($params) { |
|
47 | - $user = \OCP\User::getUser(); |
|
48 | - if (!empty($user)) { |
|
49 | - Trashbin::resizeTrash($user); |
|
50 | - } |
|
51 | - } |
|
46 | + public static function post_write_hook($params) { |
|
47 | + $user = \OCP\User::getUser(); |
|
48 | + if (!empty($user)) { |
|
49 | + Trashbin::resizeTrash($user); |
|
50 | + } |
|
51 | + } |
|
52 | 52 | } |
@@ -29,60 +29,60 @@ |
||
29 | 29 | |
30 | 30 | class SearchResult implements ISearchResult { |
31 | 31 | |
32 | - protected $result = [ |
|
33 | - 'exact' => [], |
|
34 | - ]; |
|
32 | + protected $result = [ |
|
33 | + 'exact' => [], |
|
34 | + ]; |
|
35 | 35 | |
36 | - protected $exactIdMatches = []; |
|
36 | + protected $exactIdMatches = []; |
|
37 | 37 | |
38 | - public function addResultSet(SearchResultType $type, array $matches, array $exactMatches = null) { |
|
39 | - $type = $type->getLabel(); |
|
40 | - if(!isset($this->result[$type])) { |
|
41 | - $this->result[$type] = []; |
|
42 | - $this->result['exact'][$type] = []; |
|
43 | - } |
|
38 | + public function addResultSet(SearchResultType $type, array $matches, array $exactMatches = null) { |
|
39 | + $type = $type->getLabel(); |
|
40 | + if(!isset($this->result[$type])) { |
|
41 | + $this->result[$type] = []; |
|
42 | + $this->result['exact'][$type] = []; |
|
43 | + } |
|
44 | 44 | |
45 | - $this->result[$type] = array_merge($this->result[$type], $matches); |
|
46 | - if(is_array($exactMatches)) { |
|
47 | - $this->result['exact'][$type] = array_merge($this->result['exact'][$type], $exactMatches); |
|
48 | - } |
|
49 | - } |
|
45 | + $this->result[$type] = array_merge($this->result[$type], $matches); |
|
46 | + if(is_array($exactMatches)) { |
|
47 | + $this->result['exact'][$type] = array_merge($this->result['exact'][$type], $exactMatches); |
|
48 | + } |
|
49 | + } |
|
50 | 50 | |
51 | - public function markExactIdMatch(SearchResultType $type) { |
|
52 | - $this->exactIdMatches[$type->getLabel()] = 1; |
|
53 | - } |
|
51 | + public function markExactIdMatch(SearchResultType $type) { |
|
52 | + $this->exactIdMatches[$type->getLabel()] = 1; |
|
53 | + } |
|
54 | 54 | |
55 | - public function hasExactIdMatch(SearchResultType $type) { |
|
56 | - return isset($this->exactIdMatches[$type->getLabel()]); |
|
57 | - } |
|
55 | + public function hasExactIdMatch(SearchResultType $type) { |
|
56 | + return isset($this->exactIdMatches[$type->getLabel()]); |
|
57 | + } |
|
58 | 58 | |
59 | - public function hasResult(SearchResultType $type, $collaboratorId) { |
|
60 | - $type = $type->getLabel(); |
|
61 | - if(!isset($this->result[$type])) { |
|
62 | - return false; |
|
63 | - } |
|
59 | + public function hasResult(SearchResultType $type, $collaboratorId) { |
|
60 | + $type = $type->getLabel(); |
|
61 | + if(!isset($this->result[$type])) { |
|
62 | + return false; |
|
63 | + } |
|
64 | 64 | |
65 | - $resultArrays = [$this->result['exact'][$type], $this->result[$type]]; |
|
66 | - foreach($resultArrays as $resultArray) { |
|
67 | - foreach ($resultArray as $result) { |
|
68 | - if ($result['value']['shareWith'] === $collaboratorId) { |
|
69 | - return true; |
|
70 | - } |
|
71 | - } |
|
72 | - } |
|
65 | + $resultArrays = [$this->result['exact'][$type], $this->result[$type]]; |
|
66 | + foreach($resultArrays as $resultArray) { |
|
67 | + foreach ($resultArray as $result) { |
|
68 | + if ($result['value']['shareWith'] === $collaboratorId) { |
|
69 | + return true; |
|
70 | + } |
|
71 | + } |
|
72 | + } |
|
73 | 73 | |
74 | - return false; |
|
75 | - } |
|
74 | + return false; |
|
75 | + } |
|
76 | 76 | |
77 | - public function asArray() { |
|
78 | - return $this->result; |
|
79 | - } |
|
77 | + public function asArray() { |
|
78 | + return $this->result; |
|
79 | + } |
|
80 | 80 | |
81 | - public function unsetResult(SearchResultType $type) { |
|
82 | - $type = $type->getLabel(); |
|
83 | - $this->result[$type] = []; |
|
84 | - if(isset($this->result['exact'][$type])) { |
|
85 | - $this->result['exact'][$type] = []; |
|
86 | - } |
|
87 | - } |
|
81 | + public function unsetResult(SearchResultType $type) { |
|
82 | + $type = $type->getLabel(); |
|
83 | + $this->result[$type] = []; |
|
84 | + if(isset($this->result['exact'][$type])) { |
|
85 | + $this->result['exact'][$type] = []; |
|
86 | + } |
|
87 | + } |
|
88 | 88 | } |
@@ -34,15 +34,15 @@ discard block |
||
34 | 34 | $helper = new Helper(\OC::$server->getConfig()); |
35 | 35 | $ocConfig = \OC::$server->getConfig(); |
36 | 36 | $uBackend = new User_Proxy( |
37 | - $helper->getServerConfigurationPrefixes(true), |
|
38 | - new LDAP(), |
|
39 | - $ocConfig, |
|
40 | - \OC::$server->getNotificationManager(), |
|
41 | - \OC::$server->getUserSession(), |
|
42 | - \OC::$server->query('LDAPUserPluginManager') |
|
37 | + $helper->getServerConfigurationPrefixes(true), |
|
38 | + new LDAP(), |
|
39 | + $ocConfig, |
|
40 | + \OC::$server->getNotificationManager(), |
|
41 | + \OC::$server->getUserSession(), |
|
42 | + \OC::$server->query('LDAPUserPluginManager') |
|
43 | 43 | ); |
44 | 44 | $deletedUsersIndex = new DeletedUsersIndex( |
45 | - $ocConfig, $dbConnection, $userMapping |
|
45 | + $ocConfig, $dbConnection, $userMapping |
|
46 | 46 | ); |
47 | 47 | |
48 | 48 | $application->add(new OCA\User_LDAP\Command\ShowConfig($helper)); |
@@ -52,8 +52,8 @@ discard block |
||
52 | 52 | $application->add(new OCA\User_LDAP\Command\DeleteConfig($helper)); |
53 | 53 | $application->add(new OCA\User_LDAP\Command\Search($ocConfig)); |
54 | 54 | $application->add(new OCA\User_LDAP\Command\ShowRemnants( |
55 | - $deletedUsersIndex, \OC::$server->getDateTimeFormatter()) |
|
55 | + $deletedUsersIndex, \OC::$server->getDateTimeFormatter()) |
|
56 | 56 | ); |
57 | 57 | $application->add(new OCA\User_LDAP\Command\CheckUser( |
58 | - $uBackend, $helper, $deletedUsersIndex, $userMapping) |
|
58 | + $uBackend, $helper, $deletedUsersIndex, $userMapping) |
|
59 | 59 | ); |
@@ -30,10 +30,10 @@ |
||
30 | 30 | use OCP\IConfig; |
31 | 31 | |
32 | 32 | class UUIDFixGroup extends UUIDFix { |
33 | - public function __construct(GroupMapping $mapper, LDAP $ldap, IConfig $config, Helper $helper) { |
|
34 | - $this->mapper = $mapper; |
|
35 | - $this->proxy = new User_Proxy($helper->getServerConfigurationPrefixes(true), $ldap, $config, |
|
36 | - \OC::$server->getNotificationManager(), \OC::$server->getUserSession(), |
|
37 | - \OC::$server->query('LDAPUserPluginManager')); |
|
38 | - } |
|
33 | + public function __construct(GroupMapping $mapper, LDAP $ldap, IConfig $config, Helper $helper) { |
|
34 | + $this->mapper = $mapper; |
|
35 | + $this->proxy = new User_Proxy($helper->getServerConfigurationPrefixes(true), $ldap, $config, |
|
36 | + \OC::$server->getNotificationManager(), \OC::$server->getUserSession(), |
|
37 | + \OC::$server->query('LDAPUserPluginManager')); |
|
38 | + } |
|
39 | 39 | } |
@@ -28,54 +28,54 @@ |
||
28 | 28 | use OCP\IServerContainer; |
29 | 29 | |
30 | 30 | class Manager implements IManager { |
31 | - /** @var string[] */ |
|
32 | - protected $sorters =[]; |
|
31 | + /** @var string[] */ |
|
32 | + protected $sorters =[]; |
|
33 | 33 | |
34 | - /** @var ISorter[] */ |
|
35 | - protected $sorterInstances = []; |
|
36 | - /** @var IServerContainer */ |
|
37 | - private $c; |
|
34 | + /** @var ISorter[] */ |
|
35 | + protected $sorterInstances = []; |
|
36 | + /** @var IServerContainer */ |
|
37 | + private $c; |
|
38 | 38 | |
39 | - public function __construct(IServerContainer $container) { |
|
40 | - $this->c = $container; |
|
41 | - } |
|
39 | + public function __construct(IServerContainer $container) { |
|
40 | + $this->c = $container; |
|
41 | + } |
|
42 | 42 | |
43 | - public function runSorters(array $sorters, array &$sortArray, array $context) { |
|
44 | - $sorterInstances = $this->getSorters(); |
|
45 | - while($sorter = array_shift($sorters)) { |
|
46 | - if(isset($sorterInstances[$sorter])) { |
|
47 | - $sorterInstances[$sorter]->sort($sortArray, $context); |
|
48 | - } else { |
|
49 | - $this->c->getLogger()->warning('No sorter for ID "{id}", skipping', [ |
|
50 | - 'app' => 'core', 'id' => $sorter |
|
51 | - ]); |
|
52 | - } |
|
53 | - } |
|
54 | - } |
|
43 | + public function runSorters(array $sorters, array &$sortArray, array $context) { |
|
44 | + $sorterInstances = $this->getSorters(); |
|
45 | + while($sorter = array_shift($sorters)) { |
|
46 | + if(isset($sorterInstances[$sorter])) { |
|
47 | + $sorterInstances[$sorter]->sort($sortArray, $context); |
|
48 | + } else { |
|
49 | + $this->c->getLogger()->warning('No sorter for ID "{id}", skipping', [ |
|
50 | + 'app' => 'core', 'id' => $sorter |
|
51 | + ]); |
|
52 | + } |
|
53 | + } |
|
54 | + } |
|
55 | 55 | |
56 | - public function registerSorter($className) { |
|
57 | - $this->sorters[] = $className; |
|
58 | - } |
|
56 | + public function registerSorter($className) { |
|
57 | + $this->sorters[] = $className; |
|
58 | + } |
|
59 | 59 | |
60 | - protected function getSorters() { |
|
61 | - if(count($this->sorterInstances) === 0) { |
|
62 | - foreach ($this->sorters as $sorter) { |
|
63 | - /** @var ISorter $instance */ |
|
64 | - $instance = $this->c->resolve($sorter); |
|
65 | - if(!$instance instanceof ISorter) { |
|
66 | - $this->c->getLogger()->notice('Skipping sorter which is not an instance of ISorter. Class name: {class}', |
|
67 | - ['app' => 'core', 'class' => $sorter]); |
|
68 | - continue; |
|
69 | - } |
|
70 | - $sorterId = trim($instance->getId()); |
|
71 | - if(trim($sorterId) === '') { |
|
72 | - $this->c->getLogger()->notice('Skipping sorter with empty ID. Class name: {class}', |
|
73 | - ['app' => 'core', 'class' => $sorter]); |
|
74 | - continue; |
|
75 | - } |
|
76 | - $this->sorterInstances[$sorterId] = $instance; |
|
77 | - } |
|
78 | - } |
|
79 | - return $this->sorterInstances; |
|
80 | - } |
|
60 | + protected function getSorters() { |
|
61 | + if(count($this->sorterInstances) === 0) { |
|
62 | + foreach ($this->sorters as $sorter) { |
|
63 | + /** @var ISorter $instance */ |
|
64 | + $instance = $this->c->resolve($sorter); |
|
65 | + if(!$instance instanceof ISorter) { |
|
66 | + $this->c->getLogger()->notice('Skipping sorter which is not an instance of ISorter. Class name: {class}', |
|
67 | + ['app' => 'core', 'class' => $sorter]); |
|
68 | + continue; |
|
69 | + } |
|
70 | + $sorterId = trim($instance->getId()); |
|
71 | + if(trim($sorterId) === '') { |
|
72 | + $this->c->getLogger()->notice('Skipping sorter with empty ID. Class name: {class}', |
|
73 | + ['app' => 'core', 'class' => $sorter]); |
|
74 | + continue; |
|
75 | + } |
|
76 | + $this->sorterInstances[$sorterId] = $instance; |
|
77 | + } |
|
78 | + } |
|
79 | + return $this->sorterInstances; |
|
80 | + } |
|
81 | 81 | } |
@@ -27,19 +27,19 @@ |
||
27 | 27 | use OCP\IServerContainer; |
28 | 28 | |
29 | 29 | class JSSettingsHelper { |
30 | - /** @var IServerContainer */ |
|
31 | - private $c; |
|
30 | + /** @var IServerContainer */ |
|
31 | + private $c; |
|
32 | 32 | |
33 | - public function __construct(IServerContainer $c) { |
|
34 | - $this->c = $c; |
|
35 | - } |
|
33 | + public function __construct(IServerContainer $c) { |
|
34 | + $this->c = $c; |
|
35 | + } |
|
36 | 36 | |
37 | - public function extend(array $settings) { |
|
38 | - $appConfig = json_decode($settings['array']['oc_appconfig'], true); |
|
37 | + public function extend(array $settings) { |
|
38 | + $appConfig = json_decode($settings['array']['oc_appconfig'], true); |
|
39 | 39 | |
40 | - $value = (int)$this->c->getConfig()->getAppValue('comments', 'maxAutoCompleteResults', 10); |
|
41 | - $appConfig['comments']['maxAutoCompleteResults'] = $value; |
|
40 | + $value = (int)$this->c->getConfig()->getAppValue('comments', 'maxAutoCompleteResults', 10); |
|
41 | + $appConfig['comments']['maxAutoCompleteResults'] = $value; |
|
42 | 42 | |
43 | - $settings['array']['oc_appconfig'] = json_encode($appConfig); |
|
44 | - } |
|
43 | + $settings['array']['oc_appconfig'] = json_encode($appConfig); |
|
44 | + } |
|
45 | 45 | } |
@@ -33,78 +33,78 @@ |
||
33 | 33 | |
34 | 34 | class ShareRecipientSorter implements ISorter { |
35 | 35 | |
36 | - /** @var IManager */ |
|
37 | - private $shareManager; |
|
38 | - /** @var Folder */ |
|
39 | - private $rootFolder; |
|
40 | - /** @var IUserSession */ |
|
41 | - private $userSession; |
|
36 | + /** @var IManager */ |
|
37 | + private $shareManager; |
|
38 | + /** @var Folder */ |
|
39 | + private $rootFolder; |
|
40 | + /** @var IUserSession */ |
|
41 | + private $userSession; |
|
42 | 42 | |
43 | - public function __construct(IManager $shareManager, IRootFolder $rootFolder, IUserSession $userSession) { |
|
44 | - $this->shareManager = $shareManager; |
|
45 | - $this->rootFolder = $rootFolder; |
|
46 | - $this->userSession = $userSession; |
|
47 | - } |
|
43 | + public function __construct(IManager $shareManager, IRootFolder $rootFolder, IUserSession $userSession) { |
|
44 | + $this->shareManager = $shareManager; |
|
45 | + $this->rootFolder = $rootFolder; |
|
46 | + $this->userSession = $userSession; |
|
47 | + } |
|
48 | 48 | |
49 | - public function getId() { |
|
50 | - return 'share-recipients'; |
|
51 | - } |
|
49 | + public function getId() { |
|
50 | + return 'share-recipients'; |
|
51 | + } |
|
52 | 52 | |
53 | - public function sort(array &$sortArray, array $context) { |
|
54 | - // let's be tolerant. Comments uses "files" by default, other usages are often singular |
|
55 | - if($context['itemType'] !== 'files' && $context['itemType'] !== 'file') { |
|
56 | - return; |
|
57 | - } |
|
58 | - $user = $this->userSession->getUser(); |
|
59 | - if($user === null) { |
|
60 | - return; |
|
61 | - } |
|
62 | - $userFolder = $this->rootFolder->getUserFolder($user->getUID()); |
|
63 | - /** @var Node[] $nodes */ |
|
64 | - $nodes = $userFolder->getById((int)$context['itemId']); |
|
65 | - if(count($nodes) === 0) { |
|
66 | - return; |
|
67 | - } |
|
68 | - $al = $this->shareManager->getAccessList($nodes[0]); |
|
53 | + public function sort(array &$sortArray, array $context) { |
|
54 | + // let's be tolerant. Comments uses "files" by default, other usages are often singular |
|
55 | + if($context['itemType'] !== 'files' && $context['itemType'] !== 'file') { |
|
56 | + return; |
|
57 | + } |
|
58 | + $user = $this->userSession->getUser(); |
|
59 | + if($user === null) { |
|
60 | + return; |
|
61 | + } |
|
62 | + $userFolder = $this->rootFolder->getUserFolder($user->getUID()); |
|
63 | + /** @var Node[] $nodes */ |
|
64 | + $nodes = $userFolder->getById((int)$context['itemId']); |
|
65 | + if(count($nodes) === 0) { |
|
66 | + return; |
|
67 | + } |
|
68 | + $al = $this->shareManager->getAccessList($nodes[0]); |
|
69 | 69 | |
70 | - foreach ($sortArray as $type => &$byType) { |
|
71 | - if(!isset($al[$type]) || !is_array($al[$type])) { |
|
72 | - continue; |
|
73 | - } |
|
70 | + foreach ($sortArray as $type => &$byType) { |
|
71 | + if(!isset($al[$type]) || !is_array($al[$type])) { |
|
72 | + continue; |
|
73 | + } |
|
74 | 74 | |
75 | - // at least on PHP 5.6 usort turned out to be not stable. So we add |
|
76 | - // the current index to the value and compare it on a draw |
|
77 | - $i = 0; |
|
78 | - $workArray = array_map(function($element) use (&$i) { |
|
79 | - return [$i++, $element]; |
|
80 | - }, $byType); |
|
75 | + // at least on PHP 5.6 usort turned out to be not stable. So we add |
|
76 | + // the current index to the value and compare it on a draw |
|
77 | + $i = 0; |
|
78 | + $workArray = array_map(function($element) use (&$i) { |
|
79 | + return [$i++, $element]; |
|
80 | + }, $byType); |
|
81 | 81 | |
82 | - usort($workArray, function ($a, $b) use ($al, $type) { |
|
83 | - $result = $this->compare($a[1], $b[1], $al[$type]); |
|
84 | - if($result === 0) { |
|
85 | - $result = $a[0] - $b[0]; |
|
86 | - } |
|
87 | - return $result; |
|
88 | - }); |
|
82 | + usort($workArray, function ($a, $b) use ($al, $type) { |
|
83 | + $result = $this->compare($a[1], $b[1], $al[$type]); |
|
84 | + if($result === 0) { |
|
85 | + $result = $a[0] - $b[0]; |
|
86 | + } |
|
87 | + return $result; |
|
88 | + }); |
|
89 | 89 | |
90 | - // and remove the index values again |
|
91 | - $byType = array_column($workArray, 1); |
|
92 | - } |
|
93 | - } |
|
90 | + // and remove the index values again |
|
91 | + $byType = array_column($workArray, 1); |
|
92 | + } |
|
93 | + } |
|
94 | 94 | |
95 | - /** |
|
96 | - * @param array $a |
|
97 | - * @param array $b |
|
98 | - * @param array $al |
|
99 | - * @return int |
|
100 | - */ |
|
101 | - protected function compare(array $a, array $b, array $al) { |
|
102 | - $a = $a['value']['shareWith']; |
|
103 | - $b = $b['value']['shareWith']; |
|
95 | + /** |
|
96 | + * @param array $a |
|
97 | + * @param array $b |
|
98 | + * @param array $al |
|
99 | + * @return int |
|
100 | + */ |
|
101 | + protected function compare(array $a, array $b, array $al) { |
|
102 | + $a = $a['value']['shareWith']; |
|
103 | + $b = $b['value']['shareWith']; |
|
104 | 104 | |
105 | - $valueA = (int)in_array($a, $al, true); |
|
106 | - $valueB = (int)in_array($b, $al, true); |
|
105 | + $valueA = (int)in_array($a, $al, true); |
|
106 | + $valueB = (int)in_array($b, $al, true); |
|
107 | 107 | |
108 | - return $valueB - $valueA; |
|
109 | - } |
|
108 | + return $valueB - $valueA; |
|
109 | + } |
|
110 | 110 | } |