@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | $configLogLevel = $this->config->getValue('loglevel', ILogger::WARN); |
| 273 | 273 | if (is_numeric($configLogLevel)) { |
| 274 | 274 | $this->nestingLevel--; |
| 275 | - return min((int)$configLogLevel, ILogger::FATAL); |
|
| 275 | + return min((int) $configLogLevel, ILogger::FATAL); |
|
| 276 | 276 | } |
| 277 | 277 | |
| 278 | 278 | // Invalid configuration, warn the user and fall back to default level of WARN |
@@ -339,7 +339,7 @@ discard block |
||
| 339 | 339 | try { |
| 340 | 340 | $serializer = $this->getSerializer(); |
| 341 | 341 | } catch (Throwable $e) { |
| 342 | - $this->error('Failed to load ExceptionSerializer serializer while trying to log ' . $exception->getMessage()); |
|
| 342 | + $this->error('Failed to load ExceptionSerializer serializer while trying to log '.$exception->getMessage()); |
|
| 343 | 343 | return; |
| 344 | 344 | } |
| 345 | 345 | |
@@ -348,7 +348,7 @@ discard block |
||
| 348 | 348 | unset($data['app'], $data['level']); |
| 349 | 349 | |
| 350 | 350 | $data = array_merge($serializer->serializeException($exception), $data); |
| 351 | - $data = $this->interpolateMessage($data, isset($context['message']) && $context['message'] !== '' ? $context['message'] : ('Exception thrown: ' . get_class($exception)), 'CustomMessage'); |
|
| 351 | + $data = $this->interpolateMessage($data, isset($context['message']) && $context['message'] !== '' ? $context['message'] : ('Exception thrown: '.get_class($exception)), 'CustomMessage'); |
|
| 352 | 352 | |
| 353 | 353 | $this->eventDispatcher?->dispatchTyped(new BeforeMessageLoggedEvent($app, $level, $data)); |
| 354 | 354 | |
@@ -386,7 +386,7 @@ discard block |
||
| 386 | 386 | } |
| 387 | 387 | } catch (Throwable $e) { |
| 388 | 388 | // make sure we dont hard crash if logging fails |
| 389 | - error_log('Error when trying to log exception: ' . $e->getMessage() . ' ' . $e->getTraceAsString()); |
|
| 389 | + error_log('Error when trying to log exception: '.$e->getMessage().' '.$e->getTraceAsString()); |
|
| 390 | 390 | } |
| 391 | 391 | } |
| 392 | 392 | |
@@ -417,7 +417,7 @@ discard block |
||
| 417 | 417 | $replace = []; |
| 418 | 418 | $usedContextKeys = []; |
| 419 | 419 | foreach ($context as $key => $val) { |
| 420 | - $fullKey = '{' . $key . '}'; |
|
| 420 | + $fullKey = '{'.$key.'}'; |
|
| 421 | 421 | $replace[$fullKey] = $val; |
| 422 | 422 | if (str_contains($message, $fullKey)) { |
| 423 | 423 | $usedContextKeys[$key] = true; |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | if (PHP_VERSION_ID < 80200) { |
| 10 | 10 | http_response_code(500); |
| 11 | 11 | echo 'This version of Nextcloud requires at least PHP 8.2<br/>'; |
| 12 | - echo 'You are currently running ' . PHP_VERSION . '. Please update your PHP version.'; |
|
| 12 | + echo 'You are currently running '.PHP_VERSION.'. Please update your PHP version.'; |
|
| 13 | 13 | exit(1); |
| 14 | 14 | } |
| 15 | 15 | |
@@ -17,6 +17,6 @@ discard block |
||
| 17 | 17 | if (PHP_VERSION_ID >= 80600) { |
| 18 | 18 | http_response_code(500); |
| 19 | 19 | echo 'This version of Nextcloud is not compatible with PHP>=8.6.<br/>'; |
| 20 | - echo 'You are currently running ' . PHP_VERSION . '.'; |
|
| 20 | + echo 'You are currently running '.PHP_VERSION.'.'; |
|
| 21 | 21 | exit(1); |
| 22 | 22 | } |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | if ($this->tempStorage) { |
| 158 | - system('rm -rf ' . escapeshellarg($this->tempStorage->getDataDir())); |
|
| 158 | + system('rm -rf '.escapeshellarg($this->tempStorage->getDataDir())); |
|
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | self::logout(); |
@@ -178,11 +178,11 @@ discard block |
||
| 178 | 178 | $storage2 = $this->getTestStorage(); |
| 179 | 179 | $storage3 = $this->getTestStorage(); |
| 180 | 180 | $root = self::getUniqueID('/'); |
| 181 | - Filesystem::mount($storage1, [], $root . '/'); |
|
| 182 | - Filesystem::mount($storage2, [], $root . '/substorage'); |
|
| 183 | - Filesystem::mount($storage3, [], $root . '/folder/anotherstorage'); |
|
| 181 | + Filesystem::mount($storage1, [], $root.'/'); |
|
| 182 | + Filesystem::mount($storage2, [], $root.'/substorage'); |
|
| 183 | + Filesystem::mount($storage3, [], $root.'/folder/anotherstorage'); |
|
| 184 | 184 | $textSize = strlen("dummy file data\n"); |
| 185 | - $imageSize = filesize(\OC::$SERVERROOT . '/core/img/logo/logo.png'); |
|
| 185 | + $imageSize = filesize(\OC::$SERVERROOT.'/core/img/logo/logo.png'); |
|
| 186 | 186 | $storageSize = $textSize * 2 + $imageSize; |
| 187 | 187 | |
| 188 | 188 | $storageInfo = $storage3->getCache()->get(''); |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | $this->assertEquals('foo.png', $folderData[1]['name']); |
| 240 | 240 | $this->assertEquals('foo.txt', $folderData[2]['name']); |
| 241 | 241 | |
| 242 | - $folderView = new View($root . '/folder'); |
|
| 242 | + $folderView = new View($root.'/folder'); |
|
| 243 | 243 | $this->assertEquals($rootView->getFileInfo('/folder'), $folderView->getFileInfo('/')); |
| 244 | 244 | |
| 245 | 245 | $cachedData = $rootView->getFileInfo('/foo.txt'); |
@@ -504,10 +504,10 @@ discard block |
||
| 504 | 504 | } |
| 505 | 505 | |
| 506 | 506 | public function moveBetweenStorages($storage1, $storage2) { |
| 507 | - Filesystem::mount($storage1, [], '/' . $this->user . '/'); |
|
| 508 | - Filesystem::mount($storage2, [], '/' . $this->user . '/substorage'); |
|
| 507 | + Filesystem::mount($storage1, [], '/'.$this->user.'/'); |
|
| 508 | + Filesystem::mount($storage2, [], '/'.$this->user.'/substorage'); |
|
| 509 | 509 | |
| 510 | - $rootView = new View('/' . $this->user); |
|
| 510 | + $rootView = new View('/'.$this->user); |
|
| 511 | 511 | $rootView->rename('foo.txt', 'substorage/folder/foo.txt'); |
| 512 | 512 | $this->assertFalse($rootView->file_exists('foo.txt')); |
| 513 | 513 | $this->assertTrue($rootView->file_exists('substorage/folder/foo.txt')); |
@@ -614,11 +614,11 @@ discard block |
||
| 614 | 614 | $storage2 = $this->getTestStorage(); |
| 615 | 615 | $defaultRoot = Filesystem::getRoot(); |
| 616 | 616 | Filesystem::mount($storage1, [], '/'); |
| 617 | - Filesystem::mount($storage2, [], $defaultRoot . '/substorage'); |
|
| 617 | + Filesystem::mount($storage2, [], $defaultRoot.'/substorage'); |
|
| 618 | 618 | \OC_Hook::connect('OC_Filesystem', 'post_write', $this, 'dummyHook'); |
| 619 | 619 | |
| 620 | 620 | $rootView = new View(''); |
| 621 | - $subView = new View($defaultRoot . '/substorage'); |
|
| 621 | + $subView = new View($defaultRoot.'/substorage'); |
|
| 622 | 622 | $this->hookPath = null; |
| 623 | 623 | |
| 624 | 624 | $rootView->file_put_contents('/foo.txt', 'asd'); |
@@ -658,7 +658,7 @@ discard block |
||
| 658 | 658 | */ |
| 659 | 659 | $storage = new $class([]); |
| 660 | 660 | $textData = "dummy file data\n"; |
| 661 | - $imgData = file_get_contents(\OC::$SERVERROOT . '/core/img/logo/logo.png'); |
|
| 661 | + $imgData = file_get_contents(\OC::$SERVERROOT.'/core/img/logo/logo.png'); |
|
| 662 | 662 | $storage->mkdir('folder'); |
| 663 | 663 | $storage->file_put_contents('foo.txt', $textData); |
| 664 | 664 | $storage->file_put_contents('foo.png', $imgData); |
@@ -677,10 +677,10 @@ discard block |
||
| 677 | 677 | $storage2 = $this->getTestStorage(); |
| 678 | 678 | $defaultRoot = Filesystem::getRoot(); |
| 679 | 679 | Filesystem::mount($storage1, [], '/'); |
| 680 | - Filesystem::mount($storage2, [], $defaultRoot . '_substorage'); |
|
| 680 | + Filesystem::mount($storage2, [], $defaultRoot.'_substorage'); |
|
| 681 | 681 | \OC_Hook::connect('OC_Filesystem', 'post_write', $this, 'dummyHook'); |
| 682 | 682 | |
| 683 | - $subView = new View($defaultRoot . '_substorage'); |
|
| 683 | + $subView = new View($defaultRoot.'_substorage'); |
|
| 684 | 684 | $this->hookPath = null; |
| 685 | 685 | |
| 686 | 686 | $subView->file_put_contents('/foo.txt', 'asd'); |
@@ -773,7 +773,7 @@ discard block |
||
| 773 | 773 | |
| 774 | 774 | $rootView = new View(''); |
| 775 | 775 | foreach ($names as $name) { |
| 776 | - $rootView->file_put_contents('/' . $name, 'dummy content'); |
|
| 776 | + $rootView->file_put_contents('/'.$name, 'dummy content'); |
|
| 777 | 777 | } |
| 778 | 778 | |
| 779 | 779 | $list = $rootView->getDirectoryContent('/'); |
@@ -811,15 +811,15 @@ discard block |
||
| 811 | 811 | $depth = ((4000 - $tmpdirLength) / 57); |
| 812 | 812 | |
| 813 | 813 | foreach (range(0, $depth - 1) as $i) { |
| 814 | - $longPath .= $ds . $folderName; |
|
| 814 | + $longPath .= $ds.$folderName; |
|
| 815 | 815 | $result = $rootView->mkdir($longPath); |
| 816 | - $this->assertTrue($result, "mkdir failed on $i - path length: " . strlen($longPath)); |
|
| 816 | + $this->assertTrue($result, "mkdir failed on $i - path length: ".strlen($longPath)); |
|
| 817 | 817 | |
| 818 | - $result = $rootView->file_put_contents($longPath . "{$ds}test.txt", 'lorem'); |
|
| 818 | + $result = $rootView->file_put_contents($longPath."{$ds}test.txt", 'lorem'); |
|
| 819 | 819 | $this->assertEquals(5, $result, "file_put_contents failed on $i"); |
| 820 | 820 | |
| 821 | 821 | $this->assertTrue($rootView->file_exists($longPath)); |
| 822 | - $this->assertTrue($rootView->file_exists($longPath . "{$ds}test.txt")); |
|
| 822 | + $this->assertTrue($rootView->file_exists($longPath."{$ds}test.txt")); |
|
| 823 | 823 | } |
| 824 | 824 | |
| 825 | 825 | $cache = $storage->getCache(); |
@@ -832,11 +832,11 @@ discard block |
||
| 832 | 832 | $this->assertTrue(is_array($cachedFolder), "No cache entry for folder at $i"); |
| 833 | 833 | $this->assertEquals($folderName, $cachedFolder['name'], "Wrong cache entry for folder at $i"); |
| 834 | 834 | |
| 835 | - $cachedFile = $cache->get($longPath . '/test.txt'); |
|
| 835 | + $cachedFile = $cache->get($longPath.'/test.txt'); |
|
| 836 | 836 | $this->assertTrue(is_array($cachedFile), "No cache entry for file at $i"); |
| 837 | 837 | $this->assertEquals('test.txt', $cachedFile['name'], "Wrong cache entry for file at $i"); |
| 838 | 838 | |
| 839 | - $longPath .= $ds . $folderName; |
|
| 839 | + $longPath .= $ds.$folderName; |
|
| 840 | 840 | } |
| 841 | 841 | } |
| 842 | 842 | |
@@ -1041,7 +1041,7 @@ discard block |
||
| 1041 | 1041 | $folderName = 'abcdefghijklmnopqrstuvwxyz012345678901234567890123456789'; |
| 1042 | 1042 | $depth = (4000 / 57); |
| 1043 | 1043 | foreach (range(0, $depth + 1) as $i) { |
| 1044 | - $longPath .= '/' . $folderName; |
|
| 1044 | + $longPath .= '/'.$folderName; |
|
| 1045 | 1045 | } |
| 1046 | 1046 | |
| 1047 | 1047 | $storage = new Temporary([]); |
@@ -1294,8 +1294,8 @@ discard block |
||
| 1294 | 1294 | $view = new View($rootPath); |
| 1295 | 1295 | $storage = new Temporary([]); |
| 1296 | 1296 | Filesystem::mount($storage, [], '/'); |
| 1297 | - $this->assertTrue($view->lockFile($pathPrefix . '/foo/bar', ILockingProvider::LOCK_EXCLUSIVE)); |
|
| 1298 | - $view->lockFile($pathPrefix . '/foo/bar/asd', ILockingProvider::LOCK_SHARED); |
|
| 1297 | + $this->assertTrue($view->lockFile($pathPrefix.'/foo/bar', ILockingProvider::LOCK_EXCLUSIVE)); |
|
| 1298 | + $view->lockFile($pathPrefix.'/foo/bar/asd', ILockingProvider::LOCK_SHARED); |
|
| 1299 | 1299 | } |
| 1300 | 1300 | |
| 1301 | 1301 | /** |
@@ -1313,8 +1313,8 @@ discard block |
||
| 1313 | 1313 | $view = new View($rootPath); |
| 1314 | 1314 | $storage = new Temporary([]); |
| 1315 | 1315 | Filesystem::mount($storage, [], '/'); |
| 1316 | - $this->assertFalse($view->lockFile($pathPrefix . '/foo/bar', ILockingProvider::LOCK_EXCLUSIVE)); |
|
| 1317 | - $this->assertFalse($view->lockFile($pathPrefix . '/foo/bar/asd', ILockingProvider::LOCK_SHARED)); |
|
| 1316 | + $this->assertFalse($view->lockFile($pathPrefix.'/foo/bar', ILockingProvider::LOCK_EXCLUSIVE)); |
|
| 1317 | + $this->assertFalse($view->lockFile($pathPrefix.'/foo/bar/asd', ILockingProvider::LOCK_SHARED)); |
|
| 1318 | 1318 | } |
| 1319 | 1319 | |
| 1320 | 1320 | /** |
@@ -1335,8 +1335,8 @@ discard block |
||
| 1335 | 1335 | $view = new View($rootPath); |
| 1336 | 1336 | $storage = new Temporary([]); |
| 1337 | 1337 | Filesystem::mount($storage, [], '/'); |
| 1338 | - $this->assertTrue($view->lockFile($pathPrefix . '/foo/bar', ILockingProvider::LOCK_SHARED)); |
|
| 1339 | - $view->lockFile($pathPrefix . '/foo/bar', ILockingProvider::LOCK_EXCLUSIVE); |
|
| 1338 | + $this->assertTrue($view->lockFile($pathPrefix.'/foo/bar', ILockingProvider::LOCK_SHARED)); |
|
| 1339 | + $view->lockFile($pathPrefix.'/foo/bar', ILockingProvider::LOCK_EXCLUSIVE); |
|
| 1340 | 1340 | } |
| 1341 | 1341 | |
| 1342 | 1342 | /** |
@@ -1354,8 +1354,8 @@ discard block |
||
| 1354 | 1354 | $view = new View($rootPath); |
| 1355 | 1355 | $storage = new Temporary([]); |
| 1356 | 1356 | Filesystem::mount($storage, [], '/'); |
| 1357 | - $this->assertFalse($view->lockFile($pathPrefix . '/foo/bar', ILockingProvider::LOCK_SHARED)); |
|
| 1358 | - $this->assertFalse($view->lockFile($pathPrefix . '/foo/bar', ILockingProvider::LOCK_EXCLUSIVE)); |
|
| 1357 | + $this->assertFalse($view->lockFile($pathPrefix.'/foo/bar', ILockingProvider::LOCK_SHARED)); |
|
| 1358 | + $this->assertFalse($view->lockFile($pathPrefix.'/foo/bar', ILockingProvider::LOCK_EXCLUSIVE)); |
|
| 1359 | 1359 | } |
| 1360 | 1360 | |
| 1361 | 1361 | /** |
@@ -1562,7 +1562,7 @@ discard block |
||
| 1562 | 1562 | ->onlyMethods([]) |
| 1563 | 1563 | ->getMock(); |
| 1564 | 1564 | $storage->method('getId')->willReturn('non-null-id'); |
| 1565 | - $storage->method('getStorageCache')->willReturnCallback(function () use ($storage) { |
|
| 1565 | + $storage->method('getStorageCache')->willReturnCallback(function() use ($storage) { |
|
| 1566 | 1566 | return new \OC\Files\Cache\Storage($storage, true, Server::get(IDBConnection::class)); |
| 1567 | 1567 | }); |
| 1568 | 1568 | |
@@ -1591,8 +1591,8 @@ discard block |
||
| 1591 | 1591 | self::loginAsUser($this->user); |
| 1592 | 1592 | |
| 1593 | 1593 | [$mount1, $mount2] = $this->createTestMovableMountPoints([ |
| 1594 | - $this->user . '/files/mount1', |
|
| 1595 | - $this->user . '/files/mount2', |
|
| 1594 | + $this->user.'/files/mount1', |
|
| 1595 | + $this->user.'/files/mount2', |
|
| 1596 | 1596 | ]); |
| 1597 | 1597 | $mount1->expects($this->once()) |
| 1598 | 1598 | ->method('moveMount') |
@@ -1602,7 +1602,7 @@ discard block |
||
| 1602 | 1602 | ->method('moveMount') |
| 1603 | 1603 | ->willReturn(true); |
| 1604 | 1604 | |
| 1605 | - $view = new View('/' . $this->user . '/files/'); |
|
| 1605 | + $view = new View('/'.$this->user.'/files/'); |
|
| 1606 | 1606 | $view->mkdir('sub'); |
| 1607 | 1607 | |
| 1608 | 1608 | $this->assertTrue($view->rename('mount1', 'renamed_mount'), 'Can rename mount point'); |
@@ -1613,8 +1613,8 @@ discard block |
||
| 1613 | 1613 | self::loginAsUser($this->user); |
| 1614 | 1614 | |
| 1615 | 1615 | [$mount1, $mount2] = $this->createTestMovableMountPoints([ |
| 1616 | - $this->user . '/files/mount1', |
|
| 1617 | - $this->user . '/files/mount2', |
|
| 1616 | + $this->user.'/files/mount1', |
|
| 1617 | + $this->user.'/files/mount2', |
|
| 1618 | 1618 | ]); |
| 1619 | 1619 | |
| 1620 | 1620 | $mount1->expects($this->never()) |
@@ -1623,7 +1623,7 @@ discard block |
||
| 1623 | 1623 | $mount2->expects($this->never()) |
| 1624 | 1624 | ->method('moveMount'); |
| 1625 | 1625 | |
| 1626 | - $view = new View('/' . $this->user . '/files/'); |
|
| 1626 | + $view = new View('/'.$this->user.'/files/'); |
|
| 1627 | 1627 | |
| 1628 | 1628 | $this->expectException(ForbiddenException::class); |
| 1629 | 1629 | $view->rename('mount1', 'mount2'); |
@@ -1633,8 +1633,8 @@ discard block |
||
| 1633 | 1633 | self::loginAsUser($this->user); |
| 1634 | 1634 | |
| 1635 | 1635 | [$mount1, $mount2] = $this->createTestMovableMountPoints([ |
| 1636 | - $this->user . '/files/mount1', |
|
| 1637 | - $this->user . '/files/mount2', |
|
| 1636 | + $this->user.'/files/mount1', |
|
| 1637 | + $this->user.'/files/mount2', |
|
| 1638 | 1638 | ]); |
| 1639 | 1639 | |
| 1640 | 1640 | $mount1->expects($this->never()) |
@@ -1643,7 +1643,7 @@ discard block |
||
| 1643 | 1643 | $mount2->expects($this->never()) |
| 1644 | 1644 | ->method('moveMount'); |
| 1645 | 1645 | |
| 1646 | - $view = new View('/' . $this->user . '/files/'); |
|
| 1646 | + $view = new View('/'.$this->user.'/files/'); |
|
| 1647 | 1647 | |
| 1648 | 1648 | $this->expectException(ForbiddenException::class); |
| 1649 | 1649 | $view->rename('mount1', 'mount2/sub'); |
@@ -1656,8 +1656,8 @@ discard block |
||
| 1656 | 1656 | self::loginAsUser($this->user); |
| 1657 | 1657 | |
| 1658 | 1658 | [$mount1, $mount2] = $this->createTestMovableMountPoints([ |
| 1659 | - $this->user . '/files/mount1', |
|
| 1660 | - $this->user . '/files/mount2', |
|
| 1659 | + $this->user.'/files/mount1', |
|
| 1660 | + $this->user.'/files/mount2', |
|
| 1661 | 1661 | ]); |
| 1662 | 1662 | |
| 1663 | 1663 | $mount1->expects($this->never()) |
@@ -1667,7 +1667,7 @@ discard block |
||
| 1667 | 1667 | ->method('moveMount') |
| 1668 | 1668 | ->willReturn(true); |
| 1669 | 1669 | |
| 1670 | - $view = new View('/' . $this->user . '/files/'); |
|
| 1670 | + $view = new View('/'.$this->user.'/files/'); |
|
| 1671 | 1671 | $view->mkdir('shareddir'); |
| 1672 | 1672 | $view->mkdir('shareddir/sub'); |
| 1673 | 1673 | $view->mkdir('shareddir/sub2'); |
@@ -1893,7 +1893,7 @@ discard block |
||
| 1893 | 1893 | ?int $expectedStrayLock = null, |
| 1894 | 1894 | mixed $returnValue = true, |
| 1895 | 1895 | ): void { |
| 1896 | - $view = new View('/' . $this->user . '/files/'); |
|
| 1896 | + $view = new View('/'.$this->user.'/files/'); |
|
| 1897 | 1897 | |
| 1898 | 1898 | /** @var Temporary&MockObject $storage */ |
| 1899 | 1899 | $storage = $this->getMockBuilder(Temporary::class) |
@@ -1905,19 +1905,19 @@ discard block |
||
| 1905 | 1905 | /* Same thing with encryption wrapper */ |
| 1906 | 1906 | Server::get(IStorageFactory::class)->removeStorageWrapper('oc_encryption'); |
| 1907 | 1907 | |
| 1908 | - Filesystem::mount($storage, [], $this->user . '/'); |
|
| 1908 | + Filesystem::mount($storage, [], $this->user.'/'); |
|
| 1909 | 1909 | |
| 1910 | 1910 | // work directly on disk because mkdir might be mocked |
| 1911 | 1911 | $realPath = $storage->getSourcePath(''); |
| 1912 | - mkdir($realPath . '/files'); |
|
| 1913 | - mkdir($realPath . '/files/dir'); |
|
| 1914 | - file_put_contents($realPath . '/files/test.txt', 'blah'); |
|
| 1912 | + mkdir($realPath.'/files'); |
|
| 1913 | + mkdir($realPath.'/files/dir'); |
|
| 1914 | + file_put_contents($realPath.'/files/test.txt', 'blah'); |
|
| 1915 | 1915 | $storage->getScanner()->scan('files'); |
| 1916 | 1916 | |
| 1917 | 1917 | $storage->expects($this->once()) |
| 1918 | 1918 | ->method($operation) |
| 1919 | 1919 | ->willReturnCallback( |
| 1920 | - function () use ($view, $lockedPath, &$lockTypeDuring, $returnValue) { |
|
| 1920 | + function() use ($view, $lockedPath, &$lockTypeDuring, $returnValue) { |
|
| 1921 | 1921 | $lockTypeDuring = $this->getFileLockType($view, $lockedPath); |
| 1922 | 1922 | |
| 1923 | 1923 | return $returnValue; |
@@ -1950,7 +1950,7 @@ discard block |
||
| 1950 | 1950 | * This code path uses $storage->fopen instead |
| 1951 | 1951 | */ |
| 1952 | 1952 | public function testLockFilePutContentWithStream(): void { |
| 1953 | - $view = new View('/' . $this->user . '/files/'); |
|
| 1953 | + $view = new View('/'.$this->user.'/files/'); |
|
| 1954 | 1954 | |
| 1955 | 1955 | $path = 'test_file_put_contents.txt'; |
| 1956 | 1956 | /** @var Temporary|\PHPUnit\Framework\MockObject\MockObject $storage */ |
@@ -1958,13 +1958,13 @@ discard block |
||
| 1958 | 1958 | ->onlyMethods(['fopen']) |
| 1959 | 1959 | ->getMock(); |
| 1960 | 1960 | |
| 1961 | - Filesystem::mount($storage, [], $this->user . '/'); |
|
| 1961 | + Filesystem::mount($storage, [], $this->user.'/'); |
|
| 1962 | 1962 | $storage->mkdir('files'); |
| 1963 | 1963 | |
| 1964 | 1964 | $storage->expects($this->once()) |
| 1965 | 1965 | ->method('fopen') |
| 1966 | 1966 | ->willReturnCallback( |
| 1967 | - function () use ($view, $path, &$lockTypeDuring) { |
|
| 1967 | + function() use ($view, $path, &$lockTypeDuring) { |
|
| 1968 | 1968 | $lockTypeDuring = $this->getFileLockType($view, $path); |
| 1969 | 1969 | |
| 1970 | 1970 | return fopen('php://temp', 'r+'); |
@@ -1989,7 +1989,7 @@ discard block |
||
| 1989 | 1989 | * Test locks for fopen with fclose at the end |
| 1990 | 1990 | */ |
| 1991 | 1991 | public function testLockFopen(): void { |
| 1992 | - $view = new View('/' . $this->user . '/files/'); |
|
| 1992 | + $view = new View('/'.$this->user.'/files/'); |
|
| 1993 | 1993 | |
| 1994 | 1994 | $path = 'test_file_put_contents.txt'; |
| 1995 | 1995 | /** @var Temporary|\PHPUnit\Framework\MockObject\MockObject $storage */ |
@@ -1997,13 +1997,13 @@ discard block |
||
| 1997 | 1997 | ->onlyMethods(['fopen']) |
| 1998 | 1998 | ->getMock(); |
| 1999 | 1999 | |
| 2000 | - Filesystem::mount($storage, [], $this->user . '/'); |
|
| 2000 | + Filesystem::mount($storage, [], $this->user.'/'); |
|
| 2001 | 2001 | $storage->mkdir('files'); |
| 2002 | 2002 | |
| 2003 | 2003 | $storage->expects($this->once()) |
| 2004 | 2004 | ->method('fopen') |
| 2005 | 2005 | ->willReturnCallback( |
| 2006 | - function () use ($view, $path, &$lockTypeDuring) { |
|
| 2006 | + function() use ($view, $path, &$lockTypeDuring) { |
|
| 2007 | 2007 | $lockTypeDuring = $this->getFileLockType($view, $path); |
| 2008 | 2008 | |
| 2009 | 2009 | return fopen('php://temp', 'r+'); |
@@ -2045,7 +2045,7 @@ discard block |
||
| 2045 | 2045 | if ($operation === 'touch') { |
| 2046 | 2046 | $this->markTestSkipped('touch handles storage exceptions internally'); |
| 2047 | 2047 | } |
| 2048 | - $view = new View('/' . $this->user . '/files/'); |
|
| 2048 | + $view = new View('/'.$this->user.'/files/'); |
|
| 2049 | 2049 | |
| 2050 | 2050 | /** @var Temporary|\PHPUnit\Framework\MockObject\MockObject $storage */ |
| 2051 | 2051 | $storage = $this->getMockBuilder(Temporary::class) |
@@ -2057,19 +2057,19 @@ discard block |
||
| 2057 | 2057 | /* Same thing with encryption wrapper */ |
| 2058 | 2058 | Server::get(IStorageFactory::class)->removeStorageWrapper('oc_encryption'); |
| 2059 | 2059 | |
| 2060 | - Filesystem::mount($storage, [], $this->user . '/'); |
|
| 2060 | + Filesystem::mount($storage, [], $this->user.'/'); |
|
| 2061 | 2061 | |
| 2062 | 2062 | // work directly on disk because mkdir might be mocked |
| 2063 | 2063 | $realPath = $storage->getSourcePath(''); |
| 2064 | - mkdir($realPath . '/files'); |
|
| 2065 | - mkdir($realPath . '/files/dir'); |
|
| 2066 | - file_put_contents($realPath . '/files/test.txt', 'blah'); |
|
| 2064 | + mkdir($realPath.'/files'); |
|
| 2065 | + mkdir($realPath.'/files/dir'); |
|
| 2066 | + file_put_contents($realPath.'/files/test.txt', 'blah'); |
|
| 2067 | 2067 | $storage->getScanner()->scan('files'); |
| 2068 | 2068 | |
| 2069 | 2069 | $storage->expects($this->once()) |
| 2070 | 2070 | ->method($operation) |
| 2071 | 2071 | ->willReturnCallback( |
| 2072 | - function (): void { |
|
| 2072 | + function(): void { |
|
| 2073 | 2073 | throw new \Exception('Simulated exception'); |
| 2074 | 2074 | } |
| 2075 | 2075 | ); |
@@ -2089,11 +2089,11 @@ discard block |
||
| 2089 | 2089 | } |
| 2090 | 2090 | |
| 2091 | 2091 | public function testLockBasicOperationUnlocksAfterLockException(): void { |
| 2092 | - $view = new View('/' . $this->user . '/files/'); |
|
| 2092 | + $view = new View('/'.$this->user.'/files/'); |
|
| 2093 | 2093 | |
| 2094 | 2094 | $storage = new Temporary([]); |
| 2095 | 2095 | |
| 2096 | - Filesystem::mount($storage, [], $this->user . '/'); |
|
| 2096 | + Filesystem::mount($storage, [], $this->user.'/'); |
|
| 2097 | 2097 | |
| 2098 | 2098 | $storage->mkdir('files'); |
| 2099 | 2099 | $storage->mkdir('files/dir'); |
@@ -2135,14 +2135,14 @@ discard block |
||
| 2135 | 2135 | $path, |
| 2136 | 2136 | $hookType, |
| 2137 | 2137 | ): void { |
| 2138 | - $view = new View('/' . $this->user . '/files/'); |
|
| 2138 | + $view = new View('/'.$this->user.'/files/'); |
|
| 2139 | 2139 | |
| 2140 | 2140 | /** @var Temporary|\PHPUnit\Framework\MockObject\MockObject $storage */ |
| 2141 | 2141 | $storage = $this->getMockBuilder(Temporary::class) |
| 2142 | 2142 | ->onlyMethods([$operation]) |
| 2143 | 2143 | ->getMock(); |
| 2144 | 2144 | |
| 2145 | - Filesystem::mount($storage, [], $this->user . '/'); |
|
| 2145 | + Filesystem::mount($storage, [], $this->user.'/'); |
|
| 2146 | 2146 | $storage->mkdir('files'); |
| 2147 | 2147 | |
| 2148 | 2148 | Util::connectHook( |
@@ -2174,7 +2174,7 @@ discard block |
||
| 2174 | 2174 | */ |
| 2175 | 2175 | #[\PHPUnit\Framework\Attributes\DataProvider('lockFileRenameOrCopyDataProvider')] |
| 2176 | 2176 | public function testLockFileRename($operation, $expectedLockTypeSourceDuring): void { |
| 2177 | - $view = new View('/' . $this->user . '/files/'); |
|
| 2177 | + $view = new View('/'.$this->user.'/files/'); |
|
| 2178 | 2178 | |
| 2179 | 2179 | /** @var Temporary|\PHPUnit\Framework\MockObject\MockObject $storage */ |
| 2180 | 2180 | $storage = $this->getMockBuilder(Temporary::class) |
@@ -2200,14 +2200,14 @@ discard block |
||
| 2200 | 2200 | /* Disable encryption wrapper to avoid it intercepting mocked call */ |
| 2201 | 2201 | Server::get(IStorageFactory::class)->removeStorageWrapper('oc_encryption'); |
| 2202 | 2202 | |
| 2203 | - Filesystem::mount($storage, [], $this->user . '/'); |
|
| 2203 | + Filesystem::mount($storage, [], $this->user.'/'); |
|
| 2204 | 2204 | $storage->mkdir('files'); |
| 2205 | 2205 | $view->file_put_contents($sourcePath, 'meh'); |
| 2206 | 2206 | |
| 2207 | 2207 | $storage->expects($this->once()) |
| 2208 | 2208 | ->method($operation) |
| 2209 | 2209 | ->willReturnCallback( |
| 2210 | - function () use ($view, $sourcePath, $targetPath, &$lockTypeSourceDuring, &$lockTypeTargetDuring) { |
|
| 2210 | + function() use ($view, $sourcePath, $targetPath, &$lockTypeSourceDuring, &$lockTypeTargetDuring) { |
|
| 2211 | 2211 | $lockTypeSourceDuring = $this->getFileLockType($view, $sourcePath); |
| 2212 | 2212 | $lockTypeTargetDuring = $this->getFileLockType($view, $targetPath); |
| 2213 | 2213 | |
@@ -2243,7 +2243,7 @@ discard block |
||
| 2243 | 2243 | public function testLockFileCopyException(): void { |
| 2244 | 2244 | $this->expectException(\Exception::class); |
| 2245 | 2245 | |
| 2246 | - $view = new View('/' . $this->user . '/files/'); |
|
| 2246 | + $view = new View('/'.$this->user.'/files/'); |
|
| 2247 | 2247 | |
| 2248 | 2248 | /** @var Temporary|\PHPUnit\Framework\MockObject\MockObject $storage */ |
| 2249 | 2249 | $storage = $this->getMockBuilder(Temporary::class) |
@@ -2256,14 +2256,14 @@ discard block |
||
| 2256 | 2256 | /* Disable encryption wrapper to avoid it intercepting mocked call */ |
| 2257 | 2257 | Server::get(IStorageFactory::class)->removeStorageWrapper('oc_encryption'); |
| 2258 | 2258 | |
| 2259 | - Filesystem::mount($storage, [], $this->user . '/'); |
|
| 2259 | + Filesystem::mount($storage, [], $this->user.'/'); |
|
| 2260 | 2260 | $storage->mkdir('files'); |
| 2261 | 2261 | $view->file_put_contents($sourcePath, 'meh'); |
| 2262 | 2262 | |
| 2263 | 2263 | $storage->expects($this->once()) |
| 2264 | 2264 | ->method('copy') |
| 2265 | 2265 | ->willReturnCallback( |
| 2266 | - function (): void { |
|
| 2266 | + function(): void { |
|
| 2267 | 2267 | throw new \Exception(); |
| 2268 | 2268 | } |
| 2269 | 2269 | ); |
@@ -2289,7 +2289,7 @@ discard block |
||
| 2289 | 2289 | public function testLockFileRenameUnlockOnException(): void { |
| 2290 | 2290 | self::loginAsUser('test'); |
| 2291 | 2291 | |
| 2292 | - $view = new View('/' . $this->user . '/files/'); |
|
| 2292 | + $view = new View('/'.$this->user.'/files/'); |
|
| 2293 | 2293 | |
| 2294 | 2294 | $sourcePath = 'original.txt'; |
| 2295 | 2295 | $targetPath = 'target.txt'; |
@@ -2330,7 +2330,7 @@ discard block |
||
| 2330 | 2330 | $this->assertEquals('test', $view->getFileInfo($path)->getOwner()->getUID()); |
| 2331 | 2331 | |
| 2332 | 2332 | $folderInfo = $view->getDirectoryContent(''); |
| 2333 | - $folderInfo = array_values(array_filter($folderInfo, function (FileInfo $info) { |
|
| 2333 | + $folderInfo = array_values(array_filter($folderInfo, function(FileInfo $info) { |
|
| 2334 | 2334 | return $info->getName() === 'foo.txt'; |
| 2335 | 2335 | })); |
| 2336 | 2336 | |
@@ -2340,7 +2340,7 @@ discard block |
||
| 2340 | 2340 | Filesystem::mount($subStorage, [], '/test/files/asd'); |
| 2341 | 2341 | |
| 2342 | 2342 | $folderInfo = $view->getDirectoryContent(''); |
| 2343 | - $folderInfo = array_values(array_filter($folderInfo, function (FileInfo $info) { |
|
| 2343 | + $folderInfo = array_values(array_filter($folderInfo, function(FileInfo $info) { |
|
| 2344 | 2344 | return $info->getName() === 'asd'; |
| 2345 | 2345 | })); |
| 2346 | 2346 | |
@@ -2365,7 +2365,7 @@ discard block |
||
| 2365 | 2365 | */ |
| 2366 | 2366 | #[\PHPUnit\Framework\Attributes\DataProvider('lockFileRenameOrCopyCrossStorageDataProvider')] |
| 2367 | 2367 | public function testLockFileRenameCrossStorage($viewOperation, $storageOperation, $expectedLockTypeSourceDuring): void { |
| 2368 | - $view = new View('/' . $this->user . '/files/'); |
|
| 2368 | + $view = new View('/'.$this->user.'/files/'); |
|
| 2369 | 2369 | |
| 2370 | 2370 | /** @var Temporary|\PHPUnit\Framework\MockObject\MockObject $storage */ |
| 2371 | 2371 | $storage = $this->getMockBuilder(Temporary::class) |
@@ -2395,8 +2395,8 @@ discard block |
||
| 2395 | 2395 | /* Disable encryption wrapper to avoid it intercepting mocked call */ |
| 2396 | 2396 | Server::get(IStorageFactory::class)->removeStorageWrapper('oc_encryption'); |
| 2397 | 2397 | |
| 2398 | - Filesystem::mount($storage, [], $this->user . '/'); |
|
| 2399 | - Filesystem::mount($storage2, [], $this->user . '/files/substorage'); |
|
| 2398 | + Filesystem::mount($storage, [], $this->user.'/'); |
|
| 2399 | + Filesystem::mount($storage2, [], $this->user.'/files/substorage'); |
|
| 2400 | 2400 | $storage->mkdir('files'); |
| 2401 | 2401 | $view->file_put_contents($sourcePath, 'meh'); |
| 2402 | 2402 | $storage2->getUpdater()->update(''); |
@@ -2406,7 +2406,7 @@ discard block |
||
| 2406 | 2406 | $storage2->expects($this->once()) |
| 2407 | 2407 | ->method($storageOperation) |
| 2408 | 2408 | ->willReturnCallback( |
| 2409 | - function () use ($view, $sourcePath, $targetPath, &$lockTypeSourceDuring, &$lockTypeTargetDuring) { |
|
| 2409 | + function() use ($view, $sourcePath, $targetPath, &$lockTypeSourceDuring, &$lockTypeTargetDuring) { |
|
| 2410 | 2410 | $lockTypeSourceDuring = $this->getFileLockType($view, $sourcePath); |
| 2411 | 2411 | $lockTypeTargetDuring = $this->getFileLockType($view, $targetPath); |
| 2412 | 2412 | |
@@ -2441,10 +2441,10 @@ discard block |
||
| 2441 | 2441 | self::loginAsUser('test'); |
| 2442 | 2442 | |
| 2443 | 2443 | [$mount] = $this->createTestMovableMountPoints([ |
| 2444 | - $this->user . '/files/substorage', |
|
| 2444 | + $this->user.'/files/substorage', |
|
| 2445 | 2445 | ]); |
| 2446 | 2446 | |
| 2447 | - $view = new View('/' . $this->user . '/files/'); |
|
| 2447 | + $view = new View('/'.$this->user.'/files/'); |
|
| 2448 | 2448 | $view->mkdir('subdir'); |
| 2449 | 2449 | |
| 2450 | 2450 | $sourcePath = 'substorage'; |
@@ -2453,7 +2453,7 @@ discard block |
||
| 2453 | 2453 | $mount->expects($this->once()) |
| 2454 | 2454 | ->method('moveMount') |
| 2455 | 2455 | ->willReturnCallback( |
| 2456 | - function ($target) use ($mount, $view, $sourcePath, $targetPath, &$lockTypeSourceDuring, &$lockTypeTargetDuring, &$lockTypeSharedRootDuring) { |
|
| 2456 | + function($target) use ($mount, $view, $sourcePath, $targetPath, &$lockTypeSourceDuring, &$lockTypeTargetDuring, &$lockTypeSharedRootDuring) { |
|
| 2457 | 2457 | $lockTypeSourceDuring = $this->getFileLockType($view, $sourcePath, true); |
| 2458 | 2458 | $lockTypeTargetDuring = $this->getFileLockType($view, $targetPath, true); |
| 2459 | 2459 | |
@@ -2518,14 +2518,14 @@ discard block |
||
| 2518 | 2518 | $eventHandler->expects($this->any()) |
| 2519 | 2519 | ->method('preCallback') |
| 2520 | 2520 | ->willReturnCallback( |
| 2521 | - function () use ($view, $path, $onMountPoint, &$lockTypePre): void { |
|
| 2521 | + function() use ($view, $path, $onMountPoint, &$lockTypePre): void { |
|
| 2522 | 2522 | $lockTypePre = $this->getFileLockType($view, $path, $onMountPoint); |
| 2523 | 2523 | } |
| 2524 | 2524 | ); |
| 2525 | 2525 | $eventHandler->expects($this->any()) |
| 2526 | 2526 | ->method('postCallback') |
| 2527 | 2527 | ->willReturnCallback( |
| 2528 | - function () use ($view, $path, $onMountPoint, &$lockTypePost): void { |
|
| 2528 | + function() use ($view, $path, $onMountPoint, &$lockTypePost): void { |
|
| 2529 | 2529 | $lockTypePost = $this->getFileLockType($view, $path, $onMountPoint); |
| 2530 | 2530 | } |
| 2531 | 2531 | ); |
@@ -2539,7 +2539,7 @@ discard block |
||
| 2539 | 2539 | ); |
| 2540 | 2540 | Util::connectHook( |
| 2541 | 2541 | Filesystem::CLASSNAME, |
| 2542 | - 'post_' . $hookType, |
|
| 2542 | + 'post_'.$hookType, |
|
| 2543 | 2543 | $eventHandler, |
| 2544 | 2544 | 'postCallback' |
| 2545 | 2545 | ); |
@@ -2567,7 +2567,7 @@ discard block |
||
| 2567 | 2567 | |
| 2568 | 2568 | |
| 2569 | 2569 | public function testRemoveMoveableMountPoint(): void { |
| 2570 | - $mountPoint = '/' . $this->user . '/files/mount/'; |
|
| 2570 | + $mountPoint = '/'.$this->user.'/files/mount/'; |
|
| 2571 | 2571 | |
| 2572 | 2572 | // Mock the mount point |
| 2573 | 2573 | /** @var TestMoveableMountPoint|\PHPUnit\Framework\MockObject\MockObject $mount */ |
@@ -2609,7 +2609,7 @@ discard block |
||
| 2609 | 2609 | ); |
| 2610 | 2610 | |
| 2611 | 2611 | //Delete the mountpoint |
| 2612 | - $view = new View('/' . $this->user . '/files'); |
|
| 2612 | + $view = new View('/'.$this->user.'/files'); |
|
| 2613 | 2613 | $this->assertEquals('foo', $view->rmdir('mount')); |
| 2614 | 2614 | } |
| 2615 | 2615 | |
@@ -2630,7 +2630,7 @@ discard block |
||
| 2630 | 2630 | public function testGetDirectoryContentMimeFilter($filter, $expected): void { |
| 2631 | 2631 | $storage1 = new Temporary(); |
| 2632 | 2632 | $root = self::getUniqueID('/'); |
| 2633 | - Filesystem::mount($storage1, [], $root . '/'); |
|
| 2633 | + Filesystem::mount($storage1, [], $root.'/'); |
|
| 2634 | 2634 | $view = new View($root); |
| 2635 | 2635 | |
| 2636 | 2636 | $view->file_put_contents('test1.txt', 'asd'); |
@@ -2640,7 +2640,7 @@ discard block |
||
| 2640 | 2640 | |
| 2641 | 2641 | $content = $view->getDirectoryContent('', $filter); |
| 2642 | 2642 | |
| 2643 | - $files = array_map(function (FileInfo $info) { |
|
| 2643 | + $files = array_map(function(FileInfo $info) { |
|
| 2644 | 2644 | return $info->getName(); |
| 2645 | 2645 | }, $content); |
| 2646 | 2646 | sort($files); |
@@ -2746,7 +2746,7 @@ discard block |
||
| 2746 | 2746 | $calls = ['/new/folder', '/new/folder/structure']; |
| 2747 | 2747 | $view->expects($this->exactly(2)) |
| 2748 | 2748 | ->method('mkdir') |
| 2749 | - ->willReturnCallback(function ($dir) use (&$calls): void { |
|
| 2749 | + ->willReturnCallback(function($dir) use (&$calls): void { |
|
| 2750 | 2750 | $expected = array_shift($calls); |
| 2751 | 2751 | $this->assertEquals($expected, $dir); |
| 2752 | 2752 | }); |
@@ -2843,7 +2843,7 @@ discard block |
||
| 2843 | 2843 | } |
| 2844 | 2844 | |
| 2845 | 2845 | public function testCopyPreservesContent() { |
| 2846 | - $viewUser1 = new View('/' . 'userId' . '/files'); |
|
| 2846 | + $viewUser1 = new View('/'.'userId'.'/files'); |
|
| 2847 | 2847 | $viewUser1->mkdir(''); |
| 2848 | 2848 | $viewUser1->file_put_contents('foo.txt', 'foo'); |
| 2849 | 2849 | $viewUser1->copy('foo.txt', 'bar.txt'); |