Notify user if a module appears to be installed in an incorrect path (e.g. xe-modulename-master)

This commit is contained in:
Kijin Sung 2020-12-28 14:23:45 +09:00
parent 2ba01e521a
commit 00d17ec8fc
5 changed files with 32 additions and 4 deletions

View file

@ -311,10 +311,11 @@ class adminAdminView extends admin
// Get list of modules
$oModuleModel = getModel('module');
$module_list = $oModuleModel->getModuleList();
$addTables = false;
$wrongPaths = [];
$needUpdate = false;
if(is_array($module_list))
{
$needUpdate = FALSE;
$addTables = FALSE;
$priority = array(
'module' => 1000000,
'member' => 100000,
@ -344,6 +345,10 @@ class adminAdminView extends admin
{
$needUpdate = TRUE;
}
if (!preg_match('/^[a-z0-9_]+$/i', $value->module))
{
$wrongPaths[] = $value->module;
}
}
}
@ -370,6 +375,7 @@ class adminAdminView extends admin
Context::set('module_list', $module_list);
Context::set('needUpdate', false);
Context::set('addTables', $addTables);
Context::set('wrongPaths', $wrongPaths);
Context::set('needUpdate', $needUpdate);
Context::set('newVersionList', $needUpdateList);
Context::set('counterAddonActivated', $counterAddonActivated);

View file

@ -386,3 +386,5 @@ $lang->sitelock_message_help = 'You can use HTML tags.';
$lang->your_ip = 'Your IP';
$lang->sitelock_in_use = 'This site is locked.';
$lang->about_sitelock_in_use = 'Only the administrator and visitors from specified IP addresses can access this site.';
$lang->module_exists_in_wrong_path = 'Module(s) installed in incorrect path';
$lang->about_module_exists_in_wrong_path = 'The following module(s) appear to be installed in incorrect directories.<br />Please ignore this message if you have intentionally renamed a module for testing or debugging purposes.';

View file

@ -382,3 +382,5 @@ $lang->sitelock_message_help = 'HTML 태그를 사용할 수 있습니다.';
$lang->your_ip = '접속하신 IP';
$lang->sitelock_in_use = '사이트 잠금 상태입니다.';
$lang->about_sitelock_in_use = '관리자 및 접속이 허용된 IP에서만 사이트 이용이 가능합니다.';
$lang->module_exists_in_wrong_path = '잘못된 경로에 설치된 모듈이 있습니다.';
$lang->about_module_exists_in_wrong_path = '아래의 모듈이 잘못된 경로에 설치된 것으로 보입니다. 설치 경로를 다시 확인하시기 바랍니다.<br />테스트나 오류 수정을 위해 임시로 모듈을 다른 경로에 옮겨놓으신 경우 이 메시지는 무시하셔도 됩니다.';

View file

@ -93,6 +93,14 @@ body>.x,
color: #666;
text-rendering: auto;
}
.message h2,
.message h3 {
color: #346535;
}
.message.error h2,
.message.error h3 {
color: #943a38;
}
.x h1 {
font-size: 22px;
}

View file

@ -27,16 +27,26 @@
<p>{$lang->about_sitelock_in_use} <a href="{getUrl(['module' => 'admin', 'act' => 'dispAdminConfigSitelock'])}">{$lang->cmd_configure}</a></p>
</div>
<div class="message error" cond="$wrongPaths">
<h2>{$lang->module_exists_in_wrong_path}</h2>
<p>{$lang->about_module_exists_in_wrong_path}</p>
<ul>
<block loop="$wrongPaths => $value">
<li>{$value}</li>
</block>
</ul>
</div>
<div class="message update" cond="$addTables || $needUpdate">
<h2>{$lang->need_complete_configuration}</h2>
<p>{$lang->need_complete_configuration_details}</p>
<ul>
<block loop="$module_list => $key,$value">
<li style="margin:0 0 4px 0" cond="$value->need_install">
<li style="margin:0 0 4px 0" cond="$value->need_install && !in_array($value->module, $wrongPaths)">
{$value->title} ({$value->module})
&nbsp; <button type="button" onclick="doInstallModule('{$value->module}')" class="x_btn x_btn-small">{$lang->need_table}</button>
</li>
<li style="margin:0 0 4px 0" cond="$value->need_update">
<li style="margin:0 0 4px 0" cond="$value->need_update && !in_array($value->module, $wrongPaths)">
{$value->title} ({$value->module})
&nbsp; <button type="button" onclick="doUpdateModule('{$value->module}')" class="x_btn x_btn-small">{$lang->need_update}</button>
</li>