minor performance boost for permalinks

2 posts by 2 authors in: Forums > CMS Builder
Last Post: September 25, 2018   (RSS)

By kitsguru - September 19, 2018

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('../../','../','../../../','../../../../');

Jeff Shields