Fix updating document hash while saving

pull/1/head
Victor Dubiniuk 11 years ago
parent e60c91acbb
commit b31a010018

@ -54,10 +54,11 @@ class SessionController extends Controller{
$memberId = @$_SERVER['HTTP_WEBODF_MEMBER_ID']; $memberId = @$_SERVER['HTTP_WEBODF_MEMBER_ID'];
$sessionRevision = @$_SERVER['HTTP_WEBODF_SESSION_REVISION']; $sessionRevision = @$_SERVER['HTTP_WEBODF_SESSION_REVISION'];
$content = fopen('php://input','r'); $stream = fopen('php://input','r');
if (!$content){ if (!$stream){
throw new \Exception('New conent missing'); throw new \Exception('New content missing');
} }
$content = stream_get_contents($stream);
$session = new Db_Session(); $session = new Db_Session();
$session->load($esId); $session->load($esId);
@ -110,6 +111,7 @@ class SessionController extends Controller{
// Not a last user // Not a last user
if ($memberCount>0){ if ($memberCount>0){
// Update genesis hash to prevent conflicts // Update genesis hash to prevent conflicts
Helper::warnLog('Update hash');
$session->updateGenesisHash($esId, sha1($content)); $session->updateGenesisHash($esId, sha1($content));
} else { } else {
// Last user. Kill session data // Last user. Kill session data

@ -102,7 +102,7 @@ class Db_Session extends \OCA\Documents\Db {
return $this->execute( return $this->execute(
'UPDATE `*PREFIX*documents_session` SET `genesis_hash`=? WHERE `es_id`=?', 'UPDATE `*PREFIX*documents_session` SET `genesis_hash`=? WHERE `es_id`=?',
array( array(
$esId, $genesisHash $genesisHash, $esId
) )
); );
} }

Loading…
Cancel
Save