From 99818f98ea592e36000c19bb6c5d8a50561280ce Mon Sep 17 00:00:00 2001 From: Victor Dubiniuk Date: Thu, 21 Nov 2013 23:38:39 +0300 Subject: [PATCH] Do not create -conflict if versions are enabled --- ajax/sessionController.php | 2 +- lib/helper.php | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ajax/sessionController.php b/ajax/sessionController.php index 73f1c6cb..c07bcc9b 100644 --- a/ajax/sessionController.php +++ b/ajax/sessionController.php @@ -101,7 +101,7 @@ class SessionController extends Controller{ if ($view->file_exists($path)){ $currentHash = sha1($view->file_get_contents($path)); - if ($currentHash !== $sessionData['genesis_hash']){ + if (!Helper::isVersionsEnabled() && $currentHash !== $sessionData['genesis_hash']){ // Original file was modified externally. Save to a new one $path = Helper::getNewFileName($view, $path, '-conflict'); } diff --git a/lib/helper.php b/lib/helper.php index 497eb544..f04b7867 100644 --- a/lib/helper.php +++ b/lib/helper.php @@ -26,6 +26,10 @@ class Helper{ return $path; } + public static function isVersionsEnabled(){ + return \OCP\App::isEnabled('files_versions'); + } + public static function getRandomColor(){ $str = dechex(floor(rand(0, 16777215))); return '#' . str_pad($str, 6, "0", STR_PAD_LEFT);