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 skipped_with_points += 1
continue continue
if (user.get('post_count') or 0) > 0:
# Pomijamy użytkownika, który dodał treści
continue
# Pomijanie aktywnych "weteranów" # Pomijanie aktywnych "weteranów"
created_year = datetime.datetime.fromtimestamp(user['created']).year if user.get('created') else None created_year = datetime.datetime.fromtimestamp(user['created']).year if user.get('created') else None
recent_login_threshold = now_ts - (args.recent_login_days * 86400) recent_login_threshold = now_ts - (args.recent_login_days * 86400)

View File

@ -1,28 +1,26 @@
#!/usr/bin/env php #!/usr/bin/env php
<?php <?php
if ($argc < 3) { 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); exit(1);
} }
$uid = (int) $argv[1]; $uid = (int) $argv[1];
$drupal_path = rtrim($argv[2], '/'); $drupal_path = $argv[2];
if (!file_exists($drupal_path . '/includes/bootstrap.inc')) {
echo "❌ Nie znaleziono bootstrap.inc w: $drupal_path\n";
exit(1);
}
// Bootstrap Drupala
define('DRUPAL_ROOT', $drupal_path); define('DRUPAL_ROOT', $drupal_path);
chdir(DRUPAL_ROOT); chdir(DRUPAL_ROOT);
require_once DRUPAL_ROOT . '/includes/bootstrap.inc'; require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
if ($uid <= 0) { // Załaduj użytkownika
echo "❌ UID musi być większy niż 0.\n"; $account = user_load(array('uid' => $uid));
exit(1);
}
if ($account) {
user_delete(array('uid' => $uid)); 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";
}