Rewritten class loader to skip deprecated class files:
authorRoland Häder <roland@mxchange.org>
Tue, 29 Mar 2011 16:42:19 +0000 (16:42 +0000)
committerRoland Häder <roland@mxchange.org>
Tue, 29 Mar 2011 16:42:19 +0000 (16:42 +0000)
- Rewritten class loader to skip deprecated class files which should make all
  applications working again. This is done by checking its size because I
  will remove all code from the PHP include file and add a @DEPRECATED tag to
  it. A typical size is 24 bytes
- __set() and __get() are now calling debugBackTrace() with a message to aid
  finding e.g. typos in field/attribute names
- debugBackTrace() does now accept an optional parameter for a message
- TODOs.txt updated

docs/TODOs.txt
inc/classes/main/class_BaseFrameworkSystem.php
inc/loader/class_ClassLoader.php

index 354a8ce2f834eef0952f521edc697f708b8e2d9f..05d27cd380d9ed3def2d05bee203a1fbf16c0beb 100644 (file)
@@ -3,8 +3,8 @@
 ./inc/classes/exceptions/main/class_MissingMethodException.php:13: * @todo             Try to rewrite user/guest login classes and mark this exception as deprecated
 ./inc/classes/exceptions/main/class_NoConfigEntryException.php:10: * @todo             Rename this class to NoFoundEntryException
 ./inc/classes/interfaces/class_FrameworkInterface.php:11: * @todo              Find a better name for this interface
-./inc/classes/main/class_BaseFrameworkSystem.php:1178:  * @todo        Write a logging mechanism for productive mode
-./inc/classes/main/class_BaseFrameworkSystem.php:1192:                 // @TODO Finish this part!
+./inc/classes/main/class_BaseFrameworkSystem.php:1184:  * @todo        Write a logging mechanism for productive mode
+./inc/classes/main/class_BaseFrameworkSystem.php:1198:                 // @TODO Finish this part!
 ./inc/classes/main/class_BaseFrameworkSystem.php:169:  // @todo Try to clean these constants up
 ./inc/classes/main/class_BaseFrameworkSystem.php:355:   * @todo        SearchableResult and UpdateableResult shall have a super interface to use here
 ./inc/classes/main/commands/web/class_WebLoginAreaCommand.php:64:       * @todo        Add some stuff here: Some personal data, app/game related data
index 0eaddce17e5e361d872b15c72af8c3551ee0ee73..8cbcd1df138445eda6ddd1767495a04c9eeea1eb 100644 (file)
@@ -328,7 +328,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
         * @return      void
         */
        public final function __set ($name, $value) {
-               $this->debugOutput(sprintf("Tried to set a missing field. name=%s, value[%s]=%s",
+               $this->debugBackTrace(sprintf("Tried to set a missing field. name=%s, value[%s]=%s",
                        $name,
                        gettype($value),
                        $value
@@ -342,7 +342,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
         * @return      void
         */
        public final function __get ($name) {
-               $this->debugOutput(sprintf("Tried to get a missing field. name=%s",
+               $this->debugBackTrace(sprintf("Tried to get a missing field. name=%s",
                        $name
                ));
        }
@@ -862,10 +862,16 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
        /**
         * Outputs a debug backtrace and stops further script execution
         *
+        * @param       $message        An optional message to output
         * @return      void
         */
-       public function debugBackTrace () {
+       public function debugBackTrace ($message = '') {
                // Sorry, there is no other way getting this nice backtrace
+               if (!empty($message)) {
+                       // Output message
+                       printf("Message: %s<br />\n", $message);
+               } // END - if
+
                print("<pre>\n");
                debug_print_backtrace();
                print("</pre>");
index 601b06d95d539b8bb650f917d318657dc593ff05..eef05549a88553580a4d92e163603a58e7bba084 100644 (file)
@@ -276,12 +276,14 @@ class ClassLoader {
                        // Get filename from iterator
                        $fileName = $entry->getFileName();
 
+                       // Get the FQFN and add it to our class list
+                       $fqfn = $entry->getRealPath();
+
                        // Is this file wanted?
                        //* DEBUG: */ echo "FOUND:{$fileName}<br />\n";
-                       if ((!in_array($fileName, $this->ignoreList)) && (substr($fileName, 0, strlen($this->prefix)) == $this->prefix) && (substr($fileName, -strlen($this->suffix), strlen($this->suffix)) == $this->suffix)) {
-                               // Get the FQFN and add it to our class list
-                               $fqfn = $entry->getRealPath();
+                       if ((!in_array($fileName, $this->ignoreList)) && (filesize($fqfn) > 100) && (substr($fileName, 0, strlen($this->prefix)) == $this->prefix) && (substr($fileName, -strlen($this->suffix), strlen($this->suffix)) == $this->suffix)) {
                                //* DEBUG: */ echo "ADD: {$fileName}<br />\n";
+                               // Add it to the list
                                $this->classes[$fileName] = $fqfn;
                        } // END - if
                } // END - foreach