Cleanup session on save. Ref #15
This commit is contained in:
parent
ea0d186707
commit
caeaacfc45
@ -121,7 +121,10 @@ class SessionController extends Controller{
|
||||
throw new \Exception('Document does not exist or is not writable for this user');
|
||||
}
|
||||
|
||||
$view->file_put_contents($path, $content);
|
||||
if ($view->file_put_contents($path, $content)){
|
||||
//Document saved successfully. Cleaning session data
|
||||
Session::cleanUp($sessionID);
|
||||
}
|
||||
\OCP\JSON::success();
|
||||
exit();
|
||||
} catch (\Exception $e){
|
||||
|
@ -128,9 +128,15 @@ class Session extends Db{
|
||||
return $info;
|
||||
}
|
||||
|
||||
public static function deleteByFileid($fileId){
|
||||
$query = \OCP\DB::prepare('DELETE FROM ' . self::DB_TABLE . ' WHERE `file_id` = ?');
|
||||
$query->execute(array($fileId));
|
||||
public static function cleanUp($esId){
|
||||
self::delete($esId);
|
||||
Member::deleteBySessionId($esId);
|
||||
Op::deleteBySessionId($esId);
|
||||
}
|
||||
|
||||
public static function delete($esId){
|
||||
$query = \OCP\DB::prepare('DELETE FROM ' . self::DB_TABLE . ' WHERE `es_id` = ?');
|
||||
$query->execute(array($esId));
|
||||
}
|
||||
|
||||
protected static function getUniqueSessionId(){
|
||||
|
@ -61,8 +61,6 @@ class Storage {
|
||||
return;
|
||||
}
|
||||
|
||||
Member::deleteBySessionId($session['es_id']);
|
||||
Op::deleteBySessionId($session['es_id']);
|
||||
Session::deleteByFileid($fileId);
|
||||
Session::cleanUp($session['es_id']);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user