Skip to content
Snippets Groups Projects
Commit 60c77607 authored by Thomas Müller's avatar Thomas Müller
Browse files

Merge pull request #19538 from owncloud/versions-lock

Lock files when rolling back version
parents ff898241 943c5069
No related branches found
No related tags found
No related merge requests found
......@@ -42,6 +42,7 @@ namespace OCA\Files_Versions;
use OCA\Files_Versions\AppInfo\Application;
use OCA\Files_Versions\Command\Expire;
use OCP\Lock\ILockingProvider;
class Storage {
......@@ -337,11 +338,19 @@ class Storage {
* @return bool true for success, false otherwise
*/
private static function copyFileContents($view, $path1, $path2) {
/** @var \OC\Files\Storage\Storage $storage1 */
list($storage1, $internalPath1) = $view->resolvePath($path1);
/** @var \OC\Files\Storage\Storage $storage2 */
list($storage2, $internalPath2) = $view->resolvePath($path2);
$view->lockFile($path1, ILockingProvider::LOCK_EXCLUSIVE);
$view->lockFile($path2, ILockingProvider::LOCK_EXCLUSIVE);
$result = $storage2->moveFromStorage($storage1, $internalPath1, $internalPath2);
$view->unlockFile($path1, ILockingProvider::LOCK_EXCLUSIVE);
$view->unlockFile($path2, ILockingProvider::LOCK_EXCLUSIVE);
return ($result !== false);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment