Changeset 845

Show
Ignore:
Timestamp:
03/27/08 10:24:42 (8 months ago)
Author:
laurentj
Message:

Made little performance improvement during retrieving of the response object

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/jelix/core/jConfigCompiler.class.php

    r824 r845  
    7272            $config->urlengine['jelixWWWPath'] = $path.$config->urlengine['jelixWWWPath']; 
    7373 
     74        self::_initResponsesPath($config->responses); 
     75        self::_initResponsesPath($config->_coreResponses); 
     76 
    7477 
    7578        /*if(preg_match("/^([a-zA-Z]{2})(?:_([a-zA-Z]{2}))?$/",$config->locale,$m)){ 
     
    126129        if($path!='' && $config['urlengine']['jelixWWWPath']{0} != '/') 
    127130            $config['urlengine']['jelixWWWPath'] = $path.$config['urlengine']['jelixWWWPath']; 
     131 
     132        self::_initResponsesPath($config['responses']); 
     133        self::_initResponsesPath($config['_coreResponses']); 
    128134 
    129135        /*if(preg_match("/^([a-zA-Z]{2})(?:_([a-zA-Z]{2}))?$/",$config['locale'],$m)){ 
     
    289295    } 
    290296 
     297    /** 
     298     * get all physical pathes of responses file 
     299     */ 
     300    static private function _initResponsesPath(&$list){ 
     301        $copylist = $list; // because we modify $list and then it will search for "foo.path" responses... 
     302        foreach($copylist as $type=>$class){ 
     303            if(file_exists($path=JELIX_LIB_CORE_PATH.'response/'.$class.'.class.php')){ 
     304                $list[$type.'.path']=$path; 
     305            }elseif(file_exists($path=JELIX_APP_PATH.'responses/'.$class.'.class.php')){ 
     306                $list[$type.'.path']=$path; 
     307            }else{ 
     308                throw new Exception('Jelix Config Error: the class file of the response type "'.$type.'" is not found ('.$path.')'); 
     309            } 
     310        } 
     311    } 
    291312 
    292313#ifnot ENABLE_PHP_JELIX 
  • trunk/lib/jelix/core/jConfigCompiler.class.php

    r824 r845  
    7272            $config->urlengine['jelixWWWPath'] = $path.$config->urlengine['jelixWWWPath']; 
    7373 
     74        self::_initResponsesPath($config->responses); 
     75        self::_initResponsesPath($config->_coreResponses); 
     76 
    7477 
    7578        /*if(preg_match("/^([a-zA-Z]{2})(?:_([a-zA-Z]{2}))?$/",$config->locale,$m)){ 
     
    126129        if($path!='' && $config['urlengine']['jelixWWWPath']{0} != '/') 
    127130            $config['urlengine']['jelixWWWPath'] = $path.$config['urlengine']['jelixWWWPath']; 
     131 
     132        self::_initResponsesPath($config['responses']); 
     133        self::_initResponsesPath($config['_coreResponses']); 
    128134 
    129135        /*if(preg_match("/^([a-zA-Z]{2})(?:_([a-zA-Z]{2}))?$/",$config['locale'],$m)){ 
     
    289295    } 
    290296 
     297    /** 
     298     * get all physical pathes of responses file 
     299     */ 
     300    static private function _initResponsesPath(&$list){ 
     301        $copylist = $list; // because we modify $list and then it will search for "foo.path" responses... 
     302        foreach($copylist as $type=>$class){ 
     303            if(file_exists($path=JELIX_LIB_CORE_PATH.'response/'.$class.'.class.php')){ 
     304                $list[$type.'.path']=$path; 
     305            }elseif(file_exists($path=JELIX_APP_PATH.'responses/'.$class.'.class.php')){ 
     306                $list[$type.'.path']=$path; 
     307            }else{ 
     308                throw new Exception('Jelix Config Error: the class file of the response type "'.$type.'" is not found ('.$path.')'); 
     309            } 
     310        } 
     311    } 
    291312 
    292313#ifnot ENABLE_PHP_JELIX 
  • trunk/lib/jelix/core/jConfigCompiler.class.php

    r824 r845  
    7272            $config->urlengine['jelixWWWPath'] = $path.$config->urlengine['jelixWWWPath']; 
    7373 
     74        self::_initResponsesPath($config->responses); 
     75        self::_initResponsesPath($config->_coreResponses); 
     76 
    7477 
    7578        /*if(preg_match("/^([a-zA-Z]{2})(?:_([a-zA-Z]{2}))?$/",$config->locale,$m)){ 
     
    126129        if($path!='' && $config['urlengine']['jelixWWWPath']{0} != '/') 
    127130            $config['urlengine']['jelixWWWPath'] = $path.$config['urlengine']['jelixWWWPath']; 
     131 
     132        self::_initResponsesPath($config['responses']); 
     133        self::_initResponsesPath($config['_coreResponses']); 
    128134 
    129135        /*if(preg_match("/^([a-zA-Z]{2})(?:_([a-zA-Z]{2}))?$/",$config['locale'],$m)){ 
     
    289295    } 
    290296 
     297    /** 
     298     * get all physical pathes of responses file 
     299     */ 
     300    static private function _initResponsesPath(&$list){ 
     301        $copylist = $list; // because we modify $list and then it will search for "foo.path" responses... 
     302        foreach($copylist as $type=>$class){ 
     303            if(file_exists($path=JELIX_LIB_CORE_PATH.'response/'.$class.'.class.php')){ 
     304                $list[$type.'.path']=$path; 
     305            }elseif(file_exists($path=JELIX_APP_PATH.'responses/'.$class.'.class.php')){ 
     306                $list[$type.'.path']=$path; 
     307            }else{ 
     308                throw new Exception('Jelix Config Error: the class file of the response type "'.$type.'" is not found ('.$path.')'); 
     309            } 
     310        } 
     311    } 
    291312 
    292313#ifnot ENABLE_PHP_JELIX 
  • trunk/lib/jelix/core/jCoordinator.class.php

    r838 r845  
    264264 
    265265        $respclass = $gJConfig->responses[$type]; 
    266         if(file_exists($path=JELIX_LIB_CORE_PATH.'response/'.$respclass.'.class.php')){ 
    267             require_once ($path); 
    268         }elseif(file_exists($path=JELIX_APP_PATH.'responses/'.$respclass.'.class.php')){ 
    269             require_once ($path); 
    270         }else{ 
    271             return jLocale::get('jelix~errors.default.response.not.loaded',array($this->moduleName.'~'.$this->actionName,$type)); 
    272         } 
     266        require_once ($gJConfig->responses[$type.'.path']); 
    273267 
    274268        $this->response = new $respclass(); 
  • trunk/lib/jelix/core/jCoordinator.class.php

    r838 r845  
    264264 
    265265        $respclass = $gJConfig->responses[$type]; 
    266         if(file_exists($path=JELIX_LIB_CORE_PATH.'response/'.$respclass.'.class.php')){ 
    267             require_once ($path); 
    268         }elseif(file_exists($path=JELIX_APP_PATH.'responses/'.$respclass.'.class.php')){ 
    269             require_once ($path); 
    270         }else{ 
    271             return jLocale::get('jelix~errors.default.response.not.loaded',array($this->moduleName.'~'.$this->actionName,$type)); 
    272         } 
     266        require_once ($gJConfig->responses[$type.'.path']); 
    273267 
    274268        $this->response = new $respclass(); 
  • trunk/lib/jelix/core/jCoordinator.class.php

    r838 r845  
    264264 
    265265        $respclass = $gJConfig->responses[$type]; 
    266         if(file_exists($path=JELIX_LIB_CORE_PATH.'response/'.$respclass.'.class.php')){ 
    267             require_once ($path); 
    268         }elseif(file_exists($path=JELIX_APP_PATH.'responses/'.$respclass.'.class.php')){ 
    269             require_once ($path); 
    270         }else{ 
    271             return jLocale::get('jelix~errors.default.response.not.loaded',array($this->moduleName.'~'.$this->actionName,$type)); 
    272         } 
     266        require_once ($gJConfig->responses[$type.'.path']); 
    273267 
    274268        $this->response = new $respclass(); 
  • trunk/lib/jelix/core/jRequest.class.php

    r839 r845  
    208208            } 
    209209            $respclass = $gJConfig->_coreResponses[$type]; 
     210            $path = $gJConfig->_coreResponses[$type.'.path']; 
    210211        }else{ 
    211212            if(!isset($gJConfig->responses[$type])){ 
     
    213214            } 
    214215            $respclass = $gJConfig->responses[$type]; 
    215         } 
    216         if(file_exists($path=JELIX_LIB_CORE_PATH.'response/'.$respclass.'.class.php')){ 
    217             require_once ($path); 
    218         }elseif(file_exists($path=JELIX_APP_PATH.'responses/'.$respclass.'.class.php')){ 
    219             require_once ($path); 
    220         }else{ 
    221             throw new jException('jelix~errors.ad.response.not.loaded',array($gJCoord->action->resource,$type,$gJCoord->action->getPath())); 
     216            $path = $gJConfig->responses[$type.'.path']; 
    222217        } 
    223218 
     
    226221        } 
    227222 
     223        require_once ($path); 
     224 
    228225        $response = new $respclass(); 
    229226        $gJCoord->response= $response; 
  • trunk/lib/jelix/core/jRequest.class.php

    r839 r845  
    208208            } 
    209209            $respclass = $gJConfig->_coreResponses[$type]; 
     210            $path = $gJConfig->_coreResponses[$type.'.path']; 
    210211        }else{ 
    211212            if(!isset($gJConfig->responses[$type])){ 
     
    213214            } 
    214215            $respclass = $gJConfig->responses[$type]; 
    215         } 
    216         if(file_exists($path=JELIX_LIB_CORE_PATH.'response/'.$respclass.'.class.php')){ 
    217             require_once ($path); 
    218         }elseif(file_exists($path=JELIX_APP_PATH.'responses/'.$respclass.'.class.php')){ 
    219             require_once ($path); 
    220         }else{ 
    221             throw new jException('jelix~errors.ad.response.not.loaded',array($gJCoord->action->resource,$type,$gJCoord->action->getPath())); 
     216            $path = $gJConfig->responses[$type.'.path']; 
    222217        } 
    223218 
     
    226221        } 
    227222 
     223        require_once ($path); 
     224 
    228225        $response = new $respclass(); 
    229226        $gJCoord->response= $response; 
  • trunk/lib/jelix/core/jRequest.class.php

    r839 r845  
    208208            } 
    209209            $respclass = $gJConfig->_coreResponses[$type]; 
     210            $path = $gJConfig->_coreResponses[$type.'.path']; 
    210211        }else{ 
    211212            if(!isset($gJConfig->responses[$type])){ 
     
    213214            } 
    214215            $respclass = $gJConfig->responses[$type]; 
    215         } 
    216         if(file_exists($path=JELIX_LIB_CORE_PATH.'response/'.$respclass.'.class.php')){ 
    217             require_once ($path); 
    218         }elseif(file_exists($path=JELIX_APP_PATH.'responses/'.$respclass.'.class.php')){ 
    219             require_once ($path); 
    220         }else{ 
    221             throw new jException('jelix~errors.ad.response.not.loaded',array($gJCoord->action->resource,$type,$gJCoord->action->getPath())); 
     216            $path = $gJConfig->responses[$type.'.path']; 
    222217        } 
    223218 
     
    226221        } 
    227222 
     223        require_once ($path); 
     224 
    228225        $response = new $respclass(); 
    229226        $gJCoord->response= $response; 
  • trunk/testapp/var/config/index/config.ini.php

    r691 r845  
    77[responses] 
    88html = myHtmlResponse 
    9 unittest = testUnitResponse 
    109 
  • trunk/testapp/var/config/index/config.ini.php

    r691 r845  
    77[responses] 
    88html = myHtmlResponse 
    9 unittest = testUnitResponse 
    109 
  • trunk/testapp/var/config/index/config.ini.php

    r691 r845  
    77[responses] 
    88html = myHtmlResponse 
    9 unittest = testUnitResponse 
    109 
Download in other formats: Unified Diff Zip Archive