]> source.dussan.org Git - nextcloud-server.git/commitdiff
Cleanup tempfiles after each cron job run 32663/head
authorJulius Härtl <jus@bitgrid.net>
Mon, 30 May 2022 16:01:51 +0000 (18:01 +0200)
committerJulius Härtl <jus@bitgrid.net>
Mon, 30 May 2022 16:01:51 +0000 (18:01 +0200)
Signed-off-by: Julius Härtl <jus@bitgrid.net>
cron.php

index a58ef2c206fb3ac8240e816a9157e98704b19233..7d661621ed090f203ae0ea20f16f57c73c21d626 100644 (file)
--- a/cron.php
+++ b/cron.php
@@ -64,13 +64,14 @@ try {
 
        $logger = \OC::$server->getLogger();
        $config = \OC::$server->getConfig();
+       $tempManager = \OC::$server->getTempManager();
 
        // Don't do anything if Nextcloud has not been installed
        if (!$config->getSystemValue('installed', false)) {
                exit(0);
        }
 
-       \OC::$server->getTempManager()->cleanOld();
+       $tempManager->cleanOld();
 
        // Exit if background jobs are disabled!
        $appMode = $config->getAppValue('core', 'backgroundjobs_mode', 'ajax');
@@ -149,8 +150,10 @@ try {
 
                        $logger->debug('CLI cron call has selected job with ID ' . strval($job->getId()), ['app' => 'cron']);
                        $job->execute($jobList, $logger);
+
                        // clean up after unclean jobs
                        \OC_Util::tearDownFS();
+                       $tempManager->clean();
 
                        $jobList->setLastJob($job);
                        $executedJobs[$job->getId()] = true;