User tests: Successful: Unsuccessful:
Pull Request for Issue #29819 .
added confirmation step before delete a user
php cli/joomla.php user:delete
User deleted without confirmation
a confirmation is required
? probably yes
Status | New | ⇒ | Pending |
Category | ⇒ | Libraries |
I have tested this item
The question is asked but it doesn't wait for a response
C:\htdocs\joomla-cms\cli>php joomla.php user:delete --username test
Are you sure you want to delete this user? [yes/no]:
[OK] User test deleted!
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2020-06-29 10:12:22 |
Closed_By | ⇒ | alikon | |
Labels |
Added:
?
|
Status | Closed | ⇒ | New |
Closed_Date | 2020-06-29 10:12:22 | ⇒ | |
Closed_By | alikon | ⇒ |
Status | New | ⇒ | Pending |
implemented the tip #29819 (comment) (1st part only)
That's the bit I mentioned in #29819 (comment)
It seems like your shell session is being detected as non-interactive and that's causing the issues you're seeing. Whether that's a piece missing in Joomla\Console\Application
compared to Symfony\Component\Console\Application
or there's some environment missing support, I couldn't tell you, but the fact you're getting abort messages in what appears to be detected as a non-interactive environment is at least correct behavior for that part of the system.
@brianteeman See if when you run php cli/joomla.php
if either https://github.com/joomla-framework/console/blob/master/src/Application.php#L270 or https://github.com/joomla-framework/console/blob/master/src/Application.php#L276 are being triggered. They shouldn't be based on the screenshots you have, but those are the only spots which flip the console input to a non-interactive state in the Joomla application class (symfony/symfony@87bd741 was never ported from Symfony so the env var that added support for isn't a factor here). Otherwise, you're going to need to add something like a var_dump(debug_backtrace());die;
inside Symfony\Component\Console\Input\Input::setInteractive()
to see what's flipping the switch; the input API defaults to interactive so something is forcing it to non-interactive, it'd be good to figure out what that something is.
I have tested this item
Tested successfully in Beta2-dev of 29 June.
Wampserver 3.2.2 Apache 2.4.43 MySQL 8.0.20 PHP 7.4.7
@mbabker looks like it may be a php bug with 7.4.0 symfony/symfony#34702
I can confirm my problem was a bug in php 7.4.0 and its all good in 7.4.7
just needs the non-interactive thing @wilsonge requires
I have tested this item
Works fine with PHP version 7.3.19 and Joomla beta3-dev.
@richard67 i hope i've understood correctly @wilsonge
using the non-interactive flag -n, --no-interaction Flag to disable interacting with the user
php cli/joomla.php user:delete --username aaaa -n
delete the user in a non interactive way
ok let me change the order then
yes i think so now
I have tested this item
Tested on PHP 7.4.8, Joomla 4.0.0-beta3-dev
i created a user (super user) with the name te
. The user admin is
active.
My test before applying this patch
$ php cli/joomla.php user:delete
Please enter a username:
> admin
Delete users
============
[ERROR] You can't delete the last active Super User
$ php cli/joomla.php user:delete
Please enter a username:
> test
Delete users
============
[ERROR] test does not exist!
$ php cli/joomla.php user:delete
Please enter a username:
> te
Delete users
============
[OK] User te deleted!
Then I applied the path via
git fetch origin pull/29827/head:patch-117
git checkout patch-117
i created a user (super user) with the name te
. The user admin is
active.
After that
$ php cli/joomla.php user:delete
Please enter a username:
> admin
Delete users
============
Are you sure you want to delete this user? (yes/no) [no]:
> yes
[ERROR] You can't delete the last active Super User
$ php cli/joomla.php user:delete
Please enter a username:
> testt
Delete users
============
[ERROR] testt does not exist!
$ php cli/joomla.php user:delete
Please enter a username:
> te
Delete users
============
Are you sure you want to delete this user? (yes/no) [no]:
> jsdklfjdslfls
! [NOTE] User not deleted
$ php cli/joomla.php user:delete
Please enter a username:
> te
Delete users
============
Are you sure you want to delete this user? (yes/no) [no]:
> no
! [NOTE] User not deleted
$ php cli/joomla.php user:delete
Please enter a username:
> te
Delete users
============
Are you sure you want to delete this user? (yes/no) [no]:
> yes
[OK] User te deleted!
I have tested this item
Status | Pending | ⇒ | Ready to Commit |
rtc
Status | Ready to Commit | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2020-07-25 22:57:35 |
Closed_By | ⇒ | wilsonge | |
Labels |
Added:
?
|
Thanks!
Would it not be better to check if the response is "yes" before deleting.