@@ -32,19 +32,19 @@ |
||
32 | 32 | |
33 | 33 | class UpdateHtaccess extends Command { |
34 | 34 | |
35 | - protected function configure() { |
|
36 | - $this |
|
37 | - ->setName('maintenance:update:htaccess') |
|
38 | - ->setDescription('Updates the .htaccess file'); |
|
39 | - } |
|
35 | + protected function configure() { |
|
36 | + $this |
|
37 | + ->setName('maintenance:update:htaccess') |
|
38 | + ->setDescription('Updates the .htaccess file'); |
|
39 | + } |
|
40 | 40 | |
41 | - protected function execute(InputInterface $input, OutputInterface $output) { |
|
42 | - if (\OC\Setup::updateHtaccess()) { |
|
43 | - $output->writeln('.htaccess has been updated'); |
|
44 | - return 0; |
|
45 | - } else { |
|
46 | - $output->writeln('<error>Error updating .htaccess file, not enough permissions or "overwrite.cli.url" set to an invalid URL?</error>'); |
|
47 | - return 1; |
|
48 | - } |
|
49 | - } |
|
41 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
42 | + if (\OC\Setup::updateHtaccess()) { |
|
43 | + $output->writeln('.htaccess has been updated'); |
|
44 | + return 0; |
|
45 | + } else { |
|
46 | + $output->writeln('<error>Error updating .htaccess file, not enough permissions or "overwrite.cli.url" set to an invalid URL?</error>'); |
|
47 | + return 1; |
|
48 | + } |
|
49 | + } |
|
50 | 50 | } |
@@ -29,164 +29,164 @@ |
||
29 | 29 | * @since 8.1.0 |
30 | 30 | */ |
31 | 31 | interface IImage { |
32 | - /** |
|
33 | - * Determine whether the object contains an image resource. |
|
34 | - * |
|
35 | - * @return bool |
|
36 | - * @since 8.1.0 |
|
37 | - */ |
|
38 | - public function valid(); |
|
39 | - |
|
40 | - /** |
|
41 | - * Returns the MIME type of the image or an empty string if no image is loaded. |
|
42 | - * |
|
43 | - * @return string |
|
44 | - * @since 8.1.0 |
|
45 | - */ |
|
46 | - public function mimeType(); |
|
47 | - |
|
48 | - /** |
|
49 | - * Returns the width of the image or -1 if no image is loaded. |
|
50 | - * |
|
51 | - * @return int |
|
52 | - * @since 8.1.0 |
|
53 | - */ |
|
54 | - public function width(); |
|
55 | - |
|
56 | - /** |
|
57 | - * Returns the height of the image or -1 if no image is loaded. |
|
58 | - * |
|
59 | - * @return int |
|
60 | - * @since 8.1.0 |
|
61 | - */ |
|
62 | - public function height(); |
|
63 | - |
|
64 | - /** |
|
65 | - * Returns the width when the image orientation is top-left. |
|
66 | - * |
|
67 | - * @return int |
|
68 | - * @since 8.1.0 |
|
69 | - */ |
|
70 | - public function widthTopLeft(); |
|
71 | - |
|
72 | - /** |
|
73 | - * Returns the height when the image orientation is top-left. |
|
74 | - * |
|
75 | - * @return int |
|
76 | - * @since 8.1.0 |
|
77 | - */ |
|
78 | - public function heightTopLeft(); |
|
79 | - |
|
80 | - /** |
|
81 | - * Outputs the image. |
|
82 | - * |
|
83 | - * @param string $mimeType |
|
84 | - * @return bool |
|
85 | - * @since 8.1.0 |
|
86 | - */ |
|
87 | - public function show($mimeType = null); |
|
88 | - |
|
89 | - /** |
|
90 | - * Saves the image. |
|
91 | - * |
|
92 | - * @param string $filePath |
|
93 | - * @param string $mimeType |
|
94 | - * @return bool |
|
95 | - * @since 8.1.0 |
|
96 | - */ |
|
97 | - public function save($filePath = null, $mimeType = null); |
|
98 | - |
|
99 | - /** |
|
100 | - * @return resource Returns the image resource in any. |
|
101 | - * @since 8.1.0 |
|
102 | - */ |
|
103 | - public function resource(); |
|
104 | - |
|
105 | - /** |
|
106 | - * @return string Returns the raw data mimetype |
|
107 | - * @since 13.0.0 |
|
108 | - */ |
|
109 | - public function dataMimeType(); |
|
110 | - |
|
111 | - /** |
|
112 | - * @return string Returns the raw image data. |
|
113 | - * @since 8.1.0 |
|
114 | - */ |
|
115 | - public function data(); |
|
116 | - |
|
117 | - /** |
|
118 | - * (I'm open for suggestions on better method name ;) |
|
119 | - * Get the orientation based on EXIF data. |
|
120 | - * |
|
121 | - * @return int The orientation or -1 if no EXIF data is available. |
|
122 | - * @since 8.1.0 |
|
123 | - */ |
|
124 | - public function getOrientation(); |
|
125 | - |
|
126 | - /** |
|
127 | - * (I'm open for suggestions on better method name ;) |
|
128 | - * Fixes orientation based on EXIF data. |
|
129 | - * |
|
130 | - * @return bool |
|
131 | - * @since 8.1.0 |
|
132 | - */ |
|
133 | - public function fixOrientation(); |
|
134 | - |
|
135 | - /** |
|
136 | - * Resizes the image preserving ratio. |
|
137 | - * |
|
138 | - * @param integer $maxSize The maximum size of either the width or height. |
|
139 | - * @return bool |
|
140 | - * @since 8.1.0 |
|
141 | - */ |
|
142 | - public function resize($maxSize); |
|
143 | - |
|
144 | - /** |
|
145 | - * @param int $width |
|
146 | - * @param int $height |
|
147 | - * @return bool |
|
148 | - * @since 8.1.0 |
|
149 | - */ |
|
150 | - public function preciseResize(int $width, int $height): bool; |
|
151 | - |
|
152 | - /** |
|
153 | - * Crops the image to the middle square. If the image is already square it just returns. |
|
154 | - * |
|
155 | - * @param int $size maximum size for the result (optional) |
|
156 | - * @return bool for success or failure |
|
157 | - * @since 8.1.0 |
|
158 | - */ |
|
159 | - public function centerCrop($size = 0); |
|
160 | - |
|
161 | - /** |
|
162 | - * Crops the image from point $x$y with dimension $wx$h. |
|
163 | - * |
|
164 | - * @param int $x Horizontal position |
|
165 | - * @param int $y Vertical position |
|
166 | - * @param int $w Width |
|
167 | - * @param int $h Height |
|
168 | - * @return bool for success or failure |
|
169 | - * @since 8.1.0 |
|
170 | - */ |
|
171 | - public function crop(int $x, int $y, int $w, int $h): bool; |
|
172 | - |
|
173 | - /** |
|
174 | - * Resizes the image to fit within a boundary while preserving ratio. |
|
175 | - * |
|
176 | - * @param integer $maxWidth |
|
177 | - * @param integer $maxHeight |
|
178 | - * @return bool |
|
179 | - * @since 8.1.0 |
|
180 | - */ |
|
181 | - public function fitIn($maxWidth, $maxHeight); |
|
182 | - |
|
183 | - /** |
|
184 | - * Shrinks the image to fit within a boundary while preserving ratio. |
|
185 | - * |
|
186 | - * @param integer $maxWidth |
|
187 | - * @param integer $maxHeight |
|
188 | - * @return bool |
|
189 | - * @since 8.1.0 |
|
190 | - */ |
|
191 | - public function scaleDownToFit($maxWidth, $maxHeight); |
|
32 | + /** |
|
33 | + * Determine whether the object contains an image resource. |
|
34 | + * |
|
35 | + * @return bool |
|
36 | + * @since 8.1.0 |
|
37 | + */ |
|
38 | + public function valid(); |
|
39 | + |
|
40 | + /** |
|
41 | + * Returns the MIME type of the image or an empty string if no image is loaded. |
|
42 | + * |
|
43 | + * @return string |
|
44 | + * @since 8.1.0 |
|
45 | + */ |
|
46 | + public function mimeType(); |
|
47 | + |
|
48 | + /** |
|
49 | + * Returns the width of the image or -1 if no image is loaded. |
|
50 | + * |
|
51 | + * @return int |
|
52 | + * @since 8.1.0 |
|
53 | + */ |
|
54 | + public function width(); |
|
55 | + |
|
56 | + /** |
|
57 | + * Returns the height of the image or -1 if no image is loaded. |
|
58 | + * |
|
59 | + * @return int |
|
60 | + * @since 8.1.0 |
|
61 | + */ |
|
62 | + public function height(); |
|
63 | + |
|
64 | + /** |
|
65 | + * Returns the width when the image orientation is top-left. |
|
66 | + * |
|
67 | + * @return int |
|
68 | + * @since 8.1.0 |
|
69 | + */ |
|
70 | + public function widthTopLeft(); |
|
71 | + |
|
72 | + /** |
|
73 | + * Returns the height when the image orientation is top-left. |
|
74 | + * |
|
75 | + * @return int |
|
76 | + * @since 8.1.0 |
|
77 | + */ |
|
78 | + public function heightTopLeft(); |
|
79 | + |
|
80 | + /** |
|
81 | + * Outputs the image. |
|
82 | + * |
|
83 | + * @param string $mimeType |
|
84 | + * @return bool |
|
85 | + * @since 8.1.0 |
|
86 | + */ |
|
87 | + public function show($mimeType = null); |
|
88 | + |
|
89 | + /** |
|
90 | + * Saves the image. |
|
91 | + * |
|
92 | + * @param string $filePath |
|
93 | + * @param string $mimeType |
|
94 | + * @return bool |
|
95 | + * @since 8.1.0 |
|
96 | + */ |
|
97 | + public function save($filePath = null, $mimeType = null); |
|
98 | + |
|
99 | + /** |
|
100 | + * @return resource Returns the image resource in any. |
|
101 | + * @since 8.1.0 |
|
102 | + */ |
|
103 | + public function resource(); |
|
104 | + |
|
105 | + /** |
|
106 | + * @return string Returns the raw data mimetype |
|
107 | + * @since 13.0.0 |
|
108 | + */ |
|
109 | + public function dataMimeType(); |
|
110 | + |
|
111 | + /** |
|
112 | + * @return string Returns the raw image data. |
|
113 | + * @since 8.1.0 |
|
114 | + */ |
|
115 | + public function data(); |
|
116 | + |
|
117 | + /** |
|
118 | + * (I'm open for suggestions on better method name ;) |
|
119 | + * Get the orientation based on EXIF data. |
|
120 | + * |
|
121 | + * @return int The orientation or -1 if no EXIF data is available. |
|
122 | + * @since 8.1.0 |
|
123 | + */ |
|
124 | + public function getOrientation(); |
|
125 | + |
|
126 | + /** |
|
127 | + * (I'm open for suggestions on better method name ;) |
|
128 | + * Fixes orientation based on EXIF data. |
|
129 | + * |
|
130 | + * @return bool |
|
131 | + * @since 8.1.0 |
|
132 | + */ |
|
133 | + public function fixOrientation(); |
|
134 | + |
|
135 | + /** |
|
136 | + * Resizes the image preserving ratio. |
|
137 | + * |
|
138 | + * @param integer $maxSize The maximum size of either the width or height. |
|
139 | + * @return bool |
|
140 | + * @since 8.1.0 |
|
141 | + */ |
|
142 | + public function resize($maxSize); |
|
143 | + |
|
144 | + /** |
|
145 | + * @param int $width |
|
146 | + * @param int $height |
|
147 | + * @return bool |
|
148 | + * @since 8.1.0 |
|
149 | + */ |
|
150 | + public function preciseResize(int $width, int $height): bool; |
|
151 | + |
|
152 | + /** |
|
153 | + * Crops the image to the middle square. If the image is already square it just returns. |
|
154 | + * |
|
155 | + * @param int $size maximum size for the result (optional) |
|
156 | + * @return bool for success or failure |
|
157 | + * @since 8.1.0 |
|
158 | + */ |
|
159 | + public function centerCrop($size = 0); |
|
160 | + |
|
161 | + /** |
|
162 | + * Crops the image from point $x$y with dimension $wx$h. |
|
163 | + * |
|
164 | + * @param int $x Horizontal position |
|
165 | + * @param int $y Vertical position |
|
166 | + * @param int $w Width |
|
167 | + * @param int $h Height |
|
168 | + * @return bool for success or failure |
|
169 | + * @since 8.1.0 |
|
170 | + */ |
|
171 | + public function crop(int $x, int $y, int $w, int $h): bool; |
|
172 | + |
|
173 | + /** |
|
174 | + * Resizes the image to fit within a boundary while preserving ratio. |
|
175 | + * |
|
176 | + * @param integer $maxWidth |
|
177 | + * @param integer $maxHeight |
|
178 | + * @return bool |
|
179 | + * @since 8.1.0 |
|
180 | + */ |
|
181 | + public function fitIn($maxWidth, $maxHeight); |
|
182 | + |
|
183 | + /** |
|
184 | + * Shrinks the image to fit within a boundary while preserving ratio. |
|
185 | + * |
|
186 | + * @param integer $maxWidth |
|
187 | + * @param integer $maxHeight |
|
188 | + * @return bool |
|
189 | + * @since 8.1.0 |
|
190 | + */ |
|
191 | + public function scaleDownToFit($maxWidth, $maxHeight); |
|
192 | 192 | } |
@@ -37,31 +37,31 @@ |
||
37 | 37 | */ |
38 | 38 | interface IAppContainer extends IContainer { |
39 | 39 | |
40 | - /** |
|
41 | - * used to return the appname of the set application |
|
42 | - * @return string the name of your application |
|
43 | - * @since 6.0.0 |
|
44 | - */ |
|
45 | - public function getAppName(); |
|
40 | + /** |
|
41 | + * used to return the appname of the set application |
|
42 | + * @return string the name of your application |
|
43 | + * @since 6.0.0 |
|
44 | + */ |
|
45 | + public function getAppName(); |
|
46 | 46 | |
47 | - /** |
|
48 | - * @return \OCP\IServerContainer |
|
49 | - * @since 6.0.0 |
|
50 | - */ |
|
51 | - public function getServer(); |
|
47 | + /** |
|
48 | + * @return \OCP\IServerContainer |
|
49 | + * @since 6.0.0 |
|
50 | + */ |
|
51 | + public function getServer(); |
|
52 | 52 | |
53 | - /** |
|
54 | - * @param string $middleWare |
|
55 | - * @return boolean |
|
56 | - * @since 6.0.0 |
|
57 | - */ |
|
58 | - public function registerMiddleWare($middleWare); |
|
53 | + /** |
|
54 | + * @param string $middleWare |
|
55 | + * @return boolean |
|
56 | + * @since 6.0.0 |
|
57 | + */ |
|
58 | + public function registerMiddleWare($middleWare); |
|
59 | 59 | |
60 | - /** |
|
61 | - * Register a capability |
|
62 | - * |
|
63 | - * @param string $serviceName e.g. 'OCA\Files\Capabilities' |
|
64 | - * @since 8.2.0 |
|
65 | - */ |
|
66 | - public function registerCapability($serviceName); |
|
60 | + /** |
|
61 | + * Register a capability |
|
62 | + * |
|
63 | + * @param string $serviceName e.g. 'OCA\Files\Capabilities' |
|
64 | + * @since 8.2.0 |
|
65 | + */ |
|
66 | + public function registerCapability($serviceName); |
|
67 | 67 | } |
@@ -25,7 +25,7 @@ |
||
25 | 25 | $config = \OC::$server->getConfig(); |
26 | 26 | $state = $config->getSystemValue('ldapIgnoreNamingRules', 'doSet'); |
27 | 27 | if($state === 'doSet') { |
28 | - \OC::$server->getConfig()->setSystemValue('ldapIgnoreNamingRules', false); |
|
28 | + \OC::$server->getConfig()->setSystemValue('ldapIgnoreNamingRules', false); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | $helper = new \OCA\User_LDAP\Helper($config); |
@@ -33,36 +33,36 @@ |
||
33 | 33 | */ |
34 | 34 | interface ISearch { |
35 | 35 | |
36 | - /** |
|
37 | - * Search all providers for $query |
|
38 | - * @param string $query |
|
39 | - * @param string[] $inApps optionally limit results to the given apps |
|
40 | - * @param int $page pages start at page 1 |
|
41 | - * @param int $size |
|
42 | - * @return array An array of OCP\Search\Result's |
|
43 | - * @since 8.0.0 |
|
44 | - */ |
|
45 | - public function searchPaged($query, array $inApps = array(), $page = 1, $size = 30); |
|
36 | + /** |
|
37 | + * Search all providers for $query |
|
38 | + * @param string $query |
|
39 | + * @param string[] $inApps optionally limit results to the given apps |
|
40 | + * @param int $page pages start at page 1 |
|
41 | + * @param int $size |
|
42 | + * @return array An array of OCP\Search\Result's |
|
43 | + * @since 8.0.0 |
|
44 | + */ |
|
45 | + public function searchPaged($query, array $inApps = array(), $page = 1, $size = 30); |
|
46 | 46 | |
47 | - /** |
|
48 | - * Register a new search provider to search with |
|
49 | - * @param string $class class name of a OCP\Search\Provider |
|
50 | - * @param array $options optional |
|
51 | - * @since 7.0.0 |
|
52 | - */ |
|
53 | - public function registerProvider($class, array $options = array()); |
|
47 | + /** |
|
48 | + * Register a new search provider to search with |
|
49 | + * @param string $class class name of a OCP\Search\Provider |
|
50 | + * @param array $options optional |
|
51 | + * @since 7.0.0 |
|
52 | + */ |
|
53 | + public function registerProvider($class, array $options = array()); |
|
54 | 54 | |
55 | - /** |
|
56 | - * Remove one existing search provider |
|
57 | - * @param string $provider class name of a OCP\Search\Provider |
|
58 | - * @since 7.0.0 |
|
59 | - */ |
|
60 | - public function removeProvider($provider); |
|
55 | + /** |
|
56 | + * Remove one existing search provider |
|
57 | + * @param string $provider class name of a OCP\Search\Provider |
|
58 | + * @since 7.0.0 |
|
59 | + */ |
|
60 | + public function removeProvider($provider); |
|
61 | 61 | |
62 | - /** |
|
63 | - * Remove all registered search providers |
|
64 | - * @since 7.0.0 |
|
65 | - */ |
|
66 | - public function clearProviders(); |
|
62 | + /** |
|
63 | + * Remove all registered search providers |
|
64 | + * @since 7.0.0 |
|
65 | + */ |
|
66 | + public function clearProviders(); |
|
67 | 67 | |
68 | 68 | } |
@@ -34,86 +34,86 @@ |
||
34 | 34 | */ |
35 | 35 | class Search implements ISearch { |
36 | 36 | |
37 | - private $providers = array(); |
|
38 | - private $registeredProviders = array(); |
|
37 | + private $providers = array(); |
|
38 | + private $registeredProviders = array(); |
|
39 | 39 | |
40 | - /** |
|
41 | - * Search all providers for $query |
|
42 | - * @param string $query |
|
43 | - * @param string[] $inApps optionally limit results to the given apps |
|
44 | - * @param int $page pages start at page 1 |
|
45 | - * @param int $size, 0 = all |
|
46 | - * @return array An array of OC\Search\Result's |
|
47 | - */ |
|
48 | - public function searchPaged($query, array $inApps = array(), $page = 1, $size = 30) { |
|
49 | - $this->initProviders(); |
|
50 | - $results = array(); |
|
51 | - foreach($this->providers as $provider) { |
|
52 | - /** @var $provider Provider */ |
|
53 | - if ( ! $provider->providesResultsFor($inApps) ) { |
|
54 | - continue; |
|
55 | - } |
|
56 | - if ($provider instanceof PagedProvider) { |
|
57 | - $results = array_merge($results, $provider->searchPaged($query, $page, $size)); |
|
58 | - } else if ($provider instanceof Provider) { |
|
59 | - $providerResults = $provider->search($query); |
|
60 | - if ($size > 0) { |
|
61 | - $slicedResults = array_slice($providerResults, ($page - 1) * $size, $size); |
|
62 | - $results = array_merge($results, $slicedResults); |
|
63 | - } else { |
|
64 | - $results = array_merge($results, $providerResults); |
|
65 | - } |
|
66 | - } else { |
|
67 | - \OC::$server->getLogger()->warning('Ignoring Unknown search provider', array('provider' => $provider)); |
|
68 | - } |
|
69 | - } |
|
70 | - return $results; |
|
71 | - } |
|
40 | + /** |
|
41 | + * Search all providers for $query |
|
42 | + * @param string $query |
|
43 | + * @param string[] $inApps optionally limit results to the given apps |
|
44 | + * @param int $page pages start at page 1 |
|
45 | + * @param int $size, 0 = all |
|
46 | + * @return array An array of OC\Search\Result's |
|
47 | + */ |
|
48 | + public function searchPaged($query, array $inApps = array(), $page = 1, $size = 30) { |
|
49 | + $this->initProviders(); |
|
50 | + $results = array(); |
|
51 | + foreach($this->providers as $provider) { |
|
52 | + /** @var $provider Provider */ |
|
53 | + if ( ! $provider->providesResultsFor($inApps) ) { |
|
54 | + continue; |
|
55 | + } |
|
56 | + if ($provider instanceof PagedProvider) { |
|
57 | + $results = array_merge($results, $provider->searchPaged($query, $page, $size)); |
|
58 | + } else if ($provider instanceof Provider) { |
|
59 | + $providerResults = $provider->search($query); |
|
60 | + if ($size > 0) { |
|
61 | + $slicedResults = array_slice($providerResults, ($page - 1) * $size, $size); |
|
62 | + $results = array_merge($results, $slicedResults); |
|
63 | + } else { |
|
64 | + $results = array_merge($results, $providerResults); |
|
65 | + } |
|
66 | + } else { |
|
67 | + \OC::$server->getLogger()->warning('Ignoring Unknown search provider', array('provider' => $provider)); |
|
68 | + } |
|
69 | + } |
|
70 | + return $results; |
|
71 | + } |
|
72 | 72 | |
73 | - /** |
|
74 | - * Remove all registered search providers |
|
75 | - */ |
|
76 | - public function clearProviders() { |
|
77 | - $this->providers = array(); |
|
78 | - $this->registeredProviders = array(); |
|
79 | - } |
|
73 | + /** |
|
74 | + * Remove all registered search providers |
|
75 | + */ |
|
76 | + public function clearProviders() { |
|
77 | + $this->providers = array(); |
|
78 | + $this->registeredProviders = array(); |
|
79 | + } |
|
80 | 80 | |
81 | - /** |
|
82 | - * Remove one existing search provider |
|
83 | - * @param string $provider class name of a OC\Search\Provider |
|
84 | - */ |
|
85 | - public function removeProvider($provider) { |
|
86 | - $this->registeredProviders = array_filter( |
|
87 | - $this->registeredProviders, |
|
88 | - function ($element) use ($provider) { |
|
89 | - return ($element['class'] != $provider); |
|
90 | - } |
|
91 | - ); |
|
92 | - // force regeneration of providers on next search |
|
93 | - $this->providers = array(); |
|
94 | - } |
|
81 | + /** |
|
82 | + * Remove one existing search provider |
|
83 | + * @param string $provider class name of a OC\Search\Provider |
|
84 | + */ |
|
85 | + public function removeProvider($provider) { |
|
86 | + $this->registeredProviders = array_filter( |
|
87 | + $this->registeredProviders, |
|
88 | + function ($element) use ($provider) { |
|
89 | + return ($element['class'] != $provider); |
|
90 | + } |
|
91 | + ); |
|
92 | + // force regeneration of providers on next search |
|
93 | + $this->providers = array(); |
|
94 | + } |
|
95 | 95 | |
96 | - /** |
|
97 | - * Register a new search provider to search with |
|
98 | - * @param string $class class name of a OC\Search\Provider |
|
99 | - * @param array $options optional |
|
100 | - */ |
|
101 | - public function registerProvider($class, array $options = array()) { |
|
102 | - $this->registeredProviders[] = array('class' => $class, 'options' => $options); |
|
103 | - } |
|
96 | + /** |
|
97 | + * Register a new search provider to search with |
|
98 | + * @param string $class class name of a OC\Search\Provider |
|
99 | + * @param array $options optional |
|
100 | + */ |
|
101 | + public function registerProvider($class, array $options = array()) { |
|
102 | + $this->registeredProviders[] = array('class' => $class, 'options' => $options); |
|
103 | + } |
|
104 | 104 | |
105 | - /** |
|
106 | - * Create instances of all the registered search providers |
|
107 | - */ |
|
108 | - private function initProviders() { |
|
109 | - if( ! empty($this->providers) ) { |
|
110 | - return; |
|
111 | - } |
|
112 | - foreach($this->registeredProviders as $provider) { |
|
113 | - $class = $provider['class']; |
|
114 | - $options = $provider['options']; |
|
115 | - $this->providers[] = new $class($options); |
|
116 | - } |
|
117 | - } |
|
105 | + /** |
|
106 | + * Create instances of all the registered search providers |
|
107 | + */ |
|
108 | + private function initProviders() { |
|
109 | + if( ! empty($this->providers) ) { |
|
110 | + return; |
|
111 | + } |
|
112 | + foreach($this->registeredProviders as $provider) { |
|
113 | + $class = $provider['class']; |
|
114 | + $options = $provider['options']; |
|
115 | + $this->providers[] = new $class($options); |
|
116 | + } |
|
117 | + } |
|
118 | 118 | |
119 | 119 | } |
@@ -33,26 +33,26 @@ |
||
33 | 33 | * @package OC\Security\RateLimiting\Backend |
34 | 34 | */ |
35 | 35 | interface IBackend { |
36 | - /** |
|
37 | - * Gets the amount of attempts within the last specified seconds |
|
38 | - * |
|
39 | - * @param string $methodIdentifier Identifier for the method |
|
40 | - * @param string $userIdentifier Identifier for the user |
|
41 | - * @param int $seconds Seconds to look back at |
|
42 | - * @return int |
|
43 | - */ |
|
44 | - public function getAttempts(string $methodIdentifier, |
|
45 | - string $userIdentifier, |
|
46 | - int $seconds): int; |
|
36 | + /** |
|
37 | + * Gets the amount of attempts within the last specified seconds |
|
38 | + * |
|
39 | + * @param string $methodIdentifier Identifier for the method |
|
40 | + * @param string $userIdentifier Identifier for the user |
|
41 | + * @param int $seconds Seconds to look back at |
|
42 | + * @return int |
|
43 | + */ |
|
44 | + public function getAttempts(string $methodIdentifier, |
|
45 | + string $userIdentifier, |
|
46 | + int $seconds): int; |
|
47 | 47 | |
48 | - /** |
|
49 | - * Registers an attempt |
|
50 | - * |
|
51 | - * @param string $methodIdentifier Identifier for the method |
|
52 | - * @param string $userIdentifier Identifier for the user |
|
53 | - * @param int $period Period in seconds how long this attempt should be stored |
|
54 | - */ |
|
55 | - public function registerAttempt(string $methodIdentifier, |
|
56 | - string $userIdentifier, |
|
57 | - int $period); |
|
48 | + /** |
|
49 | + * Registers an attempt |
|
50 | + * |
|
51 | + * @param string $methodIdentifier Identifier for the method |
|
52 | + * @param string $userIdentifier Identifier for the user |
|
53 | + * @param int $period Period in seconds how long this attempt should be stored |
|
54 | + */ |
|
55 | + public function registerAttempt(string $methodIdentifier, |
|
56 | + string $userIdentifier, |
|
57 | + int $period); |
|
58 | 58 | } |
@@ -37,98 +37,98 @@ |
||
37 | 37 | * @since 8.0.0 |
38 | 38 | */ |
39 | 39 | class Template extends \OC_Template { |
40 | - /** |
|
41 | - * Make OC_Helper::imagePath available as a simple function |
|
42 | - * |
|
43 | - * @see \OCP\IURLGenerator::imagePath |
|
44 | - * |
|
45 | - * @param string $app |
|
46 | - * @param string $image |
|
47 | - * @return string to the image |
|
48 | - * @since 8.0.0 |
|
49 | - * @suppress PhanDeprecatedFunction |
|
50 | - */ |
|
51 | - public static function image_path($app, $image) { |
|
52 | - return \image_path($app, $image); |
|
53 | - } |
|
40 | + /** |
|
41 | + * Make OC_Helper::imagePath available as a simple function |
|
42 | + * |
|
43 | + * @see \OCP\IURLGenerator::imagePath |
|
44 | + * |
|
45 | + * @param string $app |
|
46 | + * @param string $image |
|
47 | + * @return string to the image |
|
48 | + * @since 8.0.0 |
|
49 | + * @suppress PhanDeprecatedFunction |
|
50 | + */ |
|
51 | + public static function image_path($app, $image) { |
|
52 | + return \image_path($app, $image); |
|
53 | + } |
|
54 | 54 | |
55 | 55 | |
56 | - /** |
|
57 | - * Make OC_Helper::mimetypeIcon available as a simple function |
|
58 | - * |
|
59 | - * @param string $mimetype |
|
60 | - * @return string to the image of this file type. |
|
61 | - * @since 8.0.0 |
|
62 | - * @suppress PhanDeprecatedFunction |
|
63 | - */ |
|
64 | - public static function mimetype_icon($mimetype) { |
|
65 | - return \mimetype_icon($mimetype); |
|
66 | - } |
|
56 | + /** |
|
57 | + * Make OC_Helper::mimetypeIcon available as a simple function |
|
58 | + * |
|
59 | + * @param string $mimetype |
|
60 | + * @return string to the image of this file type. |
|
61 | + * @since 8.0.0 |
|
62 | + * @suppress PhanDeprecatedFunction |
|
63 | + */ |
|
64 | + public static function mimetype_icon($mimetype) { |
|
65 | + return \mimetype_icon($mimetype); |
|
66 | + } |
|
67 | 67 | |
68 | - /** |
|
69 | - * Make preview_icon available as a simple function |
|
70 | - * |
|
71 | - * @param string $path path to file |
|
72 | - * @return string to the preview of the image |
|
73 | - * @since 8.0.0 |
|
74 | - * @suppress PhanDeprecatedFunction |
|
75 | - */ |
|
76 | - public static function preview_icon($path) { |
|
77 | - return \preview_icon($path); |
|
78 | - } |
|
68 | + /** |
|
69 | + * Make preview_icon available as a simple function |
|
70 | + * |
|
71 | + * @param string $path path to file |
|
72 | + * @return string to the preview of the image |
|
73 | + * @since 8.0.0 |
|
74 | + * @suppress PhanDeprecatedFunction |
|
75 | + */ |
|
76 | + public static function preview_icon($path) { |
|
77 | + return \preview_icon($path); |
|
78 | + } |
|
79 | 79 | |
80 | - /** |
|
81 | - * Make publicpreview_icon available as a simple function |
|
82 | - * Returns the path to the preview of the image. |
|
83 | - * |
|
84 | - * @param string $path of file |
|
85 | - * @param string $token |
|
86 | - * @return string link to the preview |
|
87 | - * @since 8.0.0 |
|
88 | - * @suppress PhanDeprecatedFunction |
|
89 | - */ |
|
90 | - public static function publicPreview_icon($path, $token) { |
|
91 | - return \publicPreview_icon($path, $token); |
|
92 | - } |
|
80 | + /** |
|
81 | + * Make publicpreview_icon available as a simple function |
|
82 | + * Returns the path to the preview of the image. |
|
83 | + * |
|
84 | + * @param string $path of file |
|
85 | + * @param string $token |
|
86 | + * @return string link to the preview |
|
87 | + * @since 8.0.0 |
|
88 | + * @suppress PhanDeprecatedFunction |
|
89 | + */ |
|
90 | + public static function publicPreview_icon($path, $token) { |
|
91 | + return \publicPreview_icon($path, $token); |
|
92 | + } |
|
93 | 93 | |
94 | - /** |
|
95 | - * Make OC_Helper::humanFileSize available as a simple function |
|
96 | - * Example: 2048 to 2 kB. |
|
97 | - * |
|
98 | - * @param int $bytes in bytes |
|
99 | - * @return string size as string |
|
100 | - * @since 8.0.0 |
|
101 | - * @suppress PhanDeprecatedFunction |
|
102 | - */ |
|
103 | - public static function human_file_size($bytes) { |
|
104 | - return \human_file_size($bytes); |
|
105 | - } |
|
94 | + /** |
|
95 | + * Make OC_Helper::humanFileSize available as a simple function |
|
96 | + * Example: 2048 to 2 kB. |
|
97 | + * |
|
98 | + * @param int $bytes in bytes |
|
99 | + * @return string size as string |
|
100 | + * @since 8.0.0 |
|
101 | + * @suppress PhanDeprecatedFunction |
|
102 | + */ |
|
103 | + public static function human_file_size($bytes) { |
|
104 | + return \human_file_size($bytes); |
|
105 | + } |
|
106 | 106 | |
107 | - /** |
|
108 | - * Return the relative date in relation to today. Returns something like "last hour" or "two month ago" |
|
109 | - * |
|
110 | - * @param int $timestamp unix timestamp |
|
111 | - * @param boolean $dateOnly |
|
112 | - * @return string human readable interpretation of the timestamp |
|
113 | - * @since 8.0.0 |
|
114 | - * @suppress PhanDeprecatedFunction |
|
115 | - * @suppress PhanTypeMismatchArgument |
|
116 | - */ |
|
117 | - public static function relative_modified_date($timestamp, $dateOnly = false) { |
|
118 | - return \relative_modified_date($timestamp, null, $dateOnly); |
|
119 | - } |
|
107 | + /** |
|
108 | + * Return the relative date in relation to today. Returns something like "last hour" or "two month ago" |
|
109 | + * |
|
110 | + * @param int $timestamp unix timestamp |
|
111 | + * @param boolean $dateOnly |
|
112 | + * @return string human readable interpretation of the timestamp |
|
113 | + * @since 8.0.0 |
|
114 | + * @suppress PhanDeprecatedFunction |
|
115 | + * @suppress PhanTypeMismatchArgument |
|
116 | + */ |
|
117 | + public static function relative_modified_date($timestamp, $dateOnly = false) { |
|
118 | + return \relative_modified_date($timestamp, null, $dateOnly); |
|
119 | + } |
|
120 | 120 | |
121 | - /** |
|
122 | - * Generate html code for an options block. |
|
123 | - * |
|
124 | - * @param array $options the options |
|
125 | - * @param mixed $selected which one is selected? |
|
126 | - * @param array $params the parameters |
|
127 | - * @return string html options |
|
128 | - * @since 8.0.0 |
|
129 | - * @suppress PhanDeprecatedFunction |
|
130 | - */ |
|
131 | - public static function html_select_options($options, $selected, $params=array()) { |
|
132 | - return \html_select_options($options, $selected, $params); |
|
133 | - } |
|
121 | + /** |
|
122 | + * Generate html code for an options block. |
|
123 | + * |
|
124 | + * @param array $options the options |
|
125 | + * @param mixed $selected which one is selected? |
|
126 | + * @param array $params the parameters |
|
127 | + * @return string html options |
|
128 | + * @since 8.0.0 |
|
129 | + * @suppress PhanDeprecatedFunction |
|
130 | + */ |
|
131 | + public static function html_select_options($options, $selected, $params=array()) { |
|
132 | + return \html_select_options($options, $selected, $params); |
|
133 | + } |
|
134 | 134 | } |
@@ -33,31 +33,31 @@ |
||
33 | 33 | * @package OCA\UpdateNotification |
34 | 34 | */ |
35 | 35 | class ResetTokenBackgroundJob extends TimedJob { |
36 | - /** @var IConfig */ |
|
37 | - private $config; |
|
38 | - /** @var ITimeFactory */ |
|
39 | - private $timeFactory; |
|
36 | + /** @var IConfig */ |
|
37 | + private $config; |
|
38 | + /** @var ITimeFactory */ |
|
39 | + private $timeFactory; |
|
40 | 40 | |
41 | - /** |
|
42 | - * @param IConfig $config |
|
43 | - * @param ITimeFactory $timeFactory |
|
44 | - */ |
|
45 | - public function __construct(IConfig $config, |
|
46 | - ITimeFactory $timeFactory) { |
|
47 | - // Run all 10 minutes |
|
48 | - $this->setInterval(60 * 10); |
|
49 | - $this->config = $config; |
|
50 | - $this->timeFactory = $timeFactory; |
|
51 | - } |
|
41 | + /** |
|
42 | + * @param IConfig $config |
|
43 | + * @param ITimeFactory $timeFactory |
|
44 | + */ |
|
45 | + public function __construct(IConfig $config, |
|
46 | + ITimeFactory $timeFactory) { |
|
47 | + // Run all 10 minutes |
|
48 | + $this->setInterval(60 * 10); |
|
49 | + $this->config = $config; |
|
50 | + $this->timeFactory = $timeFactory; |
|
51 | + } |
|
52 | 52 | |
53 | - /** |
|
54 | - * @param $argument |
|
55 | - */ |
|
56 | - protected function run($argument) { |
|
57 | - // Delete old tokens after 2 days |
|
58 | - if($this->timeFactory->getTime() - $this->config->getAppValue('core', 'updater.secret.created', $this->timeFactory->getTime()) >= 172800) { |
|
59 | - $this->config->deleteSystemValue('updater.secret'); |
|
60 | - } |
|
61 | - } |
|
53 | + /** |
|
54 | + * @param $argument |
|
55 | + */ |
|
56 | + protected function run($argument) { |
|
57 | + // Delete old tokens after 2 days |
|
58 | + if($this->timeFactory->getTime() - $this->config->getAppValue('core', 'updater.secret.created', $this->timeFactory->getTime()) >= 172800) { |
|
59 | + $this->config->deleteSystemValue('updater.secret'); |
|
60 | + } |
|
61 | + } |
|
62 | 62 | |
63 | 63 | } |