diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2019-10-11 08:33:09 +0200 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2019-10-11 08:33:09 +0200 |
commit | 543190f8b3228b994ba897c9a43fdc3f61adf663 (patch) | |
tree | 650022215976952462cef64f59c25e86fa20a006 /apps | |
parent | f6a79338d4ea66f9c341d004951b606b5310b478 (diff) | |
download | nextcloud-server-543190f8b3228b994ba897c9a43fdc3f61adf663.tar.gz nextcloud-server-543190f8b3228b994ba897c9a43fdc3f61adf663.zip |
Do not create Application instances directly
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'apps')
-rw-r--r-- | apps/dav/appinfo/app.php | 3 | ||||
-rw-r--r-- | apps/encryption/appinfo/app.php | 3 | ||||
-rw-r--r-- | apps/encryption/appinfo/routes.php | 4 | ||||
-rw-r--r-- | apps/federation/appinfo/app.php | 3 | ||||
-rw-r--r-- | apps/files/appinfo/routes.php | 3 | ||||
-rw-r--r-- | apps/files_trashbin/appinfo/routes.php | 3 | ||||
-rw-r--r-- | apps/files_trashbin/lib/BackgroundJob/ExpireTrash.php | 3 | ||||
-rw-r--r-- | apps/files_trashbin/lib/Trashbin.php | 9 | ||||
-rw-r--r-- | apps/files_versions/appinfo/routes.php | 3 | ||||
-rw-r--r-- | apps/files_versions/lib/Storage.php | 4 | ||||
-rw-r--r-- | apps/provisioning_api/lib/FederatedFileSharingFactory.php | 12 | ||||
-rw-r--r-- | apps/settings/appinfo/routes.php | 3 | ||||
-rw-r--r-- | apps/settings/lib/Settings/Personal/PersonalInfo.php | 2 |
13 files changed, 39 insertions, 16 deletions
diff --git a/apps/dav/appinfo/app.php b/apps/dav/appinfo/app.php index dd9e0e9c096..a1a2377fb3b 100644 --- a/apps/dav/appinfo/app.php +++ b/apps/dav/appinfo/app.php @@ -29,7 +29,8 @@ use Symfony\Component\EventDispatcher\GenericEvent; \OC_App::loadApps(['dav']); -$app = new Application(); +/** @var Application $app */ +$app = \OC::$server->query(Application::class); $app->registerHooks(); \OC::$server->registerService('CardDAVSyncService', function() use ($app) { diff --git a/apps/encryption/appinfo/app.php b/apps/encryption/appinfo/app.php index a39464e21f8..97d7e8f7488 100644 --- a/apps/encryption/appinfo/app.php +++ b/apps/encryption/appinfo/app.php @@ -28,7 +28,8 @@ namespace OCA\Encryption\AppInfo; $encryptionSystemReady = \OC::$server->getEncryptionManager()->isReady(); -$app = new Application(); +/** @var Application $app */ +$app = \OC::$server->query(Application::class); if ($encryptionSystemReady) { $app->registerEncryptionModule(); $app->registerHooks(); diff --git a/apps/encryption/appinfo/routes.php b/apps/encryption/appinfo/routes.php index 22f3af7fbfb..4c01dd57ad3 100644 --- a/apps/encryption/appinfo/routes.php +++ b/apps/encryption/appinfo/routes.php @@ -24,7 +24,9 @@ namespace OCA\Encryption\AppInfo; -(new Application())->registerRoutes($this, array('routes' => array( +/** @var Application $app */ +$app = \OC::$server->query(Application::class); +$app->registerRoutes($this, array('routes' => array( [ 'name' => 'Recovery#adminRecovery', diff --git a/apps/federation/appinfo/app.php b/apps/federation/appinfo/app.php index 6c53810dd2c..23be2dd2124 100644 --- a/apps/federation/appinfo/app.php +++ b/apps/federation/appinfo/app.php @@ -22,5 +22,6 @@ namespace OCA\Federation\AppInfo; -$app = new Application(); +/** @var Application $app */ +$app = \OC::$server->query(Application::class); $app->registerHooks(); diff --git a/apps/files/appinfo/routes.php b/apps/files/appinfo/routes.php index b085d79b8c8..26fce8d1713 100644 --- a/apps/files/appinfo/routes.php +++ b/apps/files/appinfo/routes.php @@ -29,7 +29,8 @@ declare(strict_types=1); */ namespace OCA\Files\AppInfo; -$application = new Application(); +/** @var Application $application */ +$application = \OC::$server->query(Application::class); $application->registerRoutes( $this, [ diff --git a/apps/files_trashbin/appinfo/routes.php b/apps/files_trashbin/appinfo/routes.php index 20d52adf3f0..8f5530d644c 100644 --- a/apps/files_trashbin/appinfo/routes.php +++ b/apps/files_trashbin/appinfo/routes.php @@ -24,7 +24,8 @@ namespace OCA\Files_Trashbin\AppInfo; -$application = new Application(); +/** @var Application $application */ +$application = \OC::$server->query(Application::class); $application->registerRoutes($this, [ 'routes' => [ [ diff --git a/apps/files_trashbin/lib/BackgroundJob/ExpireTrash.php b/apps/files_trashbin/lib/BackgroundJob/ExpireTrash.php index e19b7ce604f..919317a7b7a 100644 --- a/apps/files_trashbin/lib/BackgroundJob/ExpireTrash.php +++ b/apps/files_trashbin/lib/BackgroundJob/ExpireTrash.php @@ -62,7 +62,8 @@ class ExpireTrash extends \OC\BackgroundJob\TimedJob { } protected function fixDIForJobs() { - $application = new Application(); + /** @var Application $application */ + $application = \OC::$server->query(Application::class); $this->userManager = \OC::$server->getUserManager(); $this->expiration = $application->getContainer()->query('Expiration'); } diff --git a/apps/files_trashbin/lib/Trashbin.php b/apps/files_trashbin/lib/Trashbin.php index a06a5145d99..bb1c9c172ec 100644 --- a/apps/files_trashbin/lib/Trashbin.php +++ b/apps/files_trashbin/lib/Trashbin.php @@ -747,7 +747,8 @@ class Trashbin { */ private static function scheduleExpire($user) { // let the admin disable auto expire - $application = new Application(); + /** @var Application $application */ + $application = \OC::$server->query(Application::class); $expiration = $application->getContainer()->query('Expiration'); if ($expiration->isEnabled()) { \OC::$server->getCommandBus()->push(new Expire($user)); @@ -764,7 +765,8 @@ class Trashbin { * @return int size of deleted files */ protected static function deleteFiles($files, $user, $availableSpace) { - $application = new Application(); + /** @var Application $application */ + $application = \OC::$server->query(Application::class); $expiration = $application->getContainer()->query('Expiration'); $size = 0; @@ -791,7 +793,8 @@ class Trashbin { * @return integer[] size of deleted files and number of deleted files */ public static function deleteExpiredFiles($files, $user) { - $application = new Application(); + /** @var Application $application */ + $application = \OC::$server->query(Application::class); $expiration = $application->getContainer()->query('Expiration'); $size = 0; $count = 0; diff --git a/apps/files_versions/appinfo/routes.php b/apps/files_versions/appinfo/routes.php index 5fe6eaaee14..95722dd7780 100644 --- a/apps/files_versions/appinfo/routes.php +++ b/apps/files_versions/appinfo/routes.php @@ -26,7 +26,8 @@ namespace OCA\Files_Versions\AppInfo; -$application = new Application(); +/** @var Application $application */ +$application = \OC::$server->query(Application::class); $application->registerRoutes($this, [ 'routes' => [ [ diff --git a/apps/files_versions/lib/Storage.php b/apps/files_versions/lib/Storage.php index c42083ff352..168145ffec1 100644 --- a/apps/files_versions/lib/Storage.php +++ b/apps/files_versions/lib/Storage.php @@ -850,8 +850,8 @@ class Storage { * @return Expiration */ protected static function getExpiration(){ - if (is_null(self::$application)) { - self::$application = new Application(); + if (self::$application === null) { + self::$application = \OC::$server->query(Application::class); } return self::$application->getContainer()->query(Expiration::class); } diff --git a/apps/provisioning_api/lib/FederatedFileSharingFactory.php b/apps/provisioning_api/lib/FederatedFileSharingFactory.php index e856b2a9bed..0c7bb7068dd 100644 --- a/apps/provisioning_api/lib/FederatedFileSharingFactory.php +++ b/apps/provisioning_api/lib/FederatedFileSharingFactory.php @@ -25,9 +25,19 @@ declare(strict_types=1); namespace OCA\Provisioning_API; use OCA\FederatedFileSharing\AppInfo\Application; +use OCP\IServerContainer; class FederatedFileSharingFactory { + + /** @var IServerContainer */ + private $serverContainer; + + public function __construct(IServerContainer $serverContainer) { + $this->serverContainer = $serverContainer; + } + public function get(): Application { - return new Application(); + return $this->serverContainer->query(Application::class); } + } diff --git a/apps/settings/appinfo/routes.php b/apps/settings/appinfo/routes.php index b55bea0de68..6e7ee45619b 100644 --- a/apps/settings/appinfo/routes.php +++ b/apps/settings/appinfo/routes.php @@ -38,7 +38,8 @@ namespace OCA\Settings; use OCA\Settings\AppInfo\Application; -$application = new Application(); +/** @var Application $application */ +$application = \OC::$server->query(Application::class); $this->useCollection('root'); $application->registerRoutes($this, [ 'resources' => [ diff --git a/apps/settings/lib/Settings/Personal/PersonalInfo.php b/apps/settings/lib/Settings/Personal/PersonalInfo.php index b0c4d6faf48..1cf81ec9659 100644 --- a/apps/settings/lib/Settings/Personal/PersonalInfo.php +++ b/apps/settings/lib/Settings/Personal/PersonalInfo.php @@ -90,7 +90,7 @@ class PersonalInfo implements ISettings { $federatedFileSharingEnabled = $this->appManager->isEnabledForUser('federatedfilesharing'); $lookupServerUploadEnabled = false; if($federatedFileSharingEnabled) { - $federatedFileSharing = new Application(); + $federatedFileSharing = \OC::$server->query(Application::class); $shareProvider = $federatedFileSharing->getFederatedShareProvider(); $lookupServerUploadEnabled = $shareProvider->isLookupServerUploadEnabled(); } |