6 changed files with 17 additions and 146 deletions
-
1app/assets/js/movim_websocket.js
-
29app/models/session/Session.php
-
108app/models/session/SessionDAO.php
-
2bootstrap.php
-
18linker.php
-
5src/Movim/Daemon/Behaviour.php
@ -1,29 +0,0 @@ |
|||
<?php |
|||
|
|||
namespace modl; |
|||
|
|||
class Session extends Model { |
|||
public $name; |
|||
public $value; |
|||
public $session; |
|||
public $container; |
|||
public $timestamp; |
|||
|
|||
public function __construct() { |
|||
$this->_struct = ' |
|||
{ |
|||
"name" : |
|||
{"type":"string", "size":32, "mandatory":true, "key":true }, |
|||
"value" : |
|||
{"type":"text", "mandatory":true }, |
|||
"session" : |
|||
{"type":"string", "size":128, "mandatory":true, "key":true }, |
|||
"container" : |
|||
{"type":"string", "size":16, "mandatory":true, "key":true }, |
|||
"timestamp" : |
|||
{"type":"date" } |
|||
}'; |
|||
|
|||
parent::__construct(); |
|||
} |
|||
} |
@ -1,108 +0,0 @@ |
|||
<?php |
|||
|
|||
namespace modl; |
|||
|
|||
class SessionDAO extends SQL { |
|||
function set($session, $container, $name, $value) { |
|||
$timestamp = date(DATE_ISO8601); |
|||
|
|||
$this->_sql = ' |
|||
update session |
|||
set value = :value, |
|||
timestamp = :timestamp |
|||
where session = :session |
|||
and container = :container |
|||
and name = :name'; |
|||
|
|||
$this->prepare( |
|||
'Session', |
|||
array( |
|||
'session' => $session, |
|||
'container' => $container, |
|||
'name' => $name, |
|||
'value' => $value, |
|||
'timestamp' => $timestamp |
|||
) |
|||
); |
|||
|
|||
$this->run('Session'); |
|||
|
|||
if(!$this->_effective) { |
|||
$this->_sql = ' |
|||
insert into session |
|||
(name, value, session, container, timestamp) |
|||
values (:name, :value, :session, :container, :timestamp)'; |
|||
|
|||
$this->prepare( |
|||
'Session', |
|||
array( |
|||
'session' => $session, |
|||
'container' => $container, |
|||
'name' => $name, |
|||
'value' => $value, |
|||
'timestamp' => $timestamp |
|||
) |
|||
); |
|||
|
|||
return $this->run('Session'); |
|||
} |
|||
} |
|||
|
|||
function get($session, $container, $name) { |
|||
$this->_sql = ' |
|||
select * from session |
|||
where |
|||
session = :session |
|||
and container = :container |
|||
and name = :name'; |
|||
|
|||
$this->prepare( |
|||
'Session', |
|||
array( |
|||
'session' => $session, |
|||
'container' => $container, |
|||
'name' => $name |
|||
) |
|||
); |
|||
|
|||
return $this->run('Session', 'item'); |
|||
} |
|||
|
|||
function delete($session, $container, $name) { |
|||
$this->_sql = ' |
|||
delete from session |
|||
where |
|||
session = :session |
|||
and container = :container |
|||
and name = :name'; |
|||
|
|||
$this->prepare( |
|||
'Session', |
|||
array( |
|||
'session' => $session, |
|||
'container' => $container, |
|||
'name' => $name |
|||
) |
|||
); |
|||
|
|||
return $this->run('Session'); |
|||
} |
|||
|
|||
function deleteContainer($session, $container) { |
|||
$this->_sql = ' |
|||
delete from session |
|||
where |
|||
session = :session |
|||
and container = :container'; |
|||
|
|||
$this->prepare( |
|||
'Session', |
|||
array( |
|||
'session' => $session, |
|||
'container' => $container, |
|||
) |
|||
); |
|||
|
|||
return $this->run('Session'); |
|||
} |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue