Cleanup session on save. Ref #15

pull/1/head
Victor Dubiniuk 11 years ago
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'); 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(); \OCP\JSON::success();
exit(); exit();
} catch (\Exception $e){ } catch (\Exception $e){

@ -128,9 +128,15 @@ class Session extends Db{
return $info; return $info;
} }
public static function deleteByFileid($fileId){ public static function cleanUp($esId){
$query = \OCP\DB::prepare('DELETE FROM ' . self::DB_TABLE . ' WHERE `file_id` = ?'); self::delete($esId);
$query->execute(array($fileId)); 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(){ protected static function getUniqueSessionId(){

@ -61,8 +61,6 @@ class Storage {
return; return;
} }
Member::deleteBySessionId($session['es_id']); Session::cleanUp($session['es_id']);
Op::deleteBySessionId($session['es_id']);
Session::deleteByFileid($fileId);
} }
} }

Loading…
Cancel
Save