Add subtypes for Module type in sys_modules table
- [x] 1. Subtypes are Text, File, Profile, Context, Payment, Notification, Connect.
- [x] 2. A module may have more then one Subtype. For example, Organizations should have Profile + Context. Bit mask should be used here.
- [ ] 3. Update methods, like BxBaseServices::serviceGetModulesByType. They shouldn't create instances of each module to identify its type.
Possible issues when module instances are created: https://github.com/unaio/una/issues/4546
@AlexTr a code like below can be used in the next update to fill in newly added subtypes field:
$oInstallerUtils = new BxDolInstallerUtils();
$oModuleQuery = BxDolModuleQuery::getInstance();
$aModules = BxDolModuleQuery::getInstance()->getModulesBy(['type' => 'modules']);
foreach($aModules as $aModule)
if(($iModuleSubtypes = $oInstallerUtils->getSubtypes($aModule['name'])) != 0)
$oModuleQuery->updateModule(['subtypes' => $iModuleSubtypes], ['id' => $aModule['id']]);
@AlexTr a code like below can be used in the next update to fill in newly added
subtypesfield:$oInstallerUtils = new BxDolInstallerUtils(); $oModuleQuery = BxDolModuleQuery::getInstance(); $aModules = BxDolModuleQuery::getInstance()->getModulesBy(['type' => 'modules']); foreach($aModules as $aModule) if(($iModuleSubtypes = $oInstallerUtils->getSubtypes($aModule['name'])) != 0) $oModuleQuery->updateModule(['subtypes' => $iModuleSubtypes], ['id' => $aModule['id']]);
UNA core update doesn't have classes autoloading, but it looks like many files need to be included, is it possible to remake it to use several SQL bare statements instead ?
We can exclude usage of BxDolModuleQuery class and replace it with SQL queries. But the procedure of getting a list of subtypes for a module checks extended PHP classes and implemented interfaces.