Skip to content

Instantly share code, notes, and snippets.

@seyuf
Last active January 6, 2020 12:04
Show Gist options
  • Save seyuf/dcec40a7a9d874b09650e673a8fee85a to your computer and use it in GitHub Desktop.
Save seyuf/dcec40a7a9d874b09650e673a8fee85a to your computer and use it in GitHub Desktop.
Magento cache cleaner tool issues

Magento Cache Clean v 1.0.13

Issues when modifying registration.php file


Test Env: Magento 2.1.11 | php 7.0

  1. modify/override some dashboard view file (here layout => Vendor/Sales/view/adminhtml/layout/sales_order_invoice_view.xml )
<referenceBlock name="order_comments">
            <action method="setTemplate">
                <argument name="template" xsi:type="string">vendor::order/comments/view.phtml</argument>
            </action>
        </referenceBlock>
  1. modify content by giving fake template path vendor::order/comments/view1112222.phtml

  2. The add comment field should disapear from dashboard url admin/sales/order_invoice/view/invoice_id/id/ because template not found

  3. Modify module name in registration.php Vendor_Sales to Vendor33_Sales

  4. Refresh page step 3, in normal time the add comment field should appear because magento default layout/templation should take the lead as the module name is wrong (this is what appends when using command line cache flush or rm -rf cache files). This is not the case with the cache-cleaner tools. The module file stay in the lead (overriding core). The field is not display as the file do not exist in custom module.

Translation issues (fixed )


Test Env: magento 2.2.4 | php7.1 | 4 locales

  1. Launch cleaner watch mode
  2. Updating translations from i18n e.g {{magento_base_dir}}/app/i18n/vendor/en_us
  3. Nothing happens
  • when no actions is performed
  • when uses Hot key t (although exit is cleaning cache type(s) translate.
  • when using cmd
  1. Translation is refreshed
  • when use hotkey f (full_page)
  • when flush all hotkey a ()

if manual rm -f whatcher crahses (i was unable to reproduce after the initial error maybe linked to intellij setup)


Test Env: intellij ultimate 2019 | magento 2.3-develop | php7.1

  1. Launch the watcher
  2. $ rm -rf ./var/page_cache/* ./var/di/* ./var/generation/* ./var/cache/* ./var/view_preprocessed/* ./pub/static/* ./generated/*
  3. Error: ENOENT: no such file or directory, scandir '/var/www/magento-develop/pub/static/frontend' ** fs.js: 114 throw err **
  4. file watcher exit with ENOENT fs.js:114 throw err; ^

Error: ENOENT: no such file or directory, scandir '/var/www/magento-develop/pub/static/frontend' at Object.readdirSync (fs.js:785:3) at xi (/var/www/magento-develop/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:343:476) at /var/www/magento-develop/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:344:104 at /var/www/magento-develop/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:184:298 at /var/www/magento-develop/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:184:311 at Yd (/var/www/magento-develop/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:123:429) at Xd.f.N (/var/www/magento-develop/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:126:224) at M (/var/www/magento-develop/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:61:83) at de (/var/www/magento-develop/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:132:137) at ne (/var/www/magento-develop/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:146:38)

File sync issue (more details soon, happens after a bin/m2 set:up)


Test Env: intellij ultimate 2019 | magento 2.3.2 | php7.2 | Magesuite/elasticsuite | magesuite caching module enabled

fs.js:114 throw err; ^

Error: ENOENT: no such file or directory, scandir '/var/www/magento/pub/static/frontend' at Object.readdirSync (fs.js:785:3) at xi (/var/www/magento/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:343:476) at /var/www/magento/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:344:104 at /var/www/magento/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:184:298 at /var/www/magento/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:184:311 at Yd (/var/www/magento/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:123:429) at Xd.f.N (/var/www/magento/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:126:224) at M (/var/www/magento/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:61:83) at de (/var/www/magento/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:132:137) at ne (/var/www/magento/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:146:38)

Issues using the tool with magesuite compiled theme (Fixed by moving caches from db to file should be a kind of try catch to handle this)


Test Env: intellij ultimate 2019 | magento 2.3.2 | php7.2 | Magesuite/elasticsuite |

  1. Launch watcher
  2. Modify any file (e.g magento/app/design/frontend/creativestyle/theme-creativeshop/etc/view.xml:L:229 add-> container-slider)
  3. watcher crashes with error logs:

Watcher initialized (Ctrl-C to quit) 18:03:12 Cleaning cache type(s) block_html full_page /var/www/magento/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:108 function Pd(a,b){return a.substring(b)}function bd(a,b){if(ud(b))if(Xc(a)&&Xc(b)&&R(a)!==R(b))a=!1;else a:for(a=M(a),b=M(b);;){if(null==a){a=null==b;break a}if(null!=b&&P.b(A(a),A(b)))a=D(a),b=D(b);else{a=!1;break a}}else a=null;return Cd(a)}function id(a,b,c,d,e){this.o=a;this.first=b;this.Va=c;this.count=d;this.v=e;this.i=65937646;this.B=8192}f=id.prototype;f.toString=function(){return uc(this)};f.equiv=function(a){return this.C(null,a)}; ^

TypeError: Cannot read property 'substring' of null at Pd (/var/www/magento/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:108:27) at Function.qi (/var/www/magento/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:343:31) at je (/var/www/magento/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:141:281) at ne (/var/www/magento/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:146:119) at d (/var/www/magento/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:327:261) at c (/var/www/magento/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:327:202) at ol (/var/www/magento/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:428:182) at ql (/var/www/magento/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:431:133) at rl (/var/www/magento/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:432:319) at /var/www/magento/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:432:439

@Vinai
Copy link

Vinai commented Jan 1, 2020

FYI: Added support for app/i18n to the watcher.

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