Changeset 11889

Show
Ignore:
Timestamp:
08/30/07 17:15:54 (1 year ago)
Author:
bergie
Message:

Collectorize parameter lists, some other minor tuning. refs #102

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/midcom/midcom.core/midcom.php

    r11872 r11889  
    158158require('midcom/services/rcs.php'); 
    159159 
    160  
     160mgd_debug_start(); 
    161161///////////////////////////////////// 
    162162// Instantinate the MidCOM main class 
     
    164164 
    165165$_MIDCOM = new midcom_application(); 
    166 $GLOBALS['midcom'] =& $_MIDCOM; 
     166//$GLOBALS['midcom'] =& $_MIDCOM; 
    167167$_MIDCOM->initialize(); 
    168168?> 
  • trunk/midcom/midcom.core/midcom/application.php

    r11883 r11889  
    13221322        { 
    13231323            $host_name = $this->get_host_name(); 
    1324             $host = new midcom_db_host($_MIDGARD['host']); 
    1325             $host_prefix = $host->prefix; 
     1324            $host_prefix = $_MIDGARD['prefix']; 
    13261325            if ($host_prefix == '') 
    13271326            { 
  • trunk/midcom/midcom.core/midcom/baseclasses/core/dbobject.php

    r11359 r11889  
    11981198    function _list_parameters_domain(&$object, $domain) 
    11991199    { 
    1200         debug_push_class($object, __FUNCTION__); 
     1200        $mc = new midgard_collector('midgard_parameter', 'parentguid', $object->guid); 
     1201        $mc->add_constraint('domain', '=', $domain); 
     1202        $mc->set_key_property('name'); 
     1203        $mc->add_value_property('value'); 
    12011204         
    1202         // TODO: Switch to collector 
    1203         $query = new midgard_query_builder('midgard_parameter'); 
    1204         $query->add_constraint('parentguid', '=', $object->guid); 
    1205         $query->add_constraint('domain', '=', $domain); 
    1206  
    1207         // Temporary workaround for missing delete support 
    1208         $query->add_constraint('value', '<>', ''); 
    1209  
    1210         $result = @$query->execute(); 
    1211  
    1212         if (count($result) == 0) 
    1213         { 
    1214             debug_add("Cannot retrieve the parameter {$domain} for {$object->__table__} ID {$object->id}; query execution failed, this is most probably an empty resultset.", 
    1215                 MIDCOM_LOG_DEBUG); 
    1216             debug_pop(); 
    1217             return Array(); 
    1218         } 
    1219         $return = Array(); 
    1220  
    1221         foreach ($result as $parameter) 
    1222         { 
    1223             $return[$parameter->name] = $parameter->value; 
    1224         } 
    1225  
    1226         debug_pop(); 
    1227         return $return; 
     1205        $mc->execute(); 
     1206         
     1207        $results = array(); 
     1208         
     1209        $params = $mc->list_keys(); 
     1210        foreach ($params as $name => $param) 
     1211        { 
     1212            $results[$name] = $mc->get_subkey($name, 'value'); 
     1213        } 
     1214         
     1215        return $results; 
    12281216    } 
    12291217 
  • trunk/midcom/midcom.core/midcom/services/auth/sessionmgr.php

    r11359 r11889  
    114114        { 
    115115            debug_push_class(__CLASS__, __FUNCTION__); 
    116             debug_add('Failed to create a new login session:' . mgd_errstr(), MIDCOM_LOG_ERROR); 
    117             debug_print_r('Object was:', $session); 
     116            debug_add('Failed to create a new login session: ' . mgd_errstr(), MIDCOM_LOG_ERROR); 
    118117            debug_pop(); 
    119118            return false; 
     
    152151    function load_login_session($sessionid, $user, $clientip = null) 
    153152    { 
    154         debug_push_class(__CLASS__, __FUNCTION__); 
    155  
    156153        if ($clientip === null) 
    157154        { 
     
    165162        if (! $result) 
    166163        { 
     164            debug_push_class(__CLASS__, __FUNCTION__);         
    167165            debug_add('No login sessions have been found in the database or the query to the database failed.', MIDCOM_LOG_INFO); 
    168             debug_add('Last Midgard Error:', mgd_errstr()); 
    169166            debug_pop(); 
    170167            return false; 
     
    180177            if ($session->timestamp < $timed_out) 
    181178            { 
     179                debug_push_class(__CLASS__, __FUNCTION__);             
    182180                debug_add("The session {$session->guid} (#{$session->id}) has timed out.", MIDCOM_LOG_INFO); 
     181                debug_pop(); 
    183182                $valid = false; 
    184183            } 
     
    189188                && $session->clientip != $clientip) 
    190189            { 
     190                debug_push_class(__CLASS__, __FUNCTION__);             
    191191                debug_add("The session {$session->guid} (#{$session->id}) had mismatching client IP.", MIDCOM_LOG_INFO); 
    192192                debug_add("Expected {$session->clientip}, got {$clientip}."); 
     193                debug_pop(); 
    193194                $valid = false; 
    194195            } 
     
    196197            if (! $valid) 
    197198            { 
    198                 debug_print_r("Dropping this session:", $session); 
    199199                if (! $session->delete()) 
    200200                { 
     201                    debug_push_class(__CLASS__, __FUNCTION__);                 
    201202                    debug_add("Failed to delete the invalid session {$session->guid} (#{$session->id}): " . mgd_errstr(), MIDCOM_LOG_INFO); 
    202                     debug_print_r('Object was:', $session); 
     203                    debug_pop(); 
    203204                } 
    204205                continue; 
     
    211212                if (! $session->update()) 
    212213                { 
     214                    debug_push_class(__CLASS__, __FUNCTION__); 
    213215                    debug_add("Failed to update the session {$session->guid} (#{$session->id}) to the current timestamp: " . mgd_errstr(), MIDCOM_LOG_INFO); 
    214                     debug_print_r('Object was:', $session); 
     216                    debug_pop(); 
    215217                } 
    216218 
     
    226228        if (! $return) 
    227229        { 
    228             debug_add("We could not find any valid session having the identifier {$sessionid}.", MIDCOM_LOG_INFO); 
    229         } 
    230  
    231         debug_pop(); 
     230            //debug_add("We could not find any valid session having the identifier {$sessionid}.", MIDCOM_LOG_INFO); 
     231        } 
     232 
    232233        return $return; 
    233234    } 
     
    277278        { 
    278279            debug_push_class(__CLASS__, __FUNCTION__); 
    279             debug_add("Failed to authenticate to the given userername / password: " . mgd_errstr(), 
     280            debug_add("Failed to authenticate to the given username / password: " . mgd_errstr(), 
    280281                MIDCOM_LOG_ERROR); 
    281282            debug_pop(); 
     
    320321                debug_push_class(__CLASS__, __FUNCTION__); 
    321322                debug_add("Failed to delete the invalid session {$session->guid} (#{$session->id}): " . mgd_errstr(), MIDCOM_LOG_INFO); 
    322                 debug_print_r('Object was:', $session); 
    323323                debug_pop(); 
    324324            } 
     
    354354            debug_push_class(__CLASS__, __FUNCTION__); 
    355355            debug_add("Failed to delete the delete session {$session->guid} (#{$session->id}): " . mgd_errstr(), MIDCOM_LOG_INFO); 
    356             debug_print_r('Object was:', $session); 
    357356            debug_pop(); 
    358357            return false;