developer.jelix.org is not used any more and exists only for history. Post new tickets on the Github account.
developer.jelix.org n'est plus utilisée, et existe uniquement pour son historique. Postez les nouveaux tickets sur le compte github.

Ticket #949: 949-jSession-dao-without-now-function.diff

File 949-jSession-dao-without-now-function.diff, 2.2 KB (added by Julien, 12 years ago)
  • lib/jelix/core-modules/jelix/daos/jsession.dao.xml

     
    33    <datasources>
    44        <primarytable name="jsessions" realname="jsessions" primarykey="id" />
    55    </datasources>
    6    
     6
    77    <record>
    88        <property name="id" fieldname="id" datatype="string"/>
    9         <property name="creation" fieldname="creation" datatype="date" insertpattern="NOW()" updatepattern="" required="true"/>
    10         <property name="access" fieldname="access" datatype="date" insertpattern="NOW()" updatepattern="NOW()" required="true"/>
     9        <property name="creation" fieldname="creation" datatype="date" required="true"/>
     10        <property name="access" fieldname="access" datatype="date" required="true"/>
    1111        <property name="data" fieldname="data" datatype="string" required="true"/>
    1212    </record>
    1313
  • lib/jelix/core/jSession.class.php

     
    44* @subpackage core
    55* @author     Julien Issler
    66* @contributor Laurent Jouanneau
    7 * @copyright  2007-2008 Julien Issler, 2008 Laurent Jouanneau
     7* @copyright  2007-2009 Julien Issler, 2008 Laurent Jouanneau
    88* @link       http://www.jelix.org
    99* @licence    GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html
    1010* @since 1.0
     
    141141            $session = jDao::createRecord(self::$_params['dao_selector']);
    142142            $session->id = $id;
    143143            $session->data = $data;
     144            $date = new jDateTime();
     145            $date->now();
     146            $now = $date->toString(jDateTime::BD_DTFORMAT);
     147            $session->creation = $now;
     148            $session->access = $now;
    144149            $dao->insert($session);
    145150        }
    146151        else{
     152            $date = new jDateTime();
     153            $date->now();
    147154            $session->data = $data;
     155            $session->access = $date->toString(jDateTime::BD_DTFORMAT);
    148156            $dao->update($session);
    149157        }
    150158