Protect install.xml with is_file and try-catch against abrupt uninstall

This commit is contained in:
nertyog 2026-09-28 16:52:10 +03:00
parent 41b4fbaa35
commit d6a56769a2
2 changed files with 55 additions and 45 deletions

View File

@ -11,6 +11,8 @@
<operation error="skip">
<search><![CDATA[if ($this->user->hasPermission('access', 'catalog/product')) {]]></search>
<add position="before"><![CDATA[
try {
if (is_file(DIR_APPLICATION . 'controller/module/poll_widget_nat.php')) {
$this->load->model('setting/setting');
$nat_status = $this->config->get('module_poll_widget_nat_status');
if ($nat_status === null || $nat_status) {
@ -48,6 +50,9 @@
}
}
}
}
} catch (\Throwable $e) {
}
]]></add>
</operation>
</file>
@ -56,9 +61,11 @@
<operation error="skip">
<search><![CDATA[$data['logout'] = $this->url->link('common/logout']]></search>
<add position="before"><![CDATA[
try {
if (!isset($data['nat_menus'])) {
$data['nat_menus'] = array();
}
if (is_file(DIR_APPLICATION . 'controller/module/poll_widget_nat.php')) {
$this->load->model('setting/setting');
$nat_status = $this->config->get('module_poll_widget_nat_status');
if ($nat_status === null || $nat_status) {
@ -73,6 +80,9 @@
}
}
}
}
} catch (\Throwable $e) {
}
]]></add>
</operation>
</file>