-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Short description of the enhancement
This is something that's been mentioned in a couple of existing requests (#442, #502) but I'd like to highlight the most generic version of the request in the issue title.
There are times where you want to execute some code before PW boots up or does anything at all. There are potentially many different reasons a developer might want to do this - here is one example: I have a custom cache system and I want to check for the existence of a cache file and where it exists return the contents of that file without PW needing to boot up at all. (Just to be clear, there's a bit more to it than that and so it can't be done via .htaccess
as per ProCache).
Currently the only way to do this is to edit index.php
, but this is a core file and changes made here are liable to be lost during a PW upgrade. So it would be great if PW supported this sort of thing by allowing for including a non-core file in index.php
.
Perhaps the way to do this with the lowest overhead is to check for a file with a specific name and include it if it exists. After line 29 could be something like this:
$customInclude = $rootPath . '/index_include.php';
if(file_exists($customInclude)) include_once($customInclude);
A developer could possibly want to include more than one file with different naming and in different locations but they could handle those includes from index_include.php