@@ -35,56 +35,56 @@ |
||
35 | 35 | use OCP\IRequest; |
36 | 36 | |
37 | 37 | class CompressionMiddleware extends Middleware { |
38 | - /** @var bool */ |
|
39 | - private $useGZip; |
|
38 | + /** @var bool */ |
|
39 | + private $useGZip; |
|
40 | 40 | |
41 | - /** @var IRequest */ |
|
42 | - private $request; |
|
41 | + /** @var IRequest */ |
|
42 | + private $request; |
|
43 | 43 | |
44 | - public function __construct(IRequest $request) { |
|
45 | - $this->request = $request; |
|
46 | - $this->useGZip = false; |
|
47 | - } |
|
44 | + public function __construct(IRequest $request) { |
|
45 | + $this->request = $request; |
|
46 | + $this->useGZip = false; |
|
47 | + } |
|
48 | 48 | |
49 | - public function afterController($controller, $methodName, Response $response) { |
|
50 | - // By default we do not gzip |
|
51 | - $allowGzip = false; |
|
49 | + public function afterController($controller, $methodName, Response $response) { |
|
50 | + // By default we do not gzip |
|
51 | + $allowGzip = false; |
|
52 | 52 | |
53 | - // Only return gzipped content for 200 responses |
|
54 | - if ($response->getStatus() !== Http::STATUS_OK) { |
|
55 | - return $response; |
|
56 | - } |
|
53 | + // Only return gzipped content for 200 responses |
|
54 | + if ($response->getStatus() !== Http::STATUS_OK) { |
|
55 | + return $response; |
|
56 | + } |
|
57 | 57 | |
58 | - // Check if we are even asked for gzip |
|
59 | - $header = $this->request->getHeader('Accept-Encoding'); |
|
60 | - if (!str_contains($header, 'gzip')) { |
|
61 | - return $response; |
|
62 | - } |
|
58 | + // Check if we are even asked for gzip |
|
59 | + $header = $this->request->getHeader('Accept-Encoding'); |
|
60 | + if (!str_contains($header, 'gzip')) { |
|
61 | + return $response; |
|
62 | + } |
|
63 | 63 | |
64 | - // We only allow gzip in some cases |
|
65 | - if ($response instanceof BaseResponse) { |
|
66 | - $allowGzip = true; |
|
67 | - } |
|
68 | - if ($response instanceof JSONResponse) { |
|
69 | - $allowGzip = true; |
|
70 | - } |
|
71 | - if ($response instanceof TemplateResponse) { |
|
72 | - $allowGzip = true; |
|
73 | - } |
|
64 | + // We only allow gzip in some cases |
|
65 | + if ($response instanceof BaseResponse) { |
|
66 | + $allowGzip = true; |
|
67 | + } |
|
68 | + if ($response instanceof JSONResponse) { |
|
69 | + $allowGzip = true; |
|
70 | + } |
|
71 | + if ($response instanceof TemplateResponse) { |
|
72 | + $allowGzip = true; |
|
73 | + } |
|
74 | 74 | |
75 | - if ($allowGzip) { |
|
76 | - $this->useGZip = true; |
|
77 | - $response->addHeader('Content-Encoding', 'gzip'); |
|
78 | - } |
|
75 | + if ($allowGzip) { |
|
76 | + $this->useGZip = true; |
|
77 | + $response->addHeader('Content-Encoding', 'gzip'); |
|
78 | + } |
|
79 | 79 | |
80 | - return $response; |
|
81 | - } |
|
80 | + return $response; |
|
81 | + } |
|
82 | 82 | |
83 | - public function beforeOutput($controller, $methodName, $output) { |
|
84 | - if (!$this->useGZip) { |
|
85 | - return $output; |
|
86 | - } |
|
83 | + public function beforeOutput($controller, $methodName, $output) { |
|
84 | + if (!$this->useGZip) { |
|
85 | + return $output; |
|
86 | + } |
|
87 | 87 | |
88 | - return gzencode($output); |
|
89 | - } |
|
88 | + return gzencode($output); |
|
89 | + } |
|
90 | 90 | } |
@@ -27,133 +27,133 @@ |
||
27 | 27 | use OCP\IMemcache; |
28 | 28 | |
29 | 29 | class ArrayCache extends Cache implements IMemcache { |
30 | - /** @var array Array with the cached data */ |
|
31 | - protected $cachedData = []; |
|
30 | + /** @var array Array with the cached data */ |
|
31 | + protected $cachedData = []; |
|
32 | 32 | |
33 | - use CADTrait; |
|
33 | + use CADTrait; |
|
34 | 34 | |
35 | - /** |
|
36 | - * {@inheritDoc} |
|
37 | - */ |
|
38 | - public function get($key) { |
|
39 | - if ($this->hasKey($key)) { |
|
40 | - return $this->cachedData[$key]; |
|
41 | - } |
|
42 | - return null; |
|
43 | - } |
|
35 | + /** |
|
36 | + * {@inheritDoc} |
|
37 | + */ |
|
38 | + public function get($key) { |
|
39 | + if ($this->hasKey($key)) { |
|
40 | + return $this->cachedData[$key]; |
|
41 | + } |
|
42 | + return null; |
|
43 | + } |
|
44 | 44 | |
45 | - /** |
|
46 | - * {@inheritDoc} |
|
47 | - */ |
|
48 | - public function set($key, $value, $ttl = 0) { |
|
49 | - $this->cachedData[$key] = $value; |
|
50 | - return true; |
|
51 | - } |
|
45 | + /** |
|
46 | + * {@inheritDoc} |
|
47 | + */ |
|
48 | + public function set($key, $value, $ttl = 0) { |
|
49 | + $this->cachedData[$key] = $value; |
|
50 | + return true; |
|
51 | + } |
|
52 | 52 | |
53 | - /** |
|
54 | - * {@inheritDoc} |
|
55 | - */ |
|
56 | - public function hasKey($key) { |
|
57 | - return isset($this->cachedData[$key]); |
|
58 | - } |
|
53 | + /** |
|
54 | + * {@inheritDoc} |
|
55 | + */ |
|
56 | + public function hasKey($key) { |
|
57 | + return isset($this->cachedData[$key]); |
|
58 | + } |
|
59 | 59 | |
60 | - /** |
|
61 | - * {@inheritDoc} |
|
62 | - */ |
|
63 | - public function remove($key) { |
|
64 | - unset($this->cachedData[$key]); |
|
65 | - return true; |
|
66 | - } |
|
60 | + /** |
|
61 | + * {@inheritDoc} |
|
62 | + */ |
|
63 | + public function remove($key) { |
|
64 | + unset($this->cachedData[$key]); |
|
65 | + return true; |
|
66 | + } |
|
67 | 67 | |
68 | - /** |
|
69 | - * {@inheritDoc} |
|
70 | - */ |
|
71 | - public function clear($prefix = '') { |
|
72 | - if ($prefix === '') { |
|
73 | - $this->cachedData = []; |
|
74 | - return true; |
|
75 | - } |
|
68 | + /** |
|
69 | + * {@inheritDoc} |
|
70 | + */ |
|
71 | + public function clear($prefix = '') { |
|
72 | + if ($prefix === '') { |
|
73 | + $this->cachedData = []; |
|
74 | + return true; |
|
75 | + } |
|
76 | 76 | |
77 | - foreach ($this->cachedData as $key => $value) { |
|
78 | - if (str_starts_with($key, $prefix)) { |
|
79 | - $this->remove($key); |
|
80 | - } |
|
81 | - } |
|
82 | - return true; |
|
83 | - } |
|
77 | + foreach ($this->cachedData as $key => $value) { |
|
78 | + if (str_starts_with($key, $prefix)) { |
|
79 | + $this->remove($key); |
|
80 | + } |
|
81 | + } |
|
82 | + return true; |
|
83 | + } |
|
84 | 84 | |
85 | - /** |
|
86 | - * Set a value in the cache if it's not already stored |
|
87 | - * |
|
88 | - * @param string $key |
|
89 | - * @param mixed $value |
|
90 | - * @param int $ttl Time To Live in seconds. Defaults to 60*60*24 |
|
91 | - * @return bool |
|
92 | - */ |
|
93 | - public function add($key, $value, $ttl = 0) { |
|
94 | - // since this cache is not shared race conditions aren't an issue |
|
95 | - if ($this->hasKey($key)) { |
|
96 | - return false; |
|
97 | - } else { |
|
98 | - return $this->set($key, $value, $ttl); |
|
99 | - } |
|
100 | - } |
|
85 | + /** |
|
86 | + * Set a value in the cache if it's not already stored |
|
87 | + * |
|
88 | + * @param string $key |
|
89 | + * @param mixed $value |
|
90 | + * @param int $ttl Time To Live in seconds. Defaults to 60*60*24 |
|
91 | + * @return bool |
|
92 | + */ |
|
93 | + public function add($key, $value, $ttl = 0) { |
|
94 | + // since this cache is not shared race conditions aren't an issue |
|
95 | + if ($this->hasKey($key)) { |
|
96 | + return false; |
|
97 | + } else { |
|
98 | + return $this->set($key, $value, $ttl); |
|
99 | + } |
|
100 | + } |
|
101 | 101 | |
102 | - /** |
|
103 | - * Increase a stored number |
|
104 | - * |
|
105 | - * @param string $key |
|
106 | - * @param int $step |
|
107 | - * @return int | bool |
|
108 | - */ |
|
109 | - public function inc($key, $step = 1) { |
|
110 | - $oldValue = $this->get($key); |
|
111 | - if (is_int($oldValue)) { |
|
112 | - $this->set($key, $oldValue + $step); |
|
113 | - return $oldValue + $step; |
|
114 | - } else { |
|
115 | - $success = $this->add($key, $step); |
|
116 | - return $success ? $step : false; |
|
117 | - } |
|
118 | - } |
|
102 | + /** |
|
103 | + * Increase a stored number |
|
104 | + * |
|
105 | + * @param string $key |
|
106 | + * @param int $step |
|
107 | + * @return int | bool |
|
108 | + */ |
|
109 | + public function inc($key, $step = 1) { |
|
110 | + $oldValue = $this->get($key); |
|
111 | + if (is_int($oldValue)) { |
|
112 | + $this->set($key, $oldValue + $step); |
|
113 | + return $oldValue + $step; |
|
114 | + } else { |
|
115 | + $success = $this->add($key, $step); |
|
116 | + return $success ? $step : false; |
|
117 | + } |
|
118 | + } |
|
119 | 119 | |
120 | - /** |
|
121 | - * Decrease a stored number |
|
122 | - * |
|
123 | - * @param string $key |
|
124 | - * @param int $step |
|
125 | - * @return int | bool |
|
126 | - */ |
|
127 | - public function dec($key, $step = 1) { |
|
128 | - $oldValue = $this->get($key); |
|
129 | - if (is_int($oldValue)) { |
|
130 | - $this->set($key, $oldValue - $step); |
|
131 | - return $oldValue - $step; |
|
132 | - } else { |
|
133 | - return false; |
|
134 | - } |
|
135 | - } |
|
120 | + /** |
|
121 | + * Decrease a stored number |
|
122 | + * |
|
123 | + * @param string $key |
|
124 | + * @param int $step |
|
125 | + * @return int | bool |
|
126 | + */ |
|
127 | + public function dec($key, $step = 1) { |
|
128 | + $oldValue = $this->get($key); |
|
129 | + if (is_int($oldValue)) { |
|
130 | + $this->set($key, $oldValue - $step); |
|
131 | + return $oldValue - $step; |
|
132 | + } else { |
|
133 | + return false; |
|
134 | + } |
|
135 | + } |
|
136 | 136 | |
137 | - /** |
|
138 | - * Compare and set |
|
139 | - * |
|
140 | - * @param string $key |
|
141 | - * @param mixed $old |
|
142 | - * @param mixed $new |
|
143 | - * @return bool |
|
144 | - */ |
|
145 | - public function cas($key, $old, $new) { |
|
146 | - if ($this->get($key) === $old) { |
|
147 | - return $this->set($key, $new); |
|
148 | - } else { |
|
149 | - return false; |
|
150 | - } |
|
151 | - } |
|
137 | + /** |
|
138 | + * Compare and set |
|
139 | + * |
|
140 | + * @param string $key |
|
141 | + * @param mixed $old |
|
142 | + * @param mixed $new |
|
143 | + * @return bool |
|
144 | + */ |
|
145 | + public function cas($key, $old, $new) { |
|
146 | + if ($this->get($key) === $old) { |
|
147 | + return $this->set($key, $new); |
|
148 | + } else { |
|
149 | + return false; |
|
150 | + } |
|
151 | + } |
|
152 | 152 | |
153 | - /** |
|
154 | - * {@inheritDoc} |
|
155 | - */ |
|
156 | - public static function isAvailable(): bool { |
|
157 | - return true; |
|
158 | - } |
|
153 | + /** |
|
154 | + * {@inheritDoc} |
|
155 | + */ |
|
156 | + public static function isAvailable(): bool { |
|
157 | + return true; |
|
158 | + } |
|
159 | 159 | } |
@@ -26,24 +26,24 @@ |
||
26 | 26 | namespace OC\Files\Cache; |
27 | 27 | |
28 | 28 | class LocalRootScanner extends Scanner { |
29 | - public function scanFile($file, $reuseExisting = 0, $parentId = -1, $cacheData = null, $lock = true, $data = null) { |
|
30 | - if ($this->shouldScanPath($file)) { |
|
31 | - return parent::scanFile($file, $reuseExisting, $parentId, $cacheData, $lock, $data); |
|
32 | - } else { |
|
33 | - return null; |
|
34 | - } |
|
35 | - } |
|
29 | + public function scanFile($file, $reuseExisting = 0, $parentId = -1, $cacheData = null, $lock = true, $data = null) { |
|
30 | + if ($this->shouldScanPath($file)) { |
|
31 | + return parent::scanFile($file, $reuseExisting, $parentId, $cacheData, $lock, $data); |
|
32 | + } else { |
|
33 | + return null; |
|
34 | + } |
|
35 | + } |
|
36 | 36 | |
37 | - public function scan($path, $recursive = self::SCAN_RECURSIVE, $reuse = -1, $lock = true) { |
|
38 | - if ($this->shouldScanPath($path)) { |
|
39 | - return parent::scan($path, $recursive, $reuse, $lock); |
|
40 | - } else { |
|
41 | - return null; |
|
42 | - } |
|
43 | - } |
|
37 | + public function scan($path, $recursive = self::SCAN_RECURSIVE, $reuse = -1, $lock = true) { |
|
38 | + if ($this->shouldScanPath($path)) { |
|
39 | + return parent::scan($path, $recursive, $reuse, $lock); |
|
40 | + } else { |
|
41 | + return null; |
|
42 | + } |
|
43 | + } |
|
44 | 44 | |
45 | - private function shouldScanPath(string $path): bool { |
|
46 | - $path = trim($path, '/'); |
|
47 | - return $path === '' || str_starts_with($path, 'appdata_') || str_starts_with($path, '__groupfolders'); |
|
48 | - } |
|
45 | + private function shouldScanPath(string $path): bool { |
|
46 | + $path = trim($path, '/'); |
|
47 | + return $path === '' || str_starts_with($path, 'appdata_') || str_starts_with($path, '__groupfolders'); |
|
48 | + } |
|
49 | 49 | } |
@@ -28,11 +28,11 @@ |
||
28 | 28 | * @since 28.0.0 |
29 | 29 | */ |
30 | 30 | interface IEventSourceFactory { |
31 | - /** |
|
32 | - * Create a new event source |
|
33 | - * |
|
34 | - * @return IEventSource |
|
35 | - * @since 28.0.0 |
|
36 | - */ |
|
37 | - public function create(): IEventSource; |
|
31 | + /** |
|
32 | + * Create a new event source |
|
33 | + * |
|
34 | + * @return IEventSource |
|
35 | + * @since 28.0.0 |
|
36 | + */ |
|
37 | + public function create(): IEventSource; |
|
38 | 38 | } |
@@ -33,19 +33,19 @@ |
||
33 | 33 | use OCP\Migration\IRepairStep; |
34 | 34 | |
35 | 35 | class LookupServerSendCheck implements IRepairStep { |
36 | - private IJobList $jobList; |
|
37 | - private IConfig $config; |
|
36 | + private IJobList $jobList; |
|
37 | + private IConfig $config; |
|
38 | 38 | |
39 | - public function __construct(IJobList $jobList, IConfig $config) { |
|
40 | - $this->jobList = $jobList; |
|
41 | - $this->config = $config; |
|
42 | - } |
|
39 | + public function __construct(IJobList $jobList, IConfig $config) { |
|
40 | + $this->jobList = $jobList; |
|
41 | + $this->config = $config; |
|
42 | + } |
|
43 | 43 | |
44 | - public function getName(): string { |
|
45 | - return 'Add background job to set the lookup server share state for users'; |
|
46 | - } |
|
44 | + public function getName(): string { |
|
45 | + return 'Add background job to set the lookup server share state for users'; |
|
46 | + } |
|
47 | 47 | |
48 | - public function run(IOutput $output): void { |
|
49 | - $this->jobList->add(LookupServerSendCheckBackgroundJob::class); |
|
50 | - } |
|
48 | + public function run(IOutput $output): void { |
|
49 | + $this->jobList->add(LookupServerSendCheckBackgroundJob::class); |
|
50 | + } |
|
51 | 51 | } |
@@ -35,48 +35,48 @@ |
||
35 | 35 | |
36 | 36 | class Version011601Date20230522143227 extends SimpleMigrationStep { |
37 | 37 | |
38 | - public function __construct( |
|
39 | - private IDBConnection $connection, |
|
40 | - private ICrypto $crypto, |
|
41 | - ) { |
|
42 | - } |
|
38 | + public function __construct( |
|
39 | + private IDBConnection $connection, |
|
40 | + private ICrypto $crypto, |
|
41 | + ) { |
|
42 | + } |
|
43 | 43 | |
44 | - public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { |
|
45 | - /** @var ISchemaWrapper $schema */ |
|
46 | - $schema = $schemaClosure(); |
|
44 | + public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { |
|
45 | + /** @var ISchemaWrapper $schema */ |
|
46 | + $schema = $schemaClosure(); |
|
47 | 47 | |
48 | - if ($schema->hasTable('oauth2_clients')) { |
|
49 | - $table = $schema->getTable('oauth2_clients'); |
|
50 | - if ($table->hasColumn('secret')) { |
|
51 | - $column = $table->getColumn('secret'); |
|
52 | - $column->setLength(512); |
|
53 | - return $schema; |
|
54 | - } |
|
55 | - } |
|
48 | + if ($schema->hasTable('oauth2_clients')) { |
|
49 | + $table = $schema->getTable('oauth2_clients'); |
|
50 | + if ($table->hasColumn('secret')) { |
|
51 | + $column = $table->getColumn('secret'); |
|
52 | + $column->setLength(512); |
|
53 | + return $schema; |
|
54 | + } |
|
55 | + } |
|
56 | 56 | |
57 | - return null; |
|
58 | - } |
|
57 | + return null; |
|
58 | + } |
|
59 | 59 | |
60 | - public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options) { |
|
61 | - $qbUpdate = $this->connection->getQueryBuilder(); |
|
62 | - $qbUpdate->update('oauth2_clients') |
|
63 | - ->set('secret', $qbUpdate->createParameter('updateSecret')) |
|
64 | - ->where( |
|
65 | - $qbUpdate->expr()->eq('id', $qbUpdate->createParameter('updateId')) |
|
66 | - ); |
|
60 | + public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options) { |
|
61 | + $qbUpdate = $this->connection->getQueryBuilder(); |
|
62 | + $qbUpdate->update('oauth2_clients') |
|
63 | + ->set('secret', $qbUpdate->createParameter('updateSecret')) |
|
64 | + ->where( |
|
65 | + $qbUpdate->expr()->eq('id', $qbUpdate->createParameter('updateId')) |
|
66 | + ); |
|
67 | 67 | |
68 | - $qbSelect = $this->connection->getQueryBuilder(); |
|
69 | - $qbSelect->select('id', 'secret') |
|
70 | - ->from('oauth2_clients'); |
|
71 | - $req = $qbSelect->executeQuery(); |
|
72 | - while ($row = $req->fetch()) { |
|
73 | - $id = $row['id']; |
|
74 | - $secret = $row['secret']; |
|
75 | - $encryptedSecret = $this->crypto->encrypt($secret); |
|
76 | - $qbUpdate->setParameter('updateSecret', $encryptedSecret, IQueryBuilder::PARAM_STR); |
|
77 | - $qbUpdate->setParameter('updateId', $id, IQueryBuilder::PARAM_INT); |
|
78 | - $qbUpdate->executeStatement(); |
|
79 | - } |
|
80 | - $req->closeCursor(); |
|
81 | - } |
|
68 | + $qbSelect = $this->connection->getQueryBuilder(); |
|
69 | + $qbSelect->select('id', 'secret') |
|
70 | + ->from('oauth2_clients'); |
|
71 | + $req = $qbSelect->executeQuery(); |
|
72 | + while ($row = $req->fetch()) { |
|
73 | + $id = $row['id']; |
|
74 | + $secret = $row['secret']; |
|
75 | + $encryptedSecret = $this->crypto->encrypt($secret); |
|
76 | + $qbUpdate->setParameter('updateSecret', $encryptedSecret, IQueryBuilder::PARAM_STR); |
|
77 | + $qbUpdate->setParameter('updateId', $id, IQueryBuilder::PARAM_INT); |
|
78 | + $qbUpdate->executeStatement(); |
|
79 | + } |
|
80 | + $req->closeCursor(); |
|
81 | + } |
|
82 | 82 | } |
@@ -32,25 +32,25 @@ |
||
32 | 32 | |
33 | 33 | class Version011602Date20230613160650 extends SimpleMigrationStep { |
34 | 34 | |
35 | - public function __construct( |
|
36 | - ) { |
|
37 | - } |
|
38 | - |
|
39 | - public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { |
|
40 | - /** @var ISchemaWrapper $schema */ |
|
41 | - $schema = $schemaClosure(); |
|
42 | - |
|
43 | - if ($schema->hasTable('oauth2_clients')) { |
|
44 | - $table = $schema->getTable('oauth2_clients'); |
|
45 | - if ($table->hasColumn('secret')) { |
|
46 | - $column = $table->getColumn('secret'); |
|
47 | - // we still change the column length in case Version011601Date20230522143227 |
|
48 | - // has run before it was changed to set the length to 512 |
|
49 | - $column->setLength(512); |
|
50 | - return $schema; |
|
51 | - } |
|
52 | - } |
|
53 | - |
|
54 | - return null; |
|
55 | - } |
|
35 | + public function __construct( |
|
36 | + ) { |
|
37 | + } |
|
38 | + |
|
39 | + public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { |
|
40 | + /** @var ISchemaWrapper $schema */ |
|
41 | + $schema = $schemaClosure(); |
|
42 | + |
|
43 | + if ($schema->hasTable('oauth2_clients')) { |
|
44 | + $table = $schema->getTable('oauth2_clients'); |
|
45 | + if ($table->hasColumn('secret')) { |
|
46 | + $column = $table->getColumn('secret'); |
|
47 | + // we still change the column length in case Version011601Date20230522143227 |
|
48 | + // has run before it was changed to set the length to 512 |
|
49 | + $column->setLength(512); |
|
50 | + return $schema; |
|
51 | + } |
|
52 | + } |
|
53 | + |
|
54 | + return null; |
|
55 | + } |
|
56 | 56 | } |
@@ -31,51 +31,51 @@ |
||
31 | 31 | * @since 28.0.0 |
32 | 32 | */ |
33 | 33 | class BeforeMessageLoggedEvent extends Event { |
34 | - private int $level; |
|
35 | - private string $app; |
|
36 | - private $message; |
|
34 | + private int $level; |
|
35 | + private string $app; |
|
36 | + private $message; |
|
37 | 37 | |
38 | - /** |
|
39 | - * @param string $app |
|
40 | - * @param int $level |
|
41 | - * @param array $message |
|
42 | - * @since 28.0.0 |
|
43 | - */ |
|
44 | - public function __construct(string $app, int $level, array $message) { |
|
45 | - $this->level = $level; |
|
46 | - $this->app = $app; |
|
47 | - $this->message = $message; |
|
48 | - } |
|
38 | + /** |
|
39 | + * @param string $app |
|
40 | + * @param int $level |
|
41 | + * @param array $message |
|
42 | + * @since 28.0.0 |
|
43 | + */ |
|
44 | + public function __construct(string $app, int $level, array $message) { |
|
45 | + $this->level = $level; |
|
46 | + $this->app = $app; |
|
47 | + $this->message = $message; |
|
48 | + } |
|
49 | 49 | |
50 | - /** |
|
51 | - * Get the level of the log item |
|
52 | - * |
|
53 | - * @return int |
|
54 | - * @since 28.0.0 |
|
55 | - */ |
|
56 | - public function getLevel(): int { |
|
57 | - return $this->level; |
|
58 | - } |
|
50 | + /** |
|
51 | + * Get the level of the log item |
|
52 | + * |
|
53 | + * @return int |
|
54 | + * @since 28.0.0 |
|
55 | + */ |
|
56 | + public function getLevel(): int { |
|
57 | + return $this->level; |
|
58 | + } |
|
59 | 59 | |
60 | 60 | |
61 | - /** |
|
62 | - * Get the app context of the log item |
|
63 | - * |
|
64 | - * @return string |
|
65 | - * @since 28.0.0 |
|
66 | - */ |
|
67 | - public function getApp(): string { |
|
68 | - return $this->app; |
|
69 | - } |
|
61 | + /** |
|
62 | + * Get the app context of the log item |
|
63 | + * |
|
64 | + * @return string |
|
65 | + * @since 28.0.0 |
|
66 | + */ |
|
67 | + public function getApp(): string { |
|
68 | + return $this->app; |
|
69 | + } |
|
70 | 70 | |
71 | 71 | |
72 | - /** |
|
73 | - * Get the message of the log item |
|
74 | - * |
|
75 | - * @return array |
|
76 | - * @since 28.0.0 |
|
77 | - */ |
|
78 | - public function getMessage(): array { |
|
79 | - return $this->message; |
|
80 | - } |
|
72 | + /** |
|
73 | + * Get the message of the log item |
|
74 | + * |
|
75 | + * @return array |
|
76 | + * @since 28.0.0 |
|
77 | + */ |
|
78 | + public function getMessage(): array { |
|
79 | + return $this->message; |
|
80 | + } |
|
81 | 81 | } |
@@ -32,50 +32,50 @@ |
||
32 | 32 | use Symfony\Component\Console\Output\OutputInterface; |
33 | 33 | |
34 | 34 | class Disable extends Base { |
35 | - public function __construct( |
|
36 | - protected IUserManager $userManager, |
|
37 | - ) { |
|
38 | - parent::__construct(); |
|
39 | - } |
|
35 | + public function __construct( |
|
36 | + protected IUserManager $userManager, |
|
37 | + ) { |
|
38 | + parent::__construct(); |
|
39 | + } |
|
40 | 40 | |
41 | - protected function configure() { |
|
42 | - $this |
|
43 | - ->setName('user:disable') |
|
44 | - ->setDescription('disables the specified user') |
|
45 | - ->addArgument( |
|
46 | - 'uid', |
|
47 | - InputArgument::REQUIRED, |
|
48 | - 'the username' |
|
49 | - ); |
|
50 | - } |
|
41 | + protected function configure() { |
|
42 | + $this |
|
43 | + ->setName('user:disable') |
|
44 | + ->setDescription('disables the specified user') |
|
45 | + ->addArgument( |
|
46 | + 'uid', |
|
47 | + InputArgument::REQUIRED, |
|
48 | + 'the username' |
|
49 | + ); |
|
50 | + } |
|
51 | 51 | |
52 | - protected function execute(InputInterface $input, OutputInterface $output): int { |
|
53 | - $user = $this->userManager->get($input->getArgument('uid')); |
|
54 | - if (is_null($user)) { |
|
55 | - $output->writeln('<error>User does not exist</error>'); |
|
56 | - return 1; |
|
57 | - } |
|
52 | + protected function execute(InputInterface $input, OutputInterface $output): int { |
|
53 | + $user = $this->userManager->get($input->getArgument('uid')); |
|
54 | + if (is_null($user)) { |
|
55 | + $output->writeln('<error>User does not exist</error>'); |
|
56 | + return 1; |
|
57 | + } |
|
58 | 58 | |
59 | - $user->setEnabled(false); |
|
60 | - $output->writeln('<info>The specified user is disabled</info>'); |
|
61 | - return 0; |
|
62 | - } |
|
59 | + $user->setEnabled(false); |
|
60 | + $output->writeln('<info>The specified user is disabled</info>'); |
|
61 | + return 0; |
|
62 | + } |
|
63 | 63 | |
64 | - /** |
|
65 | - * @param string $argumentName |
|
66 | - * @param CompletionContext $context |
|
67 | - * @return string[] |
|
68 | - */ |
|
69 | - public function completeArgumentValues($argumentName, CompletionContext $context) { |
|
70 | - if ($argumentName === 'uid') { |
|
71 | - return array_map( |
|
72 | - static fn (IUser $user) => $user->getUID(), |
|
73 | - array_filter( |
|
74 | - $this->userManager->search($context->getCurrentWord()), |
|
75 | - static fn (IUser $user) => $user->isEnabled() |
|
76 | - ) |
|
77 | - ); |
|
78 | - } |
|
79 | - return []; |
|
80 | - } |
|
64 | + /** |
|
65 | + * @param string $argumentName |
|
66 | + * @param CompletionContext $context |
|
67 | + * @return string[] |
|
68 | + */ |
|
69 | + public function completeArgumentValues($argumentName, CompletionContext $context) { |
|
70 | + if ($argumentName === 'uid') { |
|
71 | + return array_map( |
|
72 | + static fn (IUser $user) => $user->getUID(), |
|
73 | + array_filter( |
|
74 | + $this->userManager->search($context->getCurrentWord()), |
|
75 | + static fn (IUser $user) => $user->isEnabled() |
|
76 | + ) |
|
77 | + ); |
|
78 | + } |
|
79 | + return []; |
|
80 | + } |
|
81 | 81 | } |