From: Roland Häder Date: Thu, 18 May 2017 21:03:48 +0000 (+0200) Subject: Rewrites: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=bce6e1295dbc1a28fcd3dbd0d7328a34679ad2d3;p=hub.git Rewrites: - new way of launching applications (core update) - first namespaces added + imported BaseHubSystem where needed Signed-off-by: Roland Häder --- diff --git a/application/hub/class_ApplicationHelper.php b/application/hub/class_ApplicationHelper.php index ad4d8626a..921e80961 100644 --- a/application/hub/class_ApplicationHelper.php +++ b/application/hub/class_ApplicationHelper.php @@ -1,4 +1,18 @@ addInstance('app', $this); - - // Is no external address set? - if ($this->getConfigInstance()->getConfigEntry('external_address') == '') { - // Determine external address - $this->getConfigInstance()->setConfigEntry('external_address', HubTools::determineOwnExternalAddress()); - } // END - if - - // Default response is console - $response = self::getResponseTypeFromSystem(); - $responseType = self::getResponseTypeFromSystem(); + public function setupApplicationData () { + // Set all application data + $this->setAppName('Unit tests and more'); + $this->setAppVersion('0.0.0'); + $this->setAppShortName('tests'); + } - // Create a new request object - $requestInstance = ObjectFactory::createObjectByName(self::convertToClassName($response) . 'Request'); + /** + * 2) Does initial stuff before starting the application + * + * @return void + */ + public function initApplication () { + // Get config instance + $cfg = FrameworkConfiguration::getSelfInstance(); - // Remember request instance here - $this->setRequestInstance($requestInstance); + // Initialize output system + ApplicationHelper::createDebugInstance('ApplicationHelper'); - // Do we have another response? - if ($requestInstance->isRequestElementSet('request')) { - // Then use it - $response = strtolower($requestInstance->getRequestElement('request')); - $responseType = $response; - } // END - if + /* + * This application needs a database connection then simply call init + * method. + */ + FrameworkBootstrap::initDatabaseInstance(); - // ... and a new response object - $responseClass = sprintf('%sResponse', self::convertToClassName($response)); - $responseInstance = ObjectFactory::createObjectByName($responseClass, array($this)); + // Get own internal address and set it in config + $cfg->setConfigEntry('internal_address', HubTools::determineOwnInternalAddress()); + } - // Remember response instance here - $this->setResponseInstance($responseInstance); + /** + * 3) Launches the application + * + * @return void + */ + public function launchApplication () { + // Get request/response instances + $requestInstance = FrameworkBootstrap::getRequestInstance(); + $responseInstance = FrameworkBootstrap::getResponseInstance(); // Get the parameter from the request $commandName = $requestInstance->getRequestElement('command'); @@ -257,6 +276,3 @@ class ApplicationHelper extends BaseFrameworkSystem implements ManageableApplica return 'node_main'; } } - -// [EOF] -?> diff --git a/application/hub/classes/apt-proxy/class_BaseNodeAptProxy.php b/application/hub/classes/apt-proxy/class_BaseNodeAptProxy.php index c372b2e26..babe4473d 100644 --- a/application/hub/classes/apt-proxy/class_BaseNodeAptProxy.php +++ b/application/hub/classes/apt-proxy/class_BaseNodeAptProxy.php @@ -1,4 +1,10 @@ isActive; } } - -// [EOF] -?> diff --git a/application/hub/classes/blocks/class_BaseBlock.php b/application/hub/classes/blocks/class_BaseBlock.php index 9425bf744..9eba5a4dd 100644 --- a/application/hub/classes/blocks/class_BaseBlock.php +++ b/application/hub/classes/blocks/class_BaseBlock.php @@ -1,4 +1,10 @@ isActive; } } - -// [EOF] -?> diff --git a/application/hub/classes/class_BaseHubSystem.php b/application/hub/classes/class_BaseHubSystem.php index da5841a67..bc5128542 100644 --- a/application/hub/classes/class_BaseHubSystem.php +++ b/application/hub/classes/class_BaseHubSystem.php @@ -1,4 +1,7 @@ getConfigInstance()->getConfigEntry('session_id'); } } - -// [EOF] -?> diff --git a/application/hub/classes/communicator/class_BaseCommunicator.php b/application/hub/classes/communicator/class_BaseCommunicator.php index 8be2c2aec..a16daf3df 100644 --- a/application/hub/classes/communicator/class_BaseCommunicator.php +++ b/application/hub/classes/communicator/class_BaseCommunicator.php @@ -1,4 +1,10 @@ diff --git a/application/hub/classes/decoder/class_BaseDecoder.php b/application/hub/classes/decoder/class_BaseDecoder.php index ba2a1e43d..2170964c1 100644 --- a/application/hub/classes/decoder/class_BaseDecoder.php +++ b/application/hub/classes/decoder/class_BaseDecoder.php @@ -1,4 +1,10 @@ diff --git a/application/hub/classes/discovery/recipient/socket/class_PackageSocketDiscovery.php b/application/hub/classes/discovery/recipient/socket/class_PackageSocketDiscovery.php index 698c44cb1..4bf16c7a4 100644 --- a/application/hub/classes/discovery/recipient/socket/class_PackageSocketDiscovery.php +++ b/application/hub/classes/discovery/recipient/socket/class_PackageSocketDiscovery.php @@ -1,4 +1,10 @@ diff --git a/application/hub/classes/helper/dht/class_DhtBootstrapHelper.php b/application/hub/classes/helper/dht/class_DhtBootstrapHelper.php index 1fc25af21..370afe301 100644 --- a/application/hub/classes/helper/dht/class_DhtBootstrapHelper.php +++ b/application/hub/classes/helper/dht/class_DhtBootstrapHelper.php @@ -1,4 +1,10 @@ diff --git a/application/hub/classes/miner/class_BaseHubMiner.php b/application/hub/classes/miner/class_BaseHubMiner.php index ecdfaa459..823596aab 100644 --- a/application/hub/classes/miner/class_BaseHubMiner.php +++ b/application/hub/classes/miner/class_BaseHubMiner.php @@ -1,4 +1,10 @@ diff --git a/application/hub/classes/package/assembler/class_PackageAssembler.php b/application/hub/classes/package/assembler/class_PackageAssembler.php index 21d7fd110..e85d72c2a 100644 --- a/application/hub/classes/package/assembler/class_PackageAssembler.php +++ b/application/hub/classes/package/assembler/class_PackageAssembler.php @@ -1,4 +1,10 @@ diff --git a/application/hub/classes/recipient/class_BaseRecipient.php b/application/hub/classes/recipient/class_BaseRecipient.php index bdcf99319..e0d9f87e8 100644 --- a/application/hub/classes/recipient/class_BaseRecipient.php +++ b/application/hub/classes/recipient/class_BaseRecipient.php @@ -1,4 +1,10 @@ diff --git a/application/hub/classes/tools/class_HubTools.php b/application/hub/classes/tools/class_HubTools.php index 37636f29c..6293e22fe 100644 --- a/application/hub/classes/tools/class_HubTools.php +++ b/application/hub/classes/tools/class_HubTools.php @@ -1,4 +1,10 @@ setConfigEntry('hub_console_cmd_fuse_resolver_class', 'ConsoleCommandResol // CFG: ENABLE-FEATURE-FUSE $cfg->setConfigEntry('enable_feature_fuse', 'N'); - -// [EOF] -?> diff --git a/application/hub/data.php b/application/hub/data.php index 8ba4cff74..7d6dceec9 100644 --- a/application/hub/data.php +++ b/application/hub/data.php @@ -1,43 +1,2 @@ - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Hub Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -// Get config instance -$cfg = FrameworkConfiguration::getSelfInstance(); - -// Get an instance of the helper -$app = call_user_func_array( - array($cfg->getConfigEntry('app_helper_class'), 'getSelfInstance'), - array() -); - -// Set application name and version -$app->setAppName('Generic Object Sharing Hub'); -$app->setAppVersion('0.0.0'); -$app->setAppShortName('hub'); - -// [EOF] -?> +// @DEPRECATED diff --git a/application/hub/debug.php b/application/hub/debug.php index 636f4f933..7fe826b60 100644 --- a/application/hub/debug.php +++ b/application/hub/debug.php @@ -23,6 +23,3 @@ // Set error reporting error_reporting(E_ALL | E_STRICT); - -// [EOF] -?> diff --git a/application/hub/exceptions.php b/application/hub/exceptions.php index 8eefa5ea5..d027c51e2 100644 --- a/application/hub/exceptions.php +++ b/application/hub/exceptions.php @@ -1,10 +1,14 @@ - * @version 0.0 - * @copyright Copyright (c) 2007 - 2008 Roland Haeder, 2009 - 2015 Hub Developer Team + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team * @license GNU GPL 3.0 or any newer version * * This program is free software: you can redistribute it and/or modify @@ -24,7 +28,7 @@ // The node's own exception handler function hub_exception_handler ($exceptionInstance) { // Is it an object and a valid instance? - if ((is_object($exceptionInstance)) && ($exceptionInstance instanceof FrameworkException)) { + if ((is_object($exceptionInstance)) && ($exceptionInstance instanceof Exception)) { // Init variable $backTrace = ''; @@ -33,14 +37,11 @@ function hub_exception_handler ($exceptionInstance) { // Init argument string $argsString = ''; - // Any arguments? - if ((isset($traceArray['args'])) && (is_array($traceArray['args'])) && (count($traceArray['args']) > 0)) { - // Convert arguments type into human-readable - foreach ($traceArray['args'] as $arg) { - $argsString .= ', ' . gettype($arg); - } // END - foreach - $argsString = substr($argsString, 2); - } // END - if + // Convert arguments type into human-readable + foreach ($traceArray['args'] as $arg) { + $argsString .= ', ' . gettype($arg); + } // END - foreach + $argsString = substr($argsString, 2); // Set missing file/line if (!isset($traceArray['file'])) $traceArray['file'] = 'unknown'; @@ -76,9 +77,9 @@ Backtrace: -------------------------------------------------------------------------------- %s --------------------------------------------------------------------------------\n", - trim(html_entity_decode(strip_tags($exceptionInstance->__toString()))), + trim(html_entity_decode(strip_tags(get_class($exceptionInstance)))), trim(html_entity_decode(strip_tags($exceptionInstance->getMessage()))), - $exceptionInstance->getHexCode(), + ($exceptionInstance instanceof FrameworkException ? $exceptionInstance->getHexCode() : '0x' . bin2hex($exceptionInstance->getCode())), $exceptionInstance->getFile(), $exceptionInstance->getLine(), trim($backTrace) @@ -86,18 +87,21 @@ Backtrace: // Output the message print($message); + } elseif (is_object($exceptionInstance)) { + // Output more details + printf('exceptionInstance=%s', print_r($exceptionInstance, true)); } else { /* * Invalid exception instance detected! Do *only* throw exceptions that * extends our own exception 'FrameworkException' to get such nice * outputs like above. */ - print('exceptionInstance[]=' . gettype($exceptionInstance) . ' is invalid! Please inform the core developer team.'); + printf('exceptionInstance[]=%s is invalid! Please inform the core developer team.' . PHP_EOL, gettype($exceptionInstance)); } } // Error handler -function __errorHandler ($errno, $errstr, $errfile, $errline, array $errcontext) { +function hub_error_handler ($errno, $errstr, $errfile, $errline, array $errcontext) { // Construct the message $message = sprintf('File: %s, Line: %s, Code: %s, Message: %s', basename($errfile), @@ -111,7 +115,7 @@ function __errorHandler ($errno, $errstr, $errfile, $errline, array $errcontext) } // END - function // Assertion handler -function __assertHandler ($file, $line, $code) { +function hub_assert_handler ($file, $line, $code) { // Empty code? if ($code === '') { $code = 'Unknown'; @@ -125,7 +129,6 @@ function __assertHandler ($file, $line, $code) { ); // Log assert - die($message . PHP_EOL); syslog(LOG_WARNING, $message); // Throw an exception here @@ -133,19 +136,14 @@ function __assertHandler ($file, $line, $code) { } // END - function // Set error handler -//set_error_handler('__errorHandler'); +//set_error_handler('hub_error_handler'); -// Set the exception handler +// Set the new handler set_exception_handler('hub_exception_handler'); // Init assert handling -assert_options(ASSERT_ACTIVE , TRUE); -assert_options(ASSERT_WARNING , FALSE); -assert_options(ASSERT_BAIL , TRUE); -assert_options(ASSERT_QUIET_EVAL, FALSE); - -// Set assertion handler -assert_options(ASSERT_CALLBACK , '__assertHandler'); - -// [EOF] -?> +assert_options(ASSERT_ACTIVE , true); +assert_options(ASSERT_WARNING , false); +assert_options(ASSERT_BAIL , true); +assert_options(ASSERT_QUIET_EVAL, false); +assert_options(ASSERT_CALLBACK , 'hub_assert_handler'); diff --git a/application/hub/init.php b/application/hub/init.php index 548d5172e..7d6dceec9 100644 --- a/application/hub/init.php +++ b/application/hub/init.php @@ -1,41 +1,2 @@ - * @version 0.0 - * @copyright Copyright (c) 2007 - 2008 Roland Haeder, 2009 - 2015 Hub Developer Team - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -// Get config instance -$cfg = FrameworkConfiguration::getSelfInstance(); - -// Initialize output system -ApplicationHelper::createDebugInstance('ApplicationHelper'); - -// This application needs a database connection then we have to simply include -// the inc/database.php script -require($cfg->getConfigEntry('base_path') . 'inc/database.php'); - -// Get own internal address and set it in config -$cfg->setConfigEntry('internal_address', HubTools::determineOwnInternalAddress()); - -// [EOF] -?> +// @DEPRECATED diff --git a/application/hub/loader.php b/application/hub/loader.php index 0cf80532e..7d6dceec9 100644 --- a/application/hub/loader.php +++ b/application/hub/loader.php @@ -1,28 +1,2 @@ - * @version 0.0 - * @copyright Copyright (c) 2007 - 2008 Roland Haeder, 2009 - 2015 Hub Developer Team - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -// Scan for application's classes, exceptions and interfaces -ClassLoader::scanApplicationClasses(); - -// [EOF] -?> +// @DEPRECATED diff --git a/application/hub/starter.php b/application/hub/starter.php index 6abc2e616..7d6dceec9 100644 --- a/application/hub/starter.php +++ b/application/hub/starter.php @@ -1,57 +1,2 @@ - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Hub Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -// Is there an application helper instance? We need the method main() for -// maining the application -$app = call_user_func_array( - array( - FrameworkConfiguration::getSelfInstance()->getConfigEntry('app_helper_class'), 'getSelfInstance' - ), array() -); - -// Some sanity checks -if ((empty($app)) || (is_null($app))) { - // Something went wrong! - ApplicationEntryPoint::app_exit(sprintf('[Main:] The application %s could not be launched because the helper class %s is not loaded.', - $application, - FrameworkConfiguration::getSelfInstance()->getConfigEntry('app_helper_class') - )); -} elseif (!is_object($app)) { - // No object! - ApplicationEntryPoint::app_exit(sprintf('[Main:] The application %s could not be launched because 'app' is not an object.', - $application - )); -} elseif (!method_exists($app, FrameworkConfiguration::getSelfInstance()->getConfigEntry('entry_method'))) { - // Method not found! - ApplicationEntryPoint::app_exit(sprintf('[Main:] The application %s could not be launched because the method %s is missing.', - $application, - FrameworkConfiguration::getSelfInstance()->getConfigEntry('entry_method') - )); -} - -// Call user function -call_user_func_array(array($app, FrameworkConfiguration::getSelfInstance()->getConfigEntry('entry_method')), array()); - -// [EOF] -?> +// @DEPRECATED diff --git a/contrib/chat-server.php b/contrib/chat-server.php index 4544db4b2..997b5ad5f 100644 --- a/contrib/chat-server.php +++ b/contrib/chat-server.php @@ -163,5 +163,3 @@ while (count($clients) > 0) { // close the listening socket socket_close($main_sock); - -?> diff --git a/contrib/mhash-benchmark.php b/contrib/mhash-benchmark.php index 41061d39e..ed44183f0 100644 --- a/contrib/mhash-benchmark.php +++ b/contrib/mhash-benchmark.php @@ -63,5 +63,3 @@ asort($timers); print 'Result from mhash() benchmark (in seconds per hasher):' . "\r\n"; print_r($timers) . "\n"; - -?> diff --git a/contrib/udp-client.php b/contrib/udp-client.php index d5dd3610e..a260db09d 100644 --- a/contrib/udp-client.php +++ b/contrib/udp-client.php @@ -171,5 +171,3 @@ if (count($data) > 0) { out(__FILE__, __LINE__, 'MIN/AVG/MAX=' . $min . '/' . $avg . '/' . $max . ''); out(__FILE__, __LINE__, 'INVALID=' . $invalid . ''); out(__FILE__, __LINE__, 'FAILED=' . $failed . ''); - -?> diff --git a/contrib/udp-inc.php b/contrib/udp-inc.php index 47f2607bf..86e2f076b 100644 --- a/contrib/udp-inc.php +++ b/contrib/udp-inc.php @@ -7,5 +7,3 @@ function out ($file, $line, $message, $displayDouble = FALSE) { $GLOBALS['last_message'] = $message; } } - -?> diff --git a/contrib/udp-server.php b/contrib/udp-server.php index 55d58efa1..c4bf936a8 100644 --- a/contrib/udp-server.php +++ b/contrib/udp-server.php @@ -65,5 +65,3 @@ do { // Sleep a little if (function_exists('time_nanosleep')) time_nanosleep(0, 500000); } while ($pkt !== FALSE); - -?> diff --git a/core b/core index 1893995b3..afe4936b8 160000 --- a/core +++ b/core @@ -1 +1 @@ -Subproject commit 1893995b39b02c07012c5f3795654fb9251b5ebd +Subproject commit afe4936b8a55f38736e1af5191a964a926d7255a diff --git a/inc b/inc deleted file mode 120000 index a13f35ca5..000000000 --- a/inc +++ /dev/null @@ -1 +0,0 @@ -core/inc/ \ No newline at end of file diff --git a/index.php b/index.php index 0a3ef7411..f0f02f6df 100644 --- a/index.php +++ b/index.php @@ -1,4 +1,19 @@ getConfigEntry('product_install_mode') == 'productive') || ($silentMode === TRUE)) { + if (($configInstance->getConfigEntry('product_install_mode') == 'productive') || ($silentMode === true)) { // Abort here exit(); } // END - if // Get some instances - $tpl = FrameworkConfiguration::getSelfInstance()->getConfigEntry('html_template_class'); + $tpl = $configInstance->getConfigEntry('html_template_class'); $languageInstance = LanguageSystem::getSelfInstance(); // Initialize template instance here to avoid warnings in IDE @@ -84,7 +99,7 @@ final class ApplicationEntryPoint { // Get the template instance from our object factory $templateInstance = ObjectFactory::createObjectByName($tpl); } catch (FrameworkException $e) { - exit(sprintf("[Main:] Could not initialize template engine for reason: %s", + exit(sprintf('[Main:] Could not initialize template engine for reason: %s', $e->getMessage() )); } @@ -105,7 +120,7 @@ final class ApplicationEntryPoint { } // END - if // Add the traceback path to the final output - $backtrace .= sprintf("%s:%d, %s(%d)
\n", + $backtrace .= sprintf('%s:%d, %s(%d)
' . PHP_EOL, basename($trace['file']), $trace['line'], $trace['function'], @@ -117,7 +132,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(); @@ -166,52 +181,109 @@ final class ApplicationEntryPoint { } /** - * Determines the correct absolute path for all includes only once per run. - * Other calls of this method are being "cached". + * Determines the correct absolute path for the framework. A set of common + * paths is being tested (first most common for applications, second when + * core tests are being executed and third/forth if the framework has been + * cloned there). * - * @return $corePath Base path (core) for all includes + * @return $frameworkPath Path for framework */ - protected static final function detectCorePath () { + public static final function detectFrameworkPath () { // Is it not set? - if (empty(self::$corePath)) { - // Auto-detect our core path - self::$corePath = str_replace("\\", '/', dirname(__FILE__)); + if (empty(self::$frameworkPath)) { + // Auto-detect core path (first application-common) + foreach (array('core', '.', '/usr/local/share/php/core', '/usr/share/php/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 framework/config-global.php + $fqfn = sprintf( + '%s%sframework%sconfig-global.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::$frameworkPath = $realPath . '/framework/'; + + // Abort here + break; + } // END - if + } // END - foreach + + // Able to find? + if (!is_dir(self::$frameworkPath)) { + // Is no directory + throw new Exception('Cannot find framework.'); + } // END - if } // END - if // Return it - return self::$corePath; + return self::$frameworkPath; } /** - * The application's main entry point. This class isolates some local + * Getter for root path + * + * @return $rootPath Root path + */ + public static function getRootPath () { + // Get __DIR__, really simple and no detection + return __DIR__; + } + + /** + * The framework's main entry point. This class isolates some local * variables which shall not become visible to outside because of security - * concerns. We are doing this here to "emulate" the well-known entry - * point in Java. + * concerns. This is done here to "emulate" the well-known entry point in + * Java. * * @return void */ public static final function main () { - // Load config file - require(self::detectCorePath() . '/inc/config.php'); + // Load bootstrap file + require sprintf('%sbootstrap%sbootstrap.inc.php', self::detectFrameworkPath(), DIRECTORY_SEPARATOR); - // Load all include files - require($cfg->getConfigEntry('base_path') . 'inc/includes.php'); + /* + * Initial bootstrap is done, continue with initialization of + * framework. + */ + FrameworkBootstrap::initFramework(); - // Include the application selector - require($cfg->getConfigEntry('base_path') . 'inc/selector.php'); - } // END - main() -} // END - class + // Next initialize the detected application + FrameworkBootstrap::prepareApplication(); + + /* + * Last step is to start the application, this will also initialize and + * register the application instance in registry. + */ + FrameworkBootstrap::startApplication(); + } +} // Developer mode active? Comment out if no dev! -define('DEVELOPER', TRUE); +define('DEVELOPER', true); // Log all exceptions (only debug! This option can create large error logs) -//define('LOG_EXCEPTIONS', TRUE); +//define('LOG_EXCEPTIONS', true); //xdebug_start_trace(); -// Do not remove the following line: +// Call above main() method ApplicationEntryPoint::main(); - -// [EOF] -?>