Skip to content

[4] Add dry-run and verbose/debug modes to update:joomla:remove-old-files cmd#31943

Merged
drmenzelit merged 5 commits intojoomla:4.0-devfrom
PhilETaylor:cleanupcommand
Jan 12, 2021
Merged

[4] Add dry-run and verbose/debug modes to update:joomla:remove-old-files cmd#31943
drmenzelit merged 5 commits intojoomla:4.0-devfrom
PhilETaylor:cleanupcommand

Conversation

@PhilETaylor
Copy link
Contributor

@PhilETaylor PhilETaylor commented Jan 9, 2021

Closes #31901 replaces #31914

Summary of Changes

Improvements to the update:joomla:remove-old-files CLI Command

  • Adds an option for --dry-run
  • Adds an output change for very verbose mode -vv
  • Adds an output change for debug mode -vvv

--dry-run option is a standard for all Symfony based commands that do destructive things.

-v -vv -vvv options are a standard Symfony command option for increasing the verbosity to assist with debugging and gathering additional information from a command.

Also See #31941 for a proposal to rename this command to Joomla:update:cleanup but this PR can be applied without that one.

Testing Instructions

run these commands to create yourself some folders and files to then go on to delete with the CLI from this PR:

touch administrator/components/com_actionlogs/actionlogs.php
touch administrator/components/com_actionlogs/controller.php
mkdir -p templates/system/images
mkdir -p templates/system/html
mkdir -p templates/protostar/less
mkdir -p templates/protostar/language/en-GB
mkdir -p templates/protostar/language
mkdir -p templates/protostar/js
mkdir -p templates/protostar/img
mkdir -p templates/protostar/images/system

Apply PR.

Run these commands as a test of each new feature:

This command should show s summary, but not delete anything:
php cli/joomla.php update:joomla:remove-old-files --dry-run

Screenshot 2021-01-09 at 15 54 48

--

This command should show what files and folders will be deleted
php cli/joomla.php update:joomla:remove-old-files --dry-run -vv

Screenshot 2021-01-09 at 15 56 24

--

This command should show what files and folders are checked and what will be deleted (output is huge, so screenshots below are snipped to show important bits)
php cli/joomla.php update:joomla:remove-old-files --dry-run -vvv

Screenshot 2021-01-09 at 15 57 42

Screenshot 2021-01-09 at 15 57 53

--

You can then set up your folders/files with the test script above, and run any of these commands to ACTUALLY DELETE the files and folders.

php cli/joomla.php update:joomla:remove-old-files

Screenshot 2021-01-09 at 15 58 42

php cli/joomla.php update:joomla:remove-old-files -vv

Screenshot 2021-01-09 at 16 00 27

and lastly php cli/joomla.php update:joomla:remove-old-files -vvv but Im not going to show that output as its huge and meant for debugging.

Actual result BEFORE applying this Pull Request

Screenshot 2021-01-09 at 16 02 23

Expected result AFTER applying this Pull Request

As explained above

Documentation Changes Required

Phil E. Taylor added 2 commits January 9, 2021 15:49
… cmd

Signed-off-by: Phil E. Taylor <phil@phil-taylor.com>
Signed-off-by: Phil E. Taylor <phil@phil-taylor.com>
Signed-off-by: Phil E. Taylor <phil@phil-taylor.com>
@toivo
Copy link
Contributor

toivo commented Jan 9, 2021

I have tested this item ✅ successfully on 0a2266d

Tested successfully in Beta7-dev of 9 January.

PHP notices were reported each time the remove-old-files command was run
Notice: Undefined variable: supressOutput in C:\www\joomla4\administrator\components\com_admin\script.php on line 6275
Notice: Undefined variable: supressOutput in C:\www\joomla4\administrator\components\com_admin\script.php on line 6280


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/31943.

Phil E. Taylor added 2 commits January 9, 2021 16:46
cs
Signed-off-by: Phil E. Taylor <phil@phil-taylor.com>

cs multi line

Signed-off-by: Phil E. Taylor <phil@phil-taylor.com>

tabs to spaces

Signed-off-by: Phil E. Taylor <phil@phil-taylor.com>

spaces to tabs - even though cs said it wanted spaces grrr

Signed-off-by: Phil E. Taylor <phil@phil-taylor.com>

adding more spaces for the fun of it

Signed-off-by: Phil E. Taylor <phil@phil-taylor.com>

Tabs must be used to indent lines; spaces are not allowed - apparently.

Signed-off-by: Phil E. Taylor <phil@phil-taylor.com>

cs - last chance!

Signed-off-by: Phil E. Taylor <phil@phil-taylor.com>
Signed-off-by: Phil E. Taylor <phil@phil-taylor.com>
@PhilETaylor

This comment was marked as abuse.

Copy link
Contributor

@wilsonge wilsonge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love it. Needs tests. But good job!

@ceford
Copy link
Contributor

ceford commented Jan 10, 2021

I have tested this item ✅ successfully on 3f9d3ce

Works as described. But at the delete stage - best to delete with the -vv option first!


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/31943.

@alikon
Copy link
Contributor

alikon commented Jan 10, 2021

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/31943.

@joomla-cms-bot joomla-cms-bot added RTC This Pull Request is Ready To Commit and removed Documentation Required RTC This Pull Request is Ready To Commit labels Jan 10, 2021
@alikon
Copy link
Contributor

alikon commented Jan 10, 2021

I have tested this item ✅ successfully on 3f9d3ce


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/31943.

@alikon
Copy link
Contributor

alikon commented Jan 10, 2021

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/31943.

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Jan 10, 2021
@PhilETaylor

This comment was marked as abuse.

@ceford
Copy link
Contributor

ceford commented Jan 10, 2021

Sorry if my comment seemed unkind. It was meant for other testers. The testing instructions were excellent - amongst the best I have encountered.

@PhilETaylor

This comment was marked as abuse.

@drmenzelit drmenzelit added this to the Joomla 4.0 milestone Jan 12, 2021
@drmenzelit drmenzelit merged commit f31365e into joomla:4.0-dev Jan 12, 2021
@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Jan 12, 2021
@drmenzelit
Copy link
Collaborator

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants