X-Git-Url: https://git.mxchange.org/?p=core.git;a=blobdiff_plain;f=index.php;h=8a0bec3be1dd52b9dad0a75d128df578d7a336de;hp=34e000d470d68b73258a697639e3545fb9deb7c3;hb=7629f2314d517561d4301ddfb068a797b6ed8700;hpb=65f6c4366c9709c9c7c9070d903f1d948be0d5b0 diff --git a/index.php b/index.php index 34e000d4..8a0bec3b 100644 --- a/index.php +++ b/index.php @@ -4,6 +4,10 @@ namespace CoreFramework\EntryPoint; // Import framework stuff use CoreFramework\Configuration\FrameworkConfiguration; +use CoreFramework\Factory\ObjectFactory; +use CoreFramework\Helper\Application\ApplicationHelper; +use CoreFramework\Loader\ClassLoader; +use CoreFramework\Generic\FrameworkException; /** * The main class with the entry point to the whole application. This class @@ -123,7 +127,7 @@ final class ApplicationEntryPoint { $applicationInstance = NULL; // Is the class there? - if (class_exists('ApplicationHelper')) { + if (class_exists('CoreFramework\Helper\Application\ApplicationHelper')) { // Get application instance $applicationInstance = ApplicationHelper::getSelfInstance(); @@ -173,15 +177,50 @@ final class ApplicationEntryPoint { /** * Determines the correct absolute path for all includes only once per run. - * Other calls of this method are being "cached". + * Other calls of this method are being "cached". This is done by checking + * a small list of common paths where the framework can reside and check if + * inc/config.php can be found. * * @return $corePath Base path (core) for all includes */ protected static final function detectCorePath () { // Is it not set? if (empty(self::$corePath)) { - // Auto-detect our core path - self::$corePath = str_replace("\\", '/', dirname(__FILE__)); + // Auto-detect core path (first application-common) + foreach (array('core', '.') as $possiblePath) { + // Create full path for testing + $realPath = realpath($possiblePath); + + // Debug message + //* NOISY-DEBUG: */ printf('[%s:%d]: realPath[%s]=%s' . PHP_EOL, __METHOD__, __LINE__, gettype($realPath), $realPath); + + // Is it FALSE? + if ($realPath === FALSE) { + // Then, not found. + continue; + } // END - if + + // First create full-qualified file name (FQFN) to inc/config.php + $fqfn = sprintf( + '%s%sinc%sconfig.php', + $realPath, + DIRECTORY_SEPARATOR, + DIRECTORY_SEPARATOR, + $possiblePath + ); + + // Debug message + //* NOISY-DEBUG: */ printf('[%s:%d]: fqfn=%s' . PHP_EOL, __METHOD__, __LINE__, $fqfn); + + // Is it readable? + if (is_readable($fqfn)) { + // Found one + self::$corePath = $realPath; + + // Abort here + break; + } // END - if + } // END - foreach } // END - if // Return it @@ -226,6 +265,3 @@ define('DEVELOPER', TRUE); // Call above main() method ApplicationEntryPoint::main(); - -// [EOF] -?>