This commit is contained in:
Alexey Berezhok
2026-07-20 01:00:35 +03:00
parent e85d945984
commit 6e32005129
5 changed files with 80 additions and 24 deletions

View File

@@ -72,4 +72,16 @@ sudo dnf install _packages/ispmanager-plugin-nginx_mod_rewrite_plugin-0.0.1-1.el
Если вдруг установка провалилась, лог установки можно изучить здесь - `/usr/local/mgr5/var/nginx-mod-rewrite-plugin.log`
Если все прошло успешно, то необходимо перейти
Если все прошло успешно, то необходимо перейти в раздел "Модули":
![Модули](img/isp_mod_rewrite1.png)
Найти модуль с названием "Модуль nginx mod_rewrite" и нажать на значек настройки модуля. На изображении выше обведены синим контуром.
Далее откроется окно сборки модуля:
![Сборка](img/isp_mod_rewrite2.png)
Для отмены сборки, нажмите кнопку "Отменить сборку". Для сборки и установки хука пересборки при обновлении nginx необходимо нажать "Собать модуль и установить хук на пересборку".
Процесс сборки можно будет изучить в логе: `/usr/local/mgr5/var/nginx-mod-rewrite-plugin.log.

BIN
img/isp_mod_rewrite1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

BIN
img/isp_mod_rewrite2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

View File

@@ -68,6 +68,10 @@ def Handle(root):
result = True
result_error = CheckModuleExists()
if result_error is None:
for parent in root.iter():
for child in list(parent):
if child.tag == 'textdata' and child.get('name') == 'nginx_mod_rewrite_plugin_msg_info':
parent.remove(child)
result_error = InstallModule()
result = result_error is None
@@ -84,6 +88,22 @@ def Handle(root):
param = etree.SubElement(error, 'param')
param.set('name', 'value')
param.text = result_error
else:
# Add <ok/> element to root
etree.SubElement(root, 'ok')
else:
# Remove textdata element with name="nginx_mod_rewrite_plugin_msg"
for parent in root.iter():
for child in list(parent):
if child.tag == 'textdata' and child.get('name') == 'nginx_mod_rewrite_plugin_msg':
parent.remove(child)
# Find the messages element with name "nginx_mod_rewrite_plugin.settings"
messages_elem = root.find(".//messages[@name='nginx_mod_rewrite_plugin.settings']")
if messages_elem is not None:
# Find the msg element with name "msg_create" and change its text
msg_create_elem = messages_elem.find(".//msg[@name='msg_create']")
if msg_create_elem is not None:
msg_create_elem.text = 'Ничего не делать'
if __name__ == "__main__":
@@ -100,6 +120,28 @@ if __name__ == "__main__":
if correct_function:
if os.getenv("PARAM_clicked_button") == "ok":
Handle(root)
else:
result_error = CheckModuleExists()
if result_error is None:
for parent in root.iter():
for child in list(parent):
if child.tag == 'textdata' and child.get('name') == 'nginx_mod_rewrite_plugin_msg_info':
parent.remove(child)
else:
# Remove textdata element with name="nginx_mod_rewrite_plugin_msg"
for parent in root.iter():
for child in list(parent):
if child.tag == 'textdata' and child.get('name') == 'nginx_mod_rewrite_plugin_msg':
parent.remove(child)
# Find the messages element with name "nginx_mod_rewrite_plugin.settings"
messages_elem = root.find(".//messages[@name='nginx_mod_rewrite_plugin.settings']")
if messages_elem is not None:
# Find the msg element with name "msg_create" and change its text
msg_create_elem = messages_elem.find(".//msg[@name='msg_create']")
if msg_create_elem is not None:
msg_create_elem.text = 'Ничего не делать'
etree.dump(root)
quit(0)

View File

@@ -11,7 +11,8 @@
<metadata name="nginx_mod_rewrite_plugin.settings" type="form" mgr="ispmgr">
<form>
<field name="nginx_mod_rewrite_plugin_field" noname="yes" fullwidth="yes">
<textdata name="nginx_mod_rewrite_plugin_msg" type="msg" />
<textdata name="nginx_mod_rewrite_plugin_msg" type="banner" status="warning"/>
<textdata name="nginx_mod_rewrite_plugin_msg_info" type="banner" status="info"/>
</field>
</form>
<buttons>
@@ -66,6 +67,7 @@
<messages name="nginx_mod_rewrite_plugin.settings">
<msg name="title">Установка модуля для nginx</msg>
<msg name="nginx_mod_rewrite_plugin_msg">Данный плагин установит ряд пакетов для сборки модуля nginx</msg>
<msg name="nginx_mod_rewrite_plugin_msg_info">Модуль уже установлен</msg>
<msg name="msg_create">Собрать модуль и установить хук на пересборку</msg>
<msg name="msg_back">&lt;&lt; Отменить сборку</msg>
</messages>