diff options
author | Salvatore Martire <4652631+salmart-dev@users.noreply.github.com> | 2025-06-06 16:28:15 +0200 |
---|---|---|
committer | Côme Chilliet <91878298+come-nc@users.noreply.github.com> | 2025-06-24 09:55:23 +0200 |
commit | 5fef6f1c90bfb2c4a8556f6fc8ba4bb6cffd71e8 (patch) | |
tree | 4b8a4fbb43e74b82665b19e8c1dae7f81312e207 | |
parent | 6bdde907ff39b1f0bc96af758a327f1252ae1c28 (diff) | |
download | nextcloud-server-fix/convert-rotate-to-timedjob.tar.gz nextcloud-server-fix/convert-rotate-to-timedjob.zip |
fix: make rotate logs a TimedJob and run every hourfix/convert-rotate-to-timedjob
Signed-off-by: Salvatore Martire <4652631+salmart-dev@users.noreply.github.com>
-rw-r--r-- | lib/private/Log/Rotate.php | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/private/Log/Rotate.php b/lib/private/Log/Rotate.php index 839c40726b7..ee1593b87ac 100644 --- a/lib/private/Log/Rotate.php +++ b/lib/private/Log/Rotate.php @@ -7,6 +7,8 @@ */ namespace OC\Log; +use OCP\AppFramework\Utility\ITimeFactory; +use OCP\BackgroundJob\TimedJob; use OCP\IConfig; use OCP\Log\RotationTrait; use Psr\Log\LoggerInterface; @@ -17,9 +19,15 @@ use Psr\Log\LoggerInterface; * For more professional log management set the 'logfile' config to a different * location and manage that with your own tools. */ -class Rotate extends \OCP\BackgroundJob\Job { +class Rotate extends TimedJob { use RotationTrait; + public function __construct(ITimeFactory $time) { + parent::__construct($time); + + $this->setInterval(3600); + } + public function run($argument): void { $config = \OCP\Server::get(IConfig::class); $this->filePath = $config->getSystemValueString('logfile', $config->getSystemValueString('datadirectory', \OC::$SERVERROOT . '/data') . '/nextcloud.log'); |