mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-03 04:29:28 +01:00
W.I.P collab Editor:
- Implement table cleanup and last save status
This commit is contained in:
parent
704a47a182
commit
a98dca4523
@ -38,6 +38,16 @@ class filemanager_collab_bo
|
|||||||
*/
|
*/
|
||||||
const DB_FILEDS_PREFIX = 'collab_';
|
const DB_FILEDS_PREFIX = 'collab_';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exception message for no session found
|
||||||
|
*/
|
||||||
|
const EXCEPTION_MESSAGE_NO_SESSION = 'Session id must be given, none given!';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exception message for no OP
|
||||||
|
*/
|
||||||
|
const EXCEPTION_MESSAGE_NO_OPS = 'ops need to be an array of op data, none array given!';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Database object
|
* Database object
|
||||||
* @var Api\Db
|
* @var Api\Db
|
||||||
@ -97,6 +107,7 @@ class filemanager_collab_bo
|
|||||||
'collab_es_id' => $es_id,
|
'collab_es_id' => $es_id,
|
||||||
'collab_genesis_url' => '',
|
'collab_genesis_url' => '',
|
||||||
'collab_genesis_hash' => '',
|
'collab_genesis_hash' => '',
|
||||||
|
'collab_last_saved' => self::getTimeStamp(),
|
||||||
'account_id' => $GLOBALS['egw_info']['user']['account_id']
|
'account_id' => $GLOBALS['egw_info']['user']['account_id']
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -105,6 +116,58 @@ class filemanager_collab_bo
|
|||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to clean up left over modifications data
|
||||||
|
*
|
||||||
|
* @param type $es_id session id
|
||||||
|
*
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public function SESSION_cleanup ($es_id)
|
||||||
|
{
|
||||||
|
if (!$es_id) throw new Exception (self::EXCEPTION_MESSAGE_NO_SESSION);
|
||||||
|
|
||||||
|
$this->db->delete(
|
||||||
|
self::OP_TABLE,
|
||||||
|
array('collab_es_id' => $es_id),
|
||||||
|
__LINE__,
|
||||||
|
__FILE__
|
||||||
|
);
|
||||||
|
$this->db->delete(
|
||||||
|
self::SESSION_TABLE,
|
||||||
|
array('collab_es_id' => $es_id),
|
||||||
|
__LINE__,
|
||||||
|
__FILE__
|
||||||
|
);
|
||||||
|
$this->db->delete(
|
||||||
|
self::MEMBER_TABLE,
|
||||||
|
array('collab_es_id' => $es_id),
|
||||||
|
__LINE__,
|
||||||
|
__FILE__
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to update last time saved in session table
|
||||||
|
*
|
||||||
|
* @param type $es_id
|
||||||
|
*
|
||||||
|
* @return boolean returns true if update is successful otherwise false
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public function SESSION_Save ($es_id)
|
||||||
|
{
|
||||||
|
if (!$es_id) throw new Exception (self::EXCEPTION_MESSAGE_NO_SESSION);
|
||||||
|
$query = $this->db->update(
|
||||||
|
self::SESSION_TABLE,
|
||||||
|
array('collab_last_save' => self::getTimeStamp()),
|
||||||
|
array('collab_es_id' => $es_id),
|
||||||
|
__LINE__,
|
||||||
|
__FILE__,
|
||||||
|
'filemanager');
|
||||||
|
return !$query? false: true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* OP addMember function is backend equivalent to addMember from frontend
|
* OP addMember function is backend equivalent to addMember from frontend
|
||||||
*
|
*
|
||||||
@ -159,7 +222,7 @@ class filemanager_collab_bo
|
|||||||
*/
|
*/
|
||||||
protected function OP_getHeadSeq($es_id)
|
protected function OP_getHeadSeq($es_id)
|
||||||
{
|
{
|
||||||
if (!$es_id) throw new Exception ('Session id must be given, none given!');
|
if (!$es_id) throw new Exception (self::EXCEPTION_MESSAGE_NO_SESSION);
|
||||||
|
|
||||||
$query = $this->db->select(
|
$query = $this->db->select(
|
||||||
self::OP_TABLE,
|
self::OP_TABLE,
|
||||||
@ -217,7 +280,7 @@ class filemanager_collab_bo
|
|||||||
*/
|
*/
|
||||||
protected function OP_addOPS ($es_id, $member_id, $client_ops)
|
protected function OP_addOPS ($es_id, $member_id, $client_ops)
|
||||||
{
|
{
|
||||||
if (count($client_ops)<= 0) throw new Exception ('ops need to be an array of op data, none array given!');
|
if (count($client_ops)<= 0) throw new Exception (self::EXCEPTION_MESSAGE_NO_OPS);
|
||||||
|
|
||||||
foreach ($client_ops as $op)
|
foreach ($client_ops as $op)
|
||||||
{
|
{
|
||||||
@ -269,7 +332,7 @@ class filemanager_collab_bo
|
|||||||
*/
|
*/
|
||||||
protected function MEMBER_getUserMemberId ($es_id, $user_id)
|
protected function MEMBER_getUserMemberId ($es_id, $user_id)
|
||||||
{
|
{
|
||||||
if (!$es_id || !$user_id) throw new Exception ('Member id must be given, none given!');
|
if (!$es_id || !$user_id) throw new Exception (self::EXCEPTION_MESSAGE_NO_SESSION);
|
||||||
$query = $this->db->select(
|
$query = $this->db->select(
|
||||||
self::MEMBER_TABLE,
|
self::MEMBER_TABLE,
|
||||||
'collab_member_id',
|
'collab_member_id',
|
||||||
|
Loading…
Reference in New Issue
Block a user