28 lines
644 B
PHP
28 lines
644 B
PHP
#!/usr/bin/env php
|
|
<?php
|
|
if ($argc < 3) {
|
|
echo "Usage: php delete_user.php <UID> <DRUPAL_PATH>\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);
|
|
}
|
|
|
|
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);
|
|
}
|
|
|
|
user_delete(array('uid' => $uid));
|
|
echo "✅ Próba usunięcia użytkownika $uid.\n";
|
|
?>
|