Skip to content

Commit

Permalink
Cleanup tempfiles after each cron job run
Browse files Browse the repository at this point in the history
Signed-off-by: Julius Härtl <jus@bitgrid.net>
  • Loading branch information
juliusknorr committed May 30, 2022
1 parent 7140201 commit c8a6dad
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cron.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,14 @@

$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');
Expand Down Expand Up @@ -149,8 +150,10 @@

$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;
Expand Down

0 comments on commit c8a6dad

Please sign in to comment.