nextcloud /
gallery
| 1 | <?php |
||||
| 2 | /** |
||||
| 3 | * Nextcloud - Gallery |
||||
| 4 | * |
||||
| 5 | * This file is licensed under the Affero General Public License version 3 or |
||||
| 6 | * later. See the COPYING file. |
||||
| 7 | * |
||||
| 8 | * @author Olivier Paroz <[email protected]> |
||||
| 9 | * |
||||
| 10 | * @copyright Olivier Paroz 2017 |
||||
| 11 | */ |
||||
| 12 | |||||
| 13 | namespace OCA\Gallery\AppInfo; |
||||
| 14 | |||||
| 15 | ini_set("gd.jpeg_ignore_warning", true); |
||||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||||
| 16 | |||||
| 17 | require_once __DIR__ . '/../../vendor/autoload.php'; |
||||
| 18 | |||||
| 19 | // A production environment will not have xdebug enabled and |
||||
| 20 | // a development environment should have the dev packages installed |
||||
| 21 | $c3 = __DIR__ . '/../../c3.php'; |
||||
| 22 | if (extension_loaded('xdebug') && file_exists($c3)) { |
||||
| 23 | include_once $c3; |
||||
| 24 | } |
||||
| 25 | |||||
| 26 | use OCP\IContainer; |
||||
|
0 ignored issues
–
show
The type
OCP\IContainer was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||
| 27 | |||||
| 28 | use OCP\AppFramework\App; |
||||
|
0 ignored issues
–
show
The type
OCP\AppFramework\App was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||
| 29 | use OCP\AppFramework\IAppContainer; |
||||
|
0 ignored issues
–
show
The type
OCP\AppFramework\IAppContainer was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||
| 30 | |||||
| 31 | use OCA\Gallery\Config\ConfigParser; |
||||
| 32 | use OCA\Gallery\Controller\PageController; |
||||
| 33 | use OCA\Gallery\Controller\ConfigController; |
||||
| 34 | use OCA\Gallery\Controller\ConfigPublicController; |
||||
| 35 | use OCA\Gallery\Controller\ConfigApiController; |
||||
|
0 ignored issues
–
show
The type
OCA\Gallery\Controller\ConfigApiController was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||
| 36 | use OCA\Gallery\Controller\FilesController; |
||||
| 37 | use OCA\Gallery\Controller\FilesPublicController; |
||||
| 38 | use OCA\Gallery\Controller\FilesApiController; |
||||
|
0 ignored issues
–
show
The type
OCA\Gallery\Controller\FilesApiController was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||
| 39 | use OCA\Gallery\Controller\PreviewController; |
||||
| 40 | use OCA\Gallery\Controller\PreviewPublicController; |
||||
| 41 | use OCA\Gallery\Controller\PreviewApiController; |
||||
|
0 ignored issues
–
show
The type
OCA\Gallery\Controller\PreviewApiController was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||
| 42 | use OCA\Gallery\Environment\Environment; |
||||
| 43 | use OCA\Gallery\Service\SearchFolderService; |
||||
| 44 | use OCA\Gallery\Service\ConfigService; |
||||
| 45 | use OCA\Gallery\Service\SearchMediaService; |
||||
| 46 | use OCA\Gallery\Service\ThumbnailService; |
||||
| 47 | use OCA\Gallery\Service\PreviewService; |
||||
| 48 | use OCA\Gallery\Service\DownloadService; |
||||
| 49 | use OCA\Gallery\Middleware\SharingCheckMiddleware; |
||||
| 50 | use OCA\Gallery\Middleware\EnvCheckMiddleware; |
||||
| 51 | use OCA\Gallery\Utility\EventSource; |
||||
| 52 | |||||
| 53 | use OCA\OcUtility\AppInfo\Application as OcUtility; |
||||
|
0 ignored issues
–
show
The type
OCA\OcUtility\AppInfo\Application was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||
| 54 | use OCP\IL10N; |
||||
|
0 ignored issues
–
show
The type
OCP\IL10N was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||
| 55 | use Symfony\Component\EventDispatcher\EventDispatcherInterface; |
||||
| 56 | |||||
| 57 | /** |
||||
| 58 | * Class Application |
||||
| 59 | * |
||||
| 60 | * @package OCA\Gallery\AppInfo |
||||
| 61 | */ |
||||
| 62 | class Application extends App { |
||||
| 63 | |||||
| 64 | /** |
||||
| 65 | * Constructor |
||||
| 66 | * |
||||
| 67 | * @param array $urlParams |
||||
| 68 | */ |
||||
| 69 | public function __construct(array $urlParams = []) { |
||||
| 70 | parent::__construct('gallery', $urlParams); |
||||
| 71 | |||||
| 72 | $container = $this->getContainer(); |
||||
| 73 | |||||
| 74 | /** |
||||
| 75 | * Controllers |
||||
| 76 | */ |
||||
| 77 | $container->registerService( |
||||
| 78 | 'PageController', function (IContainer $c) { |
||||
| 79 | return new PageController( |
||||
| 80 | $c->query('AppName'), |
||||
| 81 | $c->query('Request'), |
||||
| 82 | $c->query('Environment'), |
||||
| 83 | $c->query('OCP\IURLGenerator'), |
||||
| 84 | $c->query('OCP\IConfig'), |
||||
| 85 | $c->query(EventDispatcherInterface::class), |
||||
| 86 | $c->query(IL10N::class) |
||||
| 87 | ); |
||||
| 88 | } |
||||
| 89 | ); |
||||
| 90 | $container->registerService( |
||||
| 91 | 'ConfigController', function (IContainer $c) { |
||||
| 92 | return new ConfigController( |
||||
| 93 | $c->query('AppName'), |
||||
| 94 | $c->query('Request'), |
||||
| 95 | $c->query('ConfigService'), |
||||
| 96 | $c->query('Logger') |
||||
| 97 | ); |
||||
| 98 | } |
||||
| 99 | ); |
||||
| 100 | $container->registerService( |
||||
| 101 | 'ConfigPublicController', function (IContainer $c) { |
||||
| 102 | return new ConfigPublicController( |
||||
| 103 | $c->query('AppName'), |
||||
| 104 | $c->query('Request'), |
||||
| 105 | $c->query('ConfigService'), |
||||
| 106 | $c->query('Logger') |
||||
| 107 | ); |
||||
| 108 | } |
||||
| 109 | ); |
||||
| 110 | $container->registerService( |
||||
| 111 | 'ConfigApiController', function (IContainer $c) { |
||||
| 112 | return new ConfigApiController( |
||||
| 113 | $c->query('AppName'), |
||||
| 114 | $c->query('Request'), |
||||
| 115 | $c->query('ConfigService'), |
||||
| 116 | $c->query('Logger') |
||||
| 117 | ); |
||||
| 118 | } |
||||
| 119 | ); |
||||
| 120 | $container->registerService( |
||||
| 121 | 'FilesController', function (IContainer $c) { |
||||
| 122 | return new FilesController( |
||||
| 123 | $c->query('AppName'), |
||||
| 124 | $c->query('Request'), |
||||
| 125 | $c->query('OCP\IURLGenerator'), |
||||
| 126 | $c->query('SearchFolderService'), |
||||
| 127 | $c->query('ConfigService'), |
||||
| 128 | $c->query('SearchMediaService'), |
||||
| 129 | $c->query('DownloadService'), |
||||
| 130 | $c->query('Logger') |
||||
| 131 | ); |
||||
| 132 | } |
||||
| 133 | ); |
||||
| 134 | $container->registerService( |
||||
| 135 | 'FilesPublicController', function (IContainer $c) { |
||||
| 136 | return new FilesPublicController( |
||||
| 137 | $c->query('AppName'), |
||||
| 138 | $c->query('Request'), |
||||
| 139 | $c->query('OCP\IURLGenerator'), |
||||
| 140 | $c->query('SearchFolderService'), |
||||
| 141 | $c->query('ConfigService'), |
||||
| 142 | $c->query('SearchMediaService'), |
||||
| 143 | $c->query('DownloadService'), |
||||
| 144 | $c->query('Logger') |
||||
| 145 | ); |
||||
| 146 | } |
||||
| 147 | ); |
||||
| 148 | $container->registerService( |
||||
| 149 | 'FilesApiController', function (IContainer $c) { |
||||
| 150 | return new FilesApiController( |
||||
| 151 | $c->query('AppName'), |
||||
| 152 | $c->query('Request'), |
||||
| 153 | $c->query('OCP\IURLGenerator'), |
||||
| 154 | $c->query('SearchFolderService'), |
||||
| 155 | $c->query('ConfigService'), |
||||
| 156 | $c->query('SearchMediaService'), |
||||
| 157 | $c->query('DownloadService'), |
||||
| 158 | $c->query('Logger') |
||||
| 159 | ); |
||||
| 160 | } |
||||
| 161 | ); |
||||
| 162 | $container->registerService( |
||||
| 163 | 'PreviewController', function (IContainer $c) { |
||||
| 164 | return new PreviewController( |
||||
| 165 | $c->query('AppName'), |
||||
| 166 | $c->query('Request'), |
||||
| 167 | $c->query('OCP\IURLGenerator'), |
||||
| 168 | $c->query('ConfigService'), |
||||
| 169 | $c->query('ThumbnailService'), |
||||
| 170 | $c->query('PreviewService'), |
||||
| 171 | $c->query('DownloadService'), |
||||
| 172 | $c->query('EventSource'), |
||||
| 173 | $c->query('Logger') |
||||
| 174 | ); |
||||
| 175 | } |
||||
| 176 | ); |
||||
| 177 | $container->registerService( |
||||
| 178 | 'PreviewPublicController', function (IContainer $c) { |
||||
| 179 | return new PreviewPublicController( |
||||
| 180 | $c->query('AppName'), |
||||
| 181 | $c->query('Request'), |
||||
| 182 | $c->query('OCP\IURLGenerator'), |
||||
| 183 | $c->query('ConfigService'), |
||||
| 184 | $c->query('ThumbnailService'), |
||||
| 185 | $c->query('PreviewService'), |
||||
| 186 | $c->query('DownloadService'), |
||||
| 187 | $c->query('EventSource'), |
||||
| 188 | $c->query('Logger') |
||||
| 189 | ); |
||||
| 190 | } |
||||
| 191 | ); |
||||
| 192 | $container->registerService( |
||||
| 193 | 'PreviewApiController', function (IContainer $c) { |
||||
| 194 | return new PreviewApiController( |
||||
| 195 | $c->query('AppName'), |
||||
| 196 | $c->query('Request'), |
||||
| 197 | $c->query('OCP\IURLGenerator'), |
||||
| 198 | $c->query('ConfigService'), |
||||
| 199 | $c->query('ThumbnailService'), |
||||
| 200 | $c->query('PreviewService'), |
||||
| 201 | $c->query('DownloadService'), |
||||
| 202 | $c->query('EventSource'), |
||||
| 203 | $c->query('Logger') |
||||
| 204 | ); |
||||
| 205 | } |
||||
| 206 | ); |
||||
| 207 | |||||
| 208 | /** |
||||
| 209 | * Core |
||||
| 210 | */ |
||||
| 211 | $container->registerService( |
||||
| 212 | 'EventSource', function (IAppContainer $c) { |
||||
|
0 ignored issues
–
show
The parameter
$c is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. Loading history...
|
|||||
| 213 | return new EventSource(); |
||||
| 214 | } |
||||
| 215 | ); |
||||
| 216 | $container->registerService( |
||||
| 217 | 'Token', function (IContainer $c) { |
||||
| 218 | return $c->query('Request') |
||||
| 219 | ->getParam('token'); |
||||
| 220 | } |
||||
| 221 | ); |
||||
| 222 | $container->registerService( |
||||
| 223 | 'Session', function (IAppContainer $c) { |
||||
| 224 | return $c->getServer() |
||||
| 225 | ->getSession(); |
||||
| 226 | } |
||||
| 227 | ); |
||||
| 228 | $container->registerService( |
||||
| 229 | 'L10N', function (IAppContainer $c) { |
||||
| 230 | return $c->getServer() |
||||
| 231 | ->getL10N('gallery'); // Keep the same translations |
||||
| 232 | } |
||||
| 233 | ); |
||||
| 234 | $container->registerService( |
||||
| 235 | 'UserFolder', function (IAppContainer $c) { |
||||
| 236 | return $c->getServer() |
||||
| 237 | ->getUserFolder($c->query('UserId')); |
||||
| 238 | } |
||||
| 239 | ); |
||||
| 240 | |||||
| 241 | /** |
||||
| 242 | * OCA |
||||
| 243 | */ |
||||
| 244 | $container->registerService( |
||||
| 245 | 'ConfigParser', function () { |
||||
| 246 | return new ConfigParser(); |
||||
| 247 | } |
||||
| 248 | ); |
||||
| 249 | $container->registerService( |
||||
| 250 | 'Environment', function (IContainer $c) { |
||||
| 251 | return new Environment( |
||||
| 252 | $c->query('AppName'), |
||||
| 253 | $c->query('UserId'), |
||||
| 254 | $c->query('UserFolder'), |
||||
| 255 | $c->query('OCP\IUserManager'), |
||||
| 256 | $c->query('OCP\Files\IRootFolder'), |
||||
| 257 | $c->query('Logger') |
||||
| 258 | ); |
||||
| 259 | } |
||||
| 260 | ); |
||||
| 261 | /*// The same thing as above, but in OC9, hopefully. See https://github.com/owncloud/core/issues/12676 |
||||
| 262 | $container->registerService( |
||||
| 263 | 'Environment', function (IAppContainer $c) { |
||||
| 264 | $token = $c->query('Token'); |
||||
| 265 | |||||
| 266 | return $c |
||||
| 267 | ->getServer() |
||||
| 268 | ->getEnvironment($token); |
||||
| 269 | } |
||||
| 270 | );*/ |
||||
| 271 | /** |
||||
| 272 | * OCA External |
||||
| 273 | */ |
||||
| 274 | if (\OCP\App::isEnabled('ocutility')) { |
||||
|
0 ignored issues
–
show
The type
OCP\App was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||
| 275 | // @codeCoverageIgnoreStart |
||||
| 276 | $container->registerService( |
||||
| 277 | 'UtilityContainer', function () { |
||||
| 278 | $app = new OcUtility(); |
||||
| 279 | |||||
| 280 | return $app->getContainer(); |
||||
| 281 | } |
||||
| 282 | ); |
||||
| 283 | $container->registerService( |
||||
| 284 | 'Helper', function (IContainer $c) { |
||||
| 285 | return $c->query('UtilityContainer') |
||||
| 286 | ->query('OCA\OcUtility\Service\Helper'); |
||||
| 287 | } |
||||
| 288 | ); |
||||
| 289 | } else { |
||||
| 290 | // @codeCoverageIgnoreEnd |
||||
| 291 | $container->registerService( |
||||
| 292 | 'Logger', function (IContainer $c) { |
||||
| 293 | return $c->query('OCP\ILogger'); |
||||
| 294 | } |
||||
| 295 | ); |
||||
| 296 | } |
||||
| 297 | /** |
||||
| 298 | * Services |
||||
| 299 | */ |
||||
| 300 | $container->registerService( |
||||
| 301 | 'SearchFolderService', function (IContainer $c) { |
||||
| 302 | return new SearchFolderService( |
||||
| 303 | $c->query('AppName'), |
||||
| 304 | $c->query('Environment'), |
||||
| 305 | $c->query('Logger') |
||||
| 306 | ); |
||||
| 307 | } |
||||
| 308 | ); |
||||
| 309 | $container->registerService( |
||||
| 310 | 'ConfigService', function (IContainer $c) { |
||||
| 311 | return new ConfigService( |
||||
| 312 | $c->query('AppName'), |
||||
| 313 | $c->query('Environment'), |
||||
| 314 | $c->query('ConfigParser'), |
||||
| 315 | $c->query('OCP\IPreview'), |
||||
| 316 | $c->query('Logger') |
||||
| 317 | ); |
||||
| 318 | } |
||||
| 319 | ); |
||||
| 320 | $container->registerService( |
||||
| 321 | 'SearchMediaService', function (IContainer $c) { |
||||
| 322 | return new SearchMediaService( |
||||
| 323 | $c->query('AppName'), |
||||
| 324 | $c->query('Environment'), |
||||
| 325 | $c->query('Logger') |
||||
| 326 | ); |
||||
| 327 | } |
||||
| 328 | ); |
||||
| 329 | $container->registerService( |
||||
| 330 | 'ThumbnailService', function () { |
||||
| 331 | return new ThumbnailService(); |
||||
| 332 | } |
||||
| 333 | ); |
||||
| 334 | $container->registerService( |
||||
| 335 | 'PreviewService', function (IContainer $c) { |
||||
| 336 | return new PreviewService( |
||||
| 337 | $c->query('AppName'), |
||||
| 338 | $c->query('Environment'), |
||||
| 339 | $c->query('OCP\IPreview'), |
||||
| 340 | $c->query('Logger') |
||||
| 341 | ); |
||||
| 342 | } |
||||
| 343 | ); |
||||
| 344 | $container->registerService( |
||||
| 345 | 'DownloadService', function (IContainer $c) { |
||||
| 346 | return new DownloadService( |
||||
| 347 | $c->query('AppName'), |
||||
| 348 | $c->query('Environment'), |
||||
| 349 | $c->query('Logger') |
||||
| 350 | ); |
||||
| 351 | } |
||||
| 352 | ); |
||||
| 353 | |||||
| 354 | /** |
||||
| 355 | * Middleware |
||||
| 356 | */ |
||||
| 357 | $container->registerService( |
||||
| 358 | 'SharingCheckMiddleware', |
||||
| 359 | function (IAppContainer $c) { |
||||
| 360 | return new SharingCheckMiddleware( |
||||
| 361 | $c->query('AppName'), |
||||
| 362 | $c->query('Request'), |
||||
| 363 | $c->query('OCP\IConfig'), |
||||
| 364 | $c->query('OCP\AppFramework\Utility\IControllerMethodReflector'), |
||||
| 365 | $c->query('OCP\IURLGenerator'), |
||||
| 366 | $c->query('Logger') |
||||
| 367 | ); |
||||
| 368 | } |
||||
| 369 | ); |
||||
| 370 | $container->registerService( |
||||
| 371 | 'EnvCheckMiddleware', |
||||
| 372 | function (IContainer $c) { |
||||
| 373 | return new EnvCheckMiddleware( |
||||
| 374 | $c->query('AppName'), |
||||
| 375 | $c->query('Request'), |
||||
| 376 | $c->query('OCP\Security\IHasher'), |
||||
| 377 | $c->query('Session'), |
||||
| 378 | $c->query('Environment'), |
||||
| 379 | $c->query('OCP\AppFramework\Utility\IControllerMethodReflector'), |
||||
| 380 | $c->query('OCP\IURLGenerator'), |
||||
| 381 | $c->query('OCP\Share\IManager'), |
||||
| 382 | $c->query('Logger') |
||||
| 383 | ); |
||||
| 384 | } |
||||
| 385 | ); |
||||
| 386 | |||||
| 387 | // Executed in the order that it is registered |
||||
| 388 | $container->registerMiddleware('SharingCheckMiddleware'); |
||||
| 389 | $container->registerMiddleware('EnvCheckMiddleware'); |
||||
| 390 | } |
||||
| 391 | |||||
| 392 | } |
||||
| 393 |