Git Product home page Git Product logo

magento-cache-clean's People

Contributors

davidalger avatar davidlambauer avatar rafaelstz avatar ryantfowler avatar thampe avatar vesan-lw avatar vinai avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

magento-cache-clean's Issues

Error: ENOENT: no such file or directory,

Hi @JDavidVR, I moved your issue into it's own thread because it's not related to windows compatibility.
Your original post is below:


Hi @Vinai,
First of all, thanks for such a useful tool for magento development, today I've upgraded to version .28 and I am facing an issue reported here, in my case I am a mac user, so I am attaching the log issue, magento version EE-2.2.6

composer global show
Changed current directory to /Users/david/.composer
mage2tv/magento-cache-clean 0.0.28 A faster drop in replacement for bin/magento cache:clean with file watcher
Cleaning cache type(s) block_html full_page
fs.js:122
    throw err;
    ^

Error: ENOENT: no such file or directory, unlink '/Volumes/HOME/projects/m2/umgsubs226/var/cache/mage--5/mage---c34_BLOCK_3312FB7323BCBD5F5A27C1FF5E2CD195BF04B592'
    at Object.unlinkSync (fs.js:975:3)
    at Nh (/Users/david/.composer/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:331:292)
    at Ti (/Users/david/.composer/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:353:525)
    at /Users/david/.composer/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:358:125
    at /Users/david/.composer/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:316:275
    at X.g.da (/Users/david/.composer/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:207:133)
    at eb (/Users/david/.composer/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:104:350)
    at pg (/Users/david/.composer/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:316:238)
    at Ui.g.Db (/Users/david/.composer/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:358:85)
    at bi (/Users/david/.composer/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:337:57)

no space left on device

magento@dev:~/html$ vendor/bin/cache-clean.js --watch
Sponsored by https://www.mage2.tv

[ERROR] ENOSPC: no space left on device, watch '/var/www/html/vendor/magento/module-admin-notification/Model/ResourceModel/System/Message/Collection'

This error confuses me - what's meant by "space"?
There's 30G space available on the system and over 3.5G of RAM during runtime.

TypeError: re-find must match against a string.

/data/web/magento2/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:289
function Sf(a){a:for(var b=a;;)if(b=M(b))b=F(b);else break a;return a}function Tf(a,b){if("string"===typeof b)return a=a.exec(b),null==a?null:1===R(a)?E(a):Pe(a);throw new TypeError("re-find must match against a string.");}
                                                                                                                                                                  ^

TypeError: re-find must match against a string.
    at Tf (/data/web/magento2/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:289:169)
    at sk (/data/web/magento2/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:396:78)
    at /data/web/magento2/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:397:101
    at d (/data/web/magento2/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:322:135)
    at FSWatcher.<anonymous> (/data/web/magento2/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:321:138)
    at FSWatcher.emit (events.js:180:13)
    at FSEvent.FSWatcher._handle.onchange (fs.js:1384:12)

Add special section to remove cache notice in admin

In the magento admin, often the message "Some or more caches are invalidated" is displayed.
Often this message is not actually true. The cache records where already removed, however, the cache state is also saved as a cache record.

Out of the box the specific cache has to be cleaned through the UI, or a complete flush has to be made, to get rid of the message.

I would like to have a special "type" so I can get rid of the message via the command line, without doing a full cache flush.
Something like cache-clean.js notice. There could also be a hotkey for that action.
It would remove only the cache record by ID that saves the cache invalidation state.,

Not Working With Redis Over Socket

Expected Behavior

The cache should be cleared.

Actual Behavior

The following error is thrown:

$ vendor/bin/cache-clean.js
Sponsored by https://www.mage2.tv

Flushing all caches
events.js:167
      throw er; // Unhandled 'error' event
      ^

Error: Redis connection to /tmp/redis.sock:6379 failed - getaddrinfo ENOTFOUND /tmp/redis.sock /tmp/redis.sock:6379
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:57:26)
Emitted 'error' event at:
    at RedisClient.on_error (/Volumes/Development/Sites/mage22/vendor/mage2tv/magento-cache-clean/node_modules/redis/index.js:406:14)
    at Socket.<anonymous> (/Volumes/Development/Sites/mage22/vendor/mage2tv/magento-cache-clean/node_modules/redis/index.js:279:14)
    at Socket.emit (events.js:182:13)
    at emitErrorNT (internal/streams/destroy.js:82:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)
    at process._tickCallback (internal/process/next_tick.js:63:19)

Steps to Reproduce the Problem

  1. Set up Redis to a use a socket
  2. Configure Magento to connect to Redis over that socket for Cache, FPC and sessions
  3. Run the CLI tool

Specifications

  • Magento Version: 2.2.5 (Vanilla, no third-party extensions or themes)
  • PHP Version: 7.1.20
  • Node.js Version: 10.9.0
  • Platform: MacOS 10.13.6

Additional Details

Here is my Redis configuration, which works fine with Magento:

    'session' => [
        'save' => 'redis',
        'redis' => [
            'host' => '/tmp/redis.sock',
            'port' => '6379',
            'password' => '',
            'timeout' => '2.5',
            'persistent_identifier' => '',
            'database' => '3',
            'compression_threshold' => '2048',
            'compression_library' => 'gzip',
            'log_level' => '1',
            'max_concurrency' => '6',
            'break_after_frontend' => '5',
            'break_after_adminhtml' => '30',
            'first_lifetime' => '600',
            'bot_first_lifetime' => '60',
            'bot_lifetime' => '7200',
            'disable_locking' => '0',
            'min_lifetime' => '60',
            'max_lifetime' => '2592000'
        ]
    ],
    'cache' => [
        'frontend' => [
            'default' => [
                'backend' => 'Cm_Cache_Backend_Redis',
                'backend_options' => [
                    'server' => '/tmp/redis.sock',
                    'port' => '6379',
                    'database' => '5'
                ]
            ],
            'page_cache' => [
                'backend' => 'Cm_Cache_Backend_Redis',
                'backend_options' => [
                    'server' => '/tmp/redis.sock',
                    'port' => '6379',
                    'database' => '4',
                    'compress_data' => '0'
                ]
            ]
        ]
    ],

Docker friendly changes

Hi, and thanks for the wonderful module.
I've spent some time making the module work on Docker, and I can confirm it's working fine. But I've stumbled upon some issues. The module makes two php calls, which obviously can't work inside a node container, and I don't find it a good idea to use mixed purpose containers (php+node). Fortunately, the calls are really simple so I've just run them and saved the output:
php -r "require 'app/vendor/autoload.php'; foreach ((new \Magento\Framework\Component\ComponentRegistrar)->getPaths('module') as \$m) echo \$m.PHP_EOL;" > modules.cfg
php -r "echo json_encode( require 'app/etc/env.php' ?? []);" > settings.cfg
This can be easily run inside the php container and stored in a location of your choice. After that, I've just rewritten the cache-clean.js to use the two saved files. I am not fluent enough with closurescript to do a PR, but it will be a nice option to check first for a static file with configuration, and if not present then proceed with php calls. This will allow some further customizations like having a more fine-grained filter for watch locations. I don't think I need to watch for files inside vendor, or at least not for all of them.

Delete Interceptors When Constructor Arguments Updated

As soon as constructor arguments are updated, interceptors under generated/code/Namespace/Module/Path/To/Class.php should be deleted. Otherwise, the following error will occur:

Type Error occurred when creating object: Namespace\\Module\\Path\\To\\Class\\Interceptor

This just happened to me with cache-clean.js version 0.0.33 while updating the constructor arguments for a controller. I simply added another dependency.

Thanks Vinai!

activate cache-clean.js hotkeys in php storm

Description
after installing cache-clen.js tool globally and node js, I have added the cache-clean tool to PHP Storm startup but I did not found nodejs.console in the registry to check on it. and it does not detect any change automatically while running it from the command:
~/.composer/vendor/bin/cache-clean.js -w

Specifications

  1. PHP Storm 2018.1
  2. Magento community edition 2.2.7 with sample data for development porpuses.
  3. node js 10.15.3
  4. Mac OS Mojave 10.14.3
  5. there is no addition caching in env file.

Expected result

  1. when the tool work on startup should detect any change automatically and the hotkeys are enabled.
  2. working automatically also when running it from the command without clicking on the terminal each time.

Actual result

  1. the tool works in the startup but not detect any change and the hotkeys still disabled.
  2. nodejs.console is not existed on the registry list to check it.
  3. not working automatically from the command:
    ~/.composer/vendor/bin/cache-clean.js -w
    each time I should click on the terminal to detect the change.

Clean cache for Tests

Is it possible to clean cache for tests?

s.th. like "magento/dev/tests/integration/tmp/sandbox-0-98ce46182683c6685f2648b5f3c89b90" isn't touched when cleaning cache using your tool or?

Process Crashes When Switching Branches

I use a local composer repository. So for instance, under src/Namespace/Module, I have a module and src/*/* is configured as a local repository. Hence, modules are symlinked into the vendor directory.

When I switch between branches, where a module is only available on one branch, the process crashes with an error like this:

17:02:35 Cleaning cache type(s) block_html full_page
PHP Warning:  require(/var/www/my-m2-project/vendor/composer/../namespace/module/registration.php): failed to open stream: No such file or directory in /var/www/my-m2-project/vendor/composer/autoload_real.php on line 70
PHP Fatal error:  require(): Failed opening required '/var/www/my-m2-project/vendor/composer/../namespace/module/registration.php' (include_path='/var/www/my-m2-project/vendor/magento/zendframework1/library:.:/usr/share/php:/var/www/my-m2-project/vendor/deployer/recipes:/var/www/my-m2-project/vendor/jalogut/magento2-deployer-plus') in /var/www/my-m2-project/vendor/composer/autoload_real.php on line 70
child_process.js:660
    throw err;
    ^

Error: Command failed: php -r "require '/var/www/my-m2-project/vendor/autoload.php'; \$bp = strlen(dirname(dirname(realpath('/var/www/my-m2-project/vendor/autoload.php')))) + 1; foreach ((new \Magento\Framework\Component\ComponentRegistrar)->getPaths('module') as \$m) echo substr(\$m, \$bp).PHP_EOL;"
PHP Warning:  require(/var/www/my-m2-project/vendor/composer/../namespace/module/registration.php): failed to open stream: No such file or directory in /var/www/my-m2-project/vendor/composer/autoload_real.php on line 70
PHP Fatal error:  require(): Failed opening required '/var/www/my-m2-project/vendor/composer/../namespace/module/registration.php' (include_path='/var/www/my-m2-project/vendor/magento/zendframework1/library:.:/usr/share/php:/var/www/my-m2-project/vendor/deployer/recipes:/var/www/my-m2-project/vendor/jalogut/magento2-deployer-plus') in /var/www/my-m2-project/vendor/composer/autoload_real.php on line 70

    at checkExecSyncError (child_process.js:621:11)
    at Object.execSync (child_process.js:657:15)
    at aj (/var/www/my-m2-project/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:361:138)
    at Function.e [as a] (/var/www/my-m2-project/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:161:192)
    at ij (/var/www/my-m2-project/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:363:426)
    at Ml (/var/www/my-m2-project/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:440:368)
    at /var/www/my-m2-project/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:441:73
    at /var/www/my-m2-project/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:363:592
    at /var/www/my-m2-project/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:361:421
    at FSWatcher.<anonymous> (/var/www/my-m2-project/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:345:209) {
  status: 255,
  signal: null,
  output: [
    null,
    <Buffer 0a 57 61 72 6e 69 6e 67 3a 20 72 65 71 75 69 72 65 28 2f 76 61 72 2f 77 77 77 2f 73 75 6e 6c 69 6e 65 72 2d 6d 32 2f 76 65 6e 64 6f 72 2f 63 6f 6d 70 ... 587 more bytes>,
    <Buffer 50 48 50 20 57 61 72 6e 69 6e 67 3a 20 20 72 65 71 75 69 72 65 28 2f 76 61 72 2f 77 77 77 2f 73 75 6e 6c 69 6e 65 72 2d 6d 32 2f 76 65 6e 64 6f 72 2f ... 595 more bytes>
  ],
  pid: 24117,
  stdout: <Buffer 0a 57 61 72 6e 69 6e 67 3a 20 72 65 71 75 69 72 65 28 2f 76 61 72 2f 77 77 77 2f 73 75 6e 6c 69 6e 65 72 2d 6d 32 2f 76 65 6e 64 6f 72 2f 63 6f 6d 70 ... 587 more bytes>,
  stderr: <Buffer 50 48 50 20 57 61 72 6e 69 6e 67 3a 20 20 72 65 71 75 69 72 65 28 2f 76 61 72 2f 77 77 77 2f 73 75 6e 6c 69 6e 65 72 2d 6d 32 2f 76 65 6e 64 6f 72 2f ... 595 more bytes>
}

Process finished with exit code 1

Could you have a look at that?

Thanks a lot!

Is support varnish ?

How i can clear varnish. Do you plan support it with hotkey "v" for example for clean varnish

Doesn't play nice with our Docker dev env

We use JeroenBoersma/docker-compose-development

When starting the cache-cleaner, this is what I get;

$ vendor/bin/cache-clean.js --watch                                         
Release 0.0.35 sponsored by https://www.mage2.tv

PHP Parse error:  syntax error, unexpected end of file in Command line code on line 1
[ERROR] Command failed: php -r "require '/home/peterjaap/development/workspace/client/magento2/vendor/autoload.php'; foreach ((new \Magento\Framework\Component\ComponentRegistrar)->getPaths('module') as \$m) echo \$m.PHP_EOL;"
PHP Parse error:  syntax error, unexpected end of file in Command line code on line 1

I guess this is because the absolute path isn't correct because PHP runs in a Docker container. The valid path in the container is /data/client/magento2/.....

I tried this;

$ vendor/bin/cache-clean.js --directory /data/client/magento2 --watch
Release 0.0.35 sponsored by https://www.mage2.tv

[ERROR] The Magento directory "/data/client/magento2" does not exist

But that errors out because the directory doesn't exist on the local system. I tried symlinking it, but it gives the same error (it probably checks for a directory and a symlink doesn't count).

When I copy the actual dir to that location on my local machine and run this, it doesn't work either;

$ vendor/bin/cache-clean.js --directory /data/client/magento2 --watch

PHP Parse error:  syntax error, unexpected end of file in Command line code on line 1
[ERROR] Command failed: php -r "require '/data/client/magento2/vendor/autoload.php'; foreach ((new \Magento\Framework\Component\ComponentRegistrar)->getPaths('module') as \$m) echo \$m.PHP_EOL;"
PHP Parse error:  syntax error, unexpected end of file in Command line code on line 1

I thought that might work because the script checks that the directory exists but then actually looks in the /home/peterjaap/development/workspace/client/magento2 dir through the container.

So we may have a few options to work around this;

  • Make all paths relative
  • Support symlinks
  • Add a flag to check the directory-does-not-exist warning

Thoughts?

Observe var/cache-clean-config.json for changes

When the file var/cache-clean-config.json is present, the watcher reads the available modules and themes from it.
When a new module is added and the dump file is recreated, then the watcher should pick up the change without having to be restarted.

Not working with Ui component changes

I m running this in windowns environment and Magento2.2.7 instance so the issue is when try to change in Ui component listing xml file it trigger to remove specific id cache but when i refresh browser it doesn't actually remove cache i have to remove cache using magento command every time.
Here is how it run.
http://prntscr.com/n4hd3r

Not working for Commerce 2.3.3

I've used magento-cache-clean for Magento Commerce 2.3.2 and it works like a charm. I've used it as a composer repo in my project and as a test also as a composer global repo. Awesome!

When I want to use it for a Magento Commerce 2.3.3 project my watcher output stays the same as 2.3.2 like 'Cleaning cache type(s) block_html full_page' but the cache is not cleared and it seems that it does not work.

Someone else who has an error / bug like this?

Translate Cache Clean Does Not Work Like bin/magento

Magento 2.3, cache-clean.js 0.3.37, German locale configured, Luma theme active, all caches active, cache-clean.js running with --watch option.

  1. Create file vendor/magento/theme-frontend-luma/i18n/de_DE.csv and add the following:

    "Be the first to review this product","Be the first to review this product Custom"
    
  2. cache-clean.js flushes the translate cache type.

  3. Expected result: New translation visible on product page. Actual result: Old translation still visible on product page.

Even if I enter f to clean the full_page cache, the old translation is still visible.
Even if I enter t to clean the translate cache manually, the old translation is still visible.

It turns out that the t does not clean the translate cache correctly. In my case, the file var/cache/mage--e/mage---aaf_TRANSLATE_DE_DE_FRONTEND_DEFAULT_MAGENTO_LUMA_ is not deleted. If I call bin/magento cache:clean translate, the file is deleted correctly.

Apart from this issue, would it make sense to clean the full_page cache automatically when a translation is changed?

When installed globally the watcher sees changes but does not clear caches

Hi,

This tool works really great when running it with vendor/bin/cache-clean.js --watch

Now I installed it globally with composer: composer global require mage2tv/magento-cache-clean

File changes are seen by the watcher as it gives output. Sadly the displayed caches are not cleared. Is this something that can be supported?

Error: ENOENT: no such file or directory, lstat .git/index.lock

Sometimes I catch this error.
I use dockerize https://github.com/arvatoSCM/dockerize-magento2

vendor/bin/cache-clean.js --watch 
....
Cleaning cache type(s) config
fs.js:941
  binding.lstat(pathModule._makeLong(path));
          ^

Error: ENOENT: no such file or directory, lstat '/home/om3r/Work/dockerize-magento2/vendor/yyy/xxx/.git/index.lock'
    at Object.fs.lstatSync (fs.js:941:11)
    at Ch (/home/om3r/Work/dockerize-magento2/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:319:85)
    at d (/home/om3r/Work/dockerize-magento2/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:323:45)
    at FSWatcher.<anonymous> (/home/om3r/Work/dockerize-magento2/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:322:138)
    at emitTwo (events.js:126:13)
    at FSWatcher.emit (events.js:214:7)
    at FSEvent.FSWatcher._handle.onchange (fs.js:1364:12)

app/etc/config.php

Since one of the latest versions, it works on my machine as well (fedora).

The tool works great, thanks for that!

When editing app/etc/config.php, the config cache doesn't get flushed. I tried creating a PR, but wasn't sure enough if my suggestion would do it, next to the fact that I can't build the application 😞.

Anyway, is there a certain reason app/etc/config.php doesn't flush the config cache? And if it could actually be added, can this be considered as a feature request? 🙃

0.0.16 - [ERROR] b.setRawMode is not a function

Hey,

the watcher crashes right after the start. Maybe my node version is too old?
node --version .. v8.11.4

[ERROR] b.setRawMode is not a function
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] cache:watch: ./magento/vendor/bin/cache-clean.js -w -d ./magento/
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] cache:watch script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Regards
Marcus

Cache is not cleaned as it should

Hey Vinai,

I've a problem with your module. The cache is not cleaned as it should. The output of your module is correct. The cache to be cleaned should be "config". After your module finds the change the message "Cleaning cache type(s) config" appears but the cache is not clean. When i run "./bin/magento cache:clean config" .. it works. Any ideas?

Command & Output

./magento/vendor/bin/cache-clean.js -v -w -d ./magento/

Sponsored by https://www.mage2.tv

Magento dir ./magento/
Watcher initialized (Ctrl-C to quit)
Processing /srv/http/xxx/magento/vendor/xxx/xxx/view/adminhtml/ui_component/xxx_order_grid.xml
Cleaning cache type(s) config

Change in file

<column name="filename">
	<settings>
		<label translate="true">Filename</label>
		<filter>text</filter>
	</settings>
</column>

->

<column name="filename">
	<settings>
		<label translate="true">Filename</label>
		<filter>text</filter>
		<bodyTmpl>ui/grid/cells/html</bodyTmpl>
	</settings>
</column>

Config

'cache' => [
        'frontend' => [
            'default' => [
                'backend' => 'Cm_Cache_Backend_Redis',
                'backend_options' => [
                    'server' => '127.0.0.1',
                    'database' => '0',
                    'port' => '6379'
                ]
            ],
            'page_cache' => [
                'backend' => 'Cm_Cache_Backend_Redis',
                'backend_options' => [
                    'server' => '127.0.0.1',
                    'database' => '1',
                    'port' => '6379',
                    'compress_data' => '0'
                ]
            ]
        ]
    ]

Thx
Marcus

Watch is not working on Docker

Description

When developing using docker for mac, the watcher doesn't not notice changes from host. However, if we change a file inside the container, the watcher notices it right away.

Specifications

  1. Docker for mac version 18.06.0-ce-mac70
  2. Magento community edition 2.2.5

Steps to reproduce

  1. Enable watcher docker-compose exec phpfpm vendor/bin/cache-clean.js --watch
  2. Modify any .phtml file

NOTE: If you need, I can provide the docker-compose.yml file or help you to reproduce it.

Expected result

Watcher notices the change and clears caches

Actual result

Nothing happens. Even using verbose output, nothing is happening. The watcher does not notice the changes.

NOTE: It works if we edit the file directly inside the container

Buffer.alloc is not a function

The following error happened after commenting a die() line in a front end controllet execute() method, but it's happening in a regular basis after saving anything.

> a:{if(N.b(".php",Fd(a,Q(a)-4))&&(r(Kh(a))?(b=Buffer.alloc(2048),a=Dh.openSync(a,"r"),Dh.readSync(a,b,0,2048,0),Dh.closeSync(a),b=x.a(b)):b=null,a=C(D(Yf(/^\s*namespace\s+([a-z0-9\\]+)/mi,x.a(b)))),b=C(D(Yf(/^\s*class\s+(\w+)/mi,x.a(b)))),a=r(r(a)?b:a)?["\\",x.a(a),"\\",x.a(b)].join(""):null,a=r(a)?wk(a):null,L(a))){de(Bi,"Removing generated code",ze(", ",Z.b(Jk,a)));a=pg(Nh,a);break a}a=null}return a}return null}
>                                                     ^
> 
> TypeError: Buffer.alloc is not a function
>     at Kk (/Users/martins/www/magenteiro2/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:420:53)
>     at /Users/martins/www/magenteiro2/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:421:198
>     at FSWatcher.<anonymous> (/Users/martins/www/magenteiro2/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:334:138)
>     at emitTwo (events.js:100:13)
>     at FSWatcher.emit (events.js:185:7)
>     at FSEvent.FSWatcher._handle.onchange (fs.js:1300:12)

Video: https://www.youtube.com/watch?v=TfPskiLwy-w

Magento version: 2.3.0

Deleting files does not clean cache

Step to reproduce:

  1. Delete a layout file in a module that updates something (i.e.: app/code/Magenteiro/MeuBloco/view/frontend/layout/catalog_product_view.xml)

Expected result:
Clean layout full_page_cache, as it would happen if I edit the file above.

etc/adminhtml/menu.xml - block_html

Hey,

when I make changes in the menu.xml only the "config" cache is cleaned. To see my change I need to clean the "block_html" cache as well.

Regards
Marcus

Windows Compatibility: [ERROR] Command failed

Hello,

I am trying to run the tool on windows Git Bash :
vendor/bin/cache-clean.js config full_page
but in result I have this error :
[ERROR] Command failed: php -r 'echo json_encode((require "D:\projects\example\magento/app/etc/env.php") ?? []);'

Looks like there a problem with slash. When I run this command
php -r 'echo json_encode((require "D:/projects/example/magento/app/etc/env.php") ?? []);'
I am getting correct results.

Is it possible to get some fix for hat? Thanks in advance.

Clear static content hotkey

Hey
amenk suggested the hotkeys in #9 and it's really helpful. Lately I often have to clear the static content in order to get things to work and it would be awesome if there could be a hotkey function to clear var/view_preprocessed/
pub/static/frontend/
pub/static/adminhtml/
Maybe [s]tatic content would be an idea.

Clean generated *Extension classes when extension_attributes.xml is changed

When a new extension attribute is defined or the type of an existing extension attribute is changed, the generated extension attributes class needs to be deleted (e.g. Magento\Catalog\Api\Data\ProductExtension).
Ideally the watcher would determine the type that needs to be deleted and remove only that one class, but that would require parsing and diffing, and I think that's more effort than it's worth.
Probably it's more stable and fast enough to simply remove all generated *Extension classes in generated/code when an extension_attributes.xml file is changed.

Watcher does not work with system.xml

When using the watcher and making changes to system.xml, it should clean the config cache.

Steps to reproduce:

  1. Launch watcher
  2. Make a change to a system.xml file

Expected result:
Config cache is cleaned.

Actual result:
No cache is cleaned.

Uncaught Exception if redis is offline

My redis wasn't up and running but cc.js tried to clean parts in redis which resulted in the following error message:

Watcher initialized (Ctrl-C to quit)
Cleaning cache type(s) config
events.js:183
      throw er; // Unhandled 'error' event
      ^

Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED 127.0.0.1:6379
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1191:14)

Clean full_page Cache When Translation Changes

This is a follow-up of #35.

If I change a translation, the translate cache is cleaned, which totally makes sense. However, in most cases, I still do not see the updated translation, because the full_page cache is not cleared and still includes the old translation. Would it make sense to clean the full_page cache as well whenever a translation changes?

Timestamp in cli output in -w mode

Hi Vinai, thanks a lot for the wonderful tool!
As a developer, I want to understand when cache cleaning happened during watch mode.
So I'll be able to make a decision if my latest changes were applied and identify if in some cases a cache wasn't cleaned, so I could report these issues.
Please add timestamp at the start of a row in the CLI output.
image

Thanks.

Automatically clean static content css files when source less files change

Implement cleaning of specific static content when files are changed.

First, .less file changes can trigger removal of the obsolete copy of the .less file in var/view_preprocessed and the generated .css files in pub/static.

The second type of static files that could automatically be removed when a file is changed are the js-translation.json files. The browser local storage still would need to be cleaned manually, but at least the server side would be taken care of automatically.

Related: Issue #15.

cache-clean -w Doesn't clean the cache but it says cleaned

Hi

cache-clean -w doesn't clean cache but it says the cache cleaned

Watcher initialized (Ctrl-C to quit)
Cleaning cache type(s) layout full_page

When pressing a it flushes all the caches and it works
Other options like [c]onfig [b]lock_html [l]ayout [t]ranslate [f]ull_page [v]iew
doesn't work

Installed node v10.16.3
Ubuntu 18.04

is this work for collection cache?

I came to know that when i change any record(delete/insert) in any module it doesn't reflect on frontend untill i remove collections cache.

Is this bug or not related to cache-clean.js?

I m using windows OS :)

More crashes on Linux (inotify)

v0.0.33

Cleaning cache type(s) config
Cleaning cache type(s) config
Cleaning cache type(s) full_page
fs.js:941
  binding.lstat(pathModule._makeLong(path));
	  ^

Error: ENOENT: no such file or directory, lstat '/home/amk/local-workspace/shop.example.com/vendor/degdigital/magento2-customreports/.git/index.lock'
    at Object.fs.lstatSync (fs.js:941:11)
    at Rh (/home/amk/.composer/global/mage2tv/magento-cache-clean/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:331:167)
    at d (/home/amk/.composer/global/mage2tv/magento-cache-clean/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:335:45)
    at FSWatcher.<anonymous> (/home/amk/.composer/global/mage2tv/magento-cache-clean/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:334:138)
    at emitTwo (events.js:126:13)
    at FSWatcher.emit (events.js:214:7)
    at FSEvent.FSWatcher._handle.onchange (fs.js:1364:12)

Process finished with exit code 1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.