Store original path
This commit is contained in:
parent
3819ea07fc
commit
2b440eadcc
@ -36,10 +36,10 @@ class Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($genesisPath){
|
if ($genesisPath){
|
||||||
$session = Session::getSessionByPath($uid, $genesisPath);
|
$session = Session::getSessionByOwnerAndGenesis($uid, $genesisPath);
|
||||||
if (!$session){
|
if (!$session){
|
||||||
$hash = View::getHashByGenesis($uid, $genesisPath);
|
$hash = View::getHashByGenesis($uid, $genesisPath);
|
||||||
$session = Session::addSession($genesisPath, $hash);
|
$session = Session::addSession($genesisPath, $hash, $path);
|
||||||
}
|
}
|
||||||
\OCP\JSON::success($session);
|
\OCP\JSON::success($session);
|
||||||
exit();
|
exit();
|
||||||
|
@ -25,20 +25,21 @@ class Session {
|
|||||||
return $result->fetchRow();
|
return $result->fetchRow();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getSessionByPath($uid, $url){
|
public static function getSessionByOwnerAndGenesis($uid, $url){
|
||||||
$query = \OCP\DB::prepare('SELECT * FROM `*PREFIX*office_session` WHERE `genesis_url`= ? AND `owner`= ? ');
|
$query = \OCP\DB::prepare('SELECT * FROM `*PREFIX*office_session` WHERE `genesis_url`= ? AND `owner`= ? ');
|
||||||
$result = $query->execute(array($url, $uid));
|
$result = $query->execute(array($url, $uid));
|
||||||
return $result->fetchRow();
|
return $result->fetchRow();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function addSession($genesis, $hash){
|
public static function addSession($genesis, $hash, $documentPath){
|
||||||
$query = \OCP\DB::prepare('INSERT INTO `*PREFIX*office_session` (`es_id`, `genesis_url`, `genesis_hash`, `owner`) VALUES (?, ?, ?, ?) ');
|
$query = \OCP\DB::prepare('INSERT INTO `*PREFIX*office_session` (`es_id`, `genesis_url`, `genesis_hash`, `owner`, `document_path`) VALUES (?, ?, ?, ?, ?) ');
|
||||||
|
|
||||||
$data = array(
|
$data = array(
|
||||||
'es_id' => self::getUniqueSessionId(),
|
'es_id' => self::getUniqueSessionId(),
|
||||||
'genesis_url' => $genesis,
|
'genesis_url' => $genesis,
|
||||||
'genesis_hash' => $hash,
|
'genesis_hash' => $hash,
|
||||||
'owner' => \OCP\User::getUser()
|
'owner' => \OCP\User::getUser(),
|
||||||
|
'document_path' => $documentPath
|
||||||
);
|
);
|
||||||
$result = $query->execute(array_values($data));
|
$result = $query->execute(array_values($data));
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user