diff --git a/lib/SP/Bootstrap.php b/lib/SP/Bootstrap.php index fcc8316c..2921e03d 100644 --- a/lib/SP/Bootstrap.php +++ b/lib/SP/Bootstrap.php @@ -255,6 +255,7 @@ final class Bootstrap * @throws Services\Upgrade\UpgradeException * @throws \DI\DependencyException * @throws \DI\NotFoundException + * @throws Storage\File\FileException */ protected function initializeCommon() { diff --git a/lib/SP/Core/ModuleBase.php b/lib/SP/Core/ModuleBase.php index 83081005..f161751a 100644 --- a/lib/SP/Core/ModuleBase.php +++ b/lib/SP/Core/ModuleBase.php @@ -116,16 +116,20 @@ abstract class ModuleBase /** * Initializes event handlers + * + * @throws \DI\DependencyException + * @throws \DI\NotFoundException */ protected function initEventHandlers() { $eventDispatcher = $this->container->get(EventDispatcher::class); + if (DEBUG) { + $eventDispatcher->attach($this->container->get(FileLogHandler::class)); + } + if ($this->configData->isLogEnabled()) { $eventDispatcher->attach($this->container->get(DatabaseLogHandler::class)); - if (DEBUG) { - $eventDispatcher->attach($this->container->get(FileLogHandler::class)); - } } if ($this->configData->isMailEnabled()) { diff --git a/lib/SP/Providers/Log/FileLogHandler.php b/lib/SP/Providers/Log/FileLogHandler.php index 6594360b..dae4316a 100644 --- a/lib/SP/Providers/Log/FileLogHandler.php +++ b/lib/SP/Providers/Log/FileLogHandler.php @@ -83,6 +83,7 @@ final class FileLogHandler extends Provider implements EventReceiver *

* * @return void + * @throws \SP\Core\Exceptions\InvalidClassException * @since 5.1.0 */ public function update(SplSubject $subject) diff --git a/lib/SP/Providers/Log/LogInterface.php b/lib/SP/Providers/Log/LogInterface.php index bed56144..bbb66d29 100644 --- a/lib/SP/Providers/Log/LogInterface.php +++ b/lib/SP/Providers/Log/LogInterface.php @@ -57,6 +57,7 @@ interface LogInterface 'clear.eventlog', 'clear.track', 'unlock.track', - 'plugin.load.error' + 'plugin.load.error', + 'upgrade.' ]; } \ No newline at end of file diff --git a/lib/SP/Services/Upgrade/UpgradeAppService.php b/lib/SP/Services/Upgrade/UpgradeAppService.php index 63058641..abf15c19 100644 --- a/lib/SP/Services/Upgrade/UpgradeAppService.php +++ b/lib/SP/Services/Upgrade/UpgradeAppService.php @@ -27,6 +27,7 @@ namespace SP\Services\Upgrade; use SP\Config\ConfigData; use SP\Core\Events\Event; use SP\Core\Events\EventMessage; +use SP\Providers\Log\FileLogHandler; use SP\Services\Service; use SP\Util\VersionUtil; @@ -123,4 +124,12 @@ final class UpgradeAppService extends Service implements UpgradeInterface return false; } + + /** + * initialize + */ + protected function initialize() + { + $this->eventDispatcher->attach($this->dic->get(FileLogHandler::class)); + } } \ No newline at end of file diff --git a/lib/SP/Services/Upgrade/UpgradeAuthToken.php b/lib/SP/Services/Upgrade/UpgradeAuthToken.php index 09ead2a1..14dffb11 100644 --- a/lib/SP/Services/Upgrade/UpgradeAuthToken.php +++ b/lib/SP/Services/Upgrade/UpgradeAuthToken.php @@ -147,6 +147,5 @@ final class UpgradeAuthToken extends Service protected function initialize() { $this->authtokenService = $this->dic->get(AuthTokenService::class); - } } \ No newline at end of file diff --git a/lib/SP/Services/Upgrade/UpgradeConfigService.php b/lib/SP/Services/Upgrade/UpgradeConfigService.php index 23e40e01..0ea110d5 100644 --- a/lib/SP/Services/Upgrade/UpgradeConfigService.php +++ b/lib/SP/Services/Upgrade/UpgradeConfigService.php @@ -28,6 +28,7 @@ use SP\Config\ConfigData; use SP\Core\Events\Event; use SP\Core\Events\EventMessage; use SP\Core\MimeTypes; +use SP\Providers\Log\FileLogHandler; use SP\Services\Service; use SP\Util\VersionUtil; @@ -306,4 +307,12 @@ final class UpgradeConfigService extends Service implements UpgradeInterface ->addDetail(__u('Version'), $version)) ); } + + /** + * initialize + */ + protected function initialize() + { + $this->eventDispatcher->attach($this->dic->get(FileLogHandler::class)); + } } \ No newline at end of file diff --git a/lib/SP/Services/Upgrade/UpgradeDatabaseService.php b/lib/SP/Services/Upgrade/UpgradeDatabaseService.php index baaf857e..9b4ca80c 100644 --- a/lib/SP/Services/Upgrade/UpgradeDatabaseService.php +++ b/lib/SP/Services/Upgrade/UpgradeDatabaseService.php @@ -27,6 +27,7 @@ namespace SP\Services\Upgrade; use SP\Config\ConfigData; use SP\Core\Events\Event; use SP\Core\Events\EventMessage; +use SP\Providers\Log\FileLogHandler; use SP\Services\Service; use SP\Storage\Database\Database; use SP\Storage\Database\MySQLFileParser; @@ -213,8 +214,13 @@ final class UpgradeDatabaseService extends Service implements UpgradeInterface } } + /** + * initialize + */ protected function initialize() { + $this->eventDispatcher->attach($this->dic->get(FileLogHandler::class)); + $this->db = $this->dic->get(Database::class); } } \ No newline at end of file diff --git a/tests/phpunit.xml b/tests/phpunit.xml index 440b90eb..1f62c5ba 100644 --- a/tests/phpunit.xml +++ b/tests/phpunit.xml @@ -1,27 +1,4 @@ - - - + \ No newline at end of file diff --git a/tests/res/config/config.xml b/tests/res/config/config.xml index 416b7f20..f48f7344 100644 --- a/tests/res/config/config.xml +++ b/tests/res/config/config.xml @@ -9,11 +9,11 @@ 1 1 - f09da3c1942076460f8dc05004aa2206436712cf + 335463b295db194139a4483b30bed5dc4a8e8fab 0 0 - 1541934251 - 91de39c679ecf1d6e64cb6c0a1fde6c4ede91127 + 1541937033 + c80d905efab57187b4a1f32374fafbcff3c4d57b @@ -32,7 +32,7 @@ 0 - c3595e381a6ccc90731a642ec5e94a812a0f0875 + d101e3b4cfc15c62090eb1c5f737a454e9a7c35e PDF JPG