Fix isIDExists() error when installing member module for the first time

This commit is contained in:
Kijin Sung 2023-06-25 23:43:07 +09:00
parent 9bb2e40ef4
commit 566c1f54b7
2 changed files with 3 additions and 3 deletions

View file

@ -383,7 +383,7 @@ class ModuleController extends Module
} }
// Check whether the module name already exists // Check whether the module name already exists
if(ModuleModel::isIDExists($args->mid)) if(ModuleModel::isIDExists($args->mid, $args->module))
{ {
return new BaseObject(-1, 'msg_module_name_exists'); return new BaseObject(-1, 'msg_module_name_exists');
} }

View file

@ -23,13 +23,13 @@ class ModuleModel extends Module
/** /**
* @brief Check if mid is available * @brief Check if mid is available
*/ */
public static function isIDExists($id) public static function isIDExists($id, $module = null)
{ {
if (!preg_match('/^[a-z]{1}([a-z0-9_]+)$/i', $id)) if (!preg_match('/^[a-z]{1}([a-z0-9_]+)$/i', $id))
{ {
return true; return true;
} }
if (Context::isReservedWord(strtolower($id))) if (Context::isReservedWord(strtolower($id)) && $id !== $module)
{ {
return true; return true;
} }