Support installing/updating namespaced modules

모듈 설치 및 업데이트 메소드를 Rhymix\Modules\모듈명\Install 클래스에
넣을 수 있도록 지원한다. 이 클래스가 있는 경우 모듈명과 동일한 클래스를
찾지 않는다. 이로써 클래스 전체를 네임스페이스화할 수 있게 되었다.
This commit is contained in:
Kijin Sung 2022-01-04 01:37:38 +09:00
parent adbd29231f
commit f334889047
5 changed files with 38 additions and 19 deletions

View file

@ -153,12 +153,8 @@ class ModuleInstaller
{
$path_array = explode("/", $this->package->path);
$target_name = array_pop($path_array);
$oModule = getModule($target_name, "class");
if(!$oModule)
{
return new BaseObject(-1, 'msg_invalid_request');
}
if(!method_exists($oModule, "moduleUninstall"))
$oModule = ModuleModel::getModuleInstallClass($target_name);
if(!$oModule || !method_exists($oModule, 'moduleUninstall'))
{
return new BaseObject(-1, 'msg_invalid_request');
}
@ -203,16 +199,15 @@ class ModuleInstaller
if($type == "module")
{
$oModuleModel = getModel('module');
$oInstallController = getController('install');
$module_path = ModuleHandler::getModulePath($target_name);
if($oModuleModel->checkNeedInstall($target_name))
if(ModuleModel::checkNeedInstall($target_name))
{
$oInstallController->installModule($target_name, $module_path);
}
if($oModuleModel->checkNeedUpdate($target_name))
if(ModuleModel::checkNeedUpdate($target_name))
{
$oModule = getModule($target_name, 'class');
$oModule = ModuleModel::getModuleInstallClass($target_name);
if(method_exists($oModule, 'moduleUpdate'))
{
$oModule->moduleUpdate();

View file

@ -316,7 +316,7 @@ class autoinstallModel extends autoinstall
{
$path_array = explode("/", $path);
$target_name = array_pop($path_array);
$oModule = getModule($target_name, "class");
$oModule = ModuleModel::getModuleInstallClass($target_name);
if(!$oModule)
{
return FALSE;