-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.php
More file actions
54 lines (47 loc) · 1.62 KB
/
Copy pathscript.php
File metadata and controls
54 lines (47 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
/**
* @package Joomla.Administrator
* @subpackage com_kunenatopic2article
*
* @copyright (C) 2025 Leonid Ratner. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\Cache\Cache;
use Joomla\CMS\Log\Log;
class com_KunenaTopic2ArticleInstallerScript
{
public function uninstall($parent)
{
$this->cleanMenuItems();
$this->clearRouterCache();
return true;
}
private function cleanMenuItems()
{
try {
$db = Factory::getDbo();
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__menu'))
->where($db->quoteName('link') . ' LIKE ' . $db->quote('%option=com_kunenatopic2article%'))
->where($db->quoteName('type') . ' = ' . $db->quote('component'));
$db->setQuery($query);
$db->execute();
} catch (Exception $e) {
Log::add('Error cleaning KunenaTopic2Article menu items: ' . $e->getMessage(), Log::WARNING, 'jerror');
}
}
private function clearRouterCache()
{
try {
// Очистка кэша маршрутизации Joomla 5
$cache = Factory::getCache('com_menus', '');
$cache->clean();
$cache = Factory::getCache('com_router', '');
$cache->clean();
} catch (\Throwable $e) {
Log::add('Error clearing KunenaTopic2Article router cache: ' . $e->getMessage(), Log::WARNING, 'jerror');
}
}
}