Changeset 16070

Show
Ignore:
Timestamp:
04/11/08 15:42:59 (6 months ago)
Author:
rambo
Message:

forward porting r16068 & r16069

Files:

Legend:

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

    r15505 r16070  
    527527$GLOBALS['midcom_config_default']['auto_formatter'] = array(); 
    528528 
     529/** 
     530 * Sessioning service, disabling the service will help with external caches. 
     531 * The second option is to allow logged in users to benefit from the service 
     532 */ 
     533$GLOBALS['midcom_config_default']['sessioning_service_enable'] = true; 
     534$GLOBALS['midcom_config_default']['sessioning_service_always_enable_for_users'] = true; 
    529535 
    530536/* ----- Include the site config ----- */ 
  • trunk/midcom/midcom.core/midcom/services/_sessioning.php

    r14773 r16070  
    7070        $started = true; 
    7171 
     72    } 
     73 
     74    function _initialize($unconditional_start = false) 
     75    { 
     76        static $initialized = false; 
     77        if ($initialized) 
     78        { 
     79            return true; 
     80        } 
     81 
     82        if (   !$GLOBALS['midcom_config']['sessioning_service_enable'] 
     83            && !(   $GLOBALS['midcom_config']['sessioning_service_always_enable_for_users'] 
     84                 && $_MIDGARD['user'] 
     85                 ) 
     86            ) 
     87        { 
     88            return false; 
     89        } 
     90 
     91        // Try to start session only if the client sends the id OR we need to set data 
     92        if (   !isset($_REQUEST[session_name()]) 
     93            && !$unconditional_start) 
     94        { 
     95            return false; 
     96        } 
     97 
    7298        @session_start(); 
    7399 
     
    80106            $_SESSION["midcom_session_data"]["midcom.service.sessioning"]["startup"] = serialize(time()); 
    81107        } 
     108        $initialized = true; 
     109        return true; 
    82110    } 
    83111 
     
    93121    function exists ($domain, $key) 
    94122    { 
     123        if (!$this->_initialize()) 
     124        { 
     125            return false; 
     126        } 
    95127        if (! array_key_exists($domain, $_SESSION["midcom_session_data"])) 
    96128        { 
     
    194226    function set ($domain, $key, $value) 
    195227    { 
     228        if (!$this->_initialize(true)) 
     229        { 
     230            return false; 
     231        } 
    196232        static $no_cache = false; 
    197233        if (!$no_cache) 
  • trunk/midcom/midcom.helper.datamanager2/schema.php

    r15104 r16070  
    576576     function register_to_session($guid) 
    577577     { 
     578        $key = $this->name .  $guid; 
     579        // Seems we do not need this anymore, but return key still 
     580        return $key; 
     581 
    578582        $session =& $_MIDCOM->get_service('session'); 
    579         $key = $this->name .  $guid; 
    580  
    581583        $session->set('midcom.helper.datamanager2', $key, $this->_raw_schema); 
    582584        return $key;