How to disable Shield on demand? |
Hi,
I want to disable shield on specific conditions to maximize performance, so that no shield class is loaded I have a condition in BaseController.php Code: if (CONDITION)) How can I avoid that? Best regards Wolfgang
Sorry, you can't.
auth and email helper are loaded by Composer automatically. If you are concerned about the time it takes to load a few files, I recommend using Preload. See https://www.php.net/manual/en/opcache.preloading.php
When I remove the vendor directory in my example project codeigniter loads 139 files instead of 198.
So around 60 files would be loaded if Shield is not used, thats to much. Is there a way to use Shield without composer? It is not a good idea to change system files but is there a way to avoid the autoloading when I can manipulate the codeigniter system files? (11-08-2022, 03:58 AM)wolfgangpue Wrote: Is there a way to use Shield without composer? We do not support Shield without Composer. But you could do it by yourself. Download the source code and install in your repository and configure autoloader for the Shield class files, and add code to load the helpers when you need. (11-08-2022, 03:58 AM)wolfgangpue Wrote: It is not a good idea to change system files but is there a way to avoid the autoloading when I can manipulate the codeigniter system files? No. Composer autoloads the helpers, so CodeIgniter system does not matter.
I installed Shield without composer and added following constructor to Autoload-class.
PHP Code: function __construct() { My code in the initController function, but not all shield classes get loaded. PHP Code: $autoloader = service('autoloader'); |
Welcome Guest, Not a member yet? Register Sign In |