I am using Drupal 8, and I am wondering how I can clear more caches than the button in admin/config/development/performance does.
I have had trouble with installing Drush, so I am looking for any alternative solutions.
Drupal Answers is a question and answer site for Drupal developers and administrators. It only takes a minute to sign up.
Sign up to join this communityJust execute core/rebuild.php.
As the documentation says, it rebuilds the cache even when Drupal doesn't work; it require a token you can generate with scripts/rebuild_token_calculator.sh, so you call it as http://example.com/core/rebuild.php?token=TOKEN_YOU_GET_FROM_THE_SCRIPT.
$settings['rebuild_access'] = TRUE;
in your settings.php, too. Just remember to remove it when you are done as it not safe to leave this unprotected on a live site.
Check out Admin Toolbar for Drupal 8, it emulates all the dev functions from a drop down menu like we had in Drupal 7 from Admin Menu. Be sure to activate "Admin Toolbar Extra Tools" as part of the module.
That button clears all caches, just like drush would.
The only alternative to that would be to clear the caches directly in the database, which isn't much convenient.
drupal_flush_all_caches()
. It is just that there is more to it than simply truncating the {cache*}
tables from the database.
The methods I've come across for clearing the JavaScript cache in Drupal (either from the Admin UI or from Drush) do not work reliably, which causes a huge amount of frustration when you're using a framework on top of Drupal to create a web application.
The workaround I use is to alter the version number in your module.libraries.yml file, which is at the root of your module folder.
Example:
reporting:
version: 1.31
css:
layout:
css/jquery.notifyBar.css: {}
css/tagify.min.css: {}
css/bootstrap-datepicker.min.css: {}
theme:
css/reporting-theme.css: {}
js:
js/smsw-utils.js: {}
js/shim.min.js: {}
js/xlsx.full.min.js: {}
js/reporting.js: {}
js/knockout-min.js: {}
js/jquery.notifyBar.js: {}
js/bootstrap-datepicker.min.js: {}
js/tagify.min.js: {}
dependencies:
- core/jquery
- core/drupalSettings