Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2019-10-11 09:33:09 +0300
committerChristoph Wurst <christoph@winzerhof-wurst.at>2019-10-11 09:33:09 +0300
commit543190f8b3228b994ba897c9a43fdc3f61adf663 (patch)
tree650022215976952462cef64f59c25e86fa20a006 /apps/files_trashbin
parentf6a79338d4ea66f9c341d004951b606b5310b478 (diff)
Do not create Application instances directly
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'apps/files_trashbin')
-rw-r--r--apps/files_trashbin/appinfo/routes.php3
-rw-r--r--apps/files_trashbin/lib/BackgroundJob/ExpireTrash.php3
-rw-r--r--apps/files_trashbin/lib/Trashbin.php9
3 files changed, 10 insertions, 5 deletions
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;