mirror of
https://github.com/FreshRSS/FreshRSS.git
synced 2026-01-18 02:07:53 -05:00
For uniformity, and to avoid having PHP searching in include_path. http://php.net/manual/function.include.php https://github.com/FreshRSS/FreshRSS/pull/1715 https://github.com/FreshRSS/FreshRSS/pull/1711#issuecomment-350581350
33 lines
860 B
PHP
Executable File
33 lines
860 B
PHP
Executable File
#!/usr/bin/php
|
|
<?php
|
|
require(__DIR__ . '/_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);
|