Laravel-modules: Artisan clear-compiled should also clear [module_name]_module.php files

Created on 27 Feb 2018  路  4Comments  路  Source: nWidart/laravel-modules

Hey,

Related to this issue: https://github.com/nWidart/laravel-modules/issues/495

Not a single command to flush any of the caches (redis flushall, artisan cache:clear, artisan view:clear, artisan clear-compiled), does actually flush the [module_name]_module.php in bootstrap/cache directory (laravel-modules/src/Laravel/Module.php:18).

When upgrading from laravel-modules v1.30 to v2.7 the cached service files are generated once and then never flushed. So after setting the property defer in a Module provided ServiceProvider to false, the change is ignored forever. (or until you manually remove bootstrap/cache/*.php).

It would be nice to remove module generated cache files with the art clear-compiled command.

Can you look into that?
Thanks in advanced.

Regards,
Levi

Most helpful comment

Hi, issue is still exists and solution is not clear. Is there a way to clear modulename_module.php files from bootstrap/cache folder from artisan command ?

All 4 comments

I'll close this as it seems to have been fixed with the related issue. 馃憤

Hey @nWidart ,
when I was wondering in which case the cached files from this package under 'bootstrap/cache/' will be flushed, I stumbled over this issue.

I checked the related bug and can see how the described problem there is fixed. But I don't see how this issue here is solved by that because there is, as far as I know, still no way to flush these files with any of the listed commands.

Do I miss something here? Thanks in advance and anyway for your great work on this project.

Hi, issue is still exists and solution is not clear. Is there a way to clear modulename_module.php files from bootstrap/cache folder from artisan command ?

atm we have 2 options

  • listen to the optimize:clear cmnd and clear the files using glob ex.
Event::listen('Illuminate\Console\Events\CommandStarting', function ($event) { // or CommandFinished
    if ($event->command == 'optimize:clear') {
        File::delete(File::glob('bootstrap/cache/*_module.php'));
    }
});
  • create a cmnd that remove the files and run it when needed, this would probably go under composer.post-autoload-dump
Was this page helpful?
0 / 5 - 0 ratings

Related issues

dang-tien picture dang-tien  路  3Comments

firebed picture firebed  路  3Comments

quentingosset picture quentingosset  路  4Comments

NexxusPlexx picture NexxusPlexx  路  4Comments

sandeepk2304 picture sandeepk2304  路  3Comments