@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | public function testUpdate($path, $isDir, $allFiles, $numberOfFiles): void { |
88 | 88 | $updateMock = $this->getUpdateMock(['getOwnerPath']); |
89 | 89 | $updateMock->expects($this->once())->method('getOwnerPath') |
90 | - ->willReturnCallback(fn (OCPFile|Folder $node) => '/user/' . $node->getPath()); |
|
90 | + ->willReturnCallback(fn (OCPFile | Folder $node) => '/user/'.$node->getPath()); |
|
91 | 91 | |
92 | 92 | $this->encryptionManager->expects($this->once()) |
93 | 93 | ->method('getEncryptionModule') |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | * @param string $target |
133 | 133 | */ |
134 | 134 | public function testPostRename($source, $target): void { |
135 | - $updateMock = $this->getUpdateMock(['update','getOwnerPath']); |
|
135 | + $updateMock = $this->getUpdateMock(['update', 'getOwnerPath']); |
|
136 | 136 | |
137 | 137 | $sourceNode = $this->getFileMock($source, 'user'); |
138 | 138 | $targetNode = $this->getFileMock($target, 'user'); |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | $updateMock->expects($this->never())->method('update'); |
143 | 143 | } else { |
144 | 144 | $updateMock->expects($this->once())->method('update') |
145 | - ->willReturnCallback(fn (OCPFile|Folder $node) => $this->assertSame( |
|
145 | + ->willReturnCallback(fn (OCPFile | Folder $node) => $this->assertSame( |
|
146 | 146 | $target, |
147 | 147 | $node->getPath(), |
148 | 148 | 'update needs to be executed for the target destination' |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | $updateMock = $this->getUpdateMock(['update']); |
170 | 170 | |
171 | 171 | $updateMock->expects($this->once())->method('update') |
172 | - ->willReturnCallback(fn (OCPFile|Folder $node) => $this->assertSame( |
|
172 | + ->willReturnCallback(fn (OCPFile | Folder $node) => $this->assertSame( |
|
173 | 173 | '/folder/test.txt', |
174 | 174 | $node->getPath(), |
175 | 175 | 'update needs to be executed for the target destination' |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | } |
144 | 144 | |
145 | 145 | if ($this->tempStorage) { |
146 | - system('rm -rf ' . escapeshellarg($this->tempStorage->getDataDir())); |
|
146 | + system('rm -rf '.escapeshellarg($this->tempStorage->getDataDir())); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | self::logout(); |
@@ -169,11 +169,11 @@ discard block |
||
169 | 169 | $storage2 = $this->getTestStorage(); |
170 | 170 | $storage3 = $this->getTestStorage(); |
171 | 171 | $root = self::getUniqueID('/'); |
172 | - Filesystem::mount($storage1, [], $root . '/'); |
|
173 | - Filesystem::mount($storage2, [], $root . '/substorage'); |
|
174 | - Filesystem::mount($storage3, [], $root . '/folder/anotherstorage'); |
|
172 | + Filesystem::mount($storage1, [], $root.'/'); |
|
173 | + Filesystem::mount($storage2, [], $root.'/substorage'); |
|
174 | + Filesystem::mount($storage3, [], $root.'/folder/anotherstorage'); |
|
175 | 175 | $textSize = strlen("dummy file data\n"); |
176 | - $imageSize = filesize(\OC::$SERVERROOT . '/core/img/logo/logo.png'); |
|
176 | + $imageSize = filesize(\OC::$SERVERROOT.'/core/img/logo/logo.png'); |
|
177 | 177 | $storageSize = $textSize * 2 + $imageSize; |
178 | 178 | |
179 | 179 | $storageInfo = $storage3->getCache()->get(''); |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | $this->assertEquals('foo.png', $folderData[1]['name']); |
231 | 231 | $this->assertEquals('foo.txt', $folderData[2]['name']); |
232 | 232 | |
233 | - $folderView = new View($root . '/folder'); |
|
233 | + $folderView = new View($root.'/folder'); |
|
234 | 234 | $this->assertEquals($rootView->getFileInfo('/folder'), $folderView->getFileInfo('/')); |
235 | 235 | |
236 | 236 | $cachedData = $rootView->getFileInfo('/foo.txt'); |
@@ -519,10 +519,10 @@ discard block |
||
519 | 519 | } |
520 | 520 | |
521 | 521 | public function moveBetweenStorages($storage1, $storage2) { |
522 | - Filesystem::mount($storage1, [], '/' . $this->user . '/'); |
|
523 | - Filesystem::mount($storage2, [], '/' . $this->user . '/substorage'); |
|
522 | + Filesystem::mount($storage1, [], '/'.$this->user.'/'); |
|
523 | + Filesystem::mount($storage2, [], '/'.$this->user.'/substorage'); |
|
524 | 524 | |
525 | - $rootView = new View('/' . $this->user); |
|
525 | + $rootView = new View('/'.$this->user); |
|
526 | 526 | $rootView->rename('foo.txt', 'substorage/folder/foo.txt'); |
527 | 527 | $this->assertFalse($rootView->file_exists('foo.txt')); |
528 | 528 | $this->assertTrue($rootView->file_exists('substorage/folder/foo.txt')); |
@@ -646,11 +646,11 @@ discard block |
||
646 | 646 | $storage2 = $this->getTestStorage(); |
647 | 647 | $defaultRoot = Filesystem::getRoot(); |
648 | 648 | Filesystem::mount($storage1, [], '/'); |
649 | - Filesystem::mount($storage2, [], $defaultRoot . '/substorage'); |
|
649 | + Filesystem::mount($storage2, [], $defaultRoot.'/substorage'); |
|
650 | 650 | \OC_Hook::connect('OC_Filesystem', 'post_write', $this, 'dummyHook'); |
651 | 651 | |
652 | 652 | $rootView = new View(''); |
653 | - $subView = new View($defaultRoot . '/substorage'); |
|
653 | + $subView = new View($defaultRoot.'/substorage'); |
|
654 | 654 | $this->hookPath = null; |
655 | 655 | |
656 | 656 | $rootView->file_put_contents('/foo.txt', 'asd'); |
@@ -690,7 +690,7 @@ discard block |
||
690 | 690 | */ |
691 | 691 | $storage = new $class([]); |
692 | 692 | $textData = "dummy file data\n"; |
693 | - $imgData = file_get_contents(\OC::$SERVERROOT . '/core/img/logo/logo.png'); |
|
693 | + $imgData = file_get_contents(\OC::$SERVERROOT.'/core/img/logo/logo.png'); |
|
694 | 694 | $storage->mkdir('folder'); |
695 | 695 | $storage->file_put_contents('foo.txt', $textData); |
696 | 696 | $storage->file_put_contents('foo.png', $imgData); |
@@ -712,10 +712,10 @@ discard block |
||
712 | 712 | $storage2 = $this->getTestStorage(); |
713 | 713 | $defaultRoot = Filesystem::getRoot(); |
714 | 714 | Filesystem::mount($storage1, [], '/'); |
715 | - Filesystem::mount($storage2, [], $defaultRoot . '_substorage'); |
|
715 | + Filesystem::mount($storage2, [], $defaultRoot.'_substorage'); |
|
716 | 716 | \OC_Hook::connect('OC_Filesystem', 'post_write', $this, 'dummyHook'); |
717 | 717 | |
718 | - $subView = new View($defaultRoot . '_substorage'); |
|
718 | + $subView = new View($defaultRoot.'_substorage'); |
|
719 | 719 | $this->hookPath = null; |
720 | 720 | |
721 | 721 | $subView->file_put_contents('/foo.txt', 'asd'); |
@@ -810,7 +810,7 @@ discard block |
||
810 | 810 | |
811 | 811 | $rootView = new View(''); |
812 | 812 | foreach ($names as $name) { |
813 | - $rootView->file_put_contents('/' . $name, 'dummy content'); |
|
813 | + $rootView->file_put_contents('/'.$name, 'dummy content'); |
|
814 | 814 | } |
815 | 815 | |
816 | 816 | $list = $rootView->getDirectoryContent('/'); |
@@ -852,15 +852,15 @@ discard block |
||
852 | 852 | $depth = ((4000 - $tmpdirLength) / 57); |
853 | 853 | } |
854 | 854 | foreach (range(0, $depth - 1) as $i) { |
855 | - $longPath .= $ds . $folderName; |
|
855 | + $longPath .= $ds.$folderName; |
|
856 | 856 | $result = $rootView->mkdir($longPath); |
857 | - $this->assertTrue($result, "mkdir failed on $i - path length: " . strlen($longPath)); |
|
857 | + $this->assertTrue($result, "mkdir failed on $i - path length: ".strlen($longPath)); |
|
858 | 858 | |
859 | - $result = $rootView->file_put_contents($longPath . "{$ds}test.txt", 'lorem'); |
|
859 | + $result = $rootView->file_put_contents($longPath."{$ds}test.txt", 'lorem'); |
|
860 | 860 | $this->assertEquals(5, $result, "file_put_contents failed on $i"); |
861 | 861 | |
862 | 862 | $this->assertTrue($rootView->file_exists($longPath)); |
863 | - $this->assertTrue($rootView->file_exists($longPath . "{$ds}test.txt")); |
|
863 | + $this->assertTrue($rootView->file_exists($longPath."{$ds}test.txt")); |
|
864 | 864 | } |
865 | 865 | |
866 | 866 | $cache = $storage->getCache(); |
@@ -873,11 +873,11 @@ discard block |
||
873 | 873 | $this->assertTrue(is_array($cachedFolder), "No cache entry for folder at $i"); |
874 | 874 | $this->assertEquals($folderName, $cachedFolder['name'], "Wrong cache entry for folder at $i"); |
875 | 875 | |
876 | - $cachedFile = $cache->get($longPath . '/test.txt'); |
|
876 | + $cachedFile = $cache->get($longPath.'/test.txt'); |
|
877 | 877 | $this->assertTrue(is_array($cachedFile), "No cache entry for file at $i"); |
878 | 878 | $this->assertEquals('test.txt', $cachedFile['name'], "Wrong cache entry for file at $i"); |
879 | 879 | |
880 | - $longPath .= $ds . $folderName; |
|
880 | + $longPath .= $ds.$folderName; |
|
881 | 881 | } |
882 | 882 | } |
883 | 883 | |
@@ -1090,7 +1090,7 @@ discard block |
||
1090 | 1090 | $folderName = 'abcdefghijklmnopqrstuvwxyz012345678901234567890123456789'; |
1091 | 1091 | $depth = (4000 / 57); |
1092 | 1092 | foreach (range(0, $depth + 1) as $i) { |
1093 | - $longPath .= '/' . $folderName; |
|
1093 | + $longPath .= '/'.$folderName; |
|
1094 | 1094 | } |
1095 | 1095 | |
1096 | 1096 | $storage = new Temporary([]); |
@@ -1340,8 +1340,8 @@ discard block |
||
1340 | 1340 | $view = new View($rootPath); |
1341 | 1341 | $storage = new Temporary([]); |
1342 | 1342 | Filesystem::mount($storage, [], '/'); |
1343 | - $this->assertTrue($view->lockFile($pathPrefix . '/foo/bar', ILockingProvider::LOCK_EXCLUSIVE)); |
|
1344 | - $view->lockFile($pathPrefix . '/foo/bar/asd', ILockingProvider::LOCK_SHARED); |
|
1343 | + $this->assertTrue($view->lockFile($pathPrefix.'/foo/bar', ILockingProvider::LOCK_EXCLUSIVE)); |
|
1344 | + $view->lockFile($pathPrefix.'/foo/bar/asd', ILockingProvider::LOCK_SHARED); |
|
1345 | 1345 | } |
1346 | 1346 | |
1347 | 1347 | /** |
@@ -1359,8 +1359,8 @@ discard block |
||
1359 | 1359 | $view = new View($rootPath); |
1360 | 1360 | $storage = new Temporary([]); |
1361 | 1361 | Filesystem::mount($storage, [], '/'); |
1362 | - $this->assertFalse($view->lockFile($pathPrefix . '/foo/bar', ILockingProvider::LOCK_EXCLUSIVE)); |
|
1363 | - $this->assertFalse($view->lockFile($pathPrefix . '/foo/bar/asd', ILockingProvider::LOCK_SHARED)); |
|
1362 | + $this->assertFalse($view->lockFile($pathPrefix.'/foo/bar', ILockingProvider::LOCK_EXCLUSIVE)); |
|
1363 | + $this->assertFalse($view->lockFile($pathPrefix.'/foo/bar/asd', ILockingProvider::LOCK_SHARED)); |
|
1364 | 1364 | } |
1365 | 1365 | |
1366 | 1366 | /** |
@@ -1381,8 +1381,8 @@ discard block |
||
1381 | 1381 | $view = new View($rootPath); |
1382 | 1382 | $storage = new Temporary([]); |
1383 | 1383 | Filesystem::mount($storage, [], '/'); |
1384 | - $this->assertTrue($view->lockFile($pathPrefix . '/foo/bar', ILockingProvider::LOCK_SHARED)); |
|
1385 | - $view->lockFile($pathPrefix . '/foo/bar', ILockingProvider::LOCK_EXCLUSIVE); |
|
1384 | + $this->assertTrue($view->lockFile($pathPrefix.'/foo/bar', ILockingProvider::LOCK_SHARED)); |
|
1385 | + $view->lockFile($pathPrefix.'/foo/bar', ILockingProvider::LOCK_EXCLUSIVE); |
|
1386 | 1386 | } |
1387 | 1387 | |
1388 | 1388 | /** |
@@ -1400,8 +1400,8 @@ discard block |
||
1400 | 1400 | $view = new View($rootPath); |
1401 | 1401 | $storage = new Temporary([]); |
1402 | 1402 | Filesystem::mount($storage, [], '/'); |
1403 | - $this->assertFalse($view->lockFile($pathPrefix . '/foo/bar', ILockingProvider::LOCK_SHARED)); |
|
1404 | - $this->assertFalse($view->lockFile($pathPrefix . '/foo/bar', ILockingProvider::LOCK_EXCLUSIVE)); |
|
1403 | + $this->assertFalse($view->lockFile($pathPrefix.'/foo/bar', ILockingProvider::LOCK_SHARED)); |
|
1404 | + $this->assertFalse($view->lockFile($pathPrefix.'/foo/bar', ILockingProvider::LOCK_EXCLUSIVE)); |
|
1405 | 1405 | } |
1406 | 1406 | |
1407 | 1407 | /** |
@@ -1610,7 +1610,7 @@ discard block |
||
1610 | 1610 | ->onlyMethods([]) |
1611 | 1611 | ->getMock(); |
1612 | 1612 | $storage->method('getId')->willReturn('non-null-id'); |
1613 | - $storage->method('getStorageCache')->willReturnCallback(function () use ($storage) { |
|
1613 | + $storage->method('getStorageCache')->willReturnCallback(function() use ($storage) { |
|
1614 | 1614 | return new \OC\Files\Cache\Storage($storage, true, \OC::$server->get(IDBConnection::class)); |
1615 | 1615 | }); |
1616 | 1616 | |
@@ -1639,8 +1639,8 @@ discard block |
||
1639 | 1639 | self::loginAsUser($this->user); |
1640 | 1640 | |
1641 | 1641 | [$mount1, $mount2] = $this->createTestMovableMountPoints([ |
1642 | - $this->user . '/files/mount1', |
|
1643 | - $this->user . '/files/mount2', |
|
1642 | + $this->user.'/files/mount1', |
|
1643 | + $this->user.'/files/mount2', |
|
1644 | 1644 | ]); |
1645 | 1645 | $mount1->expects($this->once()) |
1646 | 1646 | ->method('moveMount') |
@@ -1650,7 +1650,7 @@ discard block |
||
1650 | 1650 | ->method('moveMount') |
1651 | 1651 | ->willReturn(true); |
1652 | 1652 | |
1653 | - $view = new View('/' . $this->user . '/files/'); |
|
1653 | + $view = new View('/'.$this->user.'/files/'); |
|
1654 | 1654 | $view->mkdir('sub'); |
1655 | 1655 | |
1656 | 1656 | $this->assertTrue($view->rename('mount1', 'renamed_mount'), 'Can rename mount point'); |
@@ -1661,8 +1661,8 @@ discard block |
||
1661 | 1661 | self::loginAsUser($this->user); |
1662 | 1662 | |
1663 | 1663 | [$mount1, $mount2] = $this->createTestMovableMountPoints([ |
1664 | - $this->user . '/files/mount1', |
|
1665 | - $this->user . '/files/mount2', |
|
1664 | + $this->user.'/files/mount1', |
|
1665 | + $this->user.'/files/mount2', |
|
1666 | 1666 | ]); |
1667 | 1667 | |
1668 | 1668 | $mount1->expects($this->never()) |
@@ -1671,7 +1671,7 @@ discard block |
||
1671 | 1671 | $mount2->expects($this->never()) |
1672 | 1672 | ->method('moveMount'); |
1673 | 1673 | |
1674 | - $view = new View('/' . $this->user . '/files/'); |
|
1674 | + $view = new View('/'.$this->user.'/files/'); |
|
1675 | 1675 | |
1676 | 1676 | $this->expectException(ForbiddenException::class); |
1677 | 1677 | $view->rename('mount1', 'mount2'); |
@@ -1681,8 +1681,8 @@ discard block |
||
1681 | 1681 | self::loginAsUser($this->user); |
1682 | 1682 | |
1683 | 1683 | [$mount1, $mount2] = $this->createTestMovableMountPoints([ |
1684 | - $this->user . '/files/mount1', |
|
1685 | - $this->user . '/files/mount2', |
|
1684 | + $this->user.'/files/mount1', |
|
1685 | + $this->user.'/files/mount2', |
|
1686 | 1686 | ]); |
1687 | 1687 | |
1688 | 1688 | $mount1->expects($this->never()) |
@@ -1691,7 +1691,7 @@ discard block |
||
1691 | 1691 | $mount2->expects($this->never()) |
1692 | 1692 | ->method('moveMount'); |
1693 | 1693 | |
1694 | - $view = new View('/' . $this->user . '/files/'); |
|
1694 | + $view = new View('/'.$this->user.'/files/'); |
|
1695 | 1695 | |
1696 | 1696 | $this->expectException(ForbiddenException::class); |
1697 | 1697 | $view->rename('mount1', 'mount2/sub'); |
@@ -1704,8 +1704,8 @@ discard block |
||
1704 | 1704 | self::loginAsUser($this->user); |
1705 | 1705 | |
1706 | 1706 | [$mount1, $mount2] = $this->createTestMovableMountPoints([ |
1707 | - $this->user . '/files/mount1', |
|
1708 | - $this->user . '/files/mount2', |
|
1707 | + $this->user.'/files/mount1', |
|
1708 | + $this->user.'/files/mount2', |
|
1709 | 1709 | ]); |
1710 | 1710 | |
1711 | 1711 | $mount1->expects($this->never()) |
@@ -1715,7 +1715,7 @@ discard block |
||
1715 | 1715 | ->method('moveMount') |
1716 | 1716 | ->willReturn(true); |
1717 | 1717 | |
1718 | - $view = new View('/' . $this->user . '/files/'); |
|
1718 | + $view = new View('/'.$this->user.'/files/'); |
|
1719 | 1719 | $view->mkdir('shareddir'); |
1720 | 1720 | $view->mkdir('shareddir/sub'); |
1721 | 1721 | $view->mkdir('shareddir/sub2'); |
@@ -1941,7 +1941,7 @@ discard block |
||
1941 | 1941 | $expectedStrayLock = null, |
1942 | 1942 | $returnValue = true, |
1943 | 1943 | ): void { |
1944 | - $view = new View('/' . $this->user . '/files/'); |
|
1944 | + $view = new View('/'.$this->user.'/files/'); |
|
1945 | 1945 | |
1946 | 1946 | /** @var Temporary&MockObject $storage */ |
1947 | 1947 | $storage = $this->getMockBuilder(Temporary::class) |
@@ -1953,19 +1953,19 @@ discard block |
||
1953 | 1953 | /* Same thing with encryption wrapper */ |
1954 | 1954 | Server::get(IStorageFactory::class)->removeStorageWrapper('oc_encryption'); |
1955 | 1955 | |
1956 | - Filesystem::mount($storage, [], $this->user . '/'); |
|
1956 | + Filesystem::mount($storage, [], $this->user.'/'); |
|
1957 | 1957 | |
1958 | 1958 | // work directly on disk because mkdir might be mocked |
1959 | 1959 | $realPath = $storage->getSourcePath(''); |
1960 | - mkdir($realPath . '/files'); |
|
1961 | - mkdir($realPath . '/files/dir'); |
|
1962 | - file_put_contents($realPath . '/files/test.txt', 'blah'); |
|
1960 | + mkdir($realPath.'/files'); |
|
1961 | + mkdir($realPath.'/files/dir'); |
|
1962 | + file_put_contents($realPath.'/files/test.txt', 'blah'); |
|
1963 | 1963 | $storage->getScanner()->scan('files'); |
1964 | 1964 | |
1965 | 1965 | $storage->expects($this->once()) |
1966 | 1966 | ->method($operation) |
1967 | 1967 | ->willReturnCallback( |
1968 | - function () use ($view, $lockedPath, &$lockTypeDuring, $returnValue) { |
|
1968 | + function() use ($view, $lockedPath, &$lockTypeDuring, $returnValue) { |
|
1969 | 1969 | $lockTypeDuring = $this->getFileLockType($view, $lockedPath); |
1970 | 1970 | |
1971 | 1971 | return $returnValue; |
@@ -1998,7 +1998,7 @@ discard block |
||
1998 | 1998 | * This code path uses $storage->fopen instead |
1999 | 1999 | */ |
2000 | 2000 | public function testLockFilePutContentWithStream(): void { |
2001 | - $view = new View('/' . $this->user . '/files/'); |
|
2001 | + $view = new View('/'.$this->user.'/files/'); |
|
2002 | 2002 | |
2003 | 2003 | $path = 'test_file_put_contents.txt'; |
2004 | 2004 | /** @var Temporary|\PHPUnit\Framework\MockObject\MockObject $storage */ |
@@ -2006,13 +2006,13 @@ discard block |
||
2006 | 2006 | ->onlyMethods(['fopen']) |
2007 | 2007 | ->getMock(); |
2008 | 2008 | |
2009 | - Filesystem::mount($storage, [], $this->user . '/'); |
|
2009 | + Filesystem::mount($storage, [], $this->user.'/'); |
|
2010 | 2010 | $storage->mkdir('files'); |
2011 | 2011 | |
2012 | 2012 | $storage->expects($this->once()) |
2013 | 2013 | ->method('fopen') |
2014 | 2014 | ->willReturnCallback( |
2015 | - function () use ($view, $path, &$lockTypeDuring) { |
|
2015 | + function() use ($view, $path, &$lockTypeDuring) { |
|
2016 | 2016 | $lockTypeDuring = $this->getFileLockType($view, $path); |
2017 | 2017 | |
2018 | 2018 | return fopen('php://temp', 'r+'); |
@@ -2037,7 +2037,7 @@ discard block |
||
2037 | 2037 | * Test locks for fopen with fclose at the end |
2038 | 2038 | */ |
2039 | 2039 | public function testLockFopen(): void { |
2040 | - $view = new View('/' . $this->user . '/files/'); |
|
2040 | + $view = new View('/'.$this->user.'/files/'); |
|
2041 | 2041 | |
2042 | 2042 | $path = 'test_file_put_contents.txt'; |
2043 | 2043 | /** @var Temporary|\PHPUnit\Framework\MockObject\MockObject $storage */ |
@@ -2045,13 +2045,13 @@ discard block |
||
2045 | 2045 | ->onlyMethods(['fopen']) |
2046 | 2046 | ->getMock(); |
2047 | 2047 | |
2048 | - Filesystem::mount($storage, [], $this->user . '/'); |
|
2048 | + Filesystem::mount($storage, [], $this->user.'/'); |
|
2049 | 2049 | $storage->mkdir('files'); |
2050 | 2050 | |
2051 | 2051 | $storage->expects($this->once()) |
2052 | 2052 | ->method('fopen') |
2053 | 2053 | ->willReturnCallback( |
2054 | - function () use ($view, $path, &$lockTypeDuring) { |
|
2054 | + function() use ($view, $path, &$lockTypeDuring) { |
|
2055 | 2055 | $lockTypeDuring = $this->getFileLockType($view, $path); |
2056 | 2056 | |
2057 | 2057 | return fopen('php://temp', 'r+'); |
@@ -2093,7 +2093,7 @@ discard block |
||
2093 | 2093 | if ($operation === 'touch') { |
2094 | 2094 | $this->markTestSkipped('touch handles storage exceptions internally'); |
2095 | 2095 | } |
2096 | - $view = new View('/' . $this->user . '/files/'); |
|
2096 | + $view = new View('/'.$this->user.'/files/'); |
|
2097 | 2097 | |
2098 | 2098 | /** @var Temporary|\PHPUnit\Framework\MockObject\MockObject $storage */ |
2099 | 2099 | $storage = $this->getMockBuilder(Temporary::class) |
@@ -2105,19 +2105,19 @@ discard block |
||
2105 | 2105 | /* Same thing with encryption wrapper */ |
2106 | 2106 | Server::get(IStorageFactory::class)->removeStorageWrapper('oc_encryption'); |
2107 | 2107 | |
2108 | - Filesystem::mount($storage, [], $this->user . '/'); |
|
2108 | + Filesystem::mount($storage, [], $this->user.'/'); |
|
2109 | 2109 | |
2110 | 2110 | // work directly on disk because mkdir might be mocked |
2111 | 2111 | $realPath = $storage->getSourcePath(''); |
2112 | - mkdir($realPath . '/files'); |
|
2113 | - mkdir($realPath . '/files/dir'); |
|
2114 | - file_put_contents($realPath . '/files/test.txt', 'blah'); |
|
2112 | + mkdir($realPath.'/files'); |
|
2113 | + mkdir($realPath.'/files/dir'); |
|
2114 | + file_put_contents($realPath.'/files/test.txt', 'blah'); |
|
2115 | 2115 | $storage->getScanner()->scan('files'); |
2116 | 2116 | |
2117 | 2117 | $storage->expects($this->once()) |
2118 | 2118 | ->method($operation) |
2119 | 2119 | ->willReturnCallback( |
2120 | - function () { |
|
2120 | + function() { |
|
2121 | 2121 | throw new \Exception('Simulated exception'); |
2122 | 2122 | } |
2123 | 2123 | ); |
@@ -2137,11 +2137,11 @@ discard block |
||
2137 | 2137 | } |
2138 | 2138 | |
2139 | 2139 | public function testLockBasicOperationUnlocksAfterLockException(): void { |
2140 | - $view = new View('/' . $this->user . '/files/'); |
|
2140 | + $view = new View('/'.$this->user.'/files/'); |
|
2141 | 2141 | |
2142 | 2142 | $storage = new Temporary([]); |
2143 | 2143 | |
2144 | - Filesystem::mount($storage, [], $this->user . '/'); |
|
2144 | + Filesystem::mount($storage, [], $this->user.'/'); |
|
2145 | 2145 | |
2146 | 2146 | $storage->mkdir('files'); |
2147 | 2147 | $storage->mkdir('files/dir'); |
@@ -2183,14 +2183,14 @@ discard block |
||
2183 | 2183 | $path, |
2184 | 2184 | $hookType, |
2185 | 2185 | ): void { |
2186 | - $view = new View('/' . $this->user . '/files/'); |
|
2186 | + $view = new View('/'.$this->user.'/files/'); |
|
2187 | 2187 | |
2188 | 2188 | /** @var Temporary|\PHPUnit\Framework\MockObject\MockObject $storage */ |
2189 | 2189 | $storage = $this->getMockBuilder(Temporary::class) |
2190 | 2190 | ->onlyMethods([$operation]) |
2191 | 2191 | ->getMock(); |
2192 | 2192 | |
2193 | - Filesystem::mount($storage, [], $this->user . '/'); |
|
2193 | + Filesystem::mount($storage, [], $this->user.'/'); |
|
2194 | 2194 | $storage->mkdir('files'); |
2195 | 2195 | |
2196 | 2196 | Util::connectHook( |
@@ -2222,7 +2222,7 @@ discard block |
||
2222 | 2222 | * the operation |
2223 | 2223 | */ |
2224 | 2224 | public function testLockFileRename($operation, $expectedLockTypeSourceDuring): void { |
2225 | - $view = new View('/' . $this->user . '/files/'); |
|
2225 | + $view = new View('/'.$this->user.'/files/'); |
|
2226 | 2226 | |
2227 | 2227 | /** @var Temporary|\PHPUnit\Framework\MockObject\MockObject $storage */ |
2228 | 2228 | $storage = $this->getMockBuilder(Temporary::class) |
@@ -2248,14 +2248,14 @@ discard block |
||
2248 | 2248 | /* Disable encryption wrapper to avoid it intercepting mocked call */ |
2249 | 2249 | Server::get(IStorageFactory::class)->removeStorageWrapper('oc_encryption'); |
2250 | 2250 | |
2251 | - Filesystem::mount($storage, [], $this->user . '/'); |
|
2251 | + Filesystem::mount($storage, [], $this->user.'/'); |
|
2252 | 2252 | $storage->mkdir('files'); |
2253 | 2253 | $view->file_put_contents($sourcePath, 'meh'); |
2254 | 2254 | |
2255 | 2255 | $storage->expects($this->once()) |
2256 | 2256 | ->method($operation) |
2257 | 2257 | ->willReturnCallback( |
2258 | - function () use ($view, $sourcePath, $targetPath, &$lockTypeSourceDuring, &$lockTypeTargetDuring) { |
|
2258 | + function() use ($view, $sourcePath, $targetPath, &$lockTypeSourceDuring, &$lockTypeTargetDuring) { |
|
2259 | 2259 | $lockTypeSourceDuring = $this->getFileLockType($view, $sourcePath); |
2260 | 2260 | $lockTypeTargetDuring = $this->getFileLockType($view, $targetPath); |
2261 | 2261 | |
@@ -2291,7 +2291,7 @@ discard block |
||
2291 | 2291 | public function testLockFileCopyException(): void { |
2292 | 2292 | $this->expectException(\Exception::class); |
2293 | 2293 | |
2294 | - $view = new View('/' . $this->user . '/files/'); |
|
2294 | + $view = new View('/'.$this->user.'/files/'); |
|
2295 | 2295 | |
2296 | 2296 | /** @var Temporary|\PHPUnit\Framework\MockObject\MockObject $storage */ |
2297 | 2297 | $storage = $this->getMockBuilder(Temporary::class) |
@@ -2304,14 +2304,14 @@ discard block |
||
2304 | 2304 | /* Disable encryption wrapper to avoid it intercepting mocked call */ |
2305 | 2305 | Server::get(IStorageFactory::class)->removeStorageWrapper('oc_encryption'); |
2306 | 2306 | |
2307 | - Filesystem::mount($storage, [], $this->user . '/'); |
|
2307 | + Filesystem::mount($storage, [], $this->user.'/'); |
|
2308 | 2308 | $storage->mkdir('files'); |
2309 | 2309 | $view->file_put_contents($sourcePath, 'meh'); |
2310 | 2310 | |
2311 | 2311 | $storage->expects($this->once()) |
2312 | 2312 | ->method('copy') |
2313 | 2313 | ->willReturnCallback( |
2314 | - function () { |
|
2314 | + function() { |
|
2315 | 2315 | throw new \Exception(); |
2316 | 2316 | } |
2317 | 2317 | ); |
@@ -2337,7 +2337,7 @@ discard block |
||
2337 | 2337 | public function testLockFileRenameUnlockOnException(): void { |
2338 | 2338 | self::loginAsUser('test'); |
2339 | 2339 | |
2340 | - $view = new View('/' . $this->user . '/files/'); |
|
2340 | + $view = new View('/'.$this->user.'/files/'); |
|
2341 | 2341 | |
2342 | 2342 | $sourcePath = 'original.txt'; |
2343 | 2343 | $targetPath = 'target.txt'; |
@@ -2378,7 +2378,7 @@ discard block |
||
2378 | 2378 | $this->assertEquals('test', $view->getFileInfo($path)->getOwner()->getUID()); |
2379 | 2379 | |
2380 | 2380 | $folderInfo = $view->getDirectoryContent(''); |
2381 | - $folderInfo = array_values(array_filter($folderInfo, function (FileInfo $info) { |
|
2381 | + $folderInfo = array_values(array_filter($folderInfo, function(FileInfo $info) { |
|
2382 | 2382 | return $info->getName() === 'foo.txt'; |
2383 | 2383 | })); |
2384 | 2384 | |
@@ -2388,7 +2388,7 @@ discard block |
||
2388 | 2388 | Filesystem::mount($subStorage, [], '/test/files/asd'); |
2389 | 2389 | |
2390 | 2390 | $folderInfo = $view->getDirectoryContent(''); |
2391 | - $folderInfo = array_values(array_filter($folderInfo, function (FileInfo $info) { |
|
2391 | + $folderInfo = array_values(array_filter($folderInfo, function(FileInfo $info) { |
|
2392 | 2392 | return $info->getName() === 'asd'; |
2393 | 2393 | })); |
2394 | 2394 | |
@@ -2413,7 +2413,7 @@ discard block |
||
2413 | 2413 | * the operation |
2414 | 2414 | */ |
2415 | 2415 | public function testLockFileRenameCrossStorage($viewOperation, $storageOperation, $expectedLockTypeSourceDuring): void { |
2416 | - $view = new View('/' . $this->user . '/files/'); |
|
2416 | + $view = new View('/'.$this->user.'/files/'); |
|
2417 | 2417 | |
2418 | 2418 | /** @var Temporary|\PHPUnit\Framework\MockObject\MockObject $storage */ |
2419 | 2419 | $storage = $this->getMockBuilder(Temporary::class) |
@@ -2443,8 +2443,8 @@ discard block |
||
2443 | 2443 | /* Disable encryption wrapper to avoid it intercepting mocked call */ |
2444 | 2444 | Server::get(IStorageFactory::class)->removeStorageWrapper('oc_encryption'); |
2445 | 2445 | |
2446 | - Filesystem::mount($storage, [], $this->user . '/'); |
|
2447 | - Filesystem::mount($storage2, [], $this->user . '/files/substorage'); |
|
2446 | + Filesystem::mount($storage, [], $this->user.'/'); |
|
2447 | + Filesystem::mount($storage2, [], $this->user.'/files/substorage'); |
|
2448 | 2448 | $storage->mkdir('files'); |
2449 | 2449 | $view->file_put_contents($sourcePath, 'meh'); |
2450 | 2450 | $storage2->getUpdater()->update(''); |
@@ -2454,7 +2454,7 @@ discard block |
||
2454 | 2454 | $storage2->expects($this->once()) |
2455 | 2455 | ->method($storageOperation) |
2456 | 2456 | ->willReturnCallback( |
2457 | - function () use ($view, $sourcePath, $targetPath, &$lockTypeSourceDuring, &$lockTypeTargetDuring) { |
|
2457 | + function() use ($view, $sourcePath, $targetPath, &$lockTypeSourceDuring, &$lockTypeTargetDuring) { |
|
2458 | 2458 | $lockTypeSourceDuring = $this->getFileLockType($view, $sourcePath); |
2459 | 2459 | $lockTypeTargetDuring = $this->getFileLockType($view, $targetPath); |
2460 | 2460 | |
@@ -2489,10 +2489,10 @@ discard block |
||
2489 | 2489 | self::loginAsUser('test'); |
2490 | 2490 | |
2491 | 2491 | [$mount] = $this->createTestMovableMountPoints([ |
2492 | - $this->user . '/files/substorage', |
|
2492 | + $this->user.'/files/substorage', |
|
2493 | 2493 | ]); |
2494 | 2494 | |
2495 | - $view = new View('/' . $this->user . '/files/'); |
|
2495 | + $view = new View('/'.$this->user.'/files/'); |
|
2496 | 2496 | $view->mkdir('subdir'); |
2497 | 2497 | |
2498 | 2498 | $sourcePath = 'substorage'; |
@@ -2501,7 +2501,7 @@ discard block |
||
2501 | 2501 | $mount->expects($this->once()) |
2502 | 2502 | ->method('moveMount') |
2503 | 2503 | ->willReturnCallback( |
2504 | - function ($target) use ($mount, $view, $sourcePath, $targetPath, &$lockTypeSourceDuring, &$lockTypeTargetDuring, &$lockTypeSharedRootDuring) { |
|
2504 | + function($target) use ($mount, $view, $sourcePath, $targetPath, &$lockTypeSourceDuring, &$lockTypeTargetDuring, &$lockTypeSharedRootDuring) { |
|
2505 | 2505 | $lockTypeSourceDuring = $this->getFileLockType($view, $sourcePath, true); |
2506 | 2506 | $lockTypeTargetDuring = $this->getFileLockType($view, $targetPath, true); |
2507 | 2507 | |
@@ -2566,14 +2566,14 @@ discard block |
||
2566 | 2566 | $eventHandler->expects($this->any()) |
2567 | 2567 | ->method('preCallback') |
2568 | 2568 | ->willReturnCallback( |
2569 | - function () use ($view, $path, $onMountPoint, &$lockTypePre) { |
|
2569 | + function() use ($view, $path, $onMountPoint, &$lockTypePre) { |
|
2570 | 2570 | $lockTypePre = $this->getFileLockType($view, $path, $onMountPoint); |
2571 | 2571 | } |
2572 | 2572 | ); |
2573 | 2573 | $eventHandler->expects($this->any()) |
2574 | 2574 | ->method('postCallback') |
2575 | 2575 | ->willReturnCallback( |
2576 | - function () use ($view, $path, $onMountPoint, &$lockTypePost) { |
|
2576 | + function() use ($view, $path, $onMountPoint, &$lockTypePost) { |
|
2577 | 2577 | $lockTypePost = $this->getFileLockType($view, $path, $onMountPoint); |
2578 | 2578 | } |
2579 | 2579 | ); |
@@ -2587,7 +2587,7 @@ discard block |
||
2587 | 2587 | ); |
2588 | 2588 | Util::connectHook( |
2589 | 2589 | Filesystem::CLASSNAME, |
2590 | - 'post_' . $hookType, |
|
2590 | + 'post_'.$hookType, |
|
2591 | 2591 | $eventHandler, |
2592 | 2592 | 'postCallback' |
2593 | 2593 | ); |
@@ -2615,7 +2615,7 @@ discard block |
||
2615 | 2615 | |
2616 | 2616 | |
2617 | 2617 | public function testRemoveMoveableMountPoint(): void { |
2618 | - $mountPoint = '/' . $this->user . '/files/mount/'; |
|
2618 | + $mountPoint = '/'.$this->user.'/files/mount/'; |
|
2619 | 2619 | |
2620 | 2620 | // Mock the mount point |
2621 | 2621 | /** @var TestMoveableMountPoint|\PHPUnit\Framework\MockObject\MockObject $mount */ |
@@ -2657,7 +2657,7 @@ discard block |
||
2657 | 2657 | ); |
2658 | 2658 | |
2659 | 2659 | //Delete the mountpoint |
2660 | - $view = new View('/' . $this->user . '/files'); |
|
2660 | + $view = new View('/'.$this->user.'/files'); |
|
2661 | 2661 | $this->assertEquals('foo', $view->rmdir('mount')); |
2662 | 2662 | } |
2663 | 2663 | |
@@ -2678,7 +2678,7 @@ discard block |
||
2678 | 2678 | public function testGetDirectoryContentMimeFilter($filter, $expected): void { |
2679 | 2679 | $storage1 = new Temporary(); |
2680 | 2680 | $root = self::getUniqueID('/'); |
2681 | - Filesystem::mount($storage1, [], $root . '/'); |
|
2681 | + Filesystem::mount($storage1, [], $root.'/'); |
|
2682 | 2682 | $view = new View($root); |
2683 | 2683 | |
2684 | 2684 | $view->file_put_contents('test1.txt', 'asd'); |
@@ -2688,7 +2688,7 @@ discard block |
||
2688 | 2688 | |
2689 | 2689 | $content = $view->getDirectoryContent('', $filter); |
2690 | 2690 | |
2691 | - $files = array_map(function (FileInfo $info) { |
|
2691 | + $files = array_map(function(FileInfo $info) { |
|
2692 | 2692 | return $info->getName(); |
2693 | 2693 | }, $content); |
2694 | 2694 | sort($files); |
@@ -2794,7 +2794,7 @@ discard block |
||
2794 | 2794 | $calls = ['/new/folder', '/new/folder/structure']; |
2795 | 2795 | $view->expects($this->exactly(2)) |
2796 | 2796 | ->method('mkdir') |
2797 | - ->willReturnCallback(function ($dir) use (&$calls) { |
|
2797 | + ->willReturnCallback(function($dir) use (&$calls) { |
|
2798 | 2798 | $expected = array_shift($calls); |
2799 | 2799 | $this->assertEquals($expected, $dir); |
2800 | 2800 | }); |
@@ -2891,7 +2891,7 @@ discard block |
||
2891 | 2891 | } |
2892 | 2892 | |
2893 | 2893 | public function testCopyPreservesContent() { |
2894 | - $viewUser1 = new View('/' . 'userId' . '/files'); |
|
2894 | + $viewUser1 = new View('/'.'userId'.'/files'); |
|
2895 | 2895 | $viewUser1->mkdir(''); |
2896 | 2896 | $viewUser1->file_put_contents('foo.txt', 'foo'); |
2897 | 2897 | $viewUser1->copy('foo.txt', 'bar.txt'); |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | ->getMock(); |
123 | 123 | $mockConfig->expects($this->any()) |
124 | 124 | ->method('getSystemValue') |
125 | - ->willReturnCallback(static function ($key, $default) use ($config) { |
|
125 | + ->willReturnCallback(static function($key, $default) use ($config) { |
|
126 | 126 | if ($key === 'filesystem_check_changes') { |
127 | 127 | return Watcher::CHECK_ONCE; |
128 | 128 | } else { |
@@ -131,8 +131,8 @@ discard block |
||
131 | 131 | }); |
132 | 132 | $this->overwriteService(AllConfig::class, $mockConfig); |
133 | 133 | |
134 | - $this->trashRoot1 = '/' . self::TEST_TRASHBIN_USER1 . '/files_trashbin'; |
|
135 | - $this->trashRoot2 = '/' . self::TEST_TRASHBIN_USER2 . '/files_trashbin'; |
|
134 | + $this->trashRoot1 = '/'.self::TEST_TRASHBIN_USER1.'/files_trashbin'; |
|
135 | + $this->trashRoot2 = '/'.self::TEST_TRASHBIN_USER2.'/files_trashbin'; |
|
136 | 136 | $this->rootView = new View(); |
137 | 137 | self::loginHelper(self::TEST_TRASHBIN_USER1); |
138 | 138 | } |
@@ -142,8 +142,8 @@ discard block |
||
142 | 142 | // disable trashbin to be able to properly clean up |
143 | 143 | Server::get(IAppManager::class)->disableApp('files_trashbin'); |
144 | 144 | |
145 | - $this->rootView->deleteAll('/' . self::TEST_TRASHBIN_USER1 . '/files'); |
|
146 | - $this->rootView->deleteAll('/' . self::TEST_TRASHBIN_USER2 . '/files'); |
|
145 | + $this->rootView->deleteAll('/'.self::TEST_TRASHBIN_USER1.'/files'); |
|
146 | + $this->rootView->deleteAll('/'.self::TEST_TRASHBIN_USER2.'/files'); |
|
147 | 147 | $this->rootView->deleteAll($this->trashRoot1); |
148 | 148 | $this->rootView->deleteAll($this->trashRoot2); |
149 | 149 | |
@@ -211,15 +211,15 @@ discard block |
||
211 | 211 | */ |
212 | 212 | public function testExpireOldFilesShared(): void { |
213 | 213 | $currentTime = time(); |
214 | - $folder = 'trashTest-' . $currentTime . '/'; |
|
214 | + $folder = 'trashTest-'.$currentTime.'/'; |
|
215 | 215 | $expiredDate = $currentTime - 3 * 24 * 60 * 60; |
216 | 216 | |
217 | 217 | // create some files |
218 | 218 | Filesystem::mkdir($folder); |
219 | - Filesystem::file_put_contents($folder . 'user1-1.txt', 'file1'); |
|
220 | - Filesystem::file_put_contents($folder . 'user1-2.txt', 'file2'); |
|
221 | - Filesystem::file_put_contents($folder . 'user1-3.txt', 'file3'); |
|
222 | - Filesystem::file_put_contents($folder . 'user1-4.txt', 'file4'); |
|
219 | + Filesystem::file_put_contents($folder.'user1-1.txt', 'file1'); |
|
220 | + Filesystem::file_put_contents($folder.'user1-2.txt', 'file2'); |
|
221 | + Filesystem::file_put_contents($folder.'user1-3.txt', 'file3'); |
|
222 | + Filesystem::file_put_contents($folder.'user1-4.txt', 'file4'); |
|
223 | 223 | |
224 | 224 | //share user1-4.txt with user2 |
225 | 225 | $node = \OC::$server->getUserFolder(self::TEST_TRASHBIN_USER1)->get($folder); |
@@ -233,9 +233,9 @@ discard block |
||
233 | 233 | Server::get(\OCP\Share\IManager::class)->acceptShare($share, self::TEST_TRASHBIN_USER2); |
234 | 234 | |
235 | 235 | // delete them so that they end up in the trash bin |
236 | - Filesystem::unlink($folder . 'user1-1.txt'); |
|
237 | - Filesystem::unlink($folder . 'user1-2.txt'); |
|
238 | - Filesystem::unlink($folder . 'user1-3.txt'); |
|
236 | + Filesystem::unlink($folder.'user1-1.txt'); |
|
237 | + Filesystem::unlink($folder.'user1-2.txt'); |
|
238 | + Filesystem::unlink($folder.'user1-3.txt'); |
|
239 | 239 | |
240 | 240 | $filesInTrash = Helper::getTrashFiles('/', self::TEST_TRASHBIN_USER1, 'name'); |
241 | 241 | $this->assertSame(3, count($filesInTrash)); |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | // login as user2 |
247 | 247 | self::loginHelper(self::TEST_TRASHBIN_USER2); |
248 | 248 | |
249 | - $this->assertTrue(Filesystem::file_exists($folder . 'user1-4.txt')); |
|
249 | + $this->assertTrue(Filesystem::file_exists($folder.'user1-4.txt')); |
|
250 | 250 | |
251 | 251 | // create some files |
252 | 252 | Filesystem::file_put_contents('user2-1.txt', 'file1'); |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | // every second file will get a date in the past so that it will get expired |
263 | 263 | $this->manipulateDeleteTime($filesInTrashUser2, $this->trashRoot2, $expiredDate); |
264 | 264 | |
265 | - Filesystem::unlink($folder . 'user1-4.txt'); |
|
265 | + Filesystem::unlink($folder.'user1-4.txt'); |
|
266 | 266 | |
267 | 267 | $this->runCommands(); |
268 | 268 | |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | } |
298 | 298 | if (!$found) { |
299 | 299 | // if we didn't found the expected file, something went wrong |
300 | - $this->assertTrue(false, "can't find expected file '" . $expectedFile . "' in trash bin"); |
|
300 | + $this->assertTrue(false, "can't find expected file '".$expectedFile."' in trash bin"); |
|
301 | 301 | } |
302 | 302 | } |
303 | 303 | } |
@@ -313,8 +313,8 @@ discard block |
||
313 | 313 | // modify every second file |
314 | 314 | $counter = ($counter + 1) % 2; |
315 | 315 | if ($counter === 1) { |
316 | - $source = $trashRoot . '/files/' . $file['name'] . '.d' . $file['mtime']; |
|
317 | - $target = Filesystem::normalizePath($trashRoot . '/files/' . $file['name'] . '.d' . $expireDate); |
|
316 | + $source = $trashRoot.'/files/'.$file['name'].'.d'.$file['mtime']; |
|
317 | + $target = Filesystem::normalizePath($trashRoot.'/files/'.$file['name'].'.d'.$expireDate); |
|
318 | 318 | $this->rootView->rename($source, $target); |
319 | 319 | $file['mtime'] = $expireDate; |
320 | 320 | } |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | |
380 | 380 | $this->assertTrue( |
381 | 381 | Trashbin::restore( |
382 | - 'file1.txt.d' . $trashedFile->getMtime(), |
|
382 | + 'file1.txt.d'.$trashedFile->getMtime(), |
|
383 | 383 | $trashedFile->getName(), |
384 | 384 | $trashedFile->getMtime() |
385 | 385 | ) |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | |
413 | 413 | $this->assertTrue( |
414 | 414 | Trashbin::restore( |
415 | - 'file1.txt.d' . $trashedFile->getMtime(), |
|
415 | + 'file1.txt.d'.$trashedFile->getMtime(), |
|
416 | 416 | $trashedFile->getName(), |
417 | 417 | $trashedFile->getMtime() |
418 | 418 | ) |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | |
446 | 446 | $this->assertTrue( |
447 | 447 | Trashbin::restore( |
448 | - 'folder.d' . $trashedFolder->getMtime(), |
|
448 | + 'folder.d'.$trashedFolder->getMtime(), |
|
449 | 449 | $trashedFolder->getName(), |
450 | 450 | $trashedFolder->getMtime() |
451 | 451 | ) |
@@ -478,7 +478,7 @@ discard block |
||
478 | 478 | |
479 | 479 | $this->assertTrue( |
480 | 480 | Trashbin::restore( |
481 | - 'folder.d' . $trashedFile->getMtime() . '/file1.txt', |
|
481 | + 'folder.d'.$trashedFile->getMtime().'/file1.txt', |
|
482 | 482 | 'file1.txt', |
483 | 483 | $trashedFile->getMtime() |
484 | 484 | ) |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | |
516 | 516 | $this->assertTrue( |
517 | 517 | Trashbin::restore( |
518 | - 'file1.txt.d' . $trashedFile->getMtime(), |
|
518 | + 'file1.txt.d'.$trashedFile->getMtime(), |
|
519 | 519 | $trashedFile->getName(), |
520 | 520 | $trashedFile->getMtime() |
521 | 521 | ) |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | |
553 | 553 | $this->assertTrue( |
554 | 554 | Trashbin::restore( |
555 | - 'file1.txt.d' . $trashedFile->getMtime(), |
|
555 | + 'file1.txt.d'.$trashedFile->getMtime(), |
|
556 | 556 | $trashedFile->getName(), |
557 | 557 | $trashedFile->getMtime() |
558 | 558 | ) |
@@ -593,7 +593,7 @@ discard block |
||
593 | 593 | |
594 | 594 | $this->assertTrue( |
595 | 595 | Trashbin::restore( |
596 | - 'file1.txt.d' . $trashedFile->getMtime(), |
|
596 | + 'file1.txt.d'.$trashedFile->getMtime(), |
|
597 | 597 | $trashedFile->getName(), |
598 | 598 | $trashedFile->getMtime() |
599 | 599 | ) |
@@ -642,7 +642,7 @@ discard block |
||
642 | 642 | $trashedFile = $filesInTrash[0]; |
643 | 643 | |
644 | 644 | // delete source folder |
645 | - [$storage, $internalPath] = $this->rootView->resolvePath('/' . self::TEST_TRASHBIN_USER1 . '/files/folder'); |
|
645 | + [$storage, $internalPath] = $this->rootView->resolvePath('/'.self::TEST_TRASHBIN_USER1.'/files/folder'); |
|
646 | 646 | if ($storage instanceof Local) { |
647 | 647 | $folderAbsPath = $storage->getSourcePath($internalPath); |
648 | 648 | // make folder read-only |
@@ -650,7 +650,7 @@ discard block |
||
650 | 650 | |
651 | 651 | $this->assertTrue( |
652 | 652 | Trashbin::restore( |
653 | - 'file1.txt.d' . $trashedFile->getMtime(), |
|
653 | + 'file1.txt.d'.$trashedFile->getMtime(), |
|
654 | 654 | $trashedFile->getName(), |
655 | 655 | $trashedFile->getMtime() |
656 | 656 | ) |
@@ -35,9 +35,9 @@ discard block |
||
35 | 35 | 'id' => $node instanceof NonExistingFile ? null : $node->getId(), |
36 | 36 | 'path' => $node->getPath(), |
37 | 37 | ]; |
38 | - } catch (InvalidPathException|NotFoundException $e) { |
|
38 | + } catch (InvalidPathException | NotFoundException $e) { |
|
39 | 39 | Server::get(LoggerInterface::class)->error( |
40 | - 'Exception thrown in file read: ' . $e->getMessage(), ['app' => 'admin_audit', 'exception' => $e] |
|
40 | + 'Exception thrown in file read: '.$e->getMessage(), ['app' => 'admin_audit', 'exception' => $e] |
|
41 | 41 | ); |
42 | 42 | return; |
43 | 43 | } |
@@ -60,9 +60,9 @@ discard block |
||
60 | 60 | 'oldpath' => $source->getPath(), |
61 | 61 | 'newpath' => $target->getPath(), |
62 | 62 | ]; |
63 | - } catch (InvalidPathException|NotFoundException $e) { |
|
63 | + } catch (InvalidPathException | NotFoundException $e) { |
|
64 | 64 | Server::get(LoggerInterface::class)->error( |
65 | - 'Exception thrown in file rename: ' . $e->getMessage(), ['app' => 'admin_audit', 'exception' => $e] |
|
65 | + 'Exception thrown in file rename: '.$e->getMessage(), ['app' => 'admin_audit', 'exception' => $e] |
|
66 | 66 | ); |
67 | 67 | return; |
68 | 68 | } |
@@ -84,9 +84,9 @@ discard block |
||
84 | 84 | 'id' => $event->getNode()->getId(), |
85 | 85 | 'path' => $event->getNode()->getPath(), |
86 | 86 | ]; |
87 | - } catch (InvalidPathException|NotFoundException $e) { |
|
87 | + } catch (InvalidPathException | NotFoundException $e) { |
|
88 | 88 | Server::get(LoggerInterface::class)->error( |
89 | - 'Exception thrown in file create: ' . $e->getMessage(), ['app' => 'admin_audit', 'exception' => $e] |
|
89 | + 'Exception thrown in file create: '.$e->getMessage(), ['app' => 'admin_audit', 'exception' => $e] |
|
90 | 90 | ); |
91 | 91 | return; |
92 | 92 | } |
@@ -111,9 +111,9 @@ discard block |
||
111 | 111 | 'oldpath' => $event->getSource()->getPath(), |
112 | 112 | 'newpath' => $event->getTarget()->getPath(), |
113 | 113 | ]; |
114 | - } catch (InvalidPathException|NotFoundException $e) { |
|
114 | + } catch (InvalidPathException | NotFoundException $e) { |
|
115 | 115 | Server::get(LoggerInterface::class)->error( |
116 | - 'Exception thrown in file copy: ' . $e->getMessage(), ['app' => 'admin_audit', 'exception' => $e] |
|
116 | + 'Exception thrown in file copy: '.$e->getMessage(), ['app' => 'admin_audit', 'exception' => $e] |
|
117 | 117 | ); |
118 | 118 | return; |
119 | 119 | } |
@@ -134,9 +134,9 @@ discard block |
||
134 | 134 | 'id' => $node->getId(), |
135 | 135 | 'path' => $node->getPath(), |
136 | 136 | ]; |
137 | - } catch (InvalidPathException|NotFoundException $e) { |
|
137 | + } catch (InvalidPathException | NotFoundException $e) { |
|
138 | 138 | Server::get(LoggerInterface::class)->error( |
139 | - 'Exception thrown in file write: ' . $e->getMessage(), ['app' => 'admin_audit', 'exception' => $e] |
|
139 | + 'Exception thrown in file write: '.$e->getMessage(), ['app' => 'admin_audit', 'exception' => $e] |
|
140 | 140 | ); |
141 | 141 | return; |
142 | 142 | } |
@@ -160,9 +160,9 @@ discard block |
||
160 | 160 | 'id' => $event->getNode()->getId(), |
161 | 161 | 'path' => $event->getNode()->getPath(), |
162 | 162 | ]; |
163 | - } catch (InvalidPathException|NotFoundException $e) { |
|
163 | + } catch (InvalidPathException | NotFoundException $e) { |
|
164 | 164 | Server::get(LoggerInterface::class)->error( |
165 | - 'Exception thrown in file delete: ' . $e->getMessage(), ['app' => 'admin_audit', 'exception' => $e] |
|
165 | + 'Exception thrown in file delete: '.$e->getMessage(), ['app' => 'admin_audit', 'exception' => $e] |
|
166 | 166 | ); |
167 | 167 | return; |
168 | 168 | } |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | } |
78 | 78 | |
79 | 79 | public function register(IRegistrationContext $context): void { |
80 | - $context->registerService(IAuditLogger::class, function (ContainerInterface $c) { |
|
80 | + $context->registerService(IAuditLogger::class, function(ContainerInterface $c) { |
|
81 | 81 | return new AuditLogger($c->get(ILogFactory::class), $c->get(IConfig::class)); |
82 | 82 | }); |
83 | 83 | |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | |
161 | 161 | private function tagHooks(IAuditLogger $logger, |
162 | 162 | IEventDispatcher $eventDispatcher): void { |
163 | - $eventDispatcher->addListener(ManagerEvent::EVENT_CREATE, function (ManagerEvent $event) use ($logger): void { |
|
163 | + $eventDispatcher->addListener(ManagerEvent::EVENT_CREATE, function(ManagerEvent $event) use ($logger): void { |
|
164 | 164 | $tagActions = new TagManagement($logger); |
165 | 165 | $tagActions->createTag($event->getTag()); |
166 | 166 | }); |
@@ -171,42 +171,42 @@ discard block |
||
171 | 171 | |
172 | 172 | $eventDispatcher->addListener( |
173 | 173 | NodeRenamedEvent::class, |
174 | - function (NodeRenamedEvent $event) use ($fileActions): void { |
|
174 | + function(NodeRenamedEvent $event) use ($fileActions): void { |
|
175 | 175 | $fileActions->afterRename($event); |
176 | 176 | } |
177 | 177 | ); |
178 | 178 | |
179 | 179 | $eventDispatcher->addListener( |
180 | 180 | NodeCreatedEvent::class, |
181 | - function (NodeCreatedEvent $event) use ($fileActions): void { |
|
181 | + function(NodeCreatedEvent $event) use ($fileActions): void { |
|
182 | 182 | $fileActions->create($event); |
183 | 183 | } |
184 | 184 | ); |
185 | 185 | |
186 | 186 | $eventDispatcher->addListener( |
187 | 187 | NodeCopiedEvent::class, |
188 | - function (NodeCopiedEvent $event) use ($fileActions): void { |
|
188 | + function(NodeCopiedEvent $event) use ($fileActions): void { |
|
189 | 189 | $fileActions->copy($event); |
190 | 190 | } |
191 | 191 | ); |
192 | 192 | |
193 | 193 | $eventDispatcher->addListener( |
194 | 194 | NodeWrittenEvent::class, |
195 | - function (NodeWrittenEvent $event) use ($fileActions): void { |
|
195 | + function(NodeWrittenEvent $event) use ($fileActions): void { |
|
196 | 196 | $fileActions->write($event); |
197 | 197 | } |
198 | 198 | ); |
199 | 199 | |
200 | 200 | $eventDispatcher->addListener( |
201 | 201 | BeforeNodeReadEvent::class, |
202 | - function (BeforeNodeReadEvent $event) use ($fileActions): void { |
|
202 | + function(BeforeNodeReadEvent $event) use ($fileActions): void { |
|
203 | 203 | $fileActions->read($event); |
204 | 204 | } |
205 | 205 | ); |
206 | 206 | |
207 | 207 | $eventDispatcher->addListener( |
208 | 208 | BeforeNodeDeletedEvent::class, |
209 | - function (BeforeNodeDeletedEvent $event) use ($fileActions): void { |
|
209 | + function(BeforeNodeDeletedEvent $event) use ($fileActions): void { |
|
210 | 210 | $fileActions->delete($event); |
211 | 211 | } |
212 | 212 | ); |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | ->getMock(); |
90 | 90 | $mockConfig->expects($this->any()) |
91 | 91 | ->method('getSystemValue') |
92 | - ->willReturnCallback(function ($key, $default) use ($config) { |
|
92 | + ->willReturnCallback(function($key, $default) use ($config) { |
|
93 | 93 | if ($key === 'filesystem_check_changes') { |
94 | 94 | return Watcher::CHECK_ONCE; |
95 | 95 | } else { |
@@ -124,10 +124,10 @@ discard block |
||
124 | 124 | $this->restoreService(AllConfig::class); |
125 | 125 | |
126 | 126 | if ($this->rootView) { |
127 | - $this->rootView->deleteAll(self::TEST_VERSIONS_USER . '/files/'); |
|
128 | - $this->rootView->deleteAll(self::TEST_VERSIONS_USER2 . '/files/'); |
|
129 | - $this->rootView->deleteAll(self::TEST_VERSIONS_USER . '/files_versions/'); |
|
130 | - $this->rootView->deleteAll(self::TEST_VERSIONS_USER2 . '/files_versions/'); |
|
127 | + $this->rootView->deleteAll(self::TEST_VERSIONS_USER.'/files/'); |
|
128 | + $this->rootView->deleteAll(self::TEST_VERSIONS_USER2.'/files/'); |
|
129 | + $this->rootView->deleteAll(self::TEST_VERSIONS_USER.'/files_versions/'); |
|
130 | + $this->rootView->deleteAll(self::TEST_VERSIONS_USER2.'/files_versions/'); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | \OC_Hook::clear(); |
@@ -295,10 +295,10 @@ discard block |
||
295 | 295 | $t2 = $t1 - 60 * 60 * 24 * 14; |
296 | 296 | |
297 | 297 | // create some versions |
298 | - $v1 = self::USERS_VERSIONS_ROOT . '/test.txt.v' . $t1; |
|
299 | - $v2 = self::USERS_VERSIONS_ROOT . '/test.txt.v' . $t2; |
|
300 | - $v1Renamed = self::USERS_VERSIONS_ROOT . '/test2.txt.v' . $t1; |
|
301 | - $v2Renamed = self::USERS_VERSIONS_ROOT . '/test2.txt.v' . $t2; |
|
298 | + $v1 = self::USERS_VERSIONS_ROOT.'/test.txt.v'.$t1; |
|
299 | + $v2 = self::USERS_VERSIONS_ROOT.'/test.txt.v'.$t2; |
|
300 | + $v1Renamed = self::USERS_VERSIONS_ROOT.'/test2.txt.v'.$t1; |
|
301 | + $v2Renamed = self::USERS_VERSIONS_ROOT.'/test2.txt.v'.$t2; |
|
302 | 302 | |
303 | 303 | $this->rootView->file_put_contents($v1, 'version1'); |
304 | 304 | $this->rootView->file_put_contents($v2, 'version2'); |
@@ -325,12 +325,12 @@ discard block |
||
325 | 325 | // version will be expired |
326 | 326 | $t2 = $t1 - 60 * 60 * 24 * 14; |
327 | 327 | |
328 | - $this->rootView->mkdir(self::USERS_VERSIONS_ROOT . '/folder1'); |
|
328 | + $this->rootView->mkdir(self::USERS_VERSIONS_ROOT.'/folder1'); |
|
329 | 329 | // create some versions |
330 | - $v1 = self::USERS_VERSIONS_ROOT . '/folder1/test.txt.v' . $t1; |
|
331 | - $v2 = self::USERS_VERSIONS_ROOT . '/folder1/test.txt.v' . $t2; |
|
332 | - $v1Renamed = self::USERS_VERSIONS_ROOT . '/folder1/folder2/test.txt.v' . $t1; |
|
333 | - $v2Renamed = self::USERS_VERSIONS_ROOT . '/folder1/folder2/test.txt.v' . $t2; |
|
330 | + $v1 = self::USERS_VERSIONS_ROOT.'/folder1/test.txt.v'.$t1; |
|
331 | + $v2 = self::USERS_VERSIONS_ROOT.'/folder1/test.txt.v'.$t2; |
|
332 | + $v1Renamed = self::USERS_VERSIONS_ROOT.'/folder1/folder2/test.txt.v'.$t1; |
|
333 | + $v2Renamed = self::USERS_VERSIONS_ROOT.'/folder1/folder2/test.txt.v'.$t2; |
|
334 | 334 | |
335 | 335 | $this->rootView->file_put_contents($v1, 'version1'); |
336 | 336 | $this->rootView->file_put_contents($v2, 'version2'); |
@@ -376,11 +376,11 @@ discard block |
||
376 | 376 | $t2 = $t1 - 60 * 60 * 24 * 14; |
377 | 377 | |
378 | 378 | // create some versions |
379 | - $this->rootView->mkdir(self::USERS_VERSIONS_ROOT . '/folder1'); |
|
380 | - $v1 = self::USERS_VERSIONS_ROOT . '/folder1/test.txt.v' . $t1; |
|
381 | - $v2 = self::USERS_VERSIONS_ROOT . '/folder1/test.txt.v' . $t2; |
|
382 | - $v1Renamed = self::USERS_VERSIONS_ROOT . '/folder2/folder1/test.txt.v' . $t1; |
|
383 | - $v2Renamed = self::USERS_VERSIONS_ROOT . '/folder2/folder1/test.txt.v' . $t2; |
|
379 | + $this->rootView->mkdir(self::USERS_VERSIONS_ROOT.'/folder1'); |
|
380 | + $v1 = self::USERS_VERSIONS_ROOT.'/folder1/test.txt.v'.$t1; |
|
381 | + $v2 = self::USERS_VERSIONS_ROOT.'/folder1/test.txt.v'.$t2; |
|
382 | + $v1Renamed = self::USERS_VERSIONS_ROOT.'/folder2/folder1/test.txt.v'.$t1; |
|
383 | + $v2Renamed = self::USERS_VERSIONS_ROOT.'/folder2/folder1/test.txt.v'.$t2; |
|
384 | 384 | |
385 | 385 | $this->rootView->file_put_contents($v1, 'version1'); |
386 | 386 | $this->rootView->file_put_contents($v2, 'version2'); |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | Server::get(\OCP\Share\IManager::class)->acceptShare($share, self::TEST_VERSIONS_USER2); |
414 | 414 | |
415 | 415 | self::loginHelper(self::TEST_VERSIONS_USER2); |
416 | - $versionsFolder2 = '/' . self::TEST_VERSIONS_USER2 . '/files_versions'; |
|
416 | + $versionsFolder2 = '/'.self::TEST_VERSIONS_USER2.'/files_versions'; |
|
417 | 417 | Filesystem::file_put_contents('test.txt', 'test file'); |
418 | 418 | |
419 | 419 | $t1 = time(); |
@@ -423,8 +423,8 @@ discard block |
||
423 | 423 | |
424 | 424 | $this->rootView->mkdir($versionsFolder2); |
425 | 425 | // create some versions |
426 | - $v1 = $versionsFolder2 . '/test.txt.v' . $t1; |
|
427 | - $v2 = $versionsFolder2 . '/test.txt.v' . $t2; |
|
426 | + $v1 = $versionsFolder2.'/test.txt.v'.$t1; |
|
427 | + $v2 = $versionsFolder2.'/test.txt.v'.$t2; |
|
428 | 428 | |
429 | 429 | $this->rootView->file_put_contents($v1, 'version1'); |
430 | 430 | $this->rootView->file_put_contents($v2, 'version2'); |
@@ -438,10 +438,10 @@ discard block |
||
438 | 438 | |
439 | 439 | self::loginHelper(self::TEST_VERSIONS_USER); |
440 | 440 | |
441 | - $versionsFolder1 = '/' . self::TEST_VERSIONS_USER . '/files_versions'; |
|
441 | + $versionsFolder1 = '/'.self::TEST_VERSIONS_USER.'/files_versions'; |
|
442 | 442 | |
443 | - $v1Renamed = $versionsFolder1 . '/folder1/test.txt.v' . $t1; |
|
444 | - $v2Renamed = $versionsFolder1 . '/folder1/test.txt.v' . $t2; |
|
443 | + $v1Renamed = $versionsFolder1.'/folder1/test.txt.v'.$t1; |
|
444 | + $v2Renamed = $versionsFolder1.'/folder1/test.txt.v'.$t2; |
|
445 | 445 | |
446 | 446 | $this->assertTrue($this->rootView->file_exists($v1Renamed)); |
447 | 447 | $this->assertTrue($this->rootView->file_exists($v2Renamed)); |
@@ -463,7 +463,7 @@ discard block |
||
463 | 463 | Server::get(\OCP\Share\IManager::class)->acceptShare($share, self::TEST_VERSIONS_USER2); |
464 | 464 | |
465 | 465 | self::loginHelper(self::TEST_VERSIONS_USER2); |
466 | - $versionsFolder2 = '/' . self::TEST_VERSIONS_USER2 . '/files_versions'; |
|
466 | + $versionsFolder2 = '/'.self::TEST_VERSIONS_USER2.'/files_versions'; |
|
467 | 467 | Filesystem::mkdir('folder2'); |
468 | 468 | Filesystem::file_put_contents('folder2/test.txt', 'test file'); |
469 | 469 | |
@@ -473,10 +473,10 @@ discard block |
||
473 | 473 | $t2 = $t1 - 60 * 60 * 24 * 14; |
474 | 474 | |
475 | 475 | $this->rootView->mkdir($versionsFolder2); |
476 | - $this->rootView->mkdir($versionsFolder2 . '/folder2'); |
|
476 | + $this->rootView->mkdir($versionsFolder2.'/folder2'); |
|
477 | 477 | // create some versions |
478 | - $v1 = $versionsFolder2 . '/folder2/test.txt.v' . $t1; |
|
479 | - $v2 = $versionsFolder2 . '/folder2/test.txt.v' . $t2; |
|
478 | + $v1 = $versionsFolder2.'/folder2/test.txt.v'.$t1; |
|
479 | + $v2 = $versionsFolder2.'/folder2/test.txt.v'.$t2; |
|
480 | 480 | |
481 | 481 | $this->rootView->file_put_contents($v1, 'version1'); |
482 | 482 | $this->rootView->file_put_contents($v2, 'version2'); |
@@ -489,10 +489,10 @@ discard block |
||
489 | 489 | |
490 | 490 | self::loginHelper(self::TEST_VERSIONS_USER); |
491 | 491 | |
492 | - $versionsFolder1 = '/' . self::TEST_VERSIONS_USER . '/files_versions'; |
|
492 | + $versionsFolder1 = '/'.self::TEST_VERSIONS_USER.'/files_versions'; |
|
493 | 493 | |
494 | - $v1Renamed = $versionsFolder1 . '/folder1/folder2/test.txt.v' . $t1; |
|
495 | - $v2Renamed = $versionsFolder1 . '/folder1/folder2/test.txt.v' . $t2; |
|
494 | + $v1Renamed = $versionsFolder1.'/folder1/folder2/test.txt.v'.$t1; |
|
495 | + $v2Renamed = $versionsFolder1.'/folder1/folder2/test.txt.v'.$t2; |
|
496 | 496 | |
497 | 497 | $this->assertTrue($this->rootView->file_exists($v1Renamed)); |
498 | 498 | $this->assertTrue($this->rootView->file_exists($v2Renamed)); |
@@ -510,11 +510,11 @@ discard block |
||
510 | 510 | |
511 | 511 | $this->rootView->mkdir(self::USERS_VERSIONS_ROOT); |
512 | 512 | // create some versions |
513 | - $v1 = self::USERS_VERSIONS_ROOT . '/test.txt.v' . $t1; |
|
514 | - $v2 = self::USERS_VERSIONS_ROOT . '/test.txt.v' . $t2; |
|
513 | + $v1 = self::USERS_VERSIONS_ROOT.'/test.txt.v'.$t1; |
|
514 | + $v2 = self::USERS_VERSIONS_ROOT.'/test.txt.v'.$t2; |
|
515 | 515 | // the renamed versions should not exist! Because we only moved the mount point! |
516 | - $v1Renamed = self::USERS_VERSIONS_ROOT . '/test2.txt.v' . $t1; |
|
517 | - $v2Renamed = self::USERS_VERSIONS_ROOT . '/test2.txt.v' . $t2; |
|
516 | + $v1Renamed = self::USERS_VERSIONS_ROOT.'/test2.txt.v'.$t1; |
|
517 | + $v2Renamed = self::USERS_VERSIONS_ROOT.'/test2.txt.v'.$t2; |
|
518 | 518 | |
519 | 519 | $this->rootView->file_put_contents($v1, 'version1'); |
520 | 520 | $this->rootView->file_put_contents($v2, 'version2'); |
@@ -558,10 +558,10 @@ discard block |
||
558 | 558 | $t2 = $t1 - 60 * 60 * 24 * 14; |
559 | 559 | |
560 | 560 | // create some versions |
561 | - $v1 = self::USERS_VERSIONS_ROOT . '/test.txt.v' . $t1; |
|
562 | - $v2 = self::USERS_VERSIONS_ROOT . '/test.txt.v' . $t2; |
|
563 | - $v1Copied = self::USERS_VERSIONS_ROOT . '/test2.txt.v' . $t1; |
|
564 | - $v2Copied = self::USERS_VERSIONS_ROOT . '/test2.txt.v' . $t2; |
|
561 | + $v1 = self::USERS_VERSIONS_ROOT.'/test.txt.v'.$t1; |
|
562 | + $v2 = self::USERS_VERSIONS_ROOT.'/test.txt.v'.$t2; |
|
563 | + $v1Copied = self::USERS_VERSIONS_ROOT.'/test2.txt.v'.$t1; |
|
564 | + $v2Copied = self::USERS_VERSIONS_ROOT.'/test2.txt.v'.$t2; |
|
565 | 565 | |
566 | 566 | $this->rootView->file_put_contents($v1, 'version1'); |
567 | 567 | $this->rootView->file_put_contents($v2, 'version2'); |
@@ -589,10 +589,10 @@ discard block |
||
589 | 589 | $t2 = $t1 - 60 * 60 * 24 * 14; |
590 | 590 | |
591 | 591 | // create some versions |
592 | - $v1 = self::USERS_VERSIONS_ROOT . '/subfolder/test.txt.v' . $t1; |
|
593 | - $v2 = self::USERS_VERSIONS_ROOT . '/subfolder/test.txt.v' . $t2; |
|
592 | + $v1 = self::USERS_VERSIONS_ROOT.'/subfolder/test.txt.v'.$t1; |
|
593 | + $v2 = self::USERS_VERSIONS_ROOT.'/subfolder/test.txt.v'.$t2; |
|
594 | 594 | |
595 | - $this->rootView->mkdir(self::USERS_VERSIONS_ROOT . '/subfolder/'); |
|
595 | + $this->rootView->mkdir(self::USERS_VERSIONS_ROOT.'/subfolder/'); |
|
596 | 596 | |
597 | 597 | $this->rootView->file_put_contents($v1, 'version1'); |
598 | 598 | $this->rootView->file_put_contents($v2, 'version2'); |
@@ -608,7 +608,7 @@ discard block |
||
608 | 608 | } |
609 | 609 | |
610 | 610 | //cleanup |
611 | - $this->rootView->deleteAll(self::USERS_VERSIONS_ROOT . '/subfolder'); |
|
611 | + $this->rootView->deleteAll(self::USERS_VERSIONS_ROOT.'/subfolder'); |
|
612 | 612 | } |
613 | 613 | |
614 | 614 | /** |
@@ -651,7 +651,7 @@ discard block |
||
651 | 651 | |
652 | 652 | public function testRestoreCrossStorage(): void { |
653 | 653 | $storage2 = new Temporary([]); |
654 | - Filesystem::mount($storage2, [], self::TEST_VERSIONS_USER . '/files/sub'); |
|
654 | + Filesystem::mount($storage2, [], self::TEST_VERSIONS_USER.'/files/sub'); |
|
655 | 655 | |
656 | 656 | $this->doTestRestore(); |
657 | 657 | } |
@@ -750,7 +750,7 @@ discard block |
||
750 | 750 | $eventHandler->expects($this->any()) |
751 | 751 | ->method('callback') |
752 | 752 | ->willReturnCallback( |
753 | - function ($p) use (&$params): void { |
|
753 | + function($p) use (&$params): void { |
|
754 | 754 | $params = $p; |
755 | 755 | } |
756 | 756 | ); |
@@ -764,7 +764,7 @@ discard block |
||
764 | 764 | } |
765 | 765 | |
766 | 766 | private function doTestRestore() { |
767 | - $filePath = self::TEST_VERSIONS_USER . '/files/sub/test.txt'; |
|
767 | + $filePath = self::TEST_VERSIONS_USER.'/files/sub/test.txt'; |
|
768 | 768 | $this->rootView->file_put_contents($filePath, 'test file'); |
769 | 769 | |
770 | 770 | $fileInfo = $this->rootView->getFileInfo($filePath); |
@@ -776,10 +776,10 @@ discard block |
||
776 | 776 | $t2 = $t1 - 60 * 60 * 24 * 14; |
777 | 777 | |
778 | 778 | // create some versions |
779 | - $v1 = self::USERS_VERSIONS_ROOT . '/sub/test.txt.v' . $t1; |
|
780 | - $v2 = self::USERS_VERSIONS_ROOT . '/sub/test.txt.v' . $t2; |
|
779 | + $v1 = self::USERS_VERSIONS_ROOT.'/sub/test.txt.v'.$t1; |
|
780 | + $v2 = self::USERS_VERSIONS_ROOT.'/sub/test.txt.v'.$t2; |
|
781 | 781 | |
782 | - $this->rootView->mkdir(self::USERS_VERSIONS_ROOT . '/sub'); |
|
782 | + $this->rootView->mkdir(self::USERS_VERSIONS_ROOT.'/sub'); |
|
783 | 783 | |
784 | 784 | $this->rootView->file_put_contents($v1, 'version1'); |
785 | 785 | $fileInfoV1 = $this->rootView->getFileInfo($v1); |
@@ -812,7 +812,7 @@ discard block |
||
812 | 812 | |
813 | 813 | $eventDispatcher = Server::get(IEventDispatcher::class); |
814 | 814 | $eventFired = false; |
815 | - $eventDispatcher->addListener(VersionRestoredEvent::class, function ($event) use (&$eventFired, $t2): void { |
|
815 | + $eventDispatcher->addListener(VersionRestoredEvent::class, function($event) use (&$eventFired, $t2): void { |
|
816 | 816 | $eventFired = true; |
817 | 817 | $this->assertEquals('/sub/test.txt', $event->getVersion()->getVersionPath()); |
818 | 818 | $this->assertTrue($event->getVersion()->getRevisionId() > 0); |
@@ -820,7 +820,7 @@ discard block |
||
820 | 820 | |
821 | 821 | $versionManager = Server::get(IVersionManager::class); |
822 | 822 | $versions = $versionManager->getVersionsForFile($this->user1, $info1); |
823 | - $version = array_filter($versions, function ($version) use ($t2) { |
|
823 | + $version = array_filter($versions, function($version) use ($t2) { |
|
824 | 824 | return $version->getRevisionId() === $t2; |
825 | 825 | }); |
826 | 826 | $this->assertTrue($versionManager->rollback(current($version))); |
@@ -851,7 +851,7 @@ discard block |
||
851 | 851 | ); |
852 | 852 | |
853 | 853 | $this->assertTrue( |
854 | - $this->rootView->file_exists(self::USERS_VERSIONS_ROOT . '/sub/test.txt.v' . $t0), |
|
854 | + $this->rootView->file_exists(self::USERS_VERSIONS_ROOT.'/sub/test.txt.v'.$t0), |
|
855 | 855 | 'A version file was created for the file before restoration' |
856 | 856 | ); |
857 | 857 | $this->assertTrue( |
@@ -866,15 +866,15 @@ discard block |
||
866 | 866 | $this->assertCount(2, $newVersions, 'Additional version created'); |
867 | 867 | |
868 | 868 | $this->assertTrue( |
869 | - isset($newVersions[$t0 . '#' . 'test.txt']), |
|
869 | + isset($newVersions[$t0.'#'.'test.txt']), |
|
870 | 870 | 'A version was created for the file before restoration' |
871 | 871 | ); |
872 | 872 | $this->assertTrue( |
873 | - isset($newVersions[$t1 . '#' . 'test.txt']), |
|
873 | + isset($newVersions[$t1.'#'.'test.txt']), |
|
874 | 874 | 'Untouched version is still there' |
875 | 875 | ); |
876 | 876 | $this->assertFalse( |
877 | - isset($newVersions[$t2 . '#' . 'test.txt']), |
|
877 | + isset($newVersions[$t2.'#'.'test.txt']), |
|
878 | 878 | 'Restored version is not in the list any more' |
879 | 879 | ); |
880 | 880 | } |
@@ -934,7 +934,7 @@ discard block |
||
934 | 934 | // needed to make the hooks fire |
935 | 935 | \OC_Util::setupFS(self::TEST_VERSIONS_USER); |
936 | 936 | |
937 | - $userView = new View('/' . self::TEST_VERSIONS_USER . '/files'); |
|
937 | + $userView = new View('/'.self::TEST_VERSIONS_USER.'/files'); |
|
938 | 938 | $this->createAndCheckVersions( |
939 | 939 | $userView, |
940 | 940 | 'test.txt' |
@@ -953,11 +953,11 @@ discard block |
||
953 | 953 | $this->loginAsUser(self::TEST_VERSIONS_USER); |
954 | 954 | |
955 | 955 | // need to scan for the versions |
956 | - [$rootStorage,] = $this->rootView->resolvePath(self::TEST_VERSIONS_USER . '/files_versions'); |
|
956 | + [$rootStorage, ] = $this->rootView->resolvePath(self::TEST_VERSIONS_USER.'/files_versions'); |
|
957 | 957 | $rootStorage->getScanner()->scan('files_versions'); |
958 | 958 | |
959 | 959 | $versions = Storage::getVersions( |
960 | - self::TEST_VERSIONS_USER, '/' . $path |
|
960 | + self::TEST_VERSIONS_USER, '/'.$path |
|
961 | 961 | ); |
962 | 962 | |
963 | 963 | // note: we cannot predict how many versions are created due to |
@@ -111,8 +111,8 @@ |
||
111 | 111 | $this->loginHelper(self::TEST_FILES_SHARING_API_USER1); |
112 | 112 | |
113 | 113 | $this->data = 'foobar'; |
114 | - $this->view = new View('/' . self::TEST_FILES_SHARING_API_USER1 . '/files'); |
|
115 | - $this->view2 = new View('/' . self::TEST_FILES_SHARING_API_USER2 . '/files'); |
|
114 | + $this->view = new View('/'.self::TEST_FILES_SHARING_API_USER1.'/files'); |
|
115 | + $this->view2 = new View('/'.self::TEST_FILES_SHARING_API_USER2.'/files'); |
|
116 | 116 | |
117 | 117 | $this->shareManager = Server::get(\OCP\Share\IManager::class); |
118 | 118 | $this->rootFolder = Server::get(IRootFolder::class); |
@@ -25,10 +25,10 @@ |
||
25 | 25 | protected function setupUser($name, $password = '') { |
26 | 26 | $this->createUser($name, $password); |
27 | 27 | $tmpFolder = Server::get(ITempManager::class)->getTemporaryFolder(); |
28 | - $this->registerMount($name, '\OC\Files\Storage\Local', '/' . $name, ['datadir' => $tmpFolder]); |
|
28 | + $this->registerMount($name, '\OC\Files\Storage\Local', '/'.$name, ['datadir' => $tmpFolder]); |
|
29 | 29 | $this->setupForUser($name, $password); |
30 | 30 | $this->loginWithEncryption($name); |
31 | - return new View('/' . $name . '/files'); |
|
31 | + return new View('/'.$name.'/files'); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | protected function loginHelper($user, $create = false, $password = false) { |
@@ -34,14 +34,14 @@ discard block |
||
34 | 34 | /** |
35 | 35 | * hook after file was shared |
36 | 36 | */ |
37 | - public function postShared(OCPFile|Folder $node): void { |
|
37 | + public function postShared(OCPFile | Folder $node): void { |
|
38 | 38 | $this->update($node); |
39 | 39 | } |
40 | 40 | |
41 | 41 | /** |
42 | 42 | * hook after file was unshared |
43 | 43 | */ |
44 | - public function postUnshared(OCPFile|Folder $node): void { |
|
44 | + public function postUnshared(OCPFile | Folder $node): void { |
|
45 | 45 | $this->update($node); |
46 | 46 | } |
47 | 47 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | * inform encryption module that a file was restored from the trash bin, |
50 | 50 | * e.g. to update the encryption keys |
51 | 51 | */ |
52 | - public function postRestore(OCPFile|Folder $node): void { |
|
52 | + public function postRestore(OCPFile | Folder $node): void { |
|
53 | 53 | $this->update($node); |
54 | 54 | } |
55 | 55 | |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * inform encryption module that a file was renamed, |
58 | 58 | * e.g. to update the encryption keys |
59 | 59 | */ |
60 | - public function postRename(OCPFile|Folder $source, OCPFile|Folder $target): void { |
|
60 | + public function postRename(OCPFile | Folder $source, OCPFile | Folder $target): void { |
|
61 | 61 | if (dirname($source->getPath()) !== dirname($target->getPath())) { |
62 | 62 | $this->update($target); |
63 | 63 | } |
@@ -68,18 +68,18 @@ discard block |
||
68 | 68 | * |
69 | 69 | * @throws \InvalidArgumentException |
70 | 70 | */ |
71 | - protected function getOwnerPath(OCPFile|Folder $node): string { |
|
71 | + protected function getOwnerPath(OCPFile | Folder $node): string { |
|
72 | 72 | $owner = $node->getOwner()?->getUID(); |
73 | 73 | if ($owner === null) { |
74 | - throw new InvalidArgumentException('No owner found for ' . $node->getId()); |
|
74 | + throw new InvalidArgumentException('No owner found for '.$node->getId()); |
|
75 | 75 | } |
76 | - $view = new View('/' . $owner . '/files'); |
|
76 | + $view = new View('/'.$owner.'/files'); |
|
77 | 77 | try { |
78 | 78 | $path = $view->getPath($node->getId()); |
79 | 79 | } catch (NotFoundException $e) { |
80 | - throw new InvalidArgumentException('No file found for ' . $node->getId(), previous:$e); |
|
80 | + throw new InvalidArgumentException('No file found for '.$node->getId(), previous:$e); |
|
81 | 81 | } |
82 | - return '/' . $owner . '/files/' . $path; |
|
82 | + return '/'.$owner.'/files/'.$path; |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | * @param string $path relative to data/ |
89 | 89 | * @throws Exceptions\ModuleDoesNotExistsException |
90 | 90 | */ |
91 | - public function update(OCPFile|Folder $node): void { |
|
91 | + public function update(OCPFile | Folder $node): void { |
|
92 | 92 | $encryptionModule = $this->encryptionManager->getEncryptionModule(); |
93 | 93 | |
94 | 94 | // if the encryption module doesn't encrypt the files on a per-user basis |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | $encryptionModule->update($file, $this->uid, $usersSharing); |
112 | 112 | } catch (GenericEncryptionException $e) { |
113 | 113 | // If the update of an individual file fails e.g. due to a corrupt key we should continue the operation and just log the failure |
114 | - $this->logger->error('Failed to update encryption module for ' . $this->uid . ' ' . $file, [ 'exception' => $e ]); |
|
114 | + $this->logger->error('Failed to update encryption module for '.$this->uid.' '.$file, ['exception' => $e]); |
|
115 | 115 | } |
116 | 116 | } |
117 | 117 | } |