@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | // interpolate $message as defined in PSR-3 |
211 | 211 | $replace = []; |
212 | 212 | foreach ($context as $key => $val) { |
213 | - $replace['{' . $key . '}'] = $val; |
|
213 | + $replace['{'.$key.'}'] = $val; |
|
214 | 214 | } |
215 | 215 | $message = strtr($message, $replace); |
216 | 216 | |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | } |
318 | 318 | |
319 | 319 | public function getLogPath():string { |
320 | - if($this->logger instanceof IFileBased) { |
|
320 | + if ($this->logger instanceof IFileBased) { |
|
321 | 321 | return $this->logger->getLogFilePath(); |
322 | 322 | } |
323 | 323 | throw new \RuntimeException('Log implementation has no path'); |
@@ -55,7 +55,7 @@ |
||
55 | 55 | * @return StreamResponse |
56 | 56 | */ |
57 | 57 | public function download() { |
58 | - if(!$this->log instanceof Log) { |
|
58 | + if (!$this->log instanceof Log) { |
|
59 | 59 | throw new \UnexpectedValueException('Log file not available'); |
60 | 60 | } |
61 | 61 | $resp = new StreamResponse($this->log->getLogPath()); |
@@ -39,5 +39,5 @@ |
||
39 | 39 | /** |
40 | 40 | * @since 14.0.0 |
41 | 41 | */ |
42 | - public function getEntries(int $limit=50, int $offset=0): array; |
|
42 | + public function getEntries(int $limit = 50, int $offset = 0): array; |
|
43 | 43 | } |
@@ -37,10 +37,10 @@ |
||
37 | 37 | |
38 | 38 | public function run($dummy) { |
39 | 39 | $systemConfig = \OC::$server->getSystemConfig(); |
40 | - $this->filePath = $systemConfig->getValue('logfile', $systemConfig->getValue('datadirectory', \OC::$SERVERROOT . '/data') . '/nextcloud.log'); |
|
40 | + $this->filePath = $systemConfig->getValue('logfile', $systemConfig->getValue('datadirectory', \OC::$SERVERROOT.'/data').'/nextcloud.log'); |
|
41 | 41 | |
42 | 42 | $this->maxSize = \OC::$server->getConfig()->getSystemValue('log_rotate_size', 100 * 1024 * 1024); |
43 | - if($this->shouldRotateBySize()) { |
|
43 | + if ($this->shouldRotateBySize()) { |
|
44 | 44 | $rotatedFile = $this->rotate(); |
45 | 45 | $msg = 'Log file "'.$this->filePath.'" was over '.$this->maxSize.' bytes, moved to "'.$rotatedFile.'"'; |
46 | 46 | \OC::$server->getLogger()->warning($msg, ['app' => Rotate::class]); |
@@ -59,9 +59,9 @@ |
||
59 | 59 | * @since 14.0.0 |
60 | 60 | */ |
61 | 61 | protected function shouldRotateBySize():bool { |
62 | - if ((int)$this->maxSize > 0) { |
|
62 | + if ((int) $this->maxSize > 0) { |
|
63 | 63 | $filesize = @filesize($this->filePath); |
64 | - if ($filesize >= (int)$this->maxSize) { |
|
64 | + if ($filesize >= (int) $this->maxSize) { |
|
65 | 65 | return true; |
66 | 66 | } |
67 | 67 | } |
@@ -65,9 +65,9 @@ discard block |
||
65 | 65 | $c = $this->getContainer()->getServer(); |
66 | 66 | $config = $c->getConfig(); |
67 | 67 | |
68 | - $default = $config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . '/audit.log'; |
|
68 | + $default = $config->getSystemValue('datadirectory', \OC::$SERVERROOT.'/data').'/audit.log'; |
|
69 | 69 | $logFile = $config->getAppValue('admin_audit', 'logfile', $default); |
70 | - if($logFile === null) { |
|
70 | + if ($logFile === null) { |
|
71 | 71 | $this->logger = $c->getLogger(); |
72 | 72 | return; |
73 | 73 | } |
@@ -102,9 +102,9 @@ discard block |
||
102 | 102 | protected function userManagementHooks() { |
103 | 103 | $userActions = new UserManagement($this->logger); |
104 | 104 | |
105 | - Util::connectHook('OC_User', 'post_createUser', $userActions, 'create'); |
|
106 | - Util::connectHook('OC_User', 'post_deleteUser', $userActions, 'delete'); |
|
107 | - Util::connectHook('OC_User', 'changeUser', $userActions, 'change'); |
|
105 | + Util::connectHook('OC_User', 'post_createUser', $userActions, 'create'); |
|
106 | + Util::connectHook('OC_User', 'post_deleteUser', $userActions, 'delete'); |
|
107 | + Util::connectHook('OC_User', 'changeUser', $userActions, 'change'); |
|
108 | 108 | |
109 | 109 | /** @var IUserSession|Session $userSession */ |
110 | 110 | $userSession = $this->getContainer()->getServer()->getUserSession(); |
@@ -113,15 +113,15 @@ discard block |
||
113 | 113 | $userSession->listen('\OC\User', 'postUnassignedUserId', [$userActions, 'unassign']); |
114 | 114 | } |
115 | 115 | |
116 | - protected function groupHooks() { |
|
116 | + protected function groupHooks() { |
|
117 | 117 | $groupActions = new GroupManagement($this->logger); |
118 | 118 | |
119 | 119 | /** @var IGroupManager|Manager $groupManager */ |
120 | 120 | $groupManager = $this->getContainer()->getServer()->getGroupManager(); |
121 | - $groupManager->listen('\OC\Group', 'postRemoveUser', [$groupActions, 'removeUser']); |
|
122 | - $groupManager->listen('\OC\Group', 'postAddUser', [$groupActions, 'addUser']); |
|
123 | - $groupManager->listen('\OC\Group', 'postDelete', [$groupActions, 'deleteGroup']); |
|
124 | - $groupManager->listen('\OC\Group', 'postCreate', [$groupActions, 'createGroup']); |
|
121 | + $groupManager->listen('\OC\Group', 'postRemoveUser', [$groupActions, 'removeUser']); |
|
122 | + $groupManager->listen('\OC\Group', 'postAddUser', [$groupActions, 'addUser']); |
|
123 | + $groupManager->listen('\OC\Group', 'postDelete', [$groupActions, 'deleteGroup']); |
|
124 | + $groupManager->listen('\OC\Group', 'postCreate', [$groupActions, 'createGroup']); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | protected function sharingHooks() { |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | protected function versionsHooks() { |
235 | 235 | $versionsActions = new Versions($this->logger); |
236 | 236 | Util::connectHook('\OCP\Versions', 'rollback', $versionsActions, 'rollback'); |
237 | - Util::connectHook('\OCP\Versions', 'delete',$versionsActions, 'delete'); |
|
237 | + Util::connectHook('\OCP\Versions', 'delete', $versionsActions, 'delete'); |
|
238 | 238 | } |
239 | 239 | |
240 | 240 | protected function trashbinHooks() { |
@@ -30,22 +30,22 @@ |
||
30 | 30 | use RotationTrait; |
31 | 31 | |
32 | 32 | public function __construct() { |
33 | - $this->setInterval(60*60*3); |
|
33 | + $this->setInterval(60 * 60 * 3); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | protected function run($argument) { |
37 | 37 | $config = \OC::$server->getConfig(); |
38 | - $default = $config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . '/audit.log'; |
|
38 | + $default = $config->getSystemValue('datadirectory', \OC::$SERVERROOT.'/data').'/audit.log'; |
|
39 | 39 | $this->filePath = $config->getAppValue('admin_audit', 'logfile', $default); |
40 | 40 | |
41 | - if($this->filePath === '') { |
|
41 | + if ($this->filePath === '') { |
|
42 | 42 | // default log file, nothing to do |
43 | 43 | return; |
44 | 44 | } |
45 | 45 | |
46 | 46 | $this->maxSize = $config->getSystemValue('log_rotate_size', 100 * 1024 * 1024); |
47 | 47 | |
48 | - if($this->shouldRotateBySize()) { |
|
48 | + if ($this->shouldRotateBySize()) { |
|
49 | 49 | $this->rotate(); |
50 | 50 | } |
51 | 51 | } |
@@ -6,39 +6,39 @@ |
||
6 | 6 | |
7 | 7 | class ComposerStaticInitAdminAudit |
8 | 8 | { |
9 | - public static $prefixLengthsPsr4 = array ( |
|
9 | + public static $prefixLengthsPsr4 = array( |
|
10 | 10 | 'O' => |
11 | - array ( |
|
11 | + array( |
|
12 | 12 | 'OCA\\AdminAudit\\' => 15, |
13 | 13 | ), |
14 | 14 | ); |
15 | 15 | |
16 | - public static $prefixDirsPsr4 = array ( |
|
16 | + public static $prefixDirsPsr4 = array( |
|
17 | 17 | 'OCA\\AdminAudit\\' => |
18 | - array ( |
|
19 | - 0 => __DIR__ . '/..' . '/../lib', |
|
18 | + array( |
|
19 | + 0 => __DIR__.'/..'.'/../lib', |
|
20 | 20 | ), |
21 | 21 | ); |
22 | 22 | |
23 | - public static $classMap = array ( |
|
24 | - 'OCA\\AdminAudit\\Actions\\Action' => __DIR__ . '/..' . '/../lib/Actions/Action.php', |
|
25 | - 'OCA\\AdminAudit\\Actions\\AppManagement' => __DIR__ . '/..' . '/../lib/Actions/AppManagement.php', |
|
26 | - 'OCA\\AdminAudit\\Actions\\Auth' => __DIR__ . '/..' . '/../lib/Actions/Auth.php', |
|
27 | - 'OCA\\AdminAudit\\Actions\\Console' => __DIR__ . '/..' . '/../lib/Actions/Console.php', |
|
28 | - 'OCA\\AdminAudit\\Actions\\Files' => __DIR__ . '/..' . '/../lib/Actions/Files.php', |
|
29 | - 'OCA\\AdminAudit\\Actions\\GroupManagement' => __DIR__ . '/..' . '/../lib/Actions/GroupManagement.php', |
|
30 | - 'OCA\\AdminAudit\\Actions\\Security' => __DIR__ . '/..' . '/../lib/Actions/Security.php', |
|
31 | - 'OCA\\AdminAudit\\Actions\\Sharing' => __DIR__ . '/..' . '/../lib/Actions/Sharing.php', |
|
32 | - 'OCA\\AdminAudit\\Actions\\Trashbin' => __DIR__ . '/..' . '/../lib/Actions/Trashbin.php', |
|
33 | - 'OCA\\AdminAudit\\Actions\\UserManagement' => __DIR__ . '/..' . '/../lib/Actions/UserManagement.php', |
|
34 | - 'OCA\\AdminAudit\\Actions\\Versions' => __DIR__ . '/..' . '/../lib/Actions/Versions.php', |
|
35 | - 'OCA\\AdminAudit\\AppInfo\\Application' => __DIR__ . '/..' . '/../lib/AppInfo/Application.php', |
|
36 | - 'OCA\\AdminAudit\\BackgroundJobs\\Rotate' => __DIR__ . '/..' . '/../lib/BackgroundJobs/Rotate.php', |
|
23 | + public static $classMap = array( |
|
24 | + 'OCA\\AdminAudit\\Actions\\Action' => __DIR__.'/..'.'/../lib/Actions/Action.php', |
|
25 | + 'OCA\\AdminAudit\\Actions\\AppManagement' => __DIR__.'/..'.'/../lib/Actions/AppManagement.php', |
|
26 | + 'OCA\\AdminAudit\\Actions\\Auth' => __DIR__.'/..'.'/../lib/Actions/Auth.php', |
|
27 | + 'OCA\\AdminAudit\\Actions\\Console' => __DIR__.'/..'.'/../lib/Actions/Console.php', |
|
28 | + 'OCA\\AdminAudit\\Actions\\Files' => __DIR__.'/..'.'/../lib/Actions/Files.php', |
|
29 | + 'OCA\\AdminAudit\\Actions\\GroupManagement' => __DIR__.'/..'.'/../lib/Actions/GroupManagement.php', |
|
30 | + 'OCA\\AdminAudit\\Actions\\Security' => __DIR__.'/..'.'/../lib/Actions/Security.php', |
|
31 | + 'OCA\\AdminAudit\\Actions\\Sharing' => __DIR__.'/..'.'/../lib/Actions/Sharing.php', |
|
32 | + 'OCA\\AdminAudit\\Actions\\Trashbin' => __DIR__.'/..'.'/../lib/Actions/Trashbin.php', |
|
33 | + 'OCA\\AdminAudit\\Actions\\UserManagement' => __DIR__.'/..'.'/../lib/Actions/UserManagement.php', |
|
34 | + 'OCA\\AdminAudit\\Actions\\Versions' => __DIR__.'/..'.'/../lib/Actions/Versions.php', |
|
35 | + 'OCA\\AdminAudit\\AppInfo\\Application' => __DIR__.'/..'.'/../lib/AppInfo/Application.php', |
|
36 | + 'OCA\\AdminAudit\\BackgroundJobs\\Rotate' => __DIR__.'/..'.'/../lib/BackgroundJobs/Rotate.php', |
|
37 | 37 | ); |
38 | 38 | |
39 | 39 | public static function getInitializer(ClassLoader $loader) |
40 | 40 | { |
41 | - return \Closure::bind(function () use ($loader) { |
|
41 | + return \Closure::bind(function() use ($loader) { |
|
42 | 42 | $loader->prefixLengthsPsr4 = ComposerStaticInitAdminAudit::$prefixLengthsPsr4; |
43 | 43 | $loader->prefixDirsPsr4 = ComposerStaticInitAdminAudit::$prefixDirsPsr4; |
44 | 44 | $loader->classMap = ComposerStaticInitAdminAudit::$classMap; |
@@ -6,17 +6,17 @@ |
||
6 | 6 | $baseDir = $vendorDir; |
7 | 7 | |
8 | 8 | return array( |
9 | - 'OCA\\AdminAudit\\Actions\\Action' => $baseDir . '/../lib/Actions/Action.php', |
|
10 | - 'OCA\\AdminAudit\\Actions\\AppManagement' => $baseDir . '/../lib/Actions/AppManagement.php', |
|
11 | - 'OCA\\AdminAudit\\Actions\\Auth' => $baseDir . '/../lib/Actions/Auth.php', |
|
12 | - 'OCA\\AdminAudit\\Actions\\Console' => $baseDir . '/../lib/Actions/Console.php', |
|
13 | - 'OCA\\AdminAudit\\Actions\\Files' => $baseDir . '/../lib/Actions/Files.php', |
|
14 | - 'OCA\\AdminAudit\\Actions\\GroupManagement' => $baseDir . '/../lib/Actions/GroupManagement.php', |
|
15 | - 'OCA\\AdminAudit\\Actions\\Security' => $baseDir . '/../lib/Actions/Security.php', |
|
16 | - 'OCA\\AdminAudit\\Actions\\Sharing' => $baseDir . '/../lib/Actions/Sharing.php', |
|
17 | - 'OCA\\AdminAudit\\Actions\\Trashbin' => $baseDir . '/../lib/Actions/Trashbin.php', |
|
18 | - 'OCA\\AdminAudit\\Actions\\UserManagement' => $baseDir . '/../lib/Actions/UserManagement.php', |
|
19 | - 'OCA\\AdminAudit\\Actions\\Versions' => $baseDir . '/../lib/Actions/Versions.php', |
|
20 | - 'OCA\\AdminAudit\\AppInfo\\Application' => $baseDir . '/../lib/AppInfo/Application.php', |
|
21 | - 'OCA\\AdminAudit\\BackgroundJobs\\Rotate' => $baseDir . '/../lib/BackgroundJobs/Rotate.php', |
|
9 | + 'OCA\\AdminAudit\\Actions\\Action' => $baseDir.'/../lib/Actions/Action.php', |
|
10 | + 'OCA\\AdminAudit\\Actions\\AppManagement' => $baseDir.'/../lib/Actions/AppManagement.php', |
|
11 | + 'OCA\\AdminAudit\\Actions\\Auth' => $baseDir.'/../lib/Actions/Auth.php', |
|
12 | + 'OCA\\AdminAudit\\Actions\\Console' => $baseDir.'/../lib/Actions/Console.php', |
|
13 | + 'OCA\\AdminAudit\\Actions\\Files' => $baseDir.'/../lib/Actions/Files.php', |
|
14 | + 'OCA\\AdminAudit\\Actions\\GroupManagement' => $baseDir.'/../lib/Actions/GroupManagement.php', |
|
15 | + 'OCA\\AdminAudit\\Actions\\Security' => $baseDir.'/../lib/Actions/Security.php', |
|
16 | + 'OCA\\AdminAudit\\Actions\\Sharing' => $baseDir.'/../lib/Actions/Sharing.php', |
|
17 | + 'OCA\\AdminAudit\\Actions\\Trashbin' => $baseDir.'/../lib/Actions/Trashbin.php', |
|
18 | + 'OCA\\AdminAudit\\Actions\\UserManagement' => $baseDir.'/../lib/Actions/UserManagement.php', |
|
19 | + 'OCA\\AdminAudit\\Actions\\Versions' => $baseDir.'/../lib/Actions/Versions.php', |
|
20 | + 'OCA\\AdminAudit\\AppInfo\\Application' => $baseDir.'/../lib/AppInfo/Application.php', |
|
21 | + 'OCA\\AdminAudit\\BackgroundJobs\\Rotate' => $baseDir.'/../lib/BackgroundJobs/Rotate.php', |
|
22 | 22 | ); |