Для работы скрипта, достаточно его разместить в корне любого сайта, размещённого в панели ISPmanager и запустить.
Скрипт посчитает все папки от корня аккаунта, а не текущего сайта. Т.е. он посчитает все что лежит в www.
Скрипт работает очень быстро (5-10 секунд).1. Загрузи или создай файл check_inodes.php внутрь папки сайта (туда же, где лежит wp-config.php или index.php от WordPress).
Обычно это папка с доменом или домен/public_html.2. Сам скрипт
<?php /** * Безопасный скрипт подсчета inodes (файлов и папок) * Автор: elizarov_n906 * Версия: 1.2 (Исправлены предупреждения PHP) */ // ========================================== // 1. НАСТРОЙКИ БЕЗОПАСНОСТИ // ========================================== define('MY_SECRET_PASS', 'tvoy_super_sekretniy_parol_123'); // ========================================== // 2. ПРОВЕРКА ДОСТУПА // ========================================== session_start(); if (isset($_POST['do_login']) && isset($_POST['password'])) { if (hash_equals(MY_SECRET_PASS, $_POST['password'])) { $_SESSION['is_auth'] = true; } else { $error = "Неверный пароль!"; } } if (!isset($_SESSION['is_auth'])) { ?> <!DOCTYPE html> <html lang="ru"> <head> <meta charset="UTF-8"> <title>Вход в Inode Checker</title> <style> body { font-family: Arial, sans-serif; display: flex; justify-content: center; align-items: center; height: 100vh; background: #f4f4f4; } .login-box { background: white; padding: 30px; border-radius: 8px; box-shadow: 0 4px 6px rgba(0,0,0,0.1); text-align: center; } input[type="password"] { padding: 10px; width: 200px; margin-bottom: 10px; border: 1px solid #ccc; border-radius: 4px; } button { padding: 10px 20px; background: #0073aa; color: white; border: none; border-radius: 4px; cursor: pointer; } button:hover { background: #005177; } .error { color: red; margin-bottom: 10px; } </style> </head> <body> <div class="login-box"> <h2>Доступ к сканеру inodes</h2> <?php if (isset($error)) echo '<p class="error">' . htmlspecialchars($error) . '</p>'; ?> <form method="POST"> <input type="password" name="password" placeholder="Введите пароль" required> <br> <button type="submit" name="do_login">Войти</button> </form> </div> </body> </html> <?php exit; } // ========================================== // 3. ОПРЕДЕЛЕНИЕ ПУТИ (ИСПРАВЛЕНО: теперь всегда доступно) // ========================================== // dirname(__DIR__) поднимает нас из папки www на уровень выше, в корень аккаунта $target_dir = dirname(__DIR__); // ========================================== // 4. ЛОГИКА ПОДСЧЕТА // ========================================== if (isset($_POST['start_scan'])) { @set_time_limit(300); @ini_set('memory_limit', '512M'); $results = []; $global_files = 0; $global_dirs = 0; function count_items($dir, &$files, &$dirs) { $items = @scandir($dir); if ($items === false) return; foreach ($items as $item) { if ($item === '.' || $item === '..') continue; $path = $dir . DIRECTORY_SEPARATOR . $item; if (is_dir($path)) { $dirs++; count_items($path, $files, $dirs); } else { $files++; } } } $scan_items = @scandir($target_dir); if ($scan_items !== false) { foreach ($scan_items as $item) { if ($item === '.' || $item === '..') continue; $path = $target_dir . DIRECTORY_SEPARATOR . $item; $local_files = 0; $local_dirs = 0; if (is_dir($path)) { $local_dirs = 1; count_items($path, $local_files, $local_dirs); $total = $local_files + $local_dirs; $results[htmlspecialchars($item)] = [ 'files' => $local_files, 'dirs' => $local_dirs, 'total' => $total ]; $global_files += $local_files; $global_dirs += $local_dirs; } else { $global_files++; } } } uasort($results, function($a, $b) { return $b['total'] <=> $a['total']; }); $grand_total = $global_files + $global_dirs; } ?> <!DOCTYPE html> <html lang="ru"> <head> <meta charset="UTF-8"> <title>Сканер Inodes</title> <style> body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; background: #f0f0f1; color: #3c434a; margin: 0; padding: 20px; } .container { max-width: 900px; margin: 0 auto; background: white; padding: 30px; border-radius: 8px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); } h1 { margin-top: 0; } table { width: 100%; border-collapse: collapse; margin-top: 20px; } th, td { padding: 12px; text-align: left; border-bottom: 1px solid #ddd; } th { background: #f6f7f7; font-weight: 600; } .critical { background-color: #ffe6e6 !important; color: #d63638; font-weight: bold; } .warning { background-color: #fff8e5 !important; color: #dba617; font-weight: bold; } .stats-box { background: #f0f6fc; border: 1px solid #c5d9ed; padding: 15px; border-radius: 4px; margin-top: 20px; } .btn { display: inline-block; padding: 10px 20px; background: #2271b1; color: white; text-decoration: none; border-radius: 4px; font-weight: 500; border: none; cursor: pointer; font-size: 14px; } .btn:hover { background: #135e96; } .btn-logout { background: #d63638; float: right; } .btn-logout:hover { background: #b32d2e; } .warning-text { color: #d63638; font-weight: bold; margin-top: 30px; padding: 15px; background: #fcf0f1; border: 1px solid #d63638; border-radius: 4px; } </style> </head> <body> <div class="container"> <a href="?logout=1" class="btn btn-logout">Выйти</a> <h1>Сканер файлов и папок (Inodes)</h1> <p>Сканируется корневая директория аккаунта: <code><?php echo htmlspecialchars($target_dir); ?></code></p> <?php if (!isset($_POST['start_scan'])): ?> <form method="POST"> <p>Нажмите кнопку ниже. Скрипт проверит папки <strong>mail, tmp, backup</strong> и другие в корне вашего аккаунта.</p> <button type="submit" name="start_scan" class="btn">Запустить сканирование корня аккаунта</button> </form> <?php else: ?> <h2>Результаты:</h2> <table> <thead> <tr> <th>Имя папки</th> <th>Файлов</th> <th>Папок</th> <th>Всего inodes</th> <th>Статус</th> </tr> </thead> <tbody> <?php foreach ($results as $name => $data): $status = 'Норма'; $class = ''; if ($data['total'] > 50000) { $status = 'КРИТИЧНО'; $class = 'critical'; } elseif ($data['total'] > 10000) { $status = 'Много'; $class = 'warning'; } ?> <tr class="<?php echo $class; ?>"> <td><?php echo $name . '/'; ?></td> <td><?php echo number_format($data['files'], 0, ',', ' '); ?></td> <td><?php echo number_format($data['dirs'], 0, ',', ' '); ?></td> <td><?php echo number_format($data['total'], 0, ',', ' '); ?></td> <td><?php echo $status; ?></td> </tr> <?php endforeach; ?> <tr style="font-weight: bold; background: #e0e0e0;"> <td>ИТОГО</td> <td><?php echo number_format($global_files, 0, ',', ' '); ?></td> <td><?php echo number_format($global_dirs, 0, ',', ' '); ?></td> <td><?php echo number_format($grand_total, 0, ',', ' '); ?></td> <td></td> </tr> </tbody> </table> <div class="stats-box"> <h3>Краткая статистика:</h3> <ul> <li><strong>Всего объектов (inodes):</strong> <?php echo number_format($grand_total, 0, ',', ' '); ?></li> <li><strong>Из них файлов:</strong> <?php echo number_format($global_files, 0, ',', ' '); ?></li> <li><strong>Из них папок:</strong> <?php echo number_format($global_dirs, 0, ',', ' '); ?></li> </ul> </div> <div class="warning-text"> <strong>ВАЖНО:</strong> Немедленно <strong>удалите этот файл</strong> (`check_inodes.php`) через файловый менеджер после использования! </div> <br> <form method="POST"> <button type="submit" name="start_scan" class="btn">Пересканировать заново</button> </form> <?php endif; ?> </div> </body> </html> <?php if (isset($_GET['logout'])) { session_destroy(); header("Location: " . $_SERVER['PHP_SELF']); exit; } ?>3. Открой файл, например https://zaplata.ru/check_inodes.php
Введи пароль tvoy_super_sekretniy_parol_123
4. Запусти сканер
результат будет примерно таким:
5. удали файл
