From: Roland Häder Date: Fri, 20 Jun 2008 18:04:22 +0000 (+0000) Subject: Deug backtraces centralized X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=58e0fb00204ed031ec9d312b0fa0f6f693711aae;p=shipsimu.git Deug backtraces centralized --- diff --git a/inc/classes/main/class_BaseFrameworkSystem.php b/inc/classes/main/class_BaseFrameworkSystem.php index 9432fa6..b725a85 100644 --- a/inc/classes/main/class_BaseFrameworkSystem.php +++ b/inc/classes/main/class_BaseFrameworkSystem.php @@ -894,7 +894,11 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { ); // Output it - ApplicationEntryPoint::app_die(sprintf("%s debug output:%s", $this->__toString(), $content)); + ApplicationEntryPoint::app_die(sprintf("%s debug output:
%s
Loaded includes:
%s
", + $this->__toString(), + $content, + ClassLoader::getInstance()->getPrintableIncludeList() + )); } /** diff --git a/inc/classes/main/commands/web/class_WebDoFormCommand.php b/inc/classes/main/commands/web/class_WebDoFormCommand.php index 79f292a..dfd7b2c 100644 --- a/inc/classes/main/commands/web/class_WebDoFormCommand.php +++ b/inc/classes/main/commands/web/class_WebDoFormCommand.php @@ -67,9 +67,7 @@ class WebDoFormCommand extends BaseCommand implements Commandable { */ public function execute (Requestable $requestInstance, Responseable $responseInstance) { // Should never be executed... - echo "This should never be executed!
";
-		debug_print_backtrace();
-		die("
Good bye..."); + $this->debugBacktrace(); } /** diff --git a/inc/classes/main/controller/default/class_WebDefaultNewsController.php b/inc/classes/main/controller/default/class_WebDefaultNewsController.php index fee2d39..f623f84 100644 --- a/inc/classes/main/controller/default/class_WebDefaultNewsController.php +++ b/inc/classes/main/controller/default/class_WebDefaultNewsController.php @@ -67,6 +67,9 @@ class WebDefaultNewsController extends BaseController implements Controller { * @return void */ public function handleRequest (Requestable $requestInstance, Responseable $responseInstance) { + // Add more filters by the command + $commandInstance->addExtraFilters($this); + // Run the pre filters $this->executePreFilters($requestInstance, $responseInstance); diff --git a/inc/classes/main/controller/default/class_WebLoginController.php b/inc/classes/main/controller/default/class_WebLoginController.php index 5c8f9f4..28378f3 100644 --- a/inc/classes/main/controller/default/class_WebLoginController.php +++ b/inc/classes/main/controller/default/class_WebLoginController.php @@ -66,6 +66,9 @@ class WebLoginController extends BaseController implements Controller { * @return void */ public function handleRequest (Requestable $requestInstance, Responseable $responseInstance) { + // Add more filters by the command + $commandInstance->addExtraFilters($this); + // Run the pre filters $this->executePreFilters($requestInstance, $responseInstance); diff --git a/inc/classes/main/controller/form/class_WebDoFormController.php b/inc/classes/main/controller/form/class_WebDoFormController.php index 1856dd3..42171a6 100644 --- a/inc/classes/main/controller/form/class_WebDoFormController.php +++ b/inc/classes/main/controller/form/class_WebDoFormController.php @@ -72,7 +72,7 @@ class WebDoFormController extends BaseController implements Controller { // Get command instance from resolver $commandInstance = $this->getResolverInstance()->resolveCommand($formAction); - // Try to add more filters by the command + // Add more filters by the command $commandInstance->addExtraFilters($this); // Try to run the pre filters, if auth exceptions come through redirect here diff --git a/inc/classes/main/controller/login/class_WebLoginAreaController.php b/inc/classes/main/controller/login/class_WebLoginAreaController.php index 7ea4e50..c43c897 100644 --- a/inc/classes/main/controller/login/class_WebLoginAreaController.php +++ b/inc/classes/main/controller/login/class_WebLoginAreaController.php @@ -77,6 +77,9 @@ class WebLoginAreaController extends BaseController implements Controller { * @return void */ public function handleRequest (Requestable $requestInstance, Responseable $responseInstance) { + // Add more filters by the command + $commandInstance->addExtraFilters($this); + // Try to run the pre filters, if auth exceptions come through redirect here try { // Run the pre filters diff --git a/inc/classes/main/debug/class_DebugConsoleOutput.php b/inc/classes/main/debug/class_DebugConsoleOutput.php index be17ae3..9f56903 100644 --- a/inc/classes/main/debug/class_DebugConsoleOutput.php +++ b/inc/classes/main/debug/class_DebugConsoleOutput.php @@ -58,7 +58,7 @@ class DebugConsoleOutput extends BaseFrameworkSystem implements Debugger, Output * @return void */ public final function outputStream ($output) { - print html_entity_decode(strip_tags($output)); + print(html_entity_decode(strip_tags($output))); } /** diff --git a/inc/classes/main/output/class_WebOutput.php b/inc/classes/main/output/class_WebOutput.php index 5b4f588..0b21ff3 100644 --- a/inc/classes/main/output/class_WebOutput.php +++ b/inc/classes/main/output/class_WebOutput.php @@ -90,7 +90,7 @@ class WebOutput extends BaseFrameworkSystem implements OutputStreamer, Registera * @return void */ public final function output ($outStream=false) { - print $outStream; + print($outStream); } } diff --git a/inc/classes/main/resolver/class_BaseResolver.php b/inc/classes/main/resolver/class_BaseResolver.php index 9345109..6c9ebf7 100644 --- a/inc/classes/main/resolver/class_BaseResolver.php +++ b/inc/classes/main/resolver/class_BaseResolver.php @@ -129,11 +129,7 @@ class BaseResolver extends BaseFrameworkSystem { } // Debug output - //echo "----- ".__METHOD__." -----
\n"; - //print($class."
");
-		//debug_print_backtrace();
-		//var_dump($isValid);
-		//print("
"); + //* DEBUG: */ $this->debugBacktrace(); // Set command name $this->setCommandName($commandName); diff --git a/inc/classes/main/resolver/web/class_WebControllerResolver.php b/inc/classes/main/resolver/web/class_WebControllerResolver.php index 1debf14..a02eeaa 100644 --- a/inc/classes/main/resolver/web/class_WebControllerResolver.php +++ b/inc/classes/main/resolver/web/class_WebControllerResolver.php @@ -132,10 +132,7 @@ class WebControllerResolver extends BaseResolver implements ControllerResolver { */ private function loadController ($commandName) { // Debug message - //print("----- ".__METHOD__." -----
");
-		 //debug_print_backtrace();
-		 //print("
"); - // + //* DEBUG: */ $this->debugBacktrace(); // Cache default command $defaultCommand = $this->getConfigInstance()->readConfig('default_command'); diff --git a/inc/loader/class_ClassLoader.php b/inc/loader/class_ClassLoader.php index 06b8fd8..5f0f2b9 100644 --- a/inc/loader/class_ClassLoader.php +++ b/inc/loader/class_ClassLoader.php @@ -314,11 +314,11 @@ class ClassLoader { // Count this include $this->total++; + // Mark this class as loaded + $this->loadedClasses[] = $this->classes[$fileName]; + // Developer mode excludes caching (better debugging) if (!defined('DEVELOPER')) { - // Mark this class as loaded - $this->loadedClasses[] = $this->classes[$fileName]; - // Reset cache $this->classesCached = false; } // END - if @@ -352,6 +352,22 @@ class ClassLoader { public final function getTotal () { return $this->total; } + + /** + * Getter for a printable list of included classes/interfaces/exceptions + * + * @param $includeList A printable include list + */ + public function getPrintableIncludeList () { + // Prepare the list + $includeList = ""; + foreach ($this->loadedClasses as $classFile) { + $includeList .= basename($classFile)."
\n"; + } // END - foreach + + // And return it + return $includeList; + } } // [EOF]