From 4d640c526e9d79b06ed329de2b5b4405c31db846 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Gruszczy=C5=84ski?= Date: Fri, 16 May 2025 12:32:21 +0200 Subject: [PATCH] zmiany --- app.py | 4 ++++ delete_user.php | 26 ++++++++++++-------------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/app.py b/app.py index 5fbf1ab..32c9643 100644 --- a/app.py +++ b/app.py @@ -233,6 +233,10 @@ def main(): skipped_with_points += 1 continue + if (user.get('post_count') or 0) > 0: + # Pomijamy użytkownika, który dodał treści + continue + # Pomijanie aktywnych "weteranów" created_year = datetime.datetime.fromtimestamp(user['created']).year if user.get('created') else None recent_login_threshold = now_ts - (args.recent_login_days * 86400) diff --git a/delete_user.php b/delete_user.php index fa603d2..09d1132 100644 --- a/delete_user.php +++ b/delete_user.php @@ -1,28 +1,26 @@ #!/usr/bin/env php \n"; + echo "❌ Użycie: php delete_user.php UID /sciezka/do/drupala\n"; exit(1); } $uid = (int) $argv[1]; -$drupal_path = rtrim($argv[2], '/'); - -if (!file_exists($drupal_path . '/includes/bootstrap.inc')) { - echo "❌ Nie znaleziono bootstrap.inc w: $drupal_path\n"; - exit(1); -} +$drupal_path = $argv[2]; +// Bootstrap Drupala define('DRUPAL_ROOT', $drupal_path); chdir(DRUPAL_ROOT); require_once DRUPAL_ROOT . '/includes/bootstrap.inc'; drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); -if ($uid <= 0) { - echo "❌ UID musi być większy niż 0.\n"; - exit(1); -} +// Załaduj użytkownika +$account = user_load(array('uid' => $uid)); -user_delete(array('uid' => $uid)); -echo "✅ Próba usunięcia użytkownika $uid.\n"; -?> \ No newline at end of file +if ($account) { + user_delete(array('uid' => $uid)); + echo "✅ Użytkownik $uid został usunięty.\n"; +} else { + echo "⚠️ Użytkownik $uid nie istnieje.\n"; +}