[ticket/14703] Fix parent module selection for custom extension modules

PHPBB3-14703
This commit is contained in:
rxu 2016-07-03 01:26:42 +07:00
parent 9595946508
commit 2f53761eaf

View file

@ -210,12 +210,15 @@ class module implements \phpbb\db\migration\tool\tool_interface
} }
// The "manual" way // The "manual" way
// More than 1 module with the same module_basename may exist
// Thus use empty module_basename to select a category as a parent
if (!is_numeric($parent)) if (!is_numeric($parent))
{ {
$sql = 'SELECT module_id $sql = 'SELECT module_id
FROM ' . $this->modules_table . " FROM ' . $this->modules_table . "
WHERE module_langname = '" . $this->db->sql_escape($parent) . "' WHERE module_langname = '" . $this->db->sql_escape($parent) . "'
AND module_class = '" . $this->db->sql_escape($class) . "'"; AND module_class = '" . $this->db->sql_escape($class) . "'
AND module_basename = ''";
$result = $this->db->sql_query($sql); $result = $this->db->sql_query($sql);
$module_id = $this->db->sql_fetchfield('module_id'); $module_id = $this->db->sql_fetchfield('module_id');
$this->db->sql_freeresult($result); $this->db->sql_freeresult($result);