diff --git a/app/modules/cli/Commands/InstallCommand.php b/app/modules/cli/Commands/InstallCommand.php index d5d5ef76..afd8cbf0 100644 --- a/app/modules/cli/Commands/InstallCommand.php +++ b/app/modules/cli/Commands/InstallCommand.php @@ -4,7 +4,7 @@ * * @author nuxsmin * @link https://syspass.org - * @copyright 2012-2021, Rubén Domínguez nuxsmin@$syspass.org + * @copyright 2012-2022, Rubén Domínguez nuxsmin@$syspass.org * * This file is part of sysPass. * @@ -19,7 +19,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with sysPass. If not, see . + * along with sysPass. If not, see . */ namespace SP\Modules\Cli\Commands; @@ -30,9 +30,9 @@ use SP\Core\Exceptions\InstallError; use SP\Core\Exceptions\InvalidArgumentException; use SP\Core\Language; use SP\Domain\Config\ConfigInterface; -use SP\Domain\Install\InstallerInterface; -use SP\Domain\Install\Services\InstallData; -use SP\Domain\Install\Services\Installer; +use SP\Domain\Install\In\InstallData; +use SP\Domain\Install\InstallerServiceInterface; +use SP\Domain\Install\Services\InstallerService; use SP\Util\Util; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; @@ -67,13 +67,13 @@ final class InstallCommand extends CommandBase /** * @var string */ - protected static $defaultName = 'sp:install'; - private Installer $installer; + protected static $defaultName = 'sp:install'; + private InstallerService $installer; public function __construct( LoggerInterface $logger, ConfigInterface $config, - InstallerInterface $installer + InstallerServiceInterface $installer ) { parent::__construct($logger, $config); @@ -166,7 +166,7 @@ final class InstallCommand extends CommandBase return self::FAILURE; } - $this->installer->run(Installer::getDatabaseSetup($installData, $this->configData), $installData); + $this->installer->run(InstallerService::getDatabaseSetup($installData, $this->configData), $installData); $this->logger->info(__('Installation finished')); diff --git a/app/modules/web/Controllers/Helpers/LayoutHelper.php b/app/modules/web/Controllers/Helpers/LayoutHelper.php index 3d35eb80..fca5963c 100644 --- a/app/modules/web/Controllers/Helpers/LayoutHelper.php +++ b/app/modules/web/Controllers/Helpers/LayoutHelper.php @@ -4,7 +4,7 @@ * * @author nuxsmin * @link https://syspass.org - * @copyright 2012-2021, Rubén Domínguez nuxsmin@$syspass.org + * @copyright 2012-2022, Rubén Domínguez nuxsmin@$syspass.org * * This file is part of sysPass. * @@ -33,7 +33,7 @@ use SP\Core\Crypt\CryptPKI; use SP\Core\Exceptions\SPException; use SP\Core\Language; use SP\Core\UI\ThemeInterface; -use SP\Domain\Install\Services\Installer; +use SP\Domain\Install\Services\InstallerService; use SP\Html\DataGrid\Action\DataGridAction; use SP\Http\RequestInterface; use SP\Http\Uri; @@ -119,7 +119,7 @@ final class LayoutHelper extends HelperBase $this->view->assign('app_desc', AppInfoInterface::APP_DESC); $this->view->assign('app_website_url', AppInfoInterface::APP_WEBSITE_URL); $this->view->assign('app_blog_url', AppInfoInterface::APP_BLOG_URL); - $this->view->assign('app_version', Installer::VERSION_TEXT); + $this->view->assign('app_version', InstallerService::VERSION_TEXT); $this->view->assign('logo_icon', $baseUrl.'/public/images/logo_icon.png'); $this->view->assign('logo_no_bg_color', $baseUrl.'/public/images/logo_full_nobg_outline_color.png'); $this->view->assign('logo_no_bg', $baseUrl.'/public/images/logo_full_nobg_outline.png'); diff --git a/app/modules/web/Controllers/Install/InstallController.php b/app/modules/web/Controllers/Install/InstallController.php index 103c7c38..b51c5185 100644 --- a/app/modules/web/Controllers/Install/InstallController.php +++ b/app/modules/web/Controllers/Install/InstallController.php @@ -27,9 +27,9 @@ namespace SP\Modules\Web\Controllers\Install; use Exception; use SP\Core\Application; -use SP\Domain\Install\InstallerInterface; -use SP\Domain\Install\Services\InstallData; -use SP\Domain\Install\Services\Installer; +use SP\Domain\Install\In\InstallData; +use SP\Domain\Install\InstallerServiceInterface; +use SP\Domain\Install\Services\InstallerService; use SP\Http\JsonResponse; use SP\Modules\Web\Controllers\ControllerBase; use SP\Modules\Web\Controllers\Traits\JsonTrait; @@ -42,12 +42,12 @@ final class InstallController extends ControllerBase { use JsonTrait; - private InstallerInterface $installer; + private InstallerServiceInterface $installer; public function __construct( Application $application, WebControllerHelper $webControllerHelper, - InstallerInterface $installer + InstallerServiceInterface $installer ) { parent::__construct($application, $webControllerHelper); @@ -63,7 +63,7 @@ final class InstallController extends ControllerBase $installData = $this->getInstallDataFromRequest(); try { - $this->installer->run(Installer::getDatabaseSetup($installData, $this->configData), $installData); + $this->installer->run(InstallerService::getDatabaseSetup($installData, $this->configData), $installData); return $this->returnJsonResponse(JsonResponse::JSON_SUCCESS, __u('Installation finished')); } catch (Exception $e) { @@ -74,7 +74,7 @@ final class InstallController extends ControllerBase } /** - * @return \SP\Domain\Install\Services\InstallData + * @return \SP\Domain\Install\In\InstallData */ private function getInstallDataFromRequest(): InstallData { diff --git a/app/modules/web/themes/material-blue/views/config/info.inc b/app/modules/web/themes/material-blue/views/config/info.inc index 3b54d6f4..205dce50 100644 --- a/app/modules/web/themes/material-blue/views/config/info.inc +++ b/app/modules/web/themes/material-blue/views/config/info.inc @@ -1,4 +1,27 @@ . + */ + /** * @var ThemeIcons $icons * @var \SP\Domain\Config\In\ConfigDataInterface $configData @@ -10,7 +33,7 @@
info
- +
getConfigVersion()); ?>
diff --git a/lib/Definitions.php b/lib/Definitions.php index d08d9fe5..5ad3aa8e 100644 --- a/lib/Definitions.php +++ b/lib/Definitions.php @@ -163,6 +163,7 @@ return [ ), 'SP\Domain\Export\*ServiceInterface' => autowire('SP\Domain\Export\Services\*Service'), 'SP\Domain\Import\*ServiceInterface' => autowire('SP\Domain\Import\Services\*Service'), + 'SP\Domain\Install\*ServiceInterface' => autowire('SP\Domain\Install\Services\*Service'), 'SP\Domain\Crypt\*ServiceInterface' => autowire('SP\Domain\Crypt\Services\*Service'), 'SP\Domain\Plugin\*ServiceInterface' => autowire('SP\Domain\Plugin\Services\*Service'), 'SP\Domain\ItemPreset\*ServiceInterface' => autowire('SP\Domain\ItemPreset\Services\*Service'), diff --git a/lib/SP/Domain/Install/Services/InstallData.php b/lib/SP/Domain/Install/In/InstallData.php similarity index 97% rename from lib/SP/Domain/Install/Services/InstallData.php rename to lib/SP/Domain/Install/In/InstallData.php index df62f204..56e9895a 100644 --- a/lib/SP/Domain/Install/Services/InstallData.php +++ b/lib/SP/Domain/Install/In/InstallData.php @@ -4,7 +4,7 @@ * * @author nuxsmin * @link https://syspass.org - * @copyright 2012-2021, Rubén Domínguez nuxsmin@$syspass.org + * @copyright 2012-2022, Rubén Domínguez nuxsmin@$syspass.org * * This file is part of sysPass. * @@ -20,9 +20,7 @@ * * You should have received a copy of the GNU General Public License * along with sysPass. If not, see . - */ - -namespace SP\Domain\Install\Services; + */namespace SP\Domain\Install\In; /** * Class InstallData diff --git a/lib/SP/Domain/Install/InstallerInterface.php b/lib/SP/Domain/Install/InstallerServiceInterface.php similarity index 89% rename from lib/SP/Domain/Install/InstallerInterface.php rename to lib/SP/Domain/Install/InstallerServiceInterface.php index eed66748..bcc1dacd 100644 --- a/lib/SP/Domain/Install/InstallerInterface.php +++ b/lib/SP/Domain/Install/InstallerServiceInterface.php @@ -27,16 +27,16 @@ namespace SP\Domain\Install; use SP\Core\Exceptions\InvalidArgumentException; use SP\Core\Exceptions\SPException; -use SP\Domain\Install\Services\InstallData; +use SP\Domain\Install\In\InstallData; /** * Installer class */ -interface InstallerInterface +interface InstallerServiceInterface { /** * @throws InvalidArgumentException * @throws SPException */ - public function run(DatabaseSetupInterface $databaseSetup, InstallData $installData): InstallerInterface; + public function run(DatabaseSetupInterface $databaseSetup, InstallData $installData): InstallerServiceInterface; } \ No newline at end of file diff --git a/lib/SP/Domain/Install/Services/Installer.php b/lib/SP/Domain/Install/Services/InstallerService.php similarity index 92% rename from lib/SP/Domain/Install/Services/Installer.php rename to lib/SP/Domain/Install/Services/InstallerService.php index 9361e717..679c3f16 100644 --- a/lib/SP/Domain/Install/Services/Installer.php +++ b/lib/SP/Domain/Install/Services/InstallerService.php @@ -40,16 +40,12 @@ use SP\Domain\Config\Adapters\ConfigData as ConfigSettings; use SP\Domain\Config\ConfigInterface; use SP\Domain\Config\ConfigServiceInterface; use SP\Domain\Config\In\ConfigDataInterface; -use SP\Domain\Config\Services\ConfigFileService; -use SP\Domain\Config\Services\ConfigService; use SP\Domain\Install\DatabaseSetupInterface; -use SP\Domain\Install\InstallerInterface; -use SP\Domain\User\Services\UserGroupService; -use SP\Domain\User\Services\UserProfileService; -use SP\Domain\User\Services\UserService; +use SP\Domain\Install\In\InstallData; +use SP\Domain\Install\InstallerServiceInterface; use SP\Domain\User\UserGroupServiceInterface; use SP\Domain\User\UserProfileServiceInterface; -use SP\Http\Request; +use SP\Domain\User\UserServiceInterface; use SP\Http\RequestInterface; use SP\Infrastructure\Database\DatabaseConnectionData; use SP\Infrastructure\Database\DatabaseUtil; @@ -63,7 +59,7 @@ defined('APP_ROOT') || die(); /** * Installer class */ -final class Installer implements InstallerInterface +final class InstallerService implements InstallerServiceInterface { /** * sysPass' version and build number @@ -72,19 +68,19 @@ final class Installer implements InstallerInterface public const VERSION_TEXT = '4.0'; public const BUILD = 21031301; - private Request $request; - private ConfigFileService $config; - private UserService $userService; - private UserGroupService $userGroupService; - private UserProfileService $userProfileService; - private ConfigService $configService; - private ?DatabaseSetupInterface $databaseSetup = null; - private ?InstallData $installData = null; + private RequestInterface $request; + private ConfigInterface $config; + private UserServiceInterface $userService; + private UserGroupServiceInterface $userGroupService; + private UserProfileServiceInterface $userProfileService; + private ConfigServiceInterface $configService; + private ?DatabaseSetupInterface $databaseSetup = null; + private ?InstallData $installData = null; public function __construct( RequestInterface $request, ConfigInterface $config, - UserService $userService, + UserServiceInterface $userService, UserGroupServiceInterface $userGroupService, UserProfileServiceInterface $userProfileService, ConfigServiceInterface $configService @@ -98,7 +94,7 @@ final class Installer implements InstallerInterface } /** - * @param \SP\Domain\Install\Services\InstallData $installData + * @param \SP\Domain\Install\In\InstallData $installData * @param $configData * * @return \SP\Domain\Install\DatabaseSetupInterface @@ -118,7 +114,7 @@ final class Installer implements InstallerInterface $mySQLHandler = new MySQLHandler($connectionData); - return new MySQL($mySQLHandler, $installData, $configData, $parser, new DatabaseUtil($mySQLHandler)); + return new MysqlService($mySQLHandler, $installData, $configData, $parser, new DatabaseUtil($mySQLHandler)); } throw new SPException(__u('Unimplemented'), SPException::ERROR, __u('Wrong backend type')); @@ -128,7 +124,7 @@ final class Installer implements InstallerInterface * @throws InvalidArgumentException * @throws SPException */ - public function run(DatabaseSetupInterface $databaseSetup, InstallData $installData): InstallerInterface + public function run(DatabaseSetupInterface $databaseSetup, InstallData $installData): InstallerServiceInterface { $this->databaseSetup = $databaseSetup; $this->installData = $installData; diff --git a/lib/SP/Domain/Install/Services/MySQL.php b/lib/SP/Domain/Install/Services/MysqlService.php similarity index 99% rename from lib/SP/Domain/Install/Services/MySQL.php rename to lib/SP/Domain/Install/Services/MysqlService.php index 7d9852ac..3ddb4903 100644 --- a/lib/SP/Domain/Install/Services/MySQL.php +++ b/lib/SP/Domain/Install/Services/MysqlService.php @@ -28,6 +28,7 @@ use PDOException; use SP\Core\Exceptions\SPException; use SP\Domain\Config\In\ConfigDataInterface; use SP\Domain\Install\DatabaseSetupInterface; +use SP\Domain\Install\In\InstallData; use SP\Infrastructure\Database\DatabaseFileInterface; use SP\Infrastructure\Database\DatabaseUtil; use SP\Infrastructure\Database\DBStorageInterface; @@ -39,7 +40,7 @@ use SP\Util\PasswordUtil; * * @package SP\Domain\Install\Services */ -final class MySQL implements DatabaseSetupInterface +final class MysqlService implements DatabaseSetupInterface { private InstallData $installData; private DBStorageInterface $DBStorage; diff --git a/lib/SP/Plugin/PluginManager.php b/lib/SP/Plugin/PluginManager.php index 2f1c6adc..a0e7f7cf 100644 --- a/lib/SP/Plugin/PluginManager.php +++ b/lib/SP/Plugin/PluginManager.php @@ -33,7 +33,7 @@ use SP\Core\Events\EventMessage; use SP\Core\Exceptions\ConstraintException; use SP\Core\Exceptions\QueryException; use SP\Core\Exceptions\SPException; -use SP\Domain\Install\Services\Installer; +use SP\Domain\Install\Services\InstallerService; use SP\Domain\Plugin\PluginDataServiceInterface; use SP\Domain\Plugin\PluginServiceInterface; use SP\Domain\Plugin\Services\PluginDataService; @@ -209,7 +209,7 @@ class PluginManager public function checkCompatibility(PluginInterface $plugin): bool { $pluginVersion = implode('.', $plugin->getCompatibleVersion()); - $appVersion = implode('.', array_slice(Installer::VERSION, 0, 2)); + $appVersion = implode('.', array_slice(InstallerService::VERSION, 0, 2)); if (version_compare($pluginVersion, $appVersion) === -1) { $this->pluginService->toggleEnabledByName( diff --git a/lib/SP/Util/VersionUtil.php b/lib/SP/Util/VersionUtil.php index 94120480..aa3ec0f4 100644 --- a/lib/SP/Util/VersionUtil.php +++ b/lib/SP/Util/VersionUtil.php @@ -4,7 +4,7 @@ * * @author nuxsmin * @link https://syspass.org - * @copyright 2012-2021, Rubén Domínguez nuxsmin@$syspass.org + * @copyright 2012-2022, Rubén Domínguez nuxsmin@$syspass.org * * This file is part of sysPass. * @@ -24,7 +24,7 @@ namespace SP\Util; -use SP\Domain\Install\Services\Installer; +use SP\Domain\Install\Services\InstallerService; /** * Class VersionUtil @@ -38,7 +38,7 @@ final class VersionUtil */ public static function getVersionStringNormalized(): string { - return implode('', Installer::VERSION).'.'.Installer::BUILD; + return implode('', InstallerService::VERSION).'.'.InstallerService::BUILD; } /** @@ -129,10 +129,10 @@ final class VersionUtil */ public static function getVersionArray(bool $retBuild = false): array { - $version = array_values(Installer::VERSION); + $version = array_values(InstallerService::VERSION); if ($retBuild === true) { - $version[] = Installer::BUILD; + $version[] = InstallerService::BUILD; return $version; } @@ -145,6 +145,6 @@ final class VersionUtil */ public static function getVersionArrayNormalized(): array { - return [implode('', Installer::VERSION), Installer::BUILD]; + return [implode('', InstallerService::VERSION), InstallerService::BUILD]; } } \ No newline at end of file diff --git a/tests/SP/Services/Install/InstallerTest.php b/tests/SP/Services/Install/InstallerTest.php index be8c8b59..b51a5c47 100644 --- a/tests/SP/Services/Install/InstallerTest.php +++ b/tests/SP/Services/Install/InstallerTest.php @@ -28,8 +28,8 @@ use Exception; use SP\Core\Exceptions\InvalidArgumentException; use SP\Core\Exceptions\SPException; use SP\Domain\Config\Services\ConfigService; -use SP\Domain\Install\Services\InstallData; -use SP\Domain\Install\Services\Installer; +use SP\Domain\Install\In\InstallData; +use SP\Domain\Install\Services\InstallerService; use SP\Domain\User\Services\UserGroupService; use SP\Domain\User\Services\UserProfileService; use SP\Domain\User\Services\UserService; @@ -111,7 +111,7 @@ class InstallerTest extends UnitaryTestCase } /** - * @return \SP\Domain\Install\Services\InstallData + * @return \SP\Domain\Install\In\InstallData */ private function getInstallData(): InstallData { @@ -129,11 +129,11 @@ class InstallerTest extends UnitaryTestCase } /** - * @return \SP\Domain\Install\InstallerInterface + * @return \SP\Domain\Install\InstallerServiceInterface */ - private function getDefaultInstaller(): \SP\Domain\Install\InstallerInterface + private function getDefaultInstaller(): \SP\Domain\Install\InstallerServiceInterface { - return new Installer( + return new InstallerService( $this->request, $this->config, $this->userService, @@ -436,7 +436,7 @@ class InstallerTest extends UnitaryTestCase */ public function testGetDatabaseSetupIsSuccessful() { - Installer::getDatabaseSetup($this->getInstallData(), $this->config->getConfigData()); + InstallerService::getDatabaseSetup($this->getInstallData(), $this->config->getConfigData()); } /** @@ -450,7 +450,7 @@ class InstallerTest extends UnitaryTestCase $this->expectException(SPException::class); $this->expectExceptionMessage('Unimplemented'); - Installer::getDatabaseSetup($installData, $this->config->getConfigData()); + InstallerService::getDatabaseSetup($installData, $this->config->getConfigData()); } /** diff --git a/tests/SP/Services/Install/MySQLTest.php b/tests/SP/Services/Install/MySQLTest.php index cc0a514c..c6c8d9fe 100644 --- a/tests/SP/Services/Install/MySQLTest.php +++ b/tests/SP/Services/Install/MySQLTest.php @@ -1,10 +1,10 @@ . + * along with sysPass. If not, see . */ namespace SP\Tests\Services\Install; @@ -27,8 +27,8 @@ namespace SP\Tests\Services\Install; use PDOException; use SP\Core\Exceptions\SPException; use SP\Domain\Config\In\ConfigDataInterface; -use SP\Domain\Install\Services\InstallData; -use SP\Domain\Install\Services\MySQL; +use SP\Domain\Install\In\InstallData; +use SP\Domain\Install\Services\MysqlService; use SP\Infrastructure\Database\DatabaseFileInterface; use SP\Infrastructure\Database\DatabaseUtil; use SP\Infrastructure\Database\DBStorageInterface; @@ -43,9 +43,9 @@ use SP\Tests\UnitaryTestCase; */ class MySQLTest extends UnitaryTestCase { - private DBStorageInterface $DBStorage; - private MySQL $mysql; - private Pdo $pdo; + private DBStorageInterface $DBStorage; + private MysqlService $mysql; + private Pdo $pdo; private InstallData $installData; private ConfigDataInterface $configData; private DatabaseFileInterface $databaseFile; @@ -761,13 +761,13 @@ class MySQLTest extends UnitaryTestCase $this->installData = $this->getInstallData(); $this->configData = $this->config->getConfigData(); $this->databaseUtil = $this->createMock(DatabaseUtil::class); - $this->mysql = new MySQL( + $this->mysql = new MysqlService( $this->DBStorage, $this->installData, $this->configData, $this->databaseFile, $this->databaseUtil ); } /** - * @return \SP\Domain\Install\Services\InstallData + * @return \SP\Domain\Install\In\InstallData */ private function getInstallData(): InstallData {