Changeset 1336

Show
Ignore:
Timestamp:
03/15/08 19:15:30 (7 months ago)
Author:
benoitg
Message:
  • Content.php: Eliminate the generation of a large number of useless SQL queries when getting Content metadata.
  • User.php: Do the same thing for getCurrentUser()
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wifidog-auth/CHANGELOG

    r1334 r1336  
    11# $Id$ 
     22008-03-15 Benoit GrĂ©goire  <bock@step.polymtl.ca> 
     3        * Content.php:  Eliminate the generation of a large number of useless SQL queries when getting Content metadata. 
     4        * User.php: Do the same thing for getCurrentUser() 
     5         
    262008-03-12 Benoit GrĂ©goire  <bock@step.polymtl.ca> 
    37    * Major performance improvement in content manager for content groups picking items with limits on how many times they can be displayed. 
  • trunk/wifidog-auth/wifidog/classes/Content.php

    r1334 r1336  
    10701070     */ 
    10711071    public function getTitle() { 
    1072         try { 
    1073             return self :: getObject($this->content_row['title']); 
    1074         } catch (Exception $e) { 
    1075             return null; 
    1076         } 
     1072        $retval = null; 
     1073        if(!empty($this->content_row['title'])){ 
     1074            $retval = self :: getObject($this->content_row['title']); 
     1075        } 
     1076        return $retval; 
    10771077    } 
    10781078 
     
    10821082     */ 
    10831083    public function getDescription() { 
    1084         try { 
    1085             return self :: getObject($this->content_row['description']); 
    1086         } catch (Exception $e) { 
    1087             return null; 
    1088         } 
     1084        $retval = null; 
     1085        if(!empty($this->content_row['description'])){ 
     1086            $retval = self :: getObject($this->content_row['description']); 
     1087        } 
     1088        return $retval; 
    10891089    } 
    10901090 
     
    10941094     */ 
    10951095    public function getLongDescription() { 
    1096         try { 
    1097             return self :: getObject($this->content_row['long_description']); 
    1098         } catch (Exception $e) { 
    1099             return null; 
    1100         } 
     1096        $retval = null; 
     1097        if(!empty($this->content_row['long_description'])){ 
     1098            $retval = self :: getObject($this->content_row['long_description']); 
     1099        } 
     1100        return $retval; 
    11011101    } 
    11021102 
     
    11061106     */ 
    11071107    public function getProjectInfo() { 
    1108         try { 
    1109             return self :: getObject($this->content_row['project_info']); 
    1110         } catch (Exception $e) { 
    1111             return null; 
    1112         } 
     1108        $retval = null; 
     1109        if(!empty($this->content_row['project_info'])){ 
     1110            $retval = self :: getObject($this->content_row['project_info']); 
     1111        } 
     1112        return $retval; 
    11131113    } 
    11141114 
  • trunk/wifidog-auth/wifidog/classes/User.php

    r1321 r1336  
    104104        require_once ('classes/Session.php'); 
    105105        $session = Session::getObject(); 
     106        $sessCurrentUserId = $session->get(SESS_USER_ID_VAR); 
    106107        $user = null; 
    107         try { 
    108             $user = self :: getObject($session->get(SESS_USER_ID_VAR)); 
    109             //$user = new User($session->get(SESS_USER_ID_VAR)); 
    110         } catch (Exception $e) { 
    111             /**If any problem occurs, the user should be considered logged out*/ 
    112             $session->set(SESS_USER_ID_VAR, null); 
     108        if(!empty($sessCurrentUserId)){ 
     109            try { 
     110                $user = self :: getObject($sessCurrentUserId); 
     111                //$user = new User($session->get(SESS_USER_ID_VAR)); 
     112            } catch (Exception $e) { 
     113                /**If any problem occurs, the user should be considered logged out*/ 
     114                $session->set(SESS_USER_ID_VAR, null); 
     115            } 
    113116        } 
    114117        return $user;