@@ -25,92 +25,92 @@ |
||
25 | 25 | namespace OC\OCS; |
26 | 26 | |
27 | 27 | class Provider extends \OCP\AppFramework\Controller { |
28 | - /** @var \OCP\App\IAppManager */ |
|
29 | - private $appManager; |
|
28 | + /** @var \OCP\App\IAppManager */ |
|
29 | + private $appManager; |
|
30 | 30 | |
31 | - /** |
|
32 | - * @param string $appName |
|
33 | - * @param \OCP\IRequest $request |
|
34 | - * @param \OCP\App\IAppManager $appManager |
|
35 | - */ |
|
36 | - public function __construct($appName, |
|
37 | - \OCP\IRequest $request, |
|
38 | - \OCP\App\IAppManager $appManager) { |
|
39 | - parent::__construct($appName, $request); |
|
40 | - $this->appManager = $appManager; |
|
41 | - } |
|
31 | + /** |
|
32 | + * @param string $appName |
|
33 | + * @param \OCP\IRequest $request |
|
34 | + * @param \OCP\App\IAppManager $appManager |
|
35 | + */ |
|
36 | + public function __construct($appName, |
|
37 | + \OCP\IRequest $request, |
|
38 | + \OCP\App\IAppManager $appManager) { |
|
39 | + parent::__construct($appName, $request); |
|
40 | + $this->appManager = $appManager; |
|
41 | + } |
|
42 | 42 | |
43 | - /** |
|
44 | - * @return \OCP\AppFramework\Http\JSONResponse |
|
45 | - */ |
|
46 | - public function buildProviderList() { |
|
47 | - $services = [ |
|
48 | - 'PRIVATE_DATA' => [ |
|
49 | - 'version' => 1, |
|
50 | - 'endpoints' => [ |
|
51 | - 'store' => '/ocs/v2.php/privatedata/setattribute', |
|
52 | - 'read' => '/ocs/v2.php/privatedata/getattribute', |
|
53 | - 'delete' => '/ocs/v2.php/privatedata/deleteattribute', |
|
54 | - ], |
|
55 | - ], |
|
56 | - ]; |
|
43 | + /** |
|
44 | + * @return \OCP\AppFramework\Http\JSONResponse |
|
45 | + */ |
|
46 | + public function buildProviderList() { |
|
47 | + $services = [ |
|
48 | + 'PRIVATE_DATA' => [ |
|
49 | + 'version' => 1, |
|
50 | + 'endpoints' => [ |
|
51 | + 'store' => '/ocs/v2.php/privatedata/setattribute', |
|
52 | + 'read' => '/ocs/v2.php/privatedata/getattribute', |
|
53 | + 'delete' => '/ocs/v2.php/privatedata/deleteattribute', |
|
54 | + ], |
|
55 | + ], |
|
56 | + ]; |
|
57 | 57 | |
58 | - if ($this->appManager->isEnabledForUser('files_sharing')) { |
|
59 | - $services['SHARING'] = [ |
|
60 | - 'version' => 1, |
|
61 | - 'endpoints' => [ |
|
62 | - 'share' => '/ocs/v2.php/apps/files_sharing/api/v1/shares', |
|
63 | - ], |
|
64 | - ]; |
|
65 | - $services['FEDERATED_SHARING'] = [ |
|
66 | - 'version' => 1, |
|
67 | - 'endpoints' => [ |
|
68 | - 'share' => '/ocs/v2.php/cloud/shares', |
|
69 | - 'webdav' => '/public.php/webdav/', |
|
70 | - ], |
|
71 | - ]; |
|
72 | - } |
|
58 | + if ($this->appManager->isEnabledForUser('files_sharing')) { |
|
59 | + $services['SHARING'] = [ |
|
60 | + 'version' => 1, |
|
61 | + 'endpoints' => [ |
|
62 | + 'share' => '/ocs/v2.php/apps/files_sharing/api/v1/shares', |
|
63 | + ], |
|
64 | + ]; |
|
65 | + $services['FEDERATED_SHARING'] = [ |
|
66 | + 'version' => 1, |
|
67 | + 'endpoints' => [ |
|
68 | + 'share' => '/ocs/v2.php/cloud/shares', |
|
69 | + 'webdav' => '/public.php/webdav/', |
|
70 | + ], |
|
71 | + ]; |
|
72 | + } |
|
73 | 73 | |
74 | - if ($this->appManager->isEnabledForUser('federation')) { |
|
75 | - if (isset($services['FEDERATED_SHARING'])) { |
|
76 | - $services['FEDERATED_SHARING']['endpoints']['shared-secret'] = '/ocs/v2.php/cloud/shared-secret'; |
|
77 | - $services['FEDERATED_SHARING']['endpoints']['system-address-book'] = '/remote.php/dav/addressbooks/system/system/system'; |
|
78 | - $services['FEDERATED_SHARING']['endpoints']['carddav-user'] = 'system'; |
|
79 | - } else { |
|
80 | - $services['FEDERATED_SHARING'] = [ |
|
81 | - 'version' => 1, |
|
82 | - 'endpoints' => [ |
|
83 | - 'shared-secret' => '/ocs/v2.php/cloud/shared-secret', |
|
84 | - 'system-address-book' => '/remote.php/dav/addressbooks/system/system/system', |
|
85 | - 'carddav-user' => 'system' |
|
86 | - ], |
|
87 | - ]; |
|
88 | - } |
|
89 | - } |
|
74 | + if ($this->appManager->isEnabledForUser('federation')) { |
|
75 | + if (isset($services['FEDERATED_SHARING'])) { |
|
76 | + $services['FEDERATED_SHARING']['endpoints']['shared-secret'] = '/ocs/v2.php/cloud/shared-secret'; |
|
77 | + $services['FEDERATED_SHARING']['endpoints']['system-address-book'] = '/remote.php/dav/addressbooks/system/system/system'; |
|
78 | + $services['FEDERATED_SHARING']['endpoints']['carddav-user'] = 'system'; |
|
79 | + } else { |
|
80 | + $services['FEDERATED_SHARING'] = [ |
|
81 | + 'version' => 1, |
|
82 | + 'endpoints' => [ |
|
83 | + 'shared-secret' => '/ocs/v2.php/cloud/shared-secret', |
|
84 | + 'system-address-book' => '/remote.php/dav/addressbooks/system/system/system', |
|
85 | + 'carddav-user' => 'system' |
|
86 | + ], |
|
87 | + ]; |
|
88 | + } |
|
89 | + } |
|
90 | 90 | |
91 | - if ($this->appManager->isEnabledForUser('activity')) { |
|
92 | - $services['ACTIVITY'] = [ |
|
93 | - 'version' => 1, |
|
94 | - 'endpoints' => [ |
|
95 | - 'list' => '/ocs/v2.php/cloud/activity', |
|
96 | - ], |
|
97 | - ]; |
|
98 | - } |
|
91 | + if ($this->appManager->isEnabledForUser('activity')) { |
|
92 | + $services['ACTIVITY'] = [ |
|
93 | + 'version' => 1, |
|
94 | + 'endpoints' => [ |
|
95 | + 'list' => '/ocs/v2.php/cloud/activity', |
|
96 | + ], |
|
97 | + ]; |
|
98 | + } |
|
99 | 99 | |
100 | - if ($this->appManager->isEnabledForUser('provisioning_api')) { |
|
101 | - $services['PROVISIONING'] = [ |
|
102 | - 'version' => 1, |
|
103 | - 'endpoints' => [ |
|
104 | - 'user' => '/ocs/v2.php/cloud/users', |
|
105 | - 'groups' => '/ocs/v2.php/cloud/groups', |
|
106 | - 'apps' => '/ocs/v2.php/cloud/apps', |
|
107 | - ], |
|
108 | - ]; |
|
109 | - } |
|
100 | + if ($this->appManager->isEnabledForUser('provisioning_api')) { |
|
101 | + $services['PROVISIONING'] = [ |
|
102 | + 'version' => 1, |
|
103 | + 'endpoints' => [ |
|
104 | + 'user' => '/ocs/v2.php/cloud/users', |
|
105 | + 'groups' => '/ocs/v2.php/cloud/groups', |
|
106 | + 'apps' => '/ocs/v2.php/cloud/apps', |
|
107 | + ], |
|
108 | + ]; |
|
109 | + } |
|
110 | 110 | |
111 | - return new \OCP\AppFramework\Http\JSONResponse([ |
|
112 | - 'version' => 2, |
|
113 | - 'services' => $services, |
|
114 | - ]); |
|
115 | - } |
|
111 | + return new \OCP\AppFramework\Http\JSONResponse([ |
|
112 | + 'version' => 2, |
|
113 | + 'services' => $services, |
|
114 | + ]); |
|
115 | + } |
|
116 | 116 | } |
@@ -30,7 +30,7 @@ |
||
30 | 30 | use Throwable; |
31 | 31 | |
32 | 32 | class InvalidProviderException extends Exception { |
33 | - public function __construct(string $providerId, Throwable $previous = null) { |
|
34 | - parent::__construct("The provider '$providerId' does not exist'", 0, $previous); |
|
35 | - } |
|
33 | + public function __construct(string $providerId, Throwable $previous = null) { |
|
34 | + parent::__construct("The provider '$providerId' does not exist'", 0, $previous); |
|
35 | + } |
|
36 | 36 | } |
@@ -28,16 +28,16 @@ |
||
28 | 28 | namespace OC\DB; |
29 | 29 | |
30 | 30 | class MissingIndexInformation { |
31 | - private $listOfMissingIndexes = []; |
|
31 | + private $listOfMissingIndexes = []; |
|
32 | 32 | |
33 | - public function addHintForMissingSubject(string $tableName, string $indexName) { |
|
34 | - $this->listOfMissingIndexes[] = [ |
|
35 | - 'tableName' => $tableName, |
|
36 | - 'indexName' => $indexName |
|
37 | - ]; |
|
38 | - } |
|
33 | + public function addHintForMissingSubject(string $tableName, string $indexName) { |
|
34 | + $this->listOfMissingIndexes[] = [ |
|
35 | + 'tableName' => $tableName, |
|
36 | + 'indexName' => $indexName |
|
37 | + ]; |
|
38 | + } |
|
39 | 39 | |
40 | - public function getListOfMissingIndexes(): array { |
|
41 | - return $this->listOfMissingIndexes; |
|
42 | - } |
|
40 | + public function getListOfMissingIndexes(): array { |
|
41 | + return $this->listOfMissingIndexes; |
|
42 | + } |
|
43 | 43 | } |
@@ -27,16 +27,16 @@ |
||
27 | 27 | namespace OC\DB; |
28 | 28 | |
29 | 29 | class MissingColumnInformation { |
30 | - private $listOfMissingColumns = []; |
|
30 | + private $listOfMissingColumns = []; |
|
31 | 31 | |
32 | - public function addHintForMissingColumn(string $tableName, string $columnName): void { |
|
33 | - $this->listOfMissingColumns[] = [ |
|
34 | - 'tableName' => $tableName, |
|
35 | - 'columnName' => $columnName, |
|
36 | - ]; |
|
37 | - } |
|
32 | + public function addHintForMissingColumn(string $tableName, string $columnName): void { |
|
33 | + $this->listOfMissingColumns[] = [ |
|
34 | + 'tableName' => $tableName, |
|
35 | + 'columnName' => $columnName, |
|
36 | + ]; |
|
37 | + } |
|
38 | 38 | |
39 | - public function getListOfMissingColumns(): array { |
|
40 | - return $this->listOfMissingColumns; |
|
41 | - } |
|
39 | + public function getListOfMissingColumns(): array { |
|
40 | + return $this->listOfMissingColumns; |
|
41 | + } |
|
42 | 42 | } |
@@ -31,72 +31,72 @@ |
||
31 | 31 | |
32 | 32 | class Notifier implements INotifier { |
33 | 33 | |
34 | - /** @var IFactory */ |
|
35 | - protected $l10nFactory; |
|
34 | + /** @var IFactory */ |
|
35 | + protected $l10nFactory; |
|
36 | 36 | |
37 | - /** |
|
38 | - * @param IFactory $l10nFactory |
|
39 | - */ |
|
40 | - public function __construct(\OCP\L10N\IFactory $l10nFactory) { |
|
41 | - $this->l10nFactory = $l10nFactory; |
|
42 | - } |
|
37 | + /** |
|
38 | + * @param IFactory $l10nFactory |
|
39 | + */ |
|
40 | + public function __construct(\OCP\L10N\IFactory $l10nFactory) { |
|
41 | + $this->l10nFactory = $l10nFactory; |
|
42 | + } |
|
43 | 43 | |
44 | - /** |
|
45 | - * Identifier of the notifier, only use [a-z0-9_] |
|
46 | - * |
|
47 | - * @return string |
|
48 | - * @since 17.0.0 |
|
49 | - */ |
|
50 | - public function getID(): string { |
|
51 | - return 'user_ldap'; |
|
52 | - } |
|
44 | + /** |
|
45 | + * Identifier of the notifier, only use [a-z0-9_] |
|
46 | + * |
|
47 | + * @return string |
|
48 | + * @since 17.0.0 |
|
49 | + */ |
|
50 | + public function getID(): string { |
|
51 | + return 'user_ldap'; |
|
52 | + } |
|
53 | 53 | |
54 | - /** |
|
55 | - * Human readable name describing the notifier |
|
56 | - * |
|
57 | - * @return string |
|
58 | - * @since 17.0.0 |
|
59 | - */ |
|
60 | - public function getName(): string { |
|
61 | - return $this->l10nFactory->get('user_ldap')->t('LDAP User backend'); |
|
62 | - } |
|
54 | + /** |
|
55 | + * Human readable name describing the notifier |
|
56 | + * |
|
57 | + * @return string |
|
58 | + * @since 17.0.0 |
|
59 | + */ |
|
60 | + public function getName(): string { |
|
61 | + return $this->l10nFactory->get('user_ldap')->t('LDAP User backend'); |
|
62 | + } |
|
63 | 63 | |
64 | - /** |
|
65 | - * @param INotification $notification |
|
66 | - * @param string $languageCode The code of the language that should be used to prepare the notification |
|
67 | - * @return INotification |
|
68 | - * @throws \InvalidArgumentException When the notification was not prepared by a notifier |
|
69 | - */ |
|
70 | - public function prepare(INotification $notification, string $languageCode): INotification { |
|
71 | - if ($notification->getApp() !== 'user_ldap') { |
|
72 | - // Not my app => throw |
|
73 | - throw new \InvalidArgumentException(); |
|
74 | - } |
|
64 | + /** |
|
65 | + * @param INotification $notification |
|
66 | + * @param string $languageCode The code of the language that should be used to prepare the notification |
|
67 | + * @return INotification |
|
68 | + * @throws \InvalidArgumentException When the notification was not prepared by a notifier |
|
69 | + */ |
|
70 | + public function prepare(INotification $notification, string $languageCode): INotification { |
|
71 | + if ($notification->getApp() !== 'user_ldap') { |
|
72 | + // Not my app => throw |
|
73 | + throw new \InvalidArgumentException(); |
|
74 | + } |
|
75 | 75 | |
76 | - // Read the language from the notification |
|
77 | - $l = $this->l10nFactory->get('user_ldap', $languageCode); |
|
76 | + // Read the language from the notification |
|
77 | + $l = $this->l10nFactory->get('user_ldap', $languageCode); |
|
78 | 78 | |
79 | - switch ($notification->getSubject()) { |
|
80 | - // Deal with known subjects |
|
81 | - case 'pwd_exp_warn_days': |
|
82 | - $params = $notification->getSubjectParameters(); |
|
83 | - $days = (int) $params[0]; |
|
84 | - if ($days === 2) { |
|
85 | - $notification->setParsedSubject($l->t('Your password will expire tomorrow.')); |
|
86 | - } elseif ($days === 1) { |
|
87 | - $notification->setParsedSubject($l->t('Your password will expire today.')); |
|
88 | - } else { |
|
89 | - $notification->setParsedSubject($l->n( |
|
90 | - 'Your password will expire within %n day.', |
|
91 | - 'Your password will expire within %n days.', |
|
92 | - $days |
|
93 | - )); |
|
94 | - } |
|
95 | - return $notification; |
|
79 | + switch ($notification->getSubject()) { |
|
80 | + // Deal with known subjects |
|
81 | + case 'pwd_exp_warn_days': |
|
82 | + $params = $notification->getSubjectParameters(); |
|
83 | + $days = (int) $params[0]; |
|
84 | + if ($days === 2) { |
|
85 | + $notification->setParsedSubject($l->t('Your password will expire tomorrow.')); |
|
86 | + } elseif ($days === 1) { |
|
87 | + $notification->setParsedSubject($l->t('Your password will expire today.')); |
|
88 | + } else { |
|
89 | + $notification->setParsedSubject($l->n( |
|
90 | + 'Your password will expire within %n day.', |
|
91 | + 'Your password will expire within %n days.', |
|
92 | + $days |
|
93 | + )); |
|
94 | + } |
|
95 | + return $notification; |
|
96 | 96 | |
97 | - default: |
|
98 | - // Unknown subject => Unknown notification => throw |
|
99 | - throw new \InvalidArgumentException(); |
|
100 | - } |
|
101 | - } |
|
97 | + default: |
|
98 | + // Unknown subject => Unknown notification => throw |
|
99 | + throw new \InvalidArgumentException(); |
|
100 | + } |
|
101 | + } |
|
102 | 102 | } |
@@ -30,40 +30,40 @@ |
||
30 | 30 | use OCA\User_LDAP\User_Proxy; |
31 | 31 | |
32 | 32 | class ExtStorageConfigHandler extends UserContext implements IConfigHandler { |
33 | - use SimpleSubstitutionTrait; |
|
33 | + use SimpleSubstitutionTrait; |
|
34 | 34 | |
35 | - /** |
|
36 | - * @param mixed $optionValue |
|
37 | - * @return mixed the same type as $optionValue |
|
38 | - * @since 16.0.0 |
|
39 | - * @throws \Exception |
|
40 | - */ |
|
41 | - public function handle($optionValue) { |
|
42 | - $this->placeholder = 'home'; |
|
43 | - $user = $this->getUser(); |
|
35 | + /** |
|
36 | + * @param mixed $optionValue |
|
37 | + * @return mixed the same type as $optionValue |
|
38 | + * @since 16.0.0 |
|
39 | + * @throws \Exception |
|
40 | + */ |
|
41 | + public function handle($optionValue) { |
|
42 | + $this->placeholder = 'home'; |
|
43 | + $user = $this->getUser(); |
|
44 | 44 | |
45 | - if ($user === null) { |
|
46 | - return $optionValue; |
|
47 | - } |
|
45 | + if ($user === null) { |
|
46 | + return $optionValue; |
|
47 | + } |
|
48 | 48 | |
49 | - $backend = $user->getBackend(); |
|
50 | - if (!$backend instanceof User_Proxy) { |
|
51 | - return $optionValue; |
|
52 | - } |
|
49 | + $backend = $user->getBackend(); |
|
50 | + if (!$backend instanceof User_Proxy) { |
|
51 | + return $optionValue; |
|
52 | + } |
|
53 | 53 | |
54 | - $access = $backend->getLDAPAccess($user->getUID()); |
|
55 | - if (!$access) { |
|
56 | - return $optionValue; |
|
57 | - } |
|
54 | + $access = $backend->getLDAPAccess($user->getUID()); |
|
55 | + if (!$access) { |
|
56 | + return $optionValue; |
|
57 | + } |
|
58 | 58 | |
59 | - $attribute = $access->connection->ldapExtStorageHomeAttribute; |
|
60 | - if (empty($attribute)) { |
|
61 | - return $optionValue; |
|
62 | - } |
|
59 | + $attribute = $access->connection->ldapExtStorageHomeAttribute; |
|
60 | + if (empty($attribute)) { |
|
61 | + return $optionValue; |
|
62 | + } |
|
63 | 63 | |
64 | - $ldapUser = $access->userManager->get($user->getUID()); |
|
65 | - $extHome = $ldapUser->getExtStorageHome(); |
|
64 | + $ldapUser = $access->userManager->get($user->getUID()); |
|
65 | + $extHome = $ldapUser->getExtStorageHome(); |
|
66 | 66 | |
67 | - return $this->processInput($optionValue, $extHome); |
|
68 | - } |
|
67 | + return $this->processInput($optionValue, $extHome); |
|
68 | + } |
|
69 | 69 | } |
@@ -30,50 +30,50 @@ |
||
30 | 30 | namespace OCA\User_LDAP; |
31 | 31 | |
32 | 32 | class WizardResult { |
33 | - protected $changes = []; |
|
34 | - protected $options = []; |
|
35 | - protected $markedChange = false; |
|
33 | + protected $changes = []; |
|
34 | + protected $options = []; |
|
35 | + protected $markedChange = false; |
|
36 | 36 | |
37 | - /** |
|
38 | - * @param string $key |
|
39 | - * @param mixed $value |
|
40 | - */ |
|
41 | - public function addChange($key, $value) { |
|
42 | - $this->changes[$key] = $value; |
|
43 | - } |
|
37 | + /** |
|
38 | + * @param string $key |
|
39 | + * @param mixed $value |
|
40 | + */ |
|
41 | + public function addChange($key, $value) { |
|
42 | + $this->changes[$key] = $value; |
|
43 | + } |
|
44 | 44 | |
45 | 45 | |
46 | - public function markChange() { |
|
47 | - $this->markedChange = true; |
|
48 | - } |
|
46 | + public function markChange() { |
|
47 | + $this->markedChange = true; |
|
48 | + } |
|
49 | 49 | |
50 | - /** |
|
51 | - * @param string $key |
|
52 | - * @param array|string $values |
|
53 | - */ |
|
54 | - public function addOptions($key, $values) { |
|
55 | - if (!is_array($values)) { |
|
56 | - $values = [$values]; |
|
57 | - } |
|
58 | - $this->options[$key] = $values; |
|
59 | - } |
|
50 | + /** |
|
51 | + * @param string $key |
|
52 | + * @param array|string $values |
|
53 | + */ |
|
54 | + public function addOptions($key, $values) { |
|
55 | + if (!is_array($values)) { |
|
56 | + $values = [$values]; |
|
57 | + } |
|
58 | + $this->options[$key] = $values; |
|
59 | + } |
|
60 | 60 | |
61 | - /** |
|
62 | - * @return bool |
|
63 | - */ |
|
64 | - public function hasChanges() { |
|
65 | - return (count($this->changes) > 0 || $this->markedChange); |
|
66 | - } |
|
61 | + /** |
|
62 | + * @return bool |
|
63 | + */ |
|
64 | + public function hasChanges() { |
|
65 | + return (count($this->changes) > 0 || $this->markedChange); |
|
66 | + } |
|
67 | 67 | |
68 | - /** |
|
69 | - * @return array |
|
70 | - */ |
|
71 | - public function getResultArray() { |
|
72 | - $result = []; |
|
73 | - $result['changes'] = $this->changes; |
|
74 | - if (count($this->options) > 0) { |
|
75 | - $result['options'] = $this->options; |
|
76 | - } |
|
77 | - return $result; |
|
78 | - } |
|
68 | + /** |
|
69 | + * @return array |
|
70 | + */ |
|
71 | + public function getResultArray() { |
|
72 | + $result = []; |
|
73 | + $result['changes'] = $this->changes; |
|
74 | + if (count($this->options) > 0) { |
|
75 | + $result['options'] = $this->options; |
|
76 | + } |
|
77 | + return $result; |
|
78 | + } |
|
79 | 79 | } |
@@ -33,69 +33,69 @@ |
||
33 | 33 | |
34 | 34 | class UUIDFixInsert implements IRepairStep { |
35 | 35 | |
36 | - /** @var IConfig */ |
|
37 | - protected $config; |
|
36 | + /** @var IConfig */ |
|
37 | + protected $config; |
|
38 | 38 | |
39 | - /** @var UserMapping */ |
|
40 | - protected $userMapper; |
|
39 | + /** @var UserMapping */ |
|
40 | + protected $userMapper; |
|
41 | 41 | |
42 | - /** @var GroupMapping */ |
|
43 | - protected $groupMapper; |
|
42 | + /** @var GroupMapping */ |
|
43 | + protected $groupMapper; |
|
44 | 44 | |
45 | - /** @var IJobList */ |
|
46 | - protected $jobList; |
|
45 | + /** @var IJobList */ |
|
46 | + protected $jobList; |
|
47 | 47 | |
48 | - public function __construct(IConfig $config, UserMapping $userMapper, GroupMapping $groupMapper, IJobList $jobList) { |
|
49 | - $this->config = $config; |
|
50 | - $this->userMapper = $userMapper; |
|
51 | - $this->groupMapper = $groupMapper; |
|
52 | - $this->jobList = $jobList; |
|
53 | - } |
|
48 | + public function __construct(IConfig $config, UserMapping $userMapper, GroupMapping $groupMapper, IJobList $jobList) { |
|
49 | + $this->config = $config; |
|
50 | + $this->userMapper = $userMapper; |
|
51 | + $this->groupMapper = $groupMapper; |
|
52 | + $this->jobList = $jobList; |
|
53 | + } |
|
54 | 54 | |
55 | - /** |
|
56 | - * Returns the step's name |
|
57 | - * |
|
58 | - * @return string |
|
59 | - * @since 9.1.0 |
|
60 | - */ |
|
61 | - public function getName() { |
|
62 | - return 'Insert UUIDFix background job for user and group in batches'; |
|
63 | - } |
|
55 | + /** |
|
56 | + * Returns the step's name |
|
57 | + * |
|
58 | + * @return string |
|
59 | + * @since 9.1.0 |
|
60 | + */ |
|
61 | + public function getName() { |
|
62 | + return 'Insert UUIDFix background job for user and group in batches'; |
|
63 | + } |
|
64 | 64 | |
65 | - /** |
|
66 | - * Run repair step. |
|
67 | - * Must throw exception on error. |
|
68 | - * |
|
69 | - * @param IOutput $output |
|
70 | - * @throws \Exception in case of failure |
|
71 | - * @since 9.1.0 |
|
72 | - */ |
|
73 | - public function run(IOutput $output) { |
|
74 | - $installedVersion = $this->config->getAppValue('user_ldap', 'installed_version', '1.2.1'); |
|
75 | - if (version_compare($installedVersion, '1.2.1') !== -1) { |
|
76 | - return; |
|
77 | - } |
|
65 | + /** |
|
66 | + * Run repair step. |
|
67 | + * Must throw exception on error. |
|
68 | + * |
|
69 | + * @param IOutput $output |
|
70 | + * @throws \Exception in case of failure |
|
71 | + * @since 9.1.0 |
|
72 | + */ |
|
73 | + public function run(IOutput $output) { |
|
74 | + $installedVersion = $this->config->getAppValue('user_ldap', 'installed_version', '1.2.1'); |
|
75 | + if (version_compare($installedVersion, '1.2.1') !== -1) { |
|
76 | + return; |
|
77 | + } |
|
78 | 78 | |
79 | - foreach ([$this->userMapper, $this->groupMapper] as $mapper) { |
|
80 | - $offset = 0; |
|
81 | - $batchSize = 50; |
|
82 | - $jobClass = $mapper instanceof UserMapping ? UUIDFixUser::class : UUIDFixGroup::class; |
|
83 | - do { |
|
84 | - $retry = false; |
|
85 | - $records = $mapper->getList($offset, $batchSize); |
|
86 | - if (count($records) === 0) { |
|
87 | - continue; |
|
88 | - } |
|
89 | - try { |
|
90 | - $this->jobList->add($jobClass, ['records' => $records]); |
|
91 | - $offset += $batchSize; |
|
92 | - } catch (\InvalidArgumentException $e) { |
|
93 | - if (strpos($e->getMessage(), 'Background job arguments can\'t exceed 4000') !== false) { |
|
94 | - $batchSize = (int)floor(count($records) * 0.8); |
|
95 | - $retry = true; |
|
96 | - } |
|
97 | - } |
|
98 | - } while (count($records) === $batchSize || $retry); |
|
99 | - } |
|
100 | - } |
|
79 | + foreach ([$this->userMapper, $this->groupMapper] as $mapper) { |
|
80 | + $offset = 0; |
|
81 | + $batchSize = 50; |
|
82 | + $jobClass = $mapper instanceof UserMapping ? UUIDFixUser::class : UUIDFixGroup::class; |
|
83 | + do { |
|
84 | + $retry = false; |
|
85 | + $records = $mapper->getList($offset, $batchSize); |
|
86 | + if (count($records) === 0) { |
|
87 | + continue; |
|
88 | + } |
|
89 | + try { |
|
90 | + $this->jobList->add($jobClass, ['records' => $records]); |
|
91 | + $offset += $batchSize; |
|
92 | + } catch (\InvalidArgumentException $e) { |
|
93 | + if (strpos($e->getMessage(), 'Background job arguments can\'t exceed 4000') !== false) { |
|
94 | + $batchSize = (int)floor(count($records) * 0.8); |
|
95 | + $retry = true; |
|
96 | + } |
|
97 | + } |
|
98 | + } while (count($records) === $batchSize || $retry); |
|
99 | + } |
|
100 | + } |
|
101 | 101 | } |
@@ -2,15 +2,15 @@ |
||
2 | 2 | <p> |
3 | 3 | <select id="ldap_serverconfig_chooser" name="ldap_serverconfig_chooser"> |
4 | 4 | <?php |
5 | - $i = 1; |
|
6 | - $sel = ' selected'; |
|
7 | - foreach ($_['serverConfigurationPrefixes'] as $prefix) { |
|
8 | - ?> |
|
5 | + $i = 1; |
|
6 | + $sel = ' selected'; |
|
7 | + foreach ($_['serverConfigurationPrefixes'] as $prefix) { |
|
8 | + ?> |
|
9 | 9 | <option value="<?php p($prefix); ?>"<?php p($sel); |
10 | - $sel = ''; ?>><?php p($l->t('%s. Server:', [$i++])); ?> <?php p(' '.$_['serverConfigurationHosts'][$prefix]); ?></option> |
|
10 | + $sel = ''; ?>><?php p($l->t('%s. Server:', [$i++])); ?> <?php p(' '.$_['serverConfigurationHosts'][$prefix]); ?></option> |
|
11 | 11 | <?php |
12 | - } |
|
13 | - ?> |
|
12 | + } |
|
13 | + ?> |
|
14 | 14 | </select> |
15 | 15 | <button type="button" id="ldap_action_add_configuration" |
16 | 16 | name="ldap_action_add_configuration" class="icon-add icon-default-style" |