This commit is contained in:
Mateusz Gruszczyński 2025-05-16 12:32:21 +02:00
parent bad138b96a
commit 4d640c526e
2 changed files with 16 additions and 14 deletions

4
app.py
View File

@ -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)

View File

@ -1,28 +1,26 @@
#!/usr/bin/env php
<?php
if ($argc < 3) {
echo "Usage: php delete_user.php <UID> <DRUPAL_PATH>\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));
if ($account) {
user_delete(array('uid' => $uid));
echo "✅ Próba usunięcia użytkownika $uid.\n";
?>
echo "✅ Użytkownik $uid został usunięty.\n";
} else {
echo "⚠️ Użytkownik $uid nie istnieje.\n";
}