netz98 / n98-magerun

The swiss army knife for Magento developers, sysadmins and devops. The tool provides a huge set of well tested command line commands which save hours of work time. All commands are extendable by a module API.
http://magerun.net/
Other
1.44k stars 400 forks source link

Image & JS/CSS Cache Flush #932

Closed brandontamm closed 7 years ago

brandontamm commented 7 years ago

Read an article mentioning that the below commands work but I am not able to get them to work:

I thought these actually worked previously - were these removed? Any plans for this type of cache clear? Also any plans to implement OpCache clearing? Note: I have created alias for magerun :)

ktomk commented 7 years ago

This is part of a Magerun addon you need to install first, it does not ship with magerun per default.

You can find the addon here on Github: https://github.com/peterjaap/magerun-addons .

brandontamm commented 7 years ago

I see the image cache clean command, but not the js and css cache clean...is there a way to do this?

ktomk commented 7 years ago

Yes, there is. I already commented about it earlier, sorry if that was not clear:

  1. install the Magerun add-on written by Peter Jaap Blaakmeer

You should be able to find information on how to do that within the README.md information given in his repository:

Please let me know if this information is helpful for you.

brandontamm commented 7 years ago

I'm going to feel like a pain for asking this, but am I missing something? I do see the image cache clean and a host of other addon commands.

However, I do not see anything about clearing the cached js and css?

ktomk commented 7 years ago

My mistake, the command media:cache:image:clear is not part of Magerun and I think as well not of the Add-On I linked. I fear that command is not (yet) publicly available. The article you link is perhaps short-sighted on this fact and the author was using an add-on which is not available.

However I hope the Add-On from Peter linked might contain a good alternative to it. But I can't exactly say b/c I don't have any command at hand you named.

@cmuench: You know any of the commands listed above? Maybe these can be published or added to magerun?

brandontamm commented 7 years ago

Thank you for the image cache clearing - that was definitely one I didn't have a workaround for using magerun. I currently turn the js and css merge off, clear all caches and then turn it back on which I believe does the same type of thing but I was hoping for a clean way to do this via magerun.

I also like the idea of the media rsync overs ssh feature and may implement a solution and potential pull request using docker-machine scp instead of ssh to avoid the manual ssh creation. Seems like a great idea for those who use docker :)

ktomk commented 7 years ago

Peter who maintains that add-on is very supportive and if you provide something usable I think he is very willing to take care. I also hope that Christian can shed some light here, I think the commands in question are used internally by Netz98 and they are most likely worth to add to Magerun publicly, I think they are stable enough for that. But he must say if he wishes to release them.

cmuench commented 7 years ago

@ktomk you are right. The commands are provided by an intern netz98 module. I think it's ok to publish them.

ktomk commented 7 years ago

@cmuench that's great to read. looking forward to it, let me know if I can lend you a hand.

cmuench commented 7 years ago

Two new commands are available in develop branch.

ktomk commented 7 years ago

@cmuench: Thanks!

brandontamm commented 7 years ago

These two commands work in the dev branch and are a great addition to Magerun! Thank you!!

brandontamm commented 7 years ago

I am using the magerun-dev release (so I can use the new js and css cache clearing commands) and I keep getting the following error when trying to run my alias for magerun PHP Fatal error: Call to undefined method Symfony\Component\Console\Command\HelpCommand::isHidden() in /var/www/html/vendor/symfony/console/Descriptor/ApplicationDescription.php on line 122

The ironic thing is that I can use all the magerun commands just fine, but when I kept troubleshooting a cache issue, I found that running the basic magerun command (that shows all the commands) results in the error. Is it possible that this error is breaking the commands even though magerun is echoing that the commands have been completed?

See error below ..

     ___ ___
 _ _/ _ ( _ )___ _ __  __ _ __ _ ___ _ _ _  _ _ _
| ' \_, / _ \___| '  \/ _` / _` / -_) '_| || | ' \
|_||_/_/\___/   |_|_|_\__,_\__, \___|_|  \_,_|_||_|
                           |___/
n98-magerun version 1.97.31 by netz98 GmbH

Usage:
  command [options] [arguments]

Options:
  -h, --help                 Display this help message
  -q, --quiet                Do not output any message
  -V, --version              Display this application version
      --ansi                 Force ANSI output
      --no-ansi              Disable ANSI output
  -n, --no-interaction       Do not ask any interactive question
      --root-dir[=ROOT-DIR]  Force magento root dir. No auto detection
      --skip-config          Do not load any custom config.
      --skip-root-check      Do not check if n98-magerun runs as root
  -v|vv|vvv, --verbose       Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

PHP Fatal error:  Call to undefined method Symfony\Component\Console\Command\ 
\HelpCommand::isHidden() in /var/www/html/vendor/symfony/console/Descriptor\
/ApplicationDescription.php on line 122
brandontamm commented 7 years ago

When I run 'self-update' command on version 1.97.31 (dev) ... the dev version is downgraded to 1.97.30.

After the downgrade, the basic command works and shows all commands again without the PHP Fatal Error.

Not sure if the downgrade from dev to stable was expected so I figured I'd make you guys aware.

brandontamm commented 7 years ago

FYI - The jscss and image cache clearing command report that they have run and completed, however, the new cached js and css never show up in the media folder so I'm thinking that the PHP error is breaking that functionality (probably some others too) even though magerun is echo'ing that the commands ran successfully

ktomk commented 7 years ago

The symfony component is loaded from within the vendor folder in /var/www/html/vendor - if you installed Magerun via composer this might be common, however I'm not so sure you did. So perhaps some things intermix here and you run into dependency problems. If you use the phar file from magerun this might signal a problem on the autoloading we do inside Magerun - we re-use from Magento for core functionality, this perhaps interacts with your setup and then also with composer project auto-loading. Maybe this rings a bell on your side.


For the update issue, please use the --unstable switch of the self-update command to obtain the development version:

$  n98-magerun.phar self-update --unstable

This should do the trick.

convenient commented 7 years ago

Hey @ktomk and @cmuench

I was just looking to use media:cache:jscss:clear on an old client but it hasn't been released in a tagged version yet.

Do you have any idea when you are intending on creating a new release?

We try to keep magerun on our production servers at the latest stable version, and I know technically magerun self-update --unstable will probably be fine it would likely concern our sysadmin.

ktomk commented 7 years ago

Normally the development builds are stable thanks to the checks we have running w/ Travis CI. If a build becomes red we're quick w/ fixing. However a point release would be nice, too :) :+1:

convenient commented 7 years ago

@ktomk I know it's pretty stable, you know it's pretty stable.

I just don't want to have the row with the sysadmin to convince him to ignore the message that comes along with magerun self-update --unstable

😆

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! DEVELOPMENT VERSION. DO NOT USE IN PRODUCTION !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
ktomk commented 7 years ago

Well it's perhaps an overstatement that line, the license file has a bigger disclaimer for the stable version even. But only just saying.

Perhaps Monday is a better day for a new dot release, Friday is not. I know that @cmuench has that preference, maybe it's possible to file a new version then soon. We have enough changes that would qualify I'd say.

convenient commented 7 years ago

Hey, sorry I didn't mean to press you to release on a Friday, that'd be mad.

I was just checking for the timeline, days/weeks/months. :)

have a good weekend

On 25 Aug 2017 19:54, "Tom Klingenberg" notifications@github.com wrote:

Well it's perhaps an overstatement that line, the license file has a bigger disclaimer for the stable version even. But only just saying.

Perhaps Monday is a better day for a new dot release, Friday is not. I know that @cmuench https://github.com/cmuench has that preference, maybe it's possible to file a new version then soon. We have enough changes that would qualify I'd say.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/netz98/n98-magerun/issues/932#issuecomment-325008094, or mute the thread https://github.com/notifications/unsubscribe-auth/AAkoflxzTPzllA3LJTxk0-lEB0ZOcruvks5sbxhqgaJpZM4Oi2An .

cmuench commented 7 years ago

@convenient I just created the release branch 1.98.0. If everything is ok, we publish on Monday 28. August.

convenient commented 7 years ago

@cmuench You guys are too good 🙇 Thanks!