Merge pull request #8769 from nextcloud/admin_audit_strict

Make admin_audit strict
This commit is contained in:
Morris Jobke 2018-03-12 11:57:37 +01:00 committed by GitHub
commit 430c478ba3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 22 additions and 10 deletions

View File

@ -1,4 +1,5 @@
<?php
declare(strict_types=1);
/**
* @copyright Copyright (c) 2016 Bjoern Schiessle <bjoern@schiessle.org>
* @copyright Copyright (c) 2017 Lukas Reschke <lukas@statuscode.ch>

View File

@ -1,4 +1,5 @@
<?php
declare(strict_types=1);
/**
* @copyright Copyright (c) 2016 Lukas Reschke <lukas@statuscode.ch>
*
@ -45,10 +46,10 @@ class Action {
* @param array $elements
* @param bool $obfuscateParameters
*/
public function log($text,
public function log(string $text,
array $params,
array $elements,
$obfuscateParameters = false) {
bool $obfuscateParameters = false) {
foreach($elements as $element) {
if(!isset($params[$element])) {
if ($obfuscateParameters) {

View File

@ -1,4 +1,5 @@
<?php
declare(strict_types=1);
/**
* @copyright Copyright (c) 2017 Joas Schilling <coding@schilljs.com>
*
@ -28,7 +29,7 @@ class AppManagement extends Action {
/**
* @param string $appName
*/
public function enableApp($appName) {
public function enableApp(string $appName) {
$this->log('App "%s" enabled',
['app' => $appName],
['app']
@ -39,7 +40,7 @@ class AppManagement extends Action {
* @param string $appName
* @param string[] $groups
*/
public function enableAppForGroups($appName, array $groups) {
public function enableAppForGroups(string $appName, array $groups) {
$this->log('App "%s" enabled for groups: %s',
['app' => $appName, 'groups' => implode(', ', $groups)],
['app', 'groups']
@ -49,7 +50,7 @@ class AppManagement extends Action {
/**
* @param string $appName
*/
public function disableApp($appName) {
public function disableApp(string $appName) {
$this->log('App "%s" disabled',
['app' => $appName],
['app']

View File

@ -1,4 +1,5 @@
<?php
declare(strict_types=1);
/**
* @copyright Copyright (c) 2016 Lukas Reschke <lukas@statuscode.ch>
*

View File

@ -1,4 +1,5 @@
<?php
declare(strict_types=1);
/**
* @copyright Copyright (c) 2017 Joas Schilling <coding@schilljs.com>
*
@ -28,7 +29,7 @@ class Console extends Action {
/**
* @param $arguments
*/
public function runCommand($arguments) {
public function runCommand(array $arguments) {
if ($arguments[1] === '_completion') {
// Don't log autocompletion
return;

View File

@ -1,4 +1,5 @@
<?php
declare(strict_types=1);
/**
* @copyright Copyright (c) 2016 Lukas Reschke <lukas@statuscode.ch>
*

View File

@ -1,4 +1,5 @@
<?php
declare(strict_types=1);
/**
* @copyright Copyright (c) 2016 Bjoern Schiessle <bjoern@schiessle.org>
*

View File

@ -1,4 +1,5 @@
<?php
declare(strict_types=1);
/**
* @copyright Copyright (c) 2016 Lukas Reschke <lukas@statuscode.ch>
*

View File

@ -1,4 +1,5 @@
<?php
declare(strict_types=1);
/**
* @copyright Copyright (c) 2016 Bjoern Schiessle <bjoern@schiessle.org>
*
@ -27,13 +28,13 @@ namespace OCA\AdminAudit\Actions;
class Trashbin extends Action {
public function delete($params) {
public function delete(array $params) {
$this->log('File "%s" deleted from trash bin.',
['path' => $params['path']], ['path']
);
}
public function restore($params) {
public function restore(array $params) {
$this->log('File "%s" restored from trash bin.',
['path' => $params['filePath']], ['path']
);

View File

@ -1,4 +1,5 @@
<?php
declare(strict_types=1);
/**
* @copyright Copyright (c) 2016 Lukas Reschke <lukas@statuscode.ch>
*

View File

@ -1,4 +1,5 @@
<?php
declare(strict_types=1);
/**
* @copyright Bjoern Schiessle <bjoern@schiessle.org>
*
@ -27,7 +28,7 @@ namespace OCA\AdminAudit\Actions;
class Versions extends Action {
public function rollback($params) {
public function rollback(array $params) {
$this->log('Version "%s" of "%s" was restored.',
[
'version' => $params['revision'],
@ -37,7 +38,7 @@ class Versions extends Action {
);
}
public function delete($params) {
public function delete(array $params) {
$this->log('Version "%s" was deleted.',
['path' => $params['path']],
['path']

View File

@ -1,4 +1,5 @@
<?php
declare(strict_types=1);
/**
* @copyright Copyright (c) 2017 Joas Schilling <coding@schilljs.com>
*