blob: baa81b893ca96ed2aee4123e8605c3ec162c7f14 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
#!/usr/bin/php
<?php
require('_cli.php');
$options = getopt('', array(
'user:',
));
if (empty($options['user'])) {
fail('Usage: ' . basename(__FILE__) . " --user username");
}
$username = $options['user'];
if (!FreshRSS_user_Controller::checkUsername($username)) {
fail('FreshRSS error: invalid username “' . $username . '”');
}
$usernames = listUsers();
if (!preg_grep("/^$username$/i", $usernames)) {
fail('FreshRSS error: username not found “' . $username . '”');
}
if (strcasecmp($username, FreshRSS_Context::$system_conf->default_user) === 0) {
fail('FreshRSS error: default user must not be deleted: “' . $username . '”');
}
echo 'FreshRSS deleting user “', $username, "”…\n";
$ok = FreshRSS_user_Controller::deleteUser($username);
invalidateHttpCache(FreshRSS_Context::$system_conf->default_user);
done($ok);
|