summaryrefslogtreecommitdiffstats
path: root/apps/admin_audit
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2021-03-05 14:57:07 +0100
committerRoeland Jago Douma <roeland@famdouma.nl>2021-03-05 14:57:07 +0100
commitf5dc657e941e23a98ef8f040d61149a671bcb5da (patch)
tree6aef34b4a17623fc879b670df0ac7425dc612788 /apps/admin_audit
parent5ec2323f252ad8df25414e6386ab8000f7e3c9cc (diff)
downloadnextcloud-server-f5dc657e941e23a98ef8f040d61149a671bcb5da.tar.gz
nextcloud-server-f5dc657e941e23a98ef8f040d61149a671bcb5da.zip
Move background job to DI
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'apps/admin_audit')
-rw-r--r--apps/admin_audit/lib/BackgroundJobs/Rotate.php15
1 files changed, 10 insertions, 5 deletions
diff --git a/apps/admin_audit/lib/BackgroundJobs/Rotate.php b/apps/admin_audit/lib/BackgroundJobs/Rotate.php
index 4785993bee1..4244a7e4f9e 100644
--- a/apps/admin_audit/lib/BackgroundJobs/Rotate.php
+++ b/apps/admin_audit/lib/BackgroundJobs/Rotate.php
@@ -25,26 +25,31 @@
namespace OCA\AdminAudit\BackgroundJobs;
use OC\BackgroundJob\TimedJob;
+use OCP\IConfig;
use OCP\Log\RotationTrait;
class Rotate extends TimedJob {
use RotationTrait;
- public function __construct() {
+ /** @var IConfig */
+ private $config;
+
+ public function __construct(IConfig $config) {
+ $this->config = $config;
+
$this->setInterval(60 * 60 * 3);
}
protected function run($argument) {
- $config = \OC::$server->getConfig();
- $default = $config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . '/audit.log';
- $this->filePath = $config->getAppValue('admin_audit', 'logfile', $default);
+ $default = $this->config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . '/audit.log';
+ $this->filePath = $this->config->getAppValue('admin_audit', 'logfile', $default);
if ($this->filePath === '') {
// default log file, nothing to do
return;
}
- $this->maxSize = $config->getSystemValue('log_rotate_size', 100 * 1024 * 1024);
+ $this->maxSize = $this->config->getSystemValue('log_rotate_size', 100 * 1024 * 1024);
if ($this->shouldRotateBySize()) {
$this->rotate();