diff options
Diffstat (limited to 'lib/public/Log')
-rw-r--r-- | lib/public/Log/Audit/CriticalActionPerformedEvent.php | 84 | ||||
-rw-r--r-- | lib/public/Log/IDataLogger.php | 3 | ||||
-rw-r--r-- | lib/public/Log/IFileBased.php | 3 | ||||
-rw-r--r-- | lib/public/Log/ILogFactory.php | 4 | ||||
-rw-r--r-- | lib/public/Log/IWriter.php | 3 | ||||
-rw-r--r-- | lib/public/Log/RotationTrait.php | 6 |
6 files changed, 92 insertions, 11 deletions
diff --git a/lib/public/Log/Audit/CriticalActionPerformedEvent.php b/lib/public/Log/Audit/CriticalActionPerformedEvent.php new file mode 100644 index 00000000000..1b991e4d871 --- /dev/null +++ b/lib/public/Log/Audit/CriticalActionPerformedEvent.php @@ -0,0 +1,84 @@ +<?php + +declare(strict_types=1); + +/** + * @copyright Copyright (c) 2021 Joas Schilling <coding@schilljs.com> + * + * @author Joas Schilling <coding@schilljs.com> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +namespace OCP\Log\Audit; + +use OCP\EventDispatcher\Event; + +/** + * Emitted when the admin_audit app should log an entry + * + * @since 22.0.0 + */ +class CriticalActionPerformedEvent extends Event { + + /** @var string */ + private $logMessage; + + /** @var array */ + private $parameters; + + /** @var bool */ + private $obfuscateParameters; + + /** + * @param string $logMessage + * @param array $parameters + * @param bool $obfuscateParameters + * @since 22.0.0 + */ + public function __construct(string $logMessage, + array $parameters = [], + bool $obfuscateParameters = false) { + parent::__construct(); + $this->logMessage = $logMessage; + $this->parameters = $parameters; + $this->obfuscateParameters = $obfuscateParameters; + } + + /** + * @return string + * @since 22.0.0 + */ + public function getLogMessage(): string { + return $this->logMessage; + } + + /** + * @return array + * @since 22.0.0 + */ + public function getParameters(): array { + return $this->parameters; + } + + /** + * @return bool + * @since 22.0.0 + */ + public function getObfuscateParameters(): bool { + return $this->obfuscateParameters; + } +} diff --git a/lib/public/Log/IDataLogger.php b/lib/public/Log/IDataLogger.php index ed56009ca05..e9e476c3760 100644 --- a/lib/public/Log/IDataLogger.php +++ b/lib/public/Log/IDataLogger.php @@ -16,14 +16,13 @@ declare(strict_types=1); * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ - namespace OCP\Log; /** diff --git a/lib/public/Log/IFileBased.php b/lib/public/Log/IFileBased.php index eeebb766cda..54f9e7d754a 100644 --- a/lib/public/Log/IFileBased.php +++ b/lib/public/Log/IFileBased.php @@ -14,14 +14,13 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ - namespace OCP\Log; /** diff --git a/lib/public/Log/ILogFactory.php b/lib/public/Log/ILogFactory.php index 54aa6456156..54ed761a8e7 100644 --- a/lib/public/Log/ILogFactory.php +++ b/lib/public/Log/ILogFactory.php @@ -3,6 +3,7 @@ * @copyright Copyright (c) 2018 Arthur Schiwon <blizzz@arthur-schiwon.de> * * @author Arthur Schiwon <blizzz@arthur-schiwon.de> + * @author Christoph Wurst <christoph@winzerhof-wurst.at> * @author Johannes Ernst <jernst@indiecomputing.com> * * @license GNU AGPL version 3 or any later version @@ -14,14 +15,13 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ - namespace OCP\Log; use OCP\ILogger; diff --git a/lib/public/Log/IWriter.php b/lib/public/Log/IWriter.php index bc8feb908b9..acc39533bfd 100644 --- a/lib/public/Log/IWriter.php +++ b/lib/public/Log/IWriter.php @@ -13,14 +13,13 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ - namespace OCP\Log; /** diff --git a/lib/public/Log/RotationTrait.php b/lib/public/Log/RotationTrait.php index d7de50410d6..8fc1516c346 100644 --- a/lib/public/Log/RotationTrait.php +++ b/lib/public/Log/RotationTrait.php @@ -3,6 +3,7 @@ * @copyright Copyright (c) 2018 Arthur Schiwon <blizzz@arthur-schiwon.de> * * @author Arthur Schiwon <blizzz@arthur-schiwon.de> + * @author dartcafe <github@dartcafe.de> * * @license GNU AGPL version 3 or any later version * @@ -13,14 +14,13 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ - namespace OCP\Log; /** @@ -58,7 +58,7 @@ trait RotationTrait { * @since 14.0.0 */ protected function shouldRotateBySize():bool { - if ((int)$this->maxSize > 0) { + if ((int)$this->maxSize > 0 && file_exists($this->filePath)) { $filesize = @filesize($this->filePath); if ($filesize >= (int)$this->maxSize) { return true; |