mirror of
https://github.com/nextcloud/server.git
synced 2026-03-20 01:23:22 -04:00
Merge pull request #53420 from nextcloud/fix/convert-rotate-to-timedjob
fix: make Rotate a TimedJob and run every hour
This commit is contained in:
commit
8ee06edffc
1 changed files with 9 additions and 1 deletions
|
|
@ -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');
|
||||
|
|
|
|||
Loading…
Reference in a new issue