From 225542acd9dfcbfb9ff4b3af5743f88964a38b80 Mon Sep 17 00:00:00 2001 From: Terranom674 Date: Thu, 20 Aug 2026 10:32:24 +0200 Subject: [PATCH] Remove legacy local runtime cleanup --- runtime/cleanup-stale.php | 86 --------------------------------------- 1 file changed, 86 deletions(-) delete mode 100644 runtime/cleanup-stale.php diff --git a/runtime/cleanup-stale.php b/runtime/cleanup-stale.php deleted file mode 100644 index 7f343a2..0000000 --- a/runtime/cleanup-stale.php +++ /dev/null @@ -1,86 +0,0 @@ -#!/usr/bin/env php -connect_errno) cleanup_fail('Piwigo-Datenbank ist nicht erreichbar: '.$db->connect_error); -$db->set_charset('utf8mb4'); - -$table = $prefixeTable.'bratonien_tools_nc_connections'; -$escapedTable = $db->real_escape_string($table); -$exists = $db->query("SHOW TABLES LIKE '{$escapedTable}'"); -if (!$exists) cleanup_fail('Connector-Tabelle konnte nicht geprüft werden: '.$db->error); -if ($exists->num_rows === 0) exit(0); - -$activeIds = array(); -$result = $db->query("SELECT id FROM `{$table}`"); -if (!$result) cleanup_fail('Connector-Verbindungen konnten nicht gelesen werden: '.$db->error); -while ($row = $result->fetch_assoc()) -{ - $activeIds[(int)$row['id']] = true; -} - -if (!is_dir($configDir)) exit(0); -foreach (glob($configDir.'/connection-*.conf') ?: array() as $configPath) -{ - if (!preg_match('/connection-([0-9]+)\.conf$/', $configPath, $matches)) continue; - $id = (int)$matches[1]; - if (isset($activeIds[$id])) continue; - - echo "NC Connector: entferne verwaiste Laufzeitdateien fuer Verbindung {$id}.\n"; - foreach (array('.conf','.db-password','.piwigo-password','.storages.tsv','.roots.tsv') as $suffix) - { - @unlink($configDir.'/connection-'.$id.$suffix); - } - cleanup_tree($stateRoot.'/connection-'.$id); - - $statusDir = rtrim($piwigoRoot, '/').'/_data/bratonien-tools/nc-connector-status'; - @unlink($statusDir.'/connection-'.$id.'.json'); - @unlink($statusDir.'/deleted-'.$id); -} - -exit(0);