Monday, June 25, 2012

GSoC 2012 - 5th Week Progress

      This is the 5th week of my GSoC 2012 project. In last week I started to implement class behavior in common.lib.php file.

       This week I finish remaining part of the implementing class behavior in common.lib.php file. Now the class is named as PMA_CommonFunctions and file is appeared as CommonFunctions.class.php. This class is used singleton pattern to avoid the creation of many objects by several places, which needs more memory. If any function or file with procedural codes contain more than one function inside PMA_CommonFunctions class the class object is assigned to a variable called $common_functions and used that variable to call needed functions inside that class. The classes which use the functions in PMA_CommonFunctions class, were modified by adding getter setter methods to get/set PMA_CommonFunctions class object.

                  I faced several problems while implementing this part. Some functions were used more than 400 times in many files. All of those cannot be just replaced due to some JS functions also appeared with same name. After completing those modifications, I could only see login screen on my browser. After login nothing displayed in my browser. Then according to guidance of Michal, I enabled write error log to file. So that I could debug the code. Then I found that the error was due to calling non-static methods in side static functions in some classes. Those were replaced by direct calling using the static method (PMA_CommonFunctions::getInstance()->someFunction()) instead of get the use of variable for store class instance.

       Then the code was seems work fine. At the moment code is not committed yet due to some conflicts while merging the original PMA code. I'll be able to commit those changes as soon as after resolving them.

            In next week I'll start to looking at the possibility of using PMA_mimeDefaultFunction() function (at the moment this is inside core.lib.php file) inside PMA_DisplayResults class as suggested by Marc. If possible unit tests were implement for the functions inside PMA_DisplayResults class.

No comments:

Post a Comment