minor performance boost for permalinks
2 posts by 2 authors in: Forums > CMS Builder
Last Post: September 25, 2018 (RSS)
In trying to track down an error with xdebug, I noticed that the debugger stopped in the permalinks_dispatcher.php on the foreach loop throwing a warning on the first iteration for path not found.
// load viewer library
$libraryPath = 'lib/init.php';
$dirsToCheck = array('../','../../','../../../','../../../../');
foreach ($dirsToCheck as $dir) { if (@include_once("$dir$libraryPath")) { break; }}
if (!function_exists('_init_loadSettings')) { die("Couldn't load init library, check filepath in sourcecode."); }
A simple improvement would be to reverse the first two entries in $dirsToCheck.
$dirsToCheck = array('../../','../','../../../','../../../../');
By daniel - September 25, 2018
Hi Jeff,
Thanks for reporting this! Since the dispatcher file will be two levels up from the lib folder in all default installations, I agree that it should make sense to check "../../" first. I'll make a note of this so we can review it for the next release of the plugin.
Thanks,
Technical Lead
interactivetools.com