Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added 'status' command for cache cli script / Also improved readability ... #870

Closed
wants to merge 0 commits into from

Conversation

facundocapua
Copy link
Contributor

...in output messages

@maksek maksek added PS Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development labels Dec 25, 2014
@maksek maksek self-assigned this Dec 26, 2014
@maksek
Copy link
Contributor

maksek commented Dec 29, 2014

HI @fcapua-summa, can you please provide more details in description. Use cases, output format and specifics of "improved readability". Thanks.

@maksek maksek removed their assignment Dec 29, 2014
@maksek maksek added Progress: needs update and removed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development labels Dec 29, 2014
@maksek maksek self-assigned this Dec 29, 2014
@facundocapua
Copy link
Contributor Author

Hi @maksek , sorry for the lack of details, let me explain what are the changes about:

I've made 2 changes, both in the script for cache management via command line:

  • Added 'status' command: The status of each cache type was being displayed at the end of every execution. I think it makes much more sense to have a command that let's you see the status as it is usually seen in this type of scripts.

    Actually, there is an 'info' command as part of the indexer.php script and also a 'status' command as part of the log.php script; so for me it was reasonable to have a 'status' command as part of the cache.php script instead of displaying the information every time the script is executed.
  • The second change I've made is related to readability, for example, a flush command looks like this:
vagrant@packer-virtualbox-iso:/vagrant/htdocs/dev/shell$ php cache.php --flush
Flushed cache types: config, layout, block_html, view_files_fallback, view_files_preprocessing, collections, db_ddl, eav, full_page, translate, config_integration, config_webservice, config_integration_api
Current status:
                        config: 1
                        layout: 1
                    block_html: 1
           view_files_fallback: 1
      view_files_preprocessing: 1
                   collections: 1
                        db_ddl: 1
                           eav: 1
                     full_page: 1
                     translate: 1
            config_integration: 1
             config_webservice: 1
        config_integration_api: 1vagrant@packer-virtualbox-iso:/vagrant/htdocs/dev/shell$

As you can see all the cache flushed are in the same line separated with comma, which is hard to read. There is also a line break missing at the end of the output.

After the changes I've made, now this is the output for the flush:

vagrant@packer-virtualbox-iso:/vagrant/htdocs/dev/shell$ php cache.php --flush
Flushed cache types:
config
layout
block_html
view_files_fallback
view_files_preprocessing
collections
db_ddl
eav
full_page
translate
config_integration
config_webservice
config_integration_api
vagrant@packer-virtualbox-iso:/vagrant/htdocs/dev/shell$

The changes for readability affects all commands that list cache types (flush, clean and set -when some type of cache is enabled and gets flushed-).

Of course, I've updated the Unit tests scripts accordingly.

Let me know if this clarifies what the change are about. Thanks!

@verklov
Copy link
Contributor

verklov commented Jan 5, 2015

MAGETWO-32765

@maksek
Copy link
Contributor

maksek commented Jan 6, 2015

Thanks @fcapua-summa, very nice description. We are reviewing the PR.

@maksek maksek added Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development and removed Progress: needs update labels Jan 6, 2015
@antonmakarenko
Copy link

As for me, the "status" change is detrimental for usability. Displaying status unconditionally is always more informative -- no matter change you made or even if you didn't perform any changes (just to see status). Why do you need a special command for it? What if you ran the command with no arguments? Displaying status is better than displaying nothing (sure, you can display a "help" in order to discover there is a "status" command -- but why have this extra step?).

Why is comma-separated line hard to read?

May I suggest these changes only:

  • Improve readability of the "affected cache types" list by moving it to next line with an indent -- this way it is going to be emphasized, yet won't bloat half of your screen
  • Fix for the missed trailing end of line

@facundocapua
Copy link
Contributor Author

@antonmakarenko I mostly agree with what you are saying about the 'status' command. However, it is consistent with the other cli tools provided.

When running indexer.php alone, this is the output:

php indexer.php
Usage:  php -f indexer.php -- [options]

  --status <indexer>            Show Indexer(s) Status
  --mode <indexer>              Show Indexer(s) Index Mode
  --mode-realtime <indexer>     Set index mode type "Update on Save"
  --mode-schedule <indexer>     Set index mode type "Update by Schedule"
  --reindex <indexer>           Reindex Data
  info                          Show allowed indexers
  reindexall                    Reindex Data by all indexers
  help                          This help

  <indexer>     Comma separated indexer codes or value "all" for all indexers

When running dependency.php this is the output:

php dependency.php
Usage: php -f dependency.php -- [--list-modules] [--list-components][--list-component-dependencies component_name]
        [--list-component-dependents component_name] [--list-module-dependencies module-name]
        [--list module-dependents module-name] [--direct-dependency-only]
        --help - print usage message
        --list-modules - list all modules in order of module dependency
        --list-components - list all components consisting of circularly dependent modules
        --list-component-dependencies - list components that the specified component depends on
        --list-component-dependents - list components that depends on the specified components
        --list-module-dependencies - list modules that the specified module depends on
        --list-module-dependents - list modules that depends on the specified module
        --direct-dependency-only - only return direct dependencies

When running log.php, this is the output:

php log.php
Usage:  php -f log.php -- [options]
        php -f log.php -- clean --days 1

  clean             Clean Logs
  --days <days>     Save log, days. (Minimum 1 day, if defined - ignoring system value)
  status            Display statistics per log tables
  help              This help

I agree with the fact that to get the cache type status you have an extra step, but it is just the first time, once you know you won't need that extra step.

I think it also has to be with the practise of avoiding developers lose control of what they are doing. Why should I get the status when no instruction of doing that is given?

Regarding readability, it's not that is "really hard to read", you can easily read items separated by comma, but it has to be with the fact that the cache types are usually presented as a list; actually in the same cli tool when running any other command than flushing, the cache types are presented as a list.
I think is easier to find if you are looking for a particular cache type; and as shown in my previous comment, the status took way more presence rather than the list of cache types flushed in the "flush" command execution.

Let me know if this makes sense, or something is not clear enough.

@facundocapua
Copy link
Contributor Author

I don't know why this PR was closed, I was trying to create a new PR for other issue and it appeared here as closed.

I must have messed something up. I created a new PR with the changes: #949

Sorry for the inconvenience.

magento-team pushed a commit that referenced this pull request Feb 28, 2017
fe-lix- pushed a commit to fe-lix-/magento2 that referenced this pull request Apr 29, 2018
MSI-868: Validation for URL key doesn't work and this leads to HTTP ERROR 500
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants