From 97be1beea6efba1e7341b1d7eb75df7f08e7cff1 Mon Sep 17 00:00:00 2001 From: Repellent Date: Thu, 5 Mar 2026 15:27:48 +0500 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=20=D0=BC=D0=B5=D1=82=D0=BE=D0=B4=20=D1=83=D0=B4?= =?UTF-8?q?=D0=B0=D0=BB=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=BC=D0=BE=D0=B4=D1=83?= =?UTF-8?q?=D0=BB=D0=B5=D0=B9=20=D1=81=20=D1=81=D0=B5=D1=80=D0=B2=D0=B5?= =?UTF-8?q?=D1=80=D0=B0=20(=D1=84=D0=B8=D0=B7=D0=B8=D1=87=D0=B5=D1=81?= =?UTF-8?q?=D0=BA=D0=BE=D0=B5=20=D1=83=D0=B4=D0=B0=D0=BB=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D0=B5=20=D0=BA=D0=B0=D1=82=D0=B0=D0=BB=D0=BE=D0=B3=D0=B0=20?= =?UTF-8?q?=D1=81=20=D0=BC=D0=BE=D0=B4=D1=83=D0=BB=D0=B5=D0=BC)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- class/class.modules.php | 49 ++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/class/class.modules.php b/class/class.modules.php index 764db25..a62b9fa 100644 --- a/class/class.modules.php +++ b/class/class.modules.php @@ -596,37 +596,36 @@ } - public function moduleRemove ($dir) - { - global $AVE_Template; +public function moduleRemove ($dir) +{ + global $AVE_Template; - $directory = BASE_DIR . '/modules/' . $dir; + $directory = BASE_DIR . '/modules/' . $dir; - $files = glob($directory . '*', GLOB_MARK); + clearstatcache(); - foreach ($files as $file) - { - if (substr($file, -1) == '/') - { - $this->moduleRemove($file); - } - elseif (!is_dir($file)) - { - unlink($file); - } + if (is_dir($directory)) { + $objects = new RecursiveIteratorIterator( + new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS), + RecursiveIteratorIterator::CHILD_FIRST + ); + + foreach($objects as $name => $object){ + if ($object->isDir()){ + @rmdir($name); + } else { + @unlink($name); + } } + @rmdir($directory); + } - rrmdir ($directory); + $this->clearModulesCache(); + reportLog ($AVE_Template->get_config_vars('MODULES_ACTION_REMOVE') . ' (' . $dir . ')'); - $this->clearModulesCache(); - - // Сохраняем системное сообщение в журнал - reportLog ($AVE_Template->get_config_vars('MODULES_ACTION_REMOVE') . ' (' . $dir . ')'); - - // Выполняем обновление страницы со списком модулей - header('Location:index.php?do=modules&cp=' . SESSION); - exit; - } + header('Location:index.php?do=modules&cp=' . SESSION); + exit; +} /**