From b31a010018cb2cdf4b2951e2ce75bced1ccf4414 Mon Sep 17 00:00:00 2001 From: Victor Dubiniuk Date: Sat, 9 Nov 2013 18:24:03 +0300 Subject: [PATCH] Fix updating document hash while saving --- ajax/sessionController.php | 8 +++++--- lib/db/session.php | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/ajax/sessionController.php b/ajax/sessionController.php index 34464dad..73f1c6cb 100644 --- a/ajax/sessionController.php +++ b/ajax/sessionController.php @@ -54,10 +54,11 @@ class SessionController extends Controller{ $memberId = @$_SERVER['HTTP_WEBODF_MEMBER_ID']; $sessionRevision = @$_SERVER['HTTP_WEBODF_SESSION_REVISION']; - $content = fopen('php://input','r'); - if (!$content){ - throw new \Exception('New conent missing'); + $stream = fopen('php://input','r'); + if (!$stream){ + throw new \Exception('New content missing'); } + $content = stream_get_contents($stream); $session = new Db_Session(); $session->load($esId); @@ -110,6 +111,7 @@ class SessionController extends Controller{ // Not a last user if ($memberCount>0){ // Update genesis hash to prevent conflicts + Helper::warnLog('Update hash'); $session->updateGenesisHash($esId, sha1($content)); } else { // Last user. Kill session data diff --git a/lib/db/session.php b/lib/db/session.php index 7002c2b2..6ac830f8 100644 --- a/lib/db/session.php +++ b/lib/db/session.php @@ -102,7 +102,7 @@ class Db_Session extends \OCA\Documents\Db { return $this->execute( 'UPDATE `*PREFIX*documents_session` SET `genesis_hash`=? WHERE `es_id`=?', array( - $esId, $genesisHash + $genesisHash, $esId ) ); }