Remove canvas_install() entirely and trigger the installation of canvas_stark unconditionally when Canvas itself is installed; forbid the use of `drupal_flush_all_caches` in Canvas's code base
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3580247. --> Reported by: [penyaskito](https://www.drupal.org/user/959536) Related to !780 !778 >>> <h3 id="overview">Overview</h3> <p>We have a call to `drupal_flush_all_caches` in `canvas_install()`.<br> That's considered a bad practice, and shouldn't be needed.</p> <h3 id="proposed-resolution">Proposed resolution</h3> <p>Generally speaking, we should not need <code>canvas_install()</code> <em>at all</em>. Its only purpose is to install <code>canvas_stark</code>, but this doesn't work properly because it causes a container rebuild <em>while the container is being rebuilt</em> due to the module being installed. (Hey bro, I heard you like container rebuilds...)</p> <p>We can do better than this. canvas_stark is <em>needed</em> for Canvas to operate, so it should be installed <em>unconditionally</em>, regardless of config sync, when Canvas itself <em>has been</em> installed (the past tense there is the key). We can do that in a hook_modules_installed implementation.</p> <p>Meanwhile, we can remove the <code>drupal_flush_all_caches</code> call; tests pass without it, so it is apparently not necessary. UninstallModulePageTest needs to be rewritten because it's outdated and, to be honest, nonsensical.</p> <p>To keep people away from the destructive sledgehammer that is <code>drupal_flush_all_caches</code>, let's also add a PHPCS rule which outright forbids calling it.</p> <h3 id="ui-changes">User interface changes</h3> <p>None.</p> > Related issue: [Issue #3562354](https://www.drupal.org/node/3562354) > Related issue: [Issue #474684](https://www.drupal.org/node/474684)
issue