Browse Source

Bump nextcloud/coding-standard from 0.3.0 to 0.5.0

Bumps [nextcloud/coding-standard](https://github.com/nextcloud/coding-standard) from 0.3.0 to 0.5.0.
- [Release notes](https://github.com/nextcloud/coding-standard/releases)
- [Changelog](https://github.com/nextcloud/coding-standard/blob/master/CHANGELOG.md)
- [Commits](https://github.com/nextcloud/coding-standard/compare/v0.3.0...v0.5.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
tags/v22.0.0beta1
dependabot-preview[bot] 3 years ago
parent
commit
eb502c02ff
No account linked to committer's email address
100 changed files with 389 additions and 447 deletions
  1. 1
    1
      .php_cs.dist
  2. 2
    2
      apps/comments/lib/Notification/Notifier.php
  3. 1
    1
      apps/contactsinteraction/lib/AddressBook.php
  4. 1
    1
      apps/dav/lib/AppInfo/Application.php
  5. 1
    1
      apps/dav/lib/Avatars/AvatarHome.php
  6. 5
    5
      apps/dav/lib/CalDAV/CalDavBackend.php
  7. 3
    3
      apps/dav/lib/CalDAV/Plugin.php
  8. 4
    4
      apps/dav/lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php
  9. 2
    2
      apps/dav/lib/CalDAV/Schedule/IMipPlugin.php
  10. 1
    1
      apps/dav/lib/CalDAV/Schedule/Plugin.php
  11. 1
    1
      apps/dav/lib/CalDAV/Search/SearchPlugin.php
  12. 2
    2
      apps/dav/lib/CardDAV/CardDavBackend.php
  13. 1
    1
      apps/dav/lib/CardDAV/PhotoCache.php
  14. 3
    3
      apps/dav/lib/CardDAV/Plugin.php
  15. 1
    1
      apps/dav/lib/Command/MoveCalendar.php
  16. 1
    1
      apps/dav/lib/Connector/LegacyDAVACL.php
  17. 10
    10
      apps/dav/lib/Connector/Sabre/File.php
  18. 3
    3
      apps/dav/lib/Connector/Sabre/FilesPlugin.php
  19. 2
    2
      apps/dav/lib/Connector/Sabre/Node.php
  20. 3
    3
      apps/dav/lib/Connector/Sabre/ObjectTree.php
  21. 4
    4
      apps/dav/lib/Connector/Sabre/Principal.php
  22. 1
    1
      apps/dav/lib/Connector/Sabre/QuotaPlugin.php
  23. 1
    1
      apps/dav/lib/Connector/Sabre/SharesPlugin.php
  24. 2
    2
      apps/dav/lib/Connector/Sabre/TagsPlugin.php
  25. 1
    1
      apps/dav/lib/DAV/SystemPrincipalBackend.php
  26. 1
    1
      apps/dav/lib/Files/FileSearchBackend.php
  27. 1
    1
      apps/dav/lib/Files/FilesHome.php
  28. 1
    1
      apps/dav/lib/Files/RootCollection.php
  29. 9
    9
      apps/dav/lib/Traits/PrincipalProxyTrait.php
  30. 1
    1
      apps/dav/lib/Upload/UploadHome.php
  31. 2
    2
      apps/dav/tests/unit/CalDAV/Reminder/NotificationProvider/EmailProviderTest.php
  32. 2
    2
      apps/dav/tests/unit/CardDAV/AddressBookImplTest.php
  33. 1
    1
      apps/dav/tests/unit/Connector/Sabre/FileTest.php
  34. 1
    1
      apps/encryption/lib/Crypto/EncryptAll.php
  35. 1
    1
      apps/federatedfilesharing/lib/Controller/MountPublicLinkController.php
  36. 1
    1
      apps/federatedfilesharing/lib/Controller/RequestHandlerController.php
  37. 7
    7
      apps/federatedfilesharing/lib/FederatedShareProvider.php
  38. 1
    1
      apps/federatedfilesharing/lib/Notifications.php
  39. 6
    6
      apps/federatedfilesharing/lib/OCM/CloudFederationProviderFiles.php
  40. 1
    1
      apps/federatedfilesharing/tests/AddressHandlerTest.php
  41. 1
    1
      apps/files/lib/Activity/Provider.php
  42. 1
    1
      apps/files/lib/Command/Scan.php
  43. 1
    1
      apps/files_external/lib/Command/Create.php
  44. 1
    1
      apps/files_external/lib/Command/Verify.php
  45. 2
    2
      apps/files_sharing/lib/Controller/ShareesAPIController.php
  46. 1
    1
      apps/files_sharing/lib/External/Cache.php
  47. 2
    2
      apps/files_sharing/lib/External/Storage.php
  48. 1
    1
      apps/files_sharing/lib/Scanner.php
  49. 8
    8
      apps/files_sharing/tests/CacheTest.php
  50. 3
    3
      apps/files_sharing/tests/PermissionsTest.php
  51. 3
    3
      apps/files_sharing/tests/SharedStorageTest.php
  52. 2
    2
      apps/files_sharing/tests/WatcherTest.php
  53. 1
    1
      apps/files_trashbin/lib/Sabre/RootCollection.php
  54. 1
    1
      apps/files_trashbin/lib/Sabre/TrashHome.php
  55. 2
    2
      apps/files_trashbin/tests/TrashbinTest.php
  56. 1
    1
      apps/files_versions/lib/Sabre/RootCollection.php
  57. 1
    1
      apps/files_versions/lib/Sabre/VersionHome.php
  58. 12
    12
      apps/files_versions/lib/Storage.php
  59. 1
    1
      apps/settings/lib/Controller/UsersController.php
  60. 1
    1
      apps/systemtags/lib/Activity/Provider.php
  61. 2
    2
      apps/theming/lib/Util.php
  62. 2
    2
      apps/user_ldap/lib/Access.php
  63. 1
    1
      apps/user_ldap/lib/Controller/RenewPasswordController.php
  64. 4
    4
      apps/user_ldap/tests/AccessTest.php
  65. 10
    10
      apps/user_ldap/tests/Mapping/AbstractMappingTest.php
  66. 7
    7
      apps/user_ldap/tests/WizardTest.php
  67. 2
    2
      apps/workflowengine/lib/Check/RequestTime.php
  68. 1
    1
      apps/workflowengine/lib/Service/RuleMatcher.php
  69. 1
    1
      build/integration/features/bootstrap/Avatar.php
  70. 1
    1
      build/license.php
  71. 1
    1
      build/psalm/AppFrameworkTainter.php
  72. 1
    1
      composer.json
  73. 185
    243
      composer.lock
  74. 1
    1
      core/Command/L10n/CreateJs.php
  75. 1
    1
      core/Command/TwoFactorAuth/State.php
  76. 1
    1
      core/Controller/LoginController.php
  77. 1
    1
      core/Controller/OCSController.php
  78. 1
    1
      core/Controller/TwoFactorChallengeController.php
  79. 1
    1
      lib/autoloader.php
  80. 1
    1
      lib/private/Activity/EventMerger.php
  81. 1
    1
      lib/private/App/DependencyAnalyzer.php
  82. 3
    3
      lib/private/AppFramework/App.php
  83. 1
    1
      lib/private/AppFramework/Http/Request.php
  84. 1
    1
      lib/private/AppFramework/Routing/RouteConfig.php
  85. 1
    1
      lib/private/AppFramework/Routing/RouteParser.php
  86. 1
    1
      lib/private/AppFramework/Utility/ControllerMethodReflector.php
  87. 1
    1
      lib/private/Avatar/Avatar.php
  88. 1
    1
      lib/private/Collaboration/Collaborators/RemoteGroupPlugin.php
  89. 2
    2
      lib/private/Collaboration/Collaborators/RemotePlugin.php
  90. 1
    1
      lib/private/DB/QueryBuilder/QuoteHelper.php
  91. 1
    1
      lib/private/Encryption/File.php
  92. 2
    2
      lib/private/Encryption/Keys/Storage.php
  93. 3
    3
      lib/private/Encryption/Update.php
  94. 1
    1
      lib/private/Files/Cache/HomeCache.php
  95. 1
    1
      lib/private/Files/Cache/HomePropagator.php
  96. 1
    1
      lib/private/Files/Cache/QuerySearchHelper.php
  97. 1
    1
      lib/private/Files/Cache/Wrapper/JailPropagator.php
  98. 1
    1
      lib/private/Files/Config/UserMountCache.php
  99. 1
    1
      lib/private/Files/Node/Folder.php
  100. 0
    0
      lib/private/Files/Node/Node.php

+ 1
- 1
.php_cs.dist View File

$config = new Config(); $config = new Config();
$config $config
->getFinder() ->getFinder()
->ignoreVCSIgnored(true)
->exclude('config') ->exclude('config')
->exclude('data') ->exclude('data')
->notPath('3rdparty') ->notPath('3rdparty')
->notPath('build/stubs') ->notPath('build/stubs')
->notPath('composer') ->notPath('composer')
->notPath('node_modules')
->notPath('vendor') ->notPath('vendor')
->in(__DIR__); ->in(__DIR__);
return $config; return $config;

+ 2
- 2
apps/comments/lib/Notification/Notifier.php View File

if (strpos($path, '/' . $notification->getUser() . '/files/') === 0) { if (strpos($path, '/' . $notification->getUser() . '/files/') === 0) {
// Remove /user/files/... // Remove /user/files/...
$fullPath = $path; $fullPath = $path;
list(,,, $path) = explode('/', $fullPath, 4);
[,,, $path] = explode('/', $fullPath, 4);
} }
$subjectParameters = [ $subjectParameters = [
'file' => [ 'file' => [
'name' => $displayName, 'name' => $displayName,
]; ];
} }
list($message, $messageParameters) = $this->commentToRichMessage($comment);
[$message, $messageParameters] = $this->commentToRichMessage($comment);
$notification->setRichSubject($subject, $subjectParameters) $notification->setRichSubject($subject, $subjectParameters)
->setParsedSubject($this->richToParsed($subject, $subjectParameters)) ->setParsedSubject($this->richToParsed($subject, $subjectParameters))
->setRichMessage($message, $messageParameters) ->setRichMessage($message, $messageParameters)

+ 1
- 1
apps/contactsinteraction/lib/AddressBook.php View File

} }


private function getUid(): string { private function getUid(): string {
list(, $uid) = \Sabre\Uri\split($this->principalUri);
[, $uid] = \Sabre\Uri\split($this->principalUri);
return $uid; return $uid;
} }
} }

+ 1
- 1
apps/dav/lib/AppInfo/Application.php View File

$config = $serverContainer->getConfig(); $config = $serverContainer->getConfig();
$principalUri = $event->getArgument('calendarData')['principaluri']; $principalUri = $event->getArgument('calendarData')['principaluri'];
if (strpos($principalUri, 'principals/users') === 0) { if (strpos($principalUri, 'principals/users') === 0) {
list(, $UID) = \Sabre\Uri\split($principalUri);
[, $UID] = \Sabre\Uri\split($principalUri);
$uri = $event->getArgument('calendarData')['uri']; $uri = $event->getArgument('calendarData')['uri'];
if ($config->getUserValue($UID, 'dav', 'defaultCalendar') === $uri) { if ($config->getUserValue($UID, 'dav', 'defaultCalendar') === $uri) {
$config->deleteUserValue($UID, 'dav', 'defaultCalendar'); $config->deleteUserValue($UID, 'dav', 'defaultCalendar');

+ 1
- 1
apps/dav/lib/Avatars/AvatarHome.php View File

} }


public function getName() { public function getName() {
list(,$name) = Uri\split($this->principalInfo['uri']);
[,$name] = Uri\split($this->principalInfo['uri']);
return $name; return $name;
} }



+ 5
- 5
apps/dav/lib/CalDAV/CalDavBackend.php View File

->setParameter('type', 'calendar') ->setParameter('type', 'calendar')
->setParameter('principaluri', $principals, \Doctrine\DBAL\Connection::PARAM_STR_ARRAY); ->setParameter('principaluri', $principals, \Doctrine\DBAL\Connection::PARAM_STR_ARRAY);


$result = $query->execute();
$result = $query->execute();


$readOnlyPropertyName = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only'; $readOnlyPropertyName = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only';
while ($row = $result->fetch()) { while ($row = $result->fetch()) {
} }
} }


list(, $name) = Uri\split($row['principaluri']);
[, $name] = Uri\split($row['principaluri']);
$uri = $row['uri'] . '_shared_by_' . $name; $uri = $row['uri'] . '_shared_by_' . $name;
$row['displayname'] = $row['displayname'] . ' (' . $this->getUserDisplayName($name) . ')'; $row['displayname'] = $row['displayname'] . ' (' . $this->getUserDisplayName($name) . ')';
$components = []; $components = [];


while ($row = $result->fetch()) { while ($row = $result->fetch()) {
$row['principaluri'] = (string) $row['principaluri']; $row['principaluri'] = (string) $row['principaluri'];
list(, $name) = Uri\split($row['principaluri']);
[, $name] = Uri\split($row['principaluri']);
$row['displayname'] = $row['displayname'] . "($name)"; $row['displayname'] = $row['displayname'] . "($name)";
$components = []; $components = [];
if ($row['components']) { if ($row['components']) {
} }


$row['principaluri'] = (string) $row['principaluri']; $row['principaluri'] = (string) $row['principaluri'];
list(, $name) = Uri\split($row['principaluri']);
[, $name] = Uri\split($row['principaluri']);
$row['displayname'] = $row['displayname'] . ' ' . "($name)"; $row['displayname'] = $row['displayname'] . ' ' . "($name)";
$components = []; $components = [];
if ($row['components']) { if ($row['components']) {
*/ */
private function convertPrincipal($principalUri, $toV2) { private function convertPrincipal($principalUri, $toV2) {
if ($this->principalBackend->getPrincipalPrefix() === 'principals') { if ($this->principalBackend->getPrincipalPrefix() === 'principals') {
list(, $name) = Uri\split($principalUri);
[, $name] = Uri\split($principalUri);
if ($toV2 === true) { if ($toV2 === true) {
return "principals/users/$name"; return "principals/users/$name";
} }

+ 3
- 3
apps/dav/lib/CalDAV/Plugin.php View File

*/ */
public function getCalendarHomeForPrincipal($principalUrl) { public function getCalendarHomeForPrincipal($principalUrl) {
if (strrpos($principalUrl, 'principals/users', -strlen($principalUrl)) !== false) { if (strrpos($principalUrl, 'principals/users', -strlen($principalUrl)) !== false) {
list(, $principalId) = \Sabre\Uri\split($principalUrl);
[, $principalId] = \Sabre\Uri\split($principalUrl);
return self::CALENDAR_ROOT . '/' . $principalId; return self::CALENDAR_ROOT . '/' . $principalId;
} }
if (strrpos($principalUrl, 'principals/calendar-resources', -strlen($principalUrl)) !== false) { if (strrpos($principalUrl, 'principals/calendar-resources', -strlen($principalUrl)) !== false) {
list(, $principalId) = \Sabre\Uri\split($principalUrl);
[, $principalId] = \Sabre\Uri\split($principalUrl);
return self::SYSTEM_CALENDAR_ROOT . '/calendar-resources/' . $principalId; return self::SYSTEM_CALENDAR_ROOT . '/calendar-resources/' . $principalId;
} }
if (strrpos($principalUrl, 'principals/calendar-rooms', -strlen($principalUrl)) !== false) { if (strrpos($principalUrl, 'principals/calendar-rooms', -strlen($principalUrl)) !== false) {
list(, $principalId) = \Sabre\Uri\split($principalUrl);
[, $principalId] = \Sabre\Uri\split($principalUrl);
return self::SYSTEM_CALENDAR_ROOT . '/calendar-rooms/' . $principalId; return self::SYSTEM_CALENDAR_ROOT . '/calendar-rooms/' . $principalId;
} }
} }

+ 4
- 4
apps/dav/lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php View File

if (strpos($path, $this->principalPrefix) !== 0) { if (strpos($path, $this->principalPrefix) !== 0) {
return null; return null;
} }
list(, $name) = \Sabre\Uri\split($path);
[, $name] = \Sabre\Uri\split($path);


list($backendId, $resourceId) = explode('-', $name, 2);
[$backendId, $resourceId] = explode('-', $name, 2);


$query = $this->db->getQueryBuilder(); $query = $this->db->getQueryBuilder();
$query->select(['id', 'backend_id', 'resource_id', 'email', 'displayname']) $query->select(['id', 'backend_id', 'resource_id', 'email', 'displayname'])
return null; return null;
} }


list(, $name) = \Sabre\Uri\split($path);
list($backendId, $resourceId) = explode('-', $name, 2);
[, $name] = \Sabre\Uri\split($path);
[$backendId, $resourceId] = explode('-', $name, 2);


$query = $this->db->getQueryBuilder(); $query = $this->db->getQueryBuilder();
$query->select(['id', 'backend_id', 'resource_id', 'email', 'displayname', 'group_restrictions']) $query->select(['id', 'backend_id', 'resource_id', 'email', 'displayname', 'group_restrictions'])

+ 2
- 2
apps/dav/lib/CalDAV/Schedule/IMipPlugin.php View File

/** @var Property\ICalendar\CalAddress $organizer */ /** @var Property\ICalendar\CalAddress $organizer */
$organizer = $vevent->ORGANIZER; $organizer = $vevent->ORGANIZER;
$organizerURI = $organizer->getNormalizedValue(); $organizerURI = $organizer->getNormalizedValue();
list($scheme,$organizerEmail) = explode(':',$organizerURI,2); # strip off scheme mailto:
[$scheme,$organizerEmail] = explode(':',$organizerURI,2); # strip off scheme mailto:
/** @var string|null $organizerName */ /** @var string|null $organizerName */
$organizerName = isset($organizer['CN']) ? $organizer['CN'] : null; $organizerName = isset($organizer['CN']) ? $organizer['CN'] : null;
$organizerHTML = sprintf('<a href="%s">%s</a>', $organizerHTML = sprintf('<a href="%s">%s</a>',
$attendeesText = []; $attendeesText = [];
foreach ($attendees as $attendee) { foreach ($attendees as $attendee) {
$attendeeURI = $attendee->getNormalizedValue(); $attendeeURI = $attendee->getNormalizedValue();
list($scheme,$attendeeEmail) = explode(':',$attendeeURI,2); # strip off scheme mailto:
[$scheme,$attendeeEmail] = explode(':',$attendeeURI,2); # strip off scheme mailto:
$attendeeName = isset($attendee['CN']) ? $attendee['CN'] : null; $attendeeName = isset($attendee['CN']) ? $attendee['CN'] : null;
$attendeeHTML = sprintf('<a href="%s">%s</a>', $attendeeHTML = sprintf('<a href="%s">%s</a>',
htmlspecialchars($attendeeURI), htmlspecialchars($attendeeURI),

+ 1
- 1
apps/dav/lib/CalDAV/Schedule/Plugin.php View File

} }


if (strpos($principalUrl, 'principals/users') === 0) { if (strpos($principalUrl, 'principals/users') === 0) {
list(, $userId) = split($principalUrl);
[, $userId] = split($principalUrl);
$uri = $this->config->getUserValue($userId, 'dav', 'defaultCalendar', CalDavBackend::PERSONAL_CALENDAR_URI); $uri = $this->config->getUserValue($userId, 'dav', 'defaultCalendar', CalDavBackend::PERSONAL_CALENDAR_URI);
$displayName = CalDavBackend::PERSONAL_CALENDAR_NAME; $displayName = CalDavBackend::PERSONAL_CALENDAR_NAME;
} elseif (strpos($principalUrl, 'principals/calendar-resources') === 0 || } elseif (strpos($principalUrl, 'principals/calendar-resources') === 0 ||

+ 1
- 1
apps/dav/lib/CalDAV/Search/SearchPlugin.php View File

$nodePaths = $node->calendarSearch($report->filters, $report->limit, $report->offset); $nodePaths = $node->calendarSearch($report->filters, $report->limit, $report->offset);


foreach ($nodePaths as $path) { foreach ($nodePaths as $path) {
list($properties) = $this->server->getPropertiesForPath(
[$properties] = $this->server->getPropertiesForPath(
$this->server->getRequestUri() . '/' . $path, $this->server->getRequestUri() . '/' . $path,
$report->properties); $report->properties);
$result[] = $properties; $result[] = $properties;

+ 2
- 2
apps/dav/lib/CardDAV/CardDavBackend.php View File

} }
} }


list(, $name) = \Sabre\Uri\split($row['principaluri']);
[, $name] = \Sabre\Uri\split($row['principaluri']);
$uri = $row['uri'] . '_shared_by_' . $name; $uri = $row['uri'] . '_shared_by_' . $name;
$displayName = $row['displayname'] . ' (' . $this->getUserDisplayName($name) . ')'; $displayName = $row['displayname'] . ' (' . $this->getUserDisplayName($name) . ')';




private function convertPrincipal($principalUri, $toV2) { private function convertPrincipal($principalUri, $toV2) {
if ($this->principalBackend->getPrincipalPrefix() === 'principals') { if ($this->principalBackend->getPrincipalPrefix() === 'principals') {
list(, $name) = \Sabre\Uri\split($principalUri);
[, $name] = \Sabre\Uri\split($principalUri);
if ($toV2 === true) { if ($toV2 === true) {
return "principals/users/$name"; return "principals/users/$name";
} }

+ 1
- 1
apps/dav/lib/CardDAV/PhotoCache.php View File

return false; return false;
} }
if (substr_count($parsed['path'], ';') === 1) { if (substr_count($parsed['path'], ';') === 1) {
list($type) = explode(';', $parsed['path']);
[$type] = explode(';', $parsed['path']);
} }
$val = file_get_contents($val); $val = file_get_contents($val);
} else { } else {

+ 3
- 3
apps/dav/lib/CardDAV/Plugin.php View File

*/ */
protected function getAddressbookHomeForPrincipal($principal) { protected function getAddressbookHomeForPrincipal($principal) {
if (strrpos($principal, 'principals/users', -strlen($principal)) !== false) { if (strrpos($principal, 'principals/users', -strlen($principal)) !== false) {
list(, $principalId) = \Sabre\Uri\split($principal);
[, $principalId] = \Sabre\Uri\split($principal);
return self::ADDRESSBOOK_ROOT . '/users/' . $principalId; return self::ADDRESSBOOK_ROOT . '/users/' . $principalId;
} }
if (strrpos($principal, 'principals/groups', -strlen($principal)) !== false) { if (strrpos($principal, 'principals/groups', -strlen($principal)) !== false) {
list(, $principalId) = \Sabre\Uri\split($principal);
[, $principalId] = \Sabre\Uri\split($principal);
return self::ADDRESSBOOK_ROOT . '/groups/' . $principalId; return self::ADDRESSBOOK_ROOT . '/groups/' . $principalId;
} }
if (strrpos($principal, 'principals/system', -strlen($principal)) !== false) { if (strrpos($principal, 'principals/system', -strlen($principal)) !== false) {
list(, $principalId) = \Sabre\Uri\split($principal);
[, $principalId] = \Sabre\Uri\split($principal);
return self::ADDRESSBOOK_ROOT . '/system/' . $principalId; return self::ADDRESSBOOK_ROOT . '/system/' . $principalId;
} }
} }

+ 1
- 1
apps/dav/lib/Command/MoveCalendar.php View File

private function checkShares(array $calendar, string $userOrigin, string $userDestination, bool $force = false): bool { private function checkShares(array $calendar, string $userOrigin, string $userDestination, bool $force = false): bool {
$shares = $this->calDav->getShares($calendar['id']); $shares = $this->calDav->getShares($calendar['id']);
foreach ($shares as $share) { foreach ($shares as $share) {
list(, $prefix, $userOrGroup) = explode('/', $share['href'], 3);
[, $prefix, $userOrGroup] = explode('/', $share['href'], 3);


/** /**
* Check that user destination is member of the groups which whom the calendar was shared * Check that user destination is member of the groups which whom the calendar was shared

+ 1
- 1
apps/dav/lib/Connector/LegacyDAVACL.php View File

} }


private function convertPrincipal($principal, $toV2) { private function convertPrincipal($principal, $toV2) {
list(, $name) = \Sabre\Uri\split($principal);
[, $name] = \Sabre\Uri\split($principal);
if ($toV2) { if ($toV2) {
return "principals/users/$name"; return "principals/users/$name";
} }

+ 10
- 10
apps/dav/lib/Connector/Sabre/File.php View File

} }


/** @var Storage $partStorage */ /** @var Storage $partStorage */
list($partStorage) = $this->fileView->resolvePath($this->path);
[$partStorage] = $this->fileView->resolvePath($this->path);
$needsPartFile = $partStorage->needsPartFile() && (strlen($this->path) > 1); $needsPartFile = $partStorage->needsPartFile() && (strlen($this->path) > 1);


$view = \OC\Files\Filesystem::getView(); $view = \OC\Files\Filesystem::getView();


// the part file and target file might be on a different storage in case of a single file storage (e.g. single file share) // the part file and target file might be on a different storage in case of a single file storage (e.g. single file share)
/** @var \OC\Files\Storage\Storage $partStorage */ /** @var \OC\Files\Storage\Storage $partStorage */
list($partStorage, $internalPartPath) = $this->fileView->resolvePath($partFilePath);
[$partStorage, $internalPartPath] = $this->fileView->resolvePath($partFilePath);
/** @var \OC\Files\Storage\Storage $storage */ /** @var \OC\Files\Storage\Storage $storage */
list($storage, $internalPath) = $this->fileView->resolvePath($this->path);
[$storage, $internalPath] = $this->fileView->resolvePath($this->path);
try { try {
if (!$needsPartFile) { if (!$needsPartFile) {
$this->changeLock(ILockingProvider::LOCK_EXCLUSIVE); $this->changeLock(ILockingProvider::LOCK_EXCLUSIVE);
// because we have no clue about the cause we can only throw back a 500/Internal Server Error // because we have no clue about the cause we can only throw back a 500/Internal Server Error
throw new Exception('Could not write file contents'); throw new Exception('Could not write file contents');
} }
list($count, $result) = \OC_Helper::streamCopy($data, $target);
[$count, $result] = \OC_Helper::streamCopy($data, $target);
fclose($target); fclose($target);
} }


return []; return [];
} }
/** @var \OCP\Files\Storage $storage */ /** @var \OCP\Files\Storage $storage */
list($storage, $internalPath) = $this->fileView->resolvePath($this->path);
[$storage, $internalPath] = $this->fileView->resolvePath($this->path);
if (is_null($storage)) { if (is_null($storage)) {
return []; return [];
} }
* @throws ServiceUnavailable * @throws ServiceUnavailable
*/ */
private function createFileChunked($data) { private function createFileChunked($data) {
list($path, $name) = \Sabre\Uri\split($this->path);
[$path, $name] = \Sabre\Uri\split($this->path);


$info = \OC_FileChunking::decodeName($name); $info = \OC_FileChunking::decodeName($name);
if (empty($info)) { if (empty($info)) {


if ($chunk_handler->isComplete()) { if ($chunk_handler->isComplete()) {
/** @var Storage $storage */ /** @var Storage $storage */
list($storage,) = $this->fileView->resolvePath($path);
[$storage,] = $this->fileView->resolvePath($path);
$needsPartFile = $storage->needsPartFile(); $needsPartFile = $storage->needsPartFile();
$partFile = null; $partFile = null;


$targetPath = $path . '/' . $info['name']; $targetPath = $path . '/' . $info['name'];
/** @var \OC\Files\Storage\Storage $targetStorage */ /** @var \OC\Files\Storage\Storage $targetStorage */
list($targetStorage, $targetInternalPath) = $this->fileView->resolvePath($targetPath);
[$targetStorage, $targetInternalPath] = $this->fileView->resolvePath($targetPath);


$exists = $this->fileView->file_exists($targetPath); $exists = $this->fileView->file_exists($targetPath);


$this->emitPreHooks($exists, $targetPath); $this->emitPreHooks($exists, $targetPath);
$this->fileView->changeLock($targetPath, ILockingProvider::LOCK_EXCLUSIVE); $this->fileView->changeLock($targetPath, ILockingProvider::LOCK_EXCLUSIVE);
/** @var \OC\Files\Storage\Storage $targetStorage */ /** @var \OC\Files\Storage\Storage $targetStorage */
list($targetStorage, $targetInternalPath) = $this->fileView->resolvePath($targetPath);
[$targetStorage, $targetInternalPath] = $this->fileView->resolvePath($targetPath);


if ($needsPartFile) { if ($needsPartFile) {
// we first assembly the target file as a part file // we first assembly the target file as a part file
$partFile = $this->getPartFileBasePath($path . '/' . $info['name']) . '.ocTransferId' . $info['transferid'] . '.part'; $partFile = $this->getPartFileBasePath($path . '/' . $info['name']) . '.ocTransferId' . $info['transferid'] . '.part';
/** @var \OC\Files\Storage\Storage $targetStorage */ /** @var \OC\Files\Storage\Storage $targetStorage */
list($partStorage, $partInternalPath) = $this->fileView->resolvePath($partFile);
[$partStorage, $partInternalPath] = $this->fileView->resolvePath($partFile);




$chunk_handler->file_assemble($partStorage, $partInternalPath); $chunk_handler->file_assemble($partStorage, $partInternalPath);

+ 3
- 3
apps/dav/lib/Connector/Sabre/FilesPlugin.php View File

if (!$sourceNode instanceof Node) { if (!$sourceNode instanceof Node) {
return; return;
} }
list($sourceDir,) = \Sabre\Uri\split($source);
list($destinationDir,) = \Sabre\Uri\split($destination);
[$sourceDir,] = \Sabre\Uri\split($source);
[$destinationDir,] = \Sabre\Uri\split($destination);


if ($sourceDir !== $destinationDir) { if ($sourceDir !== $destinationDir) {
$sourceNodeFileInfo = $sourceNode->getFileInfo(); $sourceNodeFileInfo = $sourceNode->getFileInfo();
public function sendFileIdHeader($filePath, \Sabre\DAV\INode $node = null) { public function sendFileIdHeader($filePath, \Sabre\DAV\INode $node = null) {
// chunked upload handling // chunked upload handling
if (isset($_SERVER['HTTP_OC_CHUNKED'])) { if (isset($_SERVER['HTTP_OC_CHUNKED'])) {
list($path, $name) = \Sabre\Uri\split($filePath);
[$path, $name] = \Sabre\Uri\split($filePath);
$info = \OC_FileChunking::decodeName($name); $info = \OC_FileChunking::decodeName($name);
if (!empty($info)) { if (!empty($info)) {
$filePath = $path . '/' . $info['name']; $filePath = $path . '/' . $info['name'];

+ 2
- 2
apps/dav/lib/Connector/Sabre/Node.php View File

throw new \Sabre\DAV\Exception\Forbidden(); throw new \Sabre\DAV\Exception\Forbidden();
} }


list($parentPath,) = \Sabre\Uri\split($this->path);
list(, $newName) = \Sabre\Uri\split($name);
[$parentPath,] = \Sabre\Uri\split($this->path);
[, $newName] = \Sabre\Uri\split($name);


// verify path of the target // verify path of the target
$this->verifyPath(); $this->verifyPath();

+ 3
- 3
apps/dav/lib/Connector/Sabre/ObjectTree.php View File

private function resolveChunkFile($path) { private function resolveChunkFile($path) {
if (isset($_SERVER['HTTP_OC_CHUNKED'])) { if (isset($_SERVER['HTTP_OC_CHUNKED'])) {
// resolve to real file name to find the proper node // resolve to real file name to find the proper node
list($dir, $name) = \Sabre\Uri\split($path);
[$dir, $name] = \Sabre\Uri\split($path);
if ($dir === '/' || $dir === '.') { if ($dir === '/' || $dir === '.') {
$dir = ''; $dir = '';
} }
// this will trigger existence check // this will trigger existence check
$this->getNodeForPath($sourcePath); $this->getNodeForPath($sourcePath);


list($destinationDir, $destinationName) = \Sabre\Uri\split($destinationPath);
[$destinationDir, $destinationName] = \Sabre\Uri\split($destinationPath);
try { try {
$this->fileView->verifyPath($destinationDir, $destinationName); $this->fileView->verifyPath($destinationDir, $destinationName);
} catch (\OCP\Files\InvalidPathException $ex) { } catch (\OCP\Files\InvalidPathException $ex) {
throw new FileLocked($e->getMessage(), $e->getCode(), $e); throw new FileLocked($e->getMessage(), $e->getCode(), $e);
} }


list($destinationDir,) = \Sabre\Uri\split($destinationPath);
[$destinationDir,] = \Sabre\Uri\split($destinationPath);
$this->markDirty($destinationDir); $this->markDirty($destinationDir);
} }
} }

+ 4
- 4
apps/dav/lib/Connector/Sabre/Principal.php View File

* @return array * @return array
*/ */
public function getPrincipalByPath($path) { public function getPrincipalByPath($path) {
list($prefix, $name) = \Sabre\Uri\split($path);
[$prefix, $name] = \Sabre\Uri\split($path);
$decodedName = urldecode($name); $decodedName = urldecode($name);


if ($name === 'calendar-proxy-write' || $name === 'calendar-proxy-read') { if ($name === 'calendar-proxy-write' || $name === 'calendar-proxy-read') {
list($prefix2, $name2) = \Sabre\Uri\split($prefix);
[$prefix2, $name2] = \Sabre\Uri\split($prefix);


if ($prefix2 === $this->principalPrefix) { if ($prefix2 === $this->principalPrefix) {
$user = $this->userManager->get($name2); $user = $this->userManager->get($name2);
* @throws Exception * @throws Exception
*/ */
public function getGroupMembership($principal, $needGroups = false) { public function getGroupMembership($principal, $needGroups = false) {
list($prefix, $name) = \Sabre\Uri\split($principal);
[$prefix, $name] = \Sabre\Uri\split($principal);


if ($prefix !== $this->principalPrefix) { if ($prefix !== $this->principalPrefix) {
return []; return [];
return []; return [];
} }


list($prefix, $name) = \Sabre\Uri\split($principal);
[$prefix, $name] = \Sabre\Uri\split($principal);
if ($this->hasCircles && $prefix === $this->principalPrefix) { if ($this->hasCircles && $prefix === $this->principalPrefix) {
$user = $this->userManager->get($name); $user = $this->userManager->get($name);
if (!$user) { if (!$user) {

+ 1
- 1
apps/dav/lib/Connector/Sabre/QuotaPlugin.php View File

} }


if ($length) { if ($length) {
list($parentPath, $newName) = \Sabre\Uri\split($path);
[$parentPath, $newName] = \Sabre\Uri\split($path);
if (is_null($parentPath)) { if (is_null($parentPath)) {
$parentPath = ''; $parentPath = '';
} }

+ 1
- 1
apps/dav/lib/Connector/Sabre/SharesPlugin.php View File

if (isset($this->cachedShares[$sabreNode->getId()])) { if (isset($this->cachedShares[$sabreNode->getId()])) {
$shares = $this->cachedShares[$sabreNode->getId()]; $shares = $this->cachedShares[$sabreNode->getId()];
} else { } else {
list($parentPath,) = \Sabre\Uri\split($sabreNode->getPath());
[$parentPath,] = \Sabre\Uri\split($sabreNode->getPath());
if ($parentPath === '') { if ($parentPath === '') {
$parentPath = '/'; $parentPath = '/';
} }

+ 2
- 2
apps/dav/lib/Connector/Sabre/TagsPlugin.php View File

$isFav = null; $isFav = null;


$propFind->handle(self::TAGS_PROPERTYNAME, function () use (&$isFav, $node) { $propFind->handle(self::TAGS_PROPERTYNAME, function () use (&$isFav, $node) {
list($tags, $isFav) = $this->getTagsAndFav($node->getId());
[$tags, $isFav] = $this->getTagsAndFav($node->getId());
return new TagList($tags); return new TagList($tags);
}); });


$propFind->handle(self::FAVORITE_PROPERTYNAME, function () use ($isFav, $node) { $propFind->handle(self::FAVORITE_PROPERTYNAME, function () use ($isFav, $node) {
if (is_null($isFav)) { if (is_null($isFav)) {
list(, $isFav) = $this->getTagsAndFav($node->getId());
[, $isFav] = $this->getTagsAndFav($node->getId());
} }
if ($isFav) { if ($isFav) {
return 1; return 1;

+ 1
- 1
apps/dav/lib/DAV/SystemPrincipalBackend.php View File

* @return array * @return array
*/ */
public function getGroupMembership($principal) { public function getGroupMembership($principal) {
list($prefix, ) = \Sabre\Uri\split($principal);
[$prefix, ] = \Sabre\Uri\split($principal);


if ($prefix === 'principals/system') { if ($prefix === 'principals/system') {
$principal = $this->getPrincipalByPath($principal); $principal = $this->getPrincipalByPath($principal);

+ 1
- 1
apps/dav/lib/Files/FileSearchBackend.php View File

* @return ISearchOperator * @return ISearchOperator
*/ */
private function transformSearchOperation(Operator $operator) { private function transformSearchOperation(Operator $operator) {
list(, $trimmedType) = explode('}', $operator->type);
[, $trimmedType] = explode('}', $operator->type);
switch ($operator->type) { switch ($operator->type) {
case Operator::OPERATION_AND: case Operator::OPERATION_AND:
case Operator::OPERATION_OR: case Operator::OPERATION_OR:

+ 1
- 1
apps/dav/lib/Files/FilesHome.php View File

} }


public function getName() { public function getName() {
list(,$name) = \Sabre\Uri\split($this->principalInfo['uri']);
[,$name] = \Sabre\Uri\split($this->principalInfo['uri']);
return $name; return $name;
} }



+ 1
- 1
apps/dav/lib/Files/RootCollection.php View File

* @return INode * @return INode
*/ */
public function getChildForPrincipal(array $principalInfo) { public function getChildForPrincipal(array $principalInfo) {
list(,$name) = \Sabre\Uri\split($principalInfo['uri']);
[,$name] = \Sabre\Uri\split($principalInfo['uri']);
$user = \OC::$server->getUserSession()->getUser(); $user = \OC::$server->getUserSession()->getUser();
if (is_null($user) || $name !== $user->getUID()) { if (is_null($user) || $name !== $user->getUID()) {
// a user is only allowed to see their own home contents, so in case another collection // a user is only allowed to see their own home contents, so in case another collection

+ 9
- 9
apps/dav/lib/Traits/PrincipalProxyTrait.php View File

* @throws Exception * @throws Exception
*/ */
public function getGroupMembership($principal, $needGroups = false) { public function getGroupMembership($principal, $needGroups = false) {
list($prefix, $name) = \Sabre\Uri\split($principal);
[$prefix, $name] = \Sabre\Uri\split($principal);


if ($prefix !== $this->principalPrefix) { if ($prefix !== $this->principalPrefix) {
return []; return [];
* @throws Exception * @throws Exception
*/ */
public function setGroupMemberSet($principal, array $members) { public function setGroupMemberSet($principal, array $members) {
list($principalUri, $target) = \Sabre\Uri\split($principal);
[$principalUri, $target] = \Sabre\Uri\split($principal);


if ($target !== 'calendar-proxy-write' && $target !== 'calendar-proxy-read') { if ($target !== 'calendar-proxy-write' && $target !== 'calendar-proxy-read') {
throw new Exception('Setting members of the group is not supported yet'); throw new Exception('Setting members of the group is not supported yet');
$permission |= ProxyMapper::PERMISSION_WRITE; $permission |= ProxyMapper::PERMISSION_WRITE;
} }


list($prefix, $owner) = \Sabre\Uri\split($principalUri);
[$prefix, $owner] = \Sabre\Uri\split($principalUri);
$proxies = $this->proxyMapper->getProxiesOf($principalUri); $proxies = $this->proxyMapper->getProxiesOf($principalUri);


foreach ($members as $member) { foreach ($members as $member) {
list($prefix, $name) = \Sabre\Uri\split($member);
[$prefix, $name] = \Sabre\Uri\split($member);


if ($prefix !== $this->principalPrefix) { if ($prefix !== $this->principalPrefix) {
throw new Exception('Invalid member group prefix: ' . $prefix); throw new Exception('Invalid member group prefix: ' . $prefix);
* @return bool * @return bool
*/ */
private function isProxyPrincipal(string $principalUri):bool { private function isProxyPrincipal(string $principalUri):bool {
list($realPrincipalUri, $proxy) = \Sabre\Uri\split($principalUri);
list($prefix, $userId) = \Sabre\Uri\split($realPrincipalUri);
[$realPrincipalUri, $proxy] = \Sabre\Uri\split($principalUri);
[$prefix, $userId] = \Sabre\Uri\split($realPrincipalUri);


if (!isset($prefix) || !isset($userId)) { if (!isset($prefix) || !isset($userId)) {
return false; return false;
* @return bool * @return bool
*/ */
private function isReadProxyPrincipal(string $principalUri):bool { private function isReadProxyPrincipal(string $principalUri):bool {
list(, $proxy) = \Sabre\Uri\split($principalUri);
[, $proxy] = \Sabre\Uri\split($principalUri);
return $proxy === 'calendar-proxy-read'; return $proxy === 'calendar-proxy-read';
} }


* @return bool * @return bool
*/ */
private function isWriteProxyPrincipal(string $principalUri):bool { private function isWriteProxyPrincipal(string $principalUri):bool {
list(, $proxy) = \Sabre\Uri\split($principalUri);
[, $proxy] = \Sabre\Uri\split($principalUri);
return $proxy === 'calendar-proxy-write'; return $proxy === 'calendar-proxy-write';
} }


* @return string * @return string
*/ */
private function getPrincipalUriFromProxyPrincipal(string $principalUri):string { private function getPrincipalUriFromProxyPrincipal(string $principalUri):string {
list($realPrincipalUri, ) = \Sabre\Uri\split($principalUri);
[$realPrincipalUri, ] = \Sabre\Uri\split($principalUri);
return $realPrincipalUri; return $realPrincipalUri;
} }
} }

+ 1
- 1
apps/dav/lib/Upload/UploadHome.php View File

} }


public function getName() { public function getName() {
list(,$name) = \Sabre\Uri\split($this->principalInfo['uri']);
[,$name] = \Sabre\Uri\split($this->principalInfo['uri']);
return $name; return $name;
} }



+ 2
- 2
apps/dav/tests/unit/CalDAV/Reminder/NotificationProvider/EmailProviderTest.php View File

} }


public function testSendWithoutAttendees():void { public function testSendWithoutAttendees():void {
list($user1, $user2, $user3, , $user5) = $users = $this->getUsers();
[$user1, $user2, $user3, , $user5] = $users = $this->getUsers();


$enL10N = $this->createMock(IL10N::class); $enL10N = $this->createMock(IL10N::class);
$enL10N->method('t') $enL10N->method('t')
} }


public function testSendWithAttendees(): void { public function testSendWithAttendees(): void {
list($user1, $user2, $user3, , $user5) = $users = $this->getUsers();
[$user1, $user2, $user3, , $user5] = $users = $this->getUsers();


$enL10N = $this->createMock(IL10N::class); $enL10N = $this->createMock(IL10N::class);
$enL10N->method('t') $enL10N->method('t')

+ 2
- 2
apps/dav/tests/unit/CardDAV/AddressBookImplTest.php View File

->willReturn(['carddata' => 'data']); ->willReturn(['carddata' => 'data']);
$addressBookImpl->expects($this->once())->method('readCard') $addressBookImpl->expects($this->once())->method('readCard')
->with('data')->willReturn($this->vCard); ->with('data')->willReturn($this->vCard);
$this->vCard->expects($this->exactly(count($properties)-1))
$this->vCard->expects($this->exactly(count($properties) - 1))
->method('createProperty'); ->method('createProperty');
$this->backend->expects($this->never())->method('createCard'); $this->backend->expects($this->never())->method('createCard');
$this->backend->expects($this->once())->method('updateCard'); $this->backend->expects($this->once())->method('updateCard');
$addressBookImpl->expects($this->once())->method('readCard') $addressBookImpl->expects($this->once())->method('readCard')
->with('data')->willReturn($this->vCard); ->with('data')->willReturn($this->vCard);
$this->vCard->method('createProperty')->willReturn($textProperty); $this->vCard->method('createProperty')->willReturn($textProperty);
$this->vCard->expects($this->exactly(count($properties)-1))
$this->vCard->expects($this->exactly(count($properties) - 1))
->method('createProperty'); ->method('createProperty');
$this->vCard->expects($this->once())->method('remove') $this->vCard->expects($this->once())->method('remove')
->with('ADR'); ->with('ADR');

+ 1
- 1
apps/dav/tests/unit/Connector/Sabre/FileTest.php View File

$userView = \OC\Files\Filesystem::getView(); $userView = \OC\Files\Filesystem::getView();
} }
$files = []; $files = [];
list($storage, $internalPath) = $userView->resolvePath($path);
[$storage, $internalPath] = $userView->resolvePath($path);
if ($storage instanceof Local) { if ($storage instanceof Local) {
$realPath = $storage->getSourcePath($internalPath); $realPath = $storage->getSourcePath($internalPath);
$dh = opendir($realPath); $dh = opendir($realPath);

+ 1
- 1
apps/encryption/lib/Crypto/EncryptAll.php View File

} }


$subject = $this->l->t('one-time password for server-side-encryption'); $subject = $this->l->t('one-time password for server-side-encryption');
list($htmlBody, $textBody) = $this->createMailBody($password);
[$htmlBody, $textBody] = $this->createMailBody($password);


// send it out now // send it out now
try { try {

+ 1
- 1
apps/federatedfilesharing/lib/Controller/MountPublicLinkController.php View File

} }


try { try {
list(, $server) = $this->addressHandler->splitUserRemote($shareWith);
[, $server] = $this->addressHandler->splitUserRemote($shareWith);
$share = $this->shareManager->getShareByToken($token); $share = $this->shareManager->getShareByToken($token);
} catch (HintException $e) { } catch (HintException $e) {
return new JSONResponse(['message' => $e->getHint()], Http::STATUS_BAD_REQUEST); return new JSONResponse(['message' => $e->getHint()], Http::STATUS_BAD_REQUEST);

+ 1
- 1
apps/federatedfilesharing/lib/Controller/RequestHandlerController.php View File



try { try {
$provider = $this->cloudFederationProviderManager->getCloudFederationProvider('file'); $provider = $this->cloudFederationProviderManager->getCloudFederationProvider('file');
list($newToken, $localId) = $provider->notificationReceived('REQUEST_RESHARE', $id, $notification);
[$newToken, $localId] = $provider->notificationReceived('REQUEST_RESHARE', $id, $notification);
return new Http\DataResponse([ return new Http\DataResponse([
'token' => $newToken, 'token' => $newToken,
'remoteId' => $localId 'remoteId' => $localId

+ 7
- 7
apps/federatedfilesharing/lib/FederatedShareProvider.php View File

$ownerCloudId = $this->cloudIdManager->getCloudId($remoteShare['owner'], $remoteShare['remote']); $ownerCloudId = $this->cloudIdManager->getCloudId($remoteShare['owner'], $remoteShare['remote']);
$shareId = $this->addShareToDB($itemSource, $itemType, $shareWith, $sharedBy, $ownerCloudId->getId(), $permissions, 'tmp_token_' . time(), $shareType); $shareId = $this->addShareToDB($itemSource, $itemType, $shareWith, $sharedBy, $ownerCloudId->getId(), $permissions, 'tmp_token_' . time(), $shareType);
$share->setId($shareId); $share->setId($shareId);
list($token, $remoteId) = $this->askOwnerToReShare($shareWith, $share, $shareId);
[$token, $remoteId] = $this->askOwnerToReShare($shareWith, $share, $shareId);
// remote share was create successfully if we get a valid token as return // remote share was create successfully if we get a valid token as return
$send = is_string($token) && $token !== ''; $send = is_string($token) && $token !== '';
} catch (\Exception $e) { } catch (\Exception $e) {
$remoteId = $remoteShare['remote_id']; $remoteId = $remoteShare['remote_id'];
$remote = $remoteShare['remote']; $remote = $remoteShare['remote'];


list($token, $remoteId) = $this->notifications->requestReShare(
[$token, $remoteId] = $this->notifications->requestReShare(
$token, $token,
$remoteId, $remoteId,
$shareId, $shareId,
$remoteId = $this->getRemoteId($share); $remoteId = $this->getRemoteId($share);
// if the local user is the owner we send the permission change to the initiator // if the local user is the owner we send the permission change to the initiator
if ($this->userManager->userExists($share->getShareOwner())) { if ($this->userManager->userExists($share->getShareOwner())) {
list(, $remote) = $this->addressHandler->splitUserRemote($share->getSharedBy());
[, $remote] = $this->addressHandler->splitUserRemote($share->getSharedBy());
} else { // ... if not we send the permission change to the owner } else { // ... if not we send the permission change to the owner
list(, $remote) = $this->addressHandler->splitUserRemote($share->getShareOwner());
[, $remote] = $this->addressHandler->splitUserRemote($share->getShareOwner());
} }
$this->notifications->sendPermissionChange($remote, $remoteId, $share->getToken(), $share->getPermissions()); $this->notifications->sendPermissionChange($remote, $remoteId, $share->getToken(), $share->getPermissions());
} }
* @throws \OC\HintException * @throws \OC\HintException
*/ */
public function delete(IShare $share) { public function delete(IShare $share) {
list(, $remote) = $this->addressHandler->splitUserRemote($share->getSharedWith());
[, $remote] = $this->addressHandler->splitUserRemote($share->getSharedWith());


// if the local user is the owner we can send the unShare request directly... // if the local user is the owner we can send the unShare request directly...
if ($this->userManager->userExists($share->getShareOwner())) { if ($this->userManager->userExists($share->getShareOwner())) {
// also send a unShare request to the initiator, if this is a different user than the owner // also send a unShare request to the initiator, if this is a different user than the owner
if ($share->getShareOwner() !== $share->getSharedBy()) { if ($share->getShareOwner() !== $share->getSharedBy()) {
if ($isOwner) { if ($isOwner) {
list(, $remote) = $this->addressHandler->splitUserRemote($share->getSharedBy());
[, $remote] = $this->addressHandler->splitUserRemote($share->getSharedBy());
} else { } else {
list(, $remote) = $this->addressHandler->splitUserRemote($share->getShareOwner());
[, $remote] = $this->addressHandler->splitUserRemote($share->getShareOwner());
} }
$remoteId = $this->getRemoteId($share); $remoteId = $this->getRemoteId($share);
$this->notifications->sendRevokeShare($remote, $remoteId, $share->getToken()); $this->notifications->sendRevokeShare($remote, $remoteId, $share->getToken());

+ 1
- 1
apps/federatedfilesharing/lib/Notifications.php View File

* @throws \OC\ServerNotAvailableException * @throws \OC\ServerNotAvailableException
*/ */
public function sendRemoteShare($token, $shareWith, $name, $remoteId, $owner, $ownerFederatedId, $sharedBy, $sharedByFederatedId, $shareType) { public function sendRemoteShare($token, $shareWith, $name, $remoteId, $owner, $ownerFederatedId, $sharedBy, $sharedByFederatedId, $shareType) {
list($user, $remote) = $this->addressHandler->splitUserRemote($shareWith);
[$user, $remote] = $this->addressHandler->splitUserRemote($shareWith);


if ($user && $remote) { if ($user && $remote) {
$local = $this->addressHandler->generateRemoteURL(); $local = $this->addressHandler->generateRemoteURL();

+ 6
- 6
apps/federatedfilesharing/lib/OCM/CloudFederationProviderFiles.php View File

throw new ProviderCouldNotAddShareException('Unsupported protocol for data exchange.', '', Http::STATUS_NOT_IMPLEMENTED); throw new ProviderCouldNotAddShareException('Unsupported protocol for data exchange.', '', Http::STATUS_NOT_IMPLEMENTED);
} }


list($ownerUid, $remote) = $this->addressHandler->splitUserRemote($share->getOwner());
[$ownerUid, $remote] = $this->addressHandler->splitUserRemote($share->getOwner());
// for backward compatibility make sure that the remote url stored in the // for backward compatibility make sure that the remote url stored in the
// database ends with a trailing slash // database ends with a trailing slash
if (substr($remote, -1) !== '/') { if (substr($remote, -1) !== '/') {
$this->verifyShare($share, $token); $this->verifyShare($share, $token);
$this->executeAcceptShare($share); $this->executeAcceptShare($share);
if ($share->getShareOwner() !== $share->getSharedBy()) { if ($share->getShareOwner() !== $share->getSharedBy()) {
list(, $remote) = $this->addressHandler->splitUserRemote($share->getSharedBy());
[, $remote] = $this->addressHandler->splitUserRemote($share->getSharedBy());
$remoteId = $this->federatedShareProvider->getRemoteId($share); $remoteId = $this->federatedShareProvider->getRemoteId($share);
$notification = $this->cloudFederationFactory->getCloudFederationNotification(); $notification = $this->cloudFederationFactory->getCloudFederationNotification();
$notification->setMessage( $notification->setMessage(
protected function executeAcceptShare(IShare $share) { protected function executeAcceptShare(IShare $share) {
try { try {
$fileId = (int)$share->getNode()->getId(); $fileId = (int)$share->getNode()->getId();
list($file, $link) = $this->getFile($this->getCorrectUid($share), $fileId);
[$file, $link] = $this->getFile($this->getCorrectUid($share), $fileId);
} catch (\Exception $e) { } catch (\Exception $e) {
throw new ShareNotFound(); throw new ShareNotFound();
} }
$this->verifyShare($share, $token); $this->verifyShare($share, $token);


if ($share->getShareOwner() !== $share->getSharedBy()) { if ($share->getShareOwner() !== $share->getSharedBy()) {
list(, $remote) = $this->addressHandler->splitUserRemote($share->getSharedBy());
[, $remote] = $this->addressHandler->splitUserRemote($share->getSharedBy());
$remoteId = $this->federatedShareProvider->getRemoteId($share); $remoteId = $this->federatedShareProvider->getRemoteId($share);
$notification = $this->cloudFederationFactory->getCloudFederationNotification(); $notification = $this->cloudFederationFactory->getCloudFederationNotification();
$notification->setMessage( $notification->setMessage(


try { try {
$fileId = (int)$share->getNode()->getId(); $fileId = (int)$share->getNode()->getId();
list($file, $link) = $this->getFile($this->getCorrectUid($share), $fileId);
[$file, $link] = $this->getFile($this->getCorrectUid($share), $fileId);
} catch (\Exception $e) { } catch (\Exception $e) {
throw new ShareNotFound(); throw new ShareNotFound();
} }
$share = $this->federatedShareProvider->getShareById($id); $share = $this->federatedShareProvider->getShareById($id);
// don't allow to share a file back to the owner // don't allow to share a file back to the owner
try { try {
list($user, $remote) = $this->addressHandler->splitUserRemote($shareWith);
[$user, $remote] = $this->addressHandler->splitUserRemote($shareWith);
$owner = $share->getShareOwner(); $owner = $share->getShareOwner();
$currentServer = $this->addressHandler->generateRemoteURL(); $currentServer = $this->addressHandler->generateRemoteURL();
if ($this->addressHandler->compareAddresses($user, $remote, $owner, $currentServer)) { if ($this->addressHandler->compareAddresses($user, $remote, $owner, $currentServer)) {

+ 1
- 1
apps/federatedfilesharing/tests/AddressHandlerTest.php View File

->method('search') ->method('search')
->willReturn([]); ->willReturn([]);


list($remoteUser, $remoteUrl) = $this->addressHandler->splitUserRemote($remote);
[$remoteUser, $remoteUrl] = $this->addressHandler->splitUserRemote($remote);
$this->assertSame($expectedUser, $remoteUser); $this->assertSame($expectedUser, $remoteUser);
$this->assertSame($expectedUrl, $remoteUrl); $this->assertSame($expectedUrl, $remoteUrl);
} }

+ 1
- 1
apps/files/lib/Activity/Provider.php View File

try { try {
$fullPath = rtrim($encryptionContainer->getPath(), '/'); $fullPath = rtrim($encryptionContainer->getPath(), '/');
// Remove /user/files/... // Remove /user/files/...
list(,,, $path) = explode('/', $fullPath, 4);
[,,, $path] = explode('/', $fullPath, 4);
if (!$path) { if (!$path) {
throw new InvalidPathException('Path could not be split correctly'); throw new InvalidPathException('Path could not be split correctly');
} }

+ 1
- 1
apps/files/lib/Command/Scan.php View File

$inputPath = $input->getOption('path'); $inputPath = $input->getOption('path');
if ($inputPath) { if ($inputPath) {
$inputPath = '/' . trim($inputPath, '/'); $inputPath = '/' . trim($inputPath, '/');
list(, $user,) = explode('/', $inputPath, 3);
[, $user,] = explode('/', $inputPath, 3);
$users = [$user]; $users = [$user];
} elseif ($input->getOption('all')) { } elseif ($input->getOption('all')) {
$users = $this->userManager->search(''); $users = $this->userManager->search('');

+ 1
- 1
apps/files_external/lib/Command/Create.php View File

$output->writeln('<error>Invalid mount configuration option "' . $configOption . '"</error>'); $output->writeln('<error>Invalid mount configuration option "' . $configOption . '"</error>');
return 1; return 1;
} }
list($key, $value) = explode('=', $configOption, 2);
[$key, $value] = explode('=', $configOption, 2);
if (!$this->validateParam($key, $value, $storageBackend, $authBackend)) { if (!$this->validateParam($key, $value, $storageBackend, $authBackend)) {
$output->writeln('<error>Unknown configuration for backends "' . $key . '"</error>'); $output->writeln('<error>Unknown configuration for backends "' . $key . '"</error>');
return 1; return 1;

+ 1
- 1
apps/files_external/lib/Command/Verify.php View File

$output->writeln('<error>Invalid mount configuration option "' . $configOption . '"</error>'); $output->writeln('<error>Invalid mount configuration option "' . $configOption . '"</error>');
return; return;
} }
list($key, $value) = explode('=', $configOption, 2);
[$key, $value] = explode('=', $configOption, 2);
$storage->setBackendOption($key, $value); $storage->setBackendOption($key, $value);
} }



+ 2
- 2
apps/files_sharing/lib/Controller/ShareesAPIController.php View File

$this->result['lookupEnabled'] = $this->config->getAppValue('files_sharing', 'lookupServerEnabled', 'yes') === 'yes'; $this->result['lookupEnabled'] = $this->config->getAppValue('files_sharing', 'lookupServerEnabled', 'yes') === 'yes';
} }


list($result, $hasMoreResults) = $this->collaboratorSearch->search($search, $shareTypes, $lookup, $this->limit, $this->offset);
[$result, $hasMoreResults] = $this->collaboratorSearch->search($search, $shareTypes, $lookup, $this->limit, $this->offset);


// extra treatment for 'exact' subarray, with a single merge expected keys might be lost // extra treatment for 'exact' subarray, with a single merge expected keys might be lost
if (isset($result['exact'])) { if (isset($result['exact'])) {
foreach ($shareTypes as $shareType) { foreach ($shareTypes as $shareType) {
$sharees = $this->getAllShareesByType($user, $shareType); $sharees = $this->getAllShareesByType($user, $shareType);
$shareTypeResults = []; $shareTypeResults = [];
foreach ($sharees as list($sharee, $displayname)) {
foreach ($sharees as [$sharee, $displayname]) {
if (!isset($this->searchResultTypeMap[$shareType])) { if (!isset($this->searchResultTypeMap[$shareType])) {
continue; continue;
} }

+ 1
- 1
apps/files_sharing/lib/External/Cache.php View File

public function __construct($storage, ICloudId $cloudId) { public function __construct($storage, ICloudId $cloudId) {
$this->cloudId = $cloudId; $this->cloudId = $cloudId;
$this->storage = $storage; $this->storage = $storage;
list(, $remote) = explode('://', $cloudId->getRemote(), 2);
[, $remote] = explode('://', $cloudId->getRemote(), 2);
$this->remote = $remote; $this->remote = $remote;
$this->remoteUser = $cloudId->getUser(); $this->remoteUser = $cloudId->getUser();
parent::__construct($storage); parent::__construct($storage);

+ 2
- 2
apps/files_sharing/lib/External/Storage.php View File

$this->cloudId = $options['cloudId']; $this->cloudId = $options['cloudId'];
$discoveryService = \OC::$server->query(\OCP\OCS\IDiscoveryService::class); $discoveryService = \OC::$server->query(\OCP\OCS\IDiscoveryService::class);


list($protocol, $remote) = explode('://', $this->cloudId->getRemote());
[$protocol, $remote] = explode('://', $this->cloudId->getRemote());
if (strpos($remote, '/')) { if (strpos($remote, '/')) {
list($host, $root) = explode('/', $remote, 2);
[$host, $root] = explode('/', $remote, 2);
} else { } else {
$host = $remote; $host = $remote;
$root = ''; $root = '';

+ 1
- 1
apps/files_sharing/lib/Scanner.php View File

} }
if ($this->storage->instanceOfStorage('\OCA\Files_Sharing\SharedStorage')) { if ($this->storage->instanceOfStorage('\OCA\Files_Sharing\SharedStorage')) {
/** @var \OC\Files\Storage\Storage $storage */ /** @var \OC\Files\Storage\Storage $storage */
list($storage) = $this->storage->resolvePath('');
[$storage] = $this->storage->resolvePath('');
$this->sourceScanner = $storage->getScanner(); $this->sourceScanner = $storage->getScanner();
return $this->sourceScanner; return $this->sourceScanner;
} else { } else {

+ 8
- 8
apps/files_sharing/tests/CacheTest.php View File

$this->view->file_put_contents('container/shareddir/subdir/another too.txt', $textData); $this->view->file_put_contents('container/shareddir/subdir/another too.txt', $textData);
$this->view->file_put_contents('container/shareddir/subdir/not a text file.xml', '<xml></xml>'); $this->view->file_put_contents('container/shareddir/subdir/not a text file.xml', '<xml></xml>');


list($this->ownerStorage,) = $this->view->resolvePath('');
[$this->ownerStorage,] = $this->view->resolvePath('');
$this->ownerCache = $this->ownerStorage->getCache(); $this->ownerCache = $this->ownerStorage->getCache();
$this->ownerStorage->getScanner()->scan(''); $this->ownerStorage->getScanner()->scan('');




// retrieve the shared storage // retrieve the shared storage
$secondView = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER2); $secondView = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER2);
list($this->sharedStorage,) = $secondView->resolvePath('files/shareddir');
[$this->sharedStorage,] = $secondView->resolvePath('files/shareddir');
$this->sharedCache = $this->sharedStorage->getCache(); $this->sharedCache = $this->sharedStorage->getCache();
} }


*/ */
public function testSearch() { public function testSearch() {
foreach ($this->searchDataProvider() as $data) { foreach ($this->searchDataProvider() as $data) {
list($pattern, $expectedFiles) = $data;
[$pattern, $expectedFiles] = $data;


$results = $this->sharedStorage->getCache()->search($pattern); $results = $this->sharedStorage->getCache()->search($pattern);




self::loginHelper(self::TEST_FILES_SHARING_API_USER2); self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
$this->assertTrue(\OC\Files\Filesystem::file_exists('/test.txt')); $this->assertTrue(\OC\Files\Filesystem::file_exists('/test.txt'));
list($sharedStorage) = \OC\Files\Filesystem::resolvePath('/' . self::TEST_FILES_SHARING_API_USER2 . '/files/test.txt');
[$sharedStorage] = \OC\Files\Filesystem::resolvePath('/' . self::TEST_FILES_SHARING_API_USER2 . '/files/test.txt');
/** /**
* @var \OCA\Files_Sharing\SharedStorage $sharedStorage * @var \OCA\Files_Sharing\SharedStorage $sharedStorage
*/ */


self::loginHelper(self::TEST_FILES_SHARING_API_USER2); self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
$this->assertTrue(\OC\Files\Filesystem::file_exists('/foo')); $this->assertTrue(\OC\Files\Filesystem::file_exists('/foo'));
list($sharedStorage) = \OC\Files\Filesystem::resolvePath('/' . self::TEST_FILES_SHARING_API_USER2 . '/files/foo');
[$sharedStorage] = \OC\Files\Filesystem::resolvePath('/' . self::TEST_FILES_SHARING_API_USER2 . '/files/foo');
/** /**
* @var \OCA\Files_Sharing\SharedStorage $sharedStorage * @var \OCA\Files_Sharing\SharedStorage $sharedStorage
*/ */
$this->shareManager->updateShare($share); $this->shareManager->updateShare($share);
\OC_Util::tearDownFS(); \OC_Util::tearDownFS();


list($sourceStorage) = \OC\Files\Filesystem::resolvePath('/' . self::TEST_FILES_SHARING_API_USER1 . '/files/foo');
[$sourceStorage] = \OC\Files\Filesystem::resolvePath('/' . self::TEST_FILES_SHARING_API_USER1 . '/files/foo');


self::loginHelper(self::TEST_FILES_SHARING_API_USER2); self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
$this->assertTrue(\OC\Files\Filesystem::file_exists('/foo')); $this->assertTrue(\OC\Files\Filesystem::file_exists('/foo'));
/** @var SharedStorage $sharedStorage */ /** @var SharedStorage $sharedStorage */
list($sharedStorage) = \OC\Files\Filesystem::resolvePath('/' . self::TEST_FILES_SHARING_API_USER2 . '/files/foo');
[$sharedStorage] = \OC\Files\Filesystem::resolvePath('/' . self::TEST_FILES_SHARING_API_USER2 . '/files/foo');


$this->assertEquals($sourceStorage->getCache()->getNumericStorageId(), $sharedStorage->getCache()->getNumericStorageId()); $this->assertEquals($sourceStorage->getCache()->getNumericStorageId(), $sharedStorage->getCache()->getNumericStorageId());
} }


\OC\Files\Filesystem::file_put_contents('/sub/bar.txt', 'bar'); \OC\Files\Filesystem::file_put_contents('/sub/bar.txt', 'bar');
/** @var SharedStorage $sharedStorage */ /** @var SharedStorage $sharedStorage */
list($sharedStorage) = \OC\Files\Filesystem::resolvePath('/' . self::TEST_FILES_SHARING_API_USER2 . '/files/sub');
[$sharedStorage] = \OC\Files\Filesystem::resolvePath('/' . self::TEST_FILES_SHARING_API_USER2 . '/files/sub');


$this->assertTrue($sharedStorage->getCache()->inCache('bar.txt')); $this->assertTrue($sharedStorage->getCache()->inCache('bar.txt'));



+ 3
- 3
apps/files_sharing/tests/PermissionsTest.php View File

$this->view->file_put_contents('container/shareddir/textfile.txt', $textData); $this->view->file_put_contents('container/shareddir/textfile.txt', $textData);
$this->view->file_put_contents('container/shareddirrestricted/textfile1.txt', $textData); $this->view->file_put_contents('container/shareddirrestricted/textfile1.txt', $textData);


list($this->ownerStorage, $internalPath) = $this->view->resolvePath('');
[$this->ownerStorage, $internalPath] = $this->view->resolvePath('');
$this->ownerCache = $this->ownerStorage->getCache(); $this->ownerCache = $this->ownerStorage->getCache();
$this->ownerStorage->getScanner()->scan(''); $this->ownerStorage->getScanner()->scan('');




// retrieve the shared storage // retrieve the shared storage
$this->secondView = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER2); $this->secondView = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER2);
list($this->sharedStorage, $internalPath) = $this->secondView->resolvePath('files/shareddir');
list($this->sharedStorageRestrictedShare, $internalPath) = $this->secondView->resolvePath('files/shareddirrestricted');
[$this->sharedStorage, $internalPath] = $this->secondView->resolvePath('files/shareddir');
[$this->sharedStorageRestrictedShare, $internalPath] = $this->secondView->resolvePath('files/shareddirrestricted');
$this->sharedCache = $this->sharedStorage->getCache(); $this->sharedCache = $this->sharedStorage->getCache();
$this->sharedCacheRestrictedShare = $this->sharedStorageRestrictedShare->getCache(); $this->sharedCacheRestrictedShare = $this->sharedStorageRestrictedShare->getCache();
} }

+ 3
- 3
apps/files_sharing/tests/SharedStorageTest.php View File



// delete the local folder // delete the local folder
/** @var \OC\Files\Storage\Storage $storage */ /** @var \OC\Files\Storage\Storage $storage */
list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath('/' . self::TEST_FILES_SHARING_API_USER2 . '/files/localfolder');
[$storage, $internalPath] = \OC\Files\Filesystem::resolvePath('/' . self::TEST_FILES_SHARING_API_USER2 . '/files/localfolder');
$storage->rmdir($internalPath); $storage->rmdir($internalPath);


//enforce reload of the mount points //enforce reload of the mount points
/** /**
* @var \OCP\Files\Storage $sharedStorage * @var \OCP\Files\Storage $sharedStorage
*/ */
list($sharedStorage,) = $view->resolvePath($this->folder);
[$sharedStorage,] = $view->resolvePath($this->folder);
$this->assertTrue($sharedStorage->instanceOfStorage('OCA\Files_Sharing\ISharedStorage')); $this->assertTrue($sharedStorage->instanceOfStorage('OCA\Files_Sharing\ISharedStorage'));


$sourceStorage = new \OC\Files\Storage\Temporary([]); $sourceStorage = new \OC\Files\Storage\Temporary([]);
/** /**
* @var \OCP\Files\Storage $sharedStorage * @var \OCP\Files\Storage $sharedStorage
*/ */
list($sharedStorage,) = $view->resolvePath($this->folder);
[$sharedStorage,] = $view->resolvePath($this->folder);
$this->assertTrue($sharedStorage->instanceOfStorage('OCA\Files_Sharing\ISharedStorage')); $this->assertTrue($sharedStorage->instanceOfStorage('OCA\Files_Sharing\ISharedStorage'));


$sourceStorage = new \OC\Files\Storage\Temporary([]); $sourceStorage = new \OC\Files\Storage\Temporary([]);

+ 2
- 2
apps/files_sharing/tests/WatcherTest.php View File

$this->view->mkdir('container/shareddir'); $this->view->mkdir('container/shareddir');
$this->view->mkdir('container/shareddir/subdir'); $this->view->mkdir('container/shareddir/subdir');


list($this->ownerStorage, $internalPath) = $this->view->resolvePath('');
[$this->ownerStorage, $internalPath] = $this->view->resolvePath('');
$this->ownerCache = $this->ownerStorage->getCache(); $this->ownerCache = $this->ownerStorage->getCache();
$this->ownerStorage->getScanner()->scan(''); $this->ownerStorage->getScanner()->scan('');




// retrieve the shared storage // retrieve the shared storage
$secondView = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER2); $secondView = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER2);
list($this->sharedStorage, $internalPath) = $secondView->resolvePath('files/shareddir');
[$this->sharedStorage, $internalPath] = $secondView->resolvePath('files/shareddir');
$this->sharedCache = $this->sharedStorage->getCache(); $this->sharedCache = $this->sharedStorage->getCache();
} }



+ 1
- 1
apps/files_trashbin/lib/Sabre/RootCollection.php View File

* @return INode * @return INode
*/ */
public function getChildForPrincipal(array $principalInfo): TrashHome { public function getChildForPrincipal(array $principalInfo): TrashHome {
list(, $name) = \Sabre\Uri\split($principalInfo['uri']);
[, $name] = \Sabre\Uri\split($principalInfo['uri']);
$user = \OC::$server->getUserSession()->getUser(); $user = \OC::$server->getUserSession()->getUser();
if (is_null($user) || $name !== $user->getUID()) { if (is_null($user) || $name !== $user->getUID()) {
throw new \Sabre\DAV\Exception\Forbidden(); throw new \Sabre\DAV\Exception\Forbidden();

+ 1
- 1
apps/files_trashbin/lib/Sabre/TrashHome.php View File

} }


public function getName(): string { public function getName(): string {
list(, $name) = \Sabre\Uri\split($this->principalInfo['uri']);
[, $name] = \Sabre\Uri\split($this->principalInfo['uri']);
return $name; return $name;
} }



+ 2
- 2
apps/files_trashbin/tests/TrashbinTest.php View File

$manipulatedList = $this->manipulateDeleteTime($filesInTrash, $this->trashRoot1, $expiredDate); $manipulatedList = $this->manipulateDeleteTime($filesInTrash, $this->trashRoot1, $expiredDate);


$testClass = new TrashbinForTesting(); $testClass = new TrashbinForTesting();
list($sizeOfDeletedFiles, $count) = $testClass->dummyDeleteExpiredFiles($manipulatedList, $expireAt);
[$sizeOfDeletedFiles, $count] = $testClass->dummyDeleteExpiredFiles($manipulatedList, $expireAt);


$this->assertSame(10, $sizeOfDeletedFiles); $this->assertSame(10, $sizeOfDeletedFiles);
$this->assertSame(2, $count); $this->assertSame(2, $count);
$trashedFile = $filesInTrash[0]; $trashedFile = $filesInTrash[0];


// delete source folder // delete source folder
list($storage, $internalPath) = $this->rootView->resolvePath('/' . self::TEST_TRASHBIN_USER1 . '/files/folder');
[$storage, $internalPath] = $this->rootView->resolvePath('/' . self::TEST_TRASHBIN_USER1 . '/files/folder');
if ($storage instanceof \OC\Files\Storage\Local) { if ($storage instanceof \OC\Files\Storage\Local) {
$folderAbsPath = $storage->getSourcePath($internalPath); $folderAbsPath = $storage->getSourcePath($internalPath);
// make folder read-only // make folder read-only

+ 1
- 1
apps/files_versions/lib/Sabre/RootCollection.php View File

* @return INode * @return INode
*/ */
public function getChildForPrincipal(array $principalInfo) { public function getChildForPrincipal(array $principalInfo) {
list(, $name) = \Sabre\Uri\split($principalInfo['uri']);
[, $name] = \Sabre\Uri\split($principalInfo['uri']);
$user = \OC::$server->getUserSession()->getUser(); $user = \OC::$server->getUserSession()->getUser();
if (is_null($user) || $name !== $user->getUID()) { if (is_null($user) || $name !== $user->getUID()) {
throw new \Sabre\DAV\Exception\Forbidden(); throw new \Sabre\DAV\Exception\Forbidden();

+ 1
- 1
apps/files_versions/lib/Sabre/VersionHome.php View File

} }


private function getUser() { private function getUser() {
list(, $name) = \Sabre\Uri\split($this->principalInfo['uri']);
[, $name] = \Sabre\Uri\split($this->principalInfo['uri']);
$user = $this->userManager->get($name); $user = $this->userManager->get($name);
if (!$user) { if (!$user) {
throw new NoUserException(); throw new NoUserException();

+ 12
- 12
apps/files_versions/lib/Storage.php View File

* @param string $source source path * @param string $source source path
*/ */
public static function setSourcePathAndUser($source) { public static function setSourcePathAndUser($source) {
list($uid, $path) = self::getUidAndFilename($source);
[$uid, $path] = self::getUidAndFilename($source);
self::$sourcePathAndUser[$source] = ['uid' => $uid, 'path' => $path]; self::$sourcePathAndUser[$source] = ['uid' => $uid, 'path' => $path];
} }


return false; return false;
} }


list($uid, $filename) = self::getUidAndFilename($filename);
[$uid, $filename] = self::getUidAndFilename($filename);


$files_view = new View('/'.$uid .'/files'); $files_view = new View('/'.$uid .'/files');


* @param string $path * @param string $path
*/ */
public static function markDeletedFile($path) { public static function markDeletedFile($path) {
list($uid, $filename) = self::getUidAndFilename($path);
[$uid, $filename] = self::getUidAndFilename($path);
self::$deletedFiles[$path] = [ self::$deletedFiles[$path] = [
'uid' => $uid, 'uid' => $uid,
'filename' => $filename]; 'filename' => $filename];
* @var \OC\Files\Storage\Storage $storage * @var \OC\Files\Storage\Storage $storage
* @var string $internalPath * @var string $internalPath
*/ */
list($storage, $internalPath) = $view->resolvePath($path);
[$storage, $internalPath] = $view->resolvePath($path);
$cache = $storage->getCache($internalPath); $cache = $storage->getCache($internalPath);
$cache->remove($internalPath); $cache->remove($internalPath);
} }
* @param string $operation can be 'copy' or 'rename' * @param string $operation can be 'copy' or 'rename'
*/ */
public static function renameOrCopy($sourcePath, $targetPath, $operation) { public static function renameOrCopy($sourcePath, $targetPath, $operation) {
list($sourceOwner, $sourcePath) = self::getSourcePathAndUser($sourcePath);
[$sourceOwner, $sourcePath] = self::getSourcePathAndUser($sourcePath);


// it was a upload of a existing file if no old path exists // it was a upload of a existing file if no old path exists
// in this case the pre-hook already called the store method and we can // in this case the pre-hook already called the store method and we can
return true; return true;
} }


list($targetOwner, $targetPath) = self::getUidAndFilename($targetPath);
[$targetOwner, $targetPath] = self::getUidAndFilename($targetPath);


$sourcePath = ltrim($sourcePath, '/'); $sourcePath = ltrim($sourcePath, '/');
$targetPath = ltrim($targetPath, '/'); $targetPath = ltrim($targetPath, '/');
*/ */
private static function copyFileContents($view, $path1, $path2) { private static function copyFileContents($view, $path1, $path2) {
/** @var \OC\Files\Storage\Storage $storage1 */ /** @var \OC\Files\Storage\Storage $storage1 */
list($storage1, $internalPath1) = $view->resolvePath($path1);
[$storage1, $internalPath1] = $view->resolvePath($path1);
/** @var \OC\Files\Storage\Storage $storage2 */ /** @var \OC\Files\Storage\Storage $storage2 */
list($storage2, $internalPath2) = $view->resolvePath($path2);
[$storage2, $internalPath2] = $view->resolvePath($path2);


$view->lockFile($path1, ILockingProvider::LOCK_EXCLUSIVE); $view->lockFile($path1, ILockingProvider::LOCK_EXCLUSIVE);
$view->lockFile($path2, ILockingProvider::LOCK_EXCLUSIVE); $view->lockFile($path2, ILockingProvider::LOCK_EXCLUSIVE);
if ($storage1->instanceOfStorage('\OC\Files\ObjectStore\ObjectStoreStorage') || $storage2->instanceOfStorage('\OC\Files\ObjectStore\ObjectStoreStorage')) { if ($storage1->instanceOfStorage('\OC\Files\ObjectStore\ObjectStoreStorage') || $storage2->instanceOfStorage('\OC\Files\ObjectStore\ObjectStoreStorage')) {
$source = $storage1->fopen($internalPath1, 'r'); $source = $storage1->fopen($internalPath1, 'r');
$target = $storage2->fopen($internalPath2, 'w'); $target = $storage2->fopen($internalPath2, 'w');
list(, $result) = \OC_Helper::streamCopy($source, $target);
[, $result] = \OC_Helper::streamCopy($source, $target);
fclose($source); fclose($source);
fclose($target); fclose($target);


$expiration = self::getExpiration(); $expiration = self::getExpiration();


if ($expiration->shouldAutoExpire()) { if ($expiration->shouldAutoExpire()) {
list($toDelete, $size) = self::getAutoExpireList($time, $versions);
[$toDelete, $size] = self::getAutoExpireList($time, $versions);
} else { } else {
$size = 0; $size = 0;
$toDelete = []; // versions we want to delete $toDelete = []; // versions we want to delete
$allVersions = Storage::getVersions($uid, $filename); $allVersions = Storage::getVersions($uid, $filename);


$time = time(); $time = time();
list($toDelete, $sizeOfDeletedVersions) = self::getExpireList($time, $allVersions, $availableSpace <= 0);
[$toDelete, $sizeOfDeletedVersions] = self::getExpireList($time, $allVersions, $availableSpace <= 0);


$availableSpace = $availableSpace + $sizeOfDeletedVersions; $availableSpace = $availableSpace + $sizeOfDeletedVersions;
$versionsSize = $versionsSize - $sizeOfDeletedVersions; $versionsSize = $versionsSize - $sizeOfDeletedVersions;
$allVersions = $result['all']; $allVersions = $result['all'];


foreach ($result['by_file'] as $versions) { foreach ($result['by_file'] as $versions) {
list($toDeleteNew, $size) = self::getExpireList($time, $versions, $availableSpace <= 0);
[$toDeleteNew, $size] = self::getExpireList($time, $versions, $availableSpace <= 0);
$toDelete = array_merge($toDelete, $toDeleteNew); $toDelete = array_merge($toDelete, $toDeleteNew);
$sizeOfDeletedVersions += $size; $sizeOfDeletedVersions += $size;
} }

+ 1
- 1
apps/settings/lib/Controller/UsersController.php View File

); );


$groupsInfo->setSorting($sortGroupsBy); $groupsInfo->setSorting($sortGroupsBy);
list($adminGroup, $groups) = $groupsInfo->get();
[$adminGroup, $groups] = $groupsInfo->get();


if (!$isLDAPUsed && $this->appManager->isEnabledForUser('user_ldap')) { if (!$isLDAPUsed && $this->appManager->isEnabledForUser('user_ldap')) {
$isLDAPUsed = (bool)array_reduce($this->userManager->getBackends(), function ($ldapFound, $backend) { $isLDAPUsed = (bool)array_reduce($this->userManager->getBackends(), function ($ldapFound, $backend) {

+ 1
- 1
apps/systemtags/lib/Activity/Provider.php View File

protected function getSystemTagParameter($parameter) { protected function getSystemTagParameter($parameter) {
$tagData = json_decode($parameter, true); $tagData = json_decode($parameter, true);
if ($tagData === null) { if ($tagData === null) {
list($name, $status) = explode('|||', substr($parameter, 3, -3));
[$name, $status] = explode('|||', substr($parameter, 3, -3));
$tagData = [ $tagData = [
'id' => 0,// No way to recover the ID 'id' => 0,// No way to recover the ID
'name' => $name, 'name' => $name,

+ 2
- 2
apps/theming/lib/Util.php View File

* @return float * @return float
*/ */
public function calculateLuminance($color) { public function calculateLuminance($color) {
list($red, $green, $blue) = $this->hexToRGB($color);
[$red, $green, $blue] = $this->hexToRGB($color);
$compiler = new Compiler(); $compiler = new Compiler();
$hsl = $compiler->toHSL($red, $green, $blue); $hsl = $compiler->toHSL($red, $green, $blue);
return $hsl[3] / 100; return $hsl[3] / 100;
* @return float * @return float
*/ */
public function calculateLuma($color) { public function calculateLuma($color) {
list($red, $green, $blue) = $this->hexToRGB($color);
[$red, $green, $blue] = $this->hexToRGB($color);
return (0.2126 * $red + 0.7152 * $green + 0.0722 * $blue) / 255; return (0.2126 * $red + 0.7152 * $green + 0.0722 * $blue) / 255;
} }



+ 2
- 2
apps/user_ldap/lib/Access.php View File

if ($search === false) { if ($search === false) {
return $counter > 0 ? $counter : false; return $counter > 0 ? $counter : false;
} }
list($sr, $pagedSearchOK) = $search;
[$sr, $pagedSearchOK] = $search;


/* ++ Fixing RHDS searches with pages with zero results ++ /* ++ Fixing RHDS searches with pages with zero results ++
* countEntriesInSearchResults() method signature changed * countEntriesInSearchResults() method signature changed
if ($search === false) { if ($search === false) {
return []; return [];
} }
list($sr, $pagedSearchOK) = $search;
[$sr, $pagedSearchOK] = $search;
$cr = $this->connection->getConnectionResource(); $cr = $this->connection->getConnectionResource();


if ($skipHandling) { if ($skipHandling) {

+ 1
- 1
apps/user_ldap/lib/Controller/RenewPasswordController.php View File

$errors = []; $errors = [];
$messages = []; $messages = [];
if (is_array($renewPasswordMessages)) { if (is_array($renewPasswordMessages)) {
list($errors, $messages) = $renewPasswordMessages;
[$errors, $messages] = $renewPasswordMessages;
} }
$this->session->remove('renewPasswordMessages'); $this->session->remove('renewPasswordMessages');
foreach ($errors as $value) { foreach ($errors as $value) {

+ 4
- 4
apps/user_ldap/tests/AccessTest.php View File

* @param array $case * @param array $case
*/ */
public function testStringResemblesDN($case) { public function testStringResemblesDN($case) {
list($lw, $con, $um, $helper) = $this->getConnectorAndLdapMock();
[$lw, $con, $um, $helper] = $this->getConnectorAndLdapMock();
/** @var IConfig|\PHPUnit\Framework\MockObject\MockObject $config */ /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject $config */
$config = $this->createMock(IConfig::class); $config = $this->createMock(IConfig::class);
$access = new Access($con, $lw, $um, $helper, $config, $this->ncUserManager); $access = new Access($con, $lw, $um, $helper, $config, $this->ncUserManager);
* @param $case * @param $case
*/ */
public function testStringResemblesDNLDAPmod($case) { public function testStringResemblesDNLDAPmod($case) {
list(, $con, $um, $helper) = $this->getConnectorAndLdapMock();
[, $con, $um, $helper] = $this->getConnectorAndLdapMock();
/** @var IConfig|\PHPUnit\Framework\MockObject\MockObject $config */ /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject $config */
$config = $this->createMock(IConfig::class); $config = $this->createMock(IConfig::class);
$lw = new LDAP(); $lw = new LDAP();
* @param $attribute * @param $attribute
*/ */
public function testSanitizeDN($attribute) { public function testSanitizeDN($attribute) {
list($lw, $con, $um, $helper) = $this->getConnectorAndLdapMock();
[$lw, $con, $um, $helper] = $this->getConnectorAndLdapMock();
/** @var IConfig|\PHPUnit\Framework\MockObject\MockObject $config */ /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject $config */
$config = $this->createMock(IConfig::class); $config = $this->createMock(IConfig::class);


} }


public function testFetchListOfGroupsKnown() { public function testFetchListOfGroupsKnown() {
$filter = 'objectClass=nextcloudGroup';
$filter = 'objectClass=nextcloudGroup';
$attributes = ['cn', 'gidNumber', 'dn']; $attributes = ['cn', 'gidNumber', 'dn'];
$base = 'ou=SomeGroups,dc=my,dc=directory'; $base = 'ou=SomeGroups,dc=my,dc=directory';



+ 10
- 10
apps/user_ldap/tests/Mapping/AbstractMappingTest.php View File

* Hint: successful mapping is tested inherently with mapEntries(). * Hint: successful mapping is tested inherently with mapEntries().
*/ */
public function testMap() { public function testMap() {
list($mapper, $data) = $this->initTest();
[$mapper, $data] = $this->initTest();


// test that mapping will not happen when it shall not // test that mapping will not happen when it shall not
$tooLongDN = 'uid=joann,ou=Secret Small Specialized Department,ou=Some Tremendously Important Department,ou=Another Very Important Department,ou=Pretty Meaningful Derpartment,ou=Quite Broad And General Department,ou=The Topmost Department,dc=hugelysuccessfulcompany,dc=com'; $tooLongDN = 'uid=joann,ou=Secret Small Specialized Department,ou=Some Tremendously Important Department,ou=Another Very Important Department,ou=Pretty Meaningful Derpartment,ou=Quite Broad And General Department,ou=The Topmost Department,dc=hugelysuccessfulcompany,dc=com';
* mapping entries * mapping entries
*/ */
public function testUnmap() { public function testUnmap() {
list($mapper, $data) = $this->initTest();
[$mapper, $data] = $this->initTest();


foreach ($data as $entry) { foreach ($data as $entry) {
$result = $mapper->unmap($entry['name']); $result = $mapper->unmap($entry['name']);
* and unsuccessful requests. * and unsuccessful requests.
*/ */
public function testGetMethods() { public function testGetMethods() {
list($mapper, $data) = $this->initTest();
[$mapper, $data] = $this->initTest();


foreach ($data as $entry) { foreach ($data as $entry) {
$fdn = $mapper->getDNByName($entry['name']); $fdn = $mapper->getDNByName($entry['name']);
* tests getNamesBySearch() for successful and unsuccessful requests. * tests getNamesBySearch() for successful and unsuccessful requests.
*/ */
public function testSearch() { public function testSearch() {
list($mapper,) = $this->initTest();
[$mapper,] = $this->initTest();


$names = $mapper->getNamesBySearch('oo', '%', '%'); $names = $mapper->getNamesBySearch('oo', '%', '%');
$this->assertTrue(is_array($names)); $this->assertTrue(is_array($names));
* tests setDNbyUUID() for successful and unsuccessful update. * tests setDNbyUUID() for successful and unsuccessful update.
*/ */
public function testSetDNMethod() { public function testSetDNMethod() {
list($mapper, $data) = $this->initTest();
[$mapper, $data] = $this->initTest();


$newDN = 'uid=modified,dc=example,dc=org'; $newDN = 'uid=modified,dc=example,dc=org';
$done = $mapper->setDNbyUUID($newDN, $data[0]['uuid']); $done = $mapper->setDNbyUUID($newDN, $data[0]['uuid']);
*/ */
public function testSetUUIDMethod() { public function testSetUUIDMethod() {
/** @var AbstractMapping $mapper */ /** @var AbstractMapping $mapper */
list($mapper, $data) = $this->initTest();
[$mapper, $data] = $this->initTest();


$newUUID = 'ABC737-DEF754'; $newUUID = 'ABC737-DEF754';


* tests clear() for successful update. * tests clear() for successful update.
*/ */
public function testClear() { public function testClear() {
list($mapper, $data) = $this->initTest();
[$mapper, $data] = $this->initTest();


$done = $mapper->clear(); $done = $mapper->clear();
$this->assertTrue($done); $this->assertTrue($done);
* tests clear() for successful update. * tests clear() for successful update.
*/ */
public function testClearCb() { public function testClearCb() {
list($mapper, $data) = $this->initTest();
[$mapper, $data] = $this->initTest();


$callbackCalls = 0; $callbackCalls = 0;
$test = $this; $test = $this;
* tests getList() method * tests getList() method
*/ */
public function testList() { public function testList() {
list($mapper, $data) = $this->initTest();
[$mapper, $data] = $this->initTest();


// get all entries without specifying offset or limit // get all entries without specifying offset or limit
$results = $mapper->getList(); $results = $mapper->getList();


public function testGetListOfIdsByDn() { public function testGetListOfIdsByDn() {
/** @var AbstractMapping $mapper */ /** @var AbstractMapping $mapper */
list($mapper,) = $this->initTest();
[$mapper,] = $this->initTest();


$listOfDNs = []; $listOfDNs = [];
for ($i = 0; $i < 66640; $i++) { for ($i = 0; $i < 66640; $i++) {

+ 7
- 7
apps/user_ldap/tests/WizardTest.php View File

} }


public function testCumulativeSearchOnAttributeLimited() { public function testCumulativeSearchOnAttributeLimited() {
list($wizard, $configuration, $ldap) = $this->getWizardAndMocks();
[$wizard, $configuration, $ldap] = $this->getWizardAndMocks();


$configuration->expects($this->any()) $configuration->expects($this->any())
->method('__get') ->method('__get')
} }


public function testCumulativeSearchOnAttributeUnlimited() { public function testCumulativeSearchOnAttributeUnlimited() {
list($wizard, $configuration, $ldap) = $this->getWizardAndMocks();
[$wizard, $configuration, $ldap] = $this->getWizardAndMocks();


$configuration->expects($this->any()) $configuration->expects($this->any())
->method('__get') ->method('__get')
} }


public function testDetectEmailAttributeAlreadySet() { public function testDetectEmailAttributeAlreadySet() {
list($wizard, $configuration, $ldap, $access)
[$wizard, $configuration, $ldap, $access]
= $this->getWizardAndMocks(); = $this->getWizardAndMocks();


$configuration->expects($this->any()) $configuration->expects($this->any())
} }


public function testDetectEmailAttributeOverrideSet() { public function testDetectEmailAttributeOverrideSet() {
list($wizard, $configuration, $ldap, $access)
[$wizard, $configuration, $ldap, $access]
= $this->getWizardAndMocks(); = $this->getWizardAndMocks();


$configuration->expects($this->any()) $configuration->expects($this->any())
} }


public function testDetectEmailAttributeFind() { public function testDetectEmailAttributeFind() {
list($wizard, $configuration, $ldap, $access)
[$wizard, $configuration, $ldap, $access]
= $this->getWizardAndMocks(); = $this->getWizardAndMocks();


$configuration->expects($this->any()) $configuration->expects($this->any())
} }


public function testDetectEmailAttributeFindNothing() { public function testDetectEmailAttributeFindNothing() {
list($wizard, $configuration, $ldap, $access)
[$wizard, $configuration, $ldap, $access]
= $this->getWizardAndMocks(); = $this->getWizardAndMocks();


$configuration->expects($this->any()) $configuration->expects($this->any())
public function testCumulativeSearchOnAttributeSkipReadDN() { public function testCumulativeSearchOnAttributeSkipReadDN() {
// tests that there is no infinite loop, when skipping already processed // tests that there is no infinite loop, when skipping already processed
// DNs (they can be returned multiple times for multiple filters ) // DNs (they can be returned multiple times for multiple filters )
list($wizard, $configuration, $ldap) = $this->getWizardAndMocks();
[$wizard, $configuration, $ldap] = $this->getWizardAndMocks();


$configuration->expects($this->any()) $configuration->expects($this->any())
->method('__get') ->method('__get')

+ 2
- 2
apps/workflowengine/lib/Check/RequestTime.php View File

* @return int * @return int
*/ */
protected function getTimestamp($currentTimestamp, $value) { protected function getTimestamp($currentTimestamp, $value) {
list($time1, $timezone1) = explode(' ', $value);
list($hour1, $minute1) = explode(':', $time1);
[$time1, $timezone1] = explode(' ', $value);
[$hour1, $minute1] = explode(':', $time1);
$date1 = new \DateTime('now', new \DateTimeZone($timezone1)); $date1 = new \DateTime('now', new \DateTimeZone($timezone1));
$date1->setTimestamp($currentTimestamp); $date1->setTimestamp($currentTimestamp);
$date1->setTime($hour1, $minute1); $date1->setTime($hour1, $minute1);

+ 1
- 1
apps/workflowengine/lib/Service/RuleMatcher.php View File

$checkInstance->setFileInfo($this->fileInfo['storage'], $this->fileInfo['path'], $this->fileInfo['isDir']); $checkInstance->setFileInfo($this->fileInfo['storage'], $this->fileInfo['path'], $this->fileInfo['isDir']);
} elseif ($checkInstance instanceof IEntityCheck) { } elseif ($checkInstance instanceof IEntityCheck) {
foreach ($this->contexts as $entityInfo) { foreach ($this->contexts as $entityInfo) {
list($entity, $subject) = $entityInfo;
[$entity, $subject] = $entityInfo;
$checkInstance->setEntitySubject($entity, $subject); $checkInstance->setEntitySubject($entity, $subject);
} }
} elseif (!$checkInstance instanceof ICheck) { } elseif (!$checkInstance instanceof ICheck) {

+ 1
- 1
build/integration/features/bootstrap/Avatar.php View File

* @param string size * @param string size
*/ */
public function lastAvatarIsASquareOfSize(string $size) { public function lastAvatarIsASquareOfSize(string $size) {
list($width, $height) = getimagesizefromstring($this->lastAvatar);
[$width, $height] = getimagesizefromstring($this->lastAvatar);


Assert::assertEquals($width, $height, 'Avatar is not a square'); Assert::assertEquals($width, $height, 'Avatar is not a square');
Assert::assertEquals($size, $width); Assert::assertEquals($size, $width);

+ 1
- 1
build/license.php View File

if (strpos($entry, '> ') === false) { if (strpos($entry, '> ') === false) {
$this->mailMap[$entry] = $entry; $this->mailMap[$entry] = $entry;
} else { } else {
list($use, $actual) = explode('> ', $entry);
[$use, $actual] = explode('> ', $entry);
$this->mailMap[$actual] = $use . '>'; $this->mailMap[$actual] = $use . '>';
} }
} }

+ 1
- 1
build/psalm/AppFrameworkTainter.php View File

if ($stmt->isPublic() && !$stmt->isMagic()) { if ($stmt->isPublic() && !$stmt->isMagic()) {
foreach ($stmt->params as $i => $param) { foreach ($stmt->params as $i => $param) {
$expr_type = new Psalm\Type\Union([new Psalm\Type\Atomic\TString()]); $expr_type = new Psalm\Type\Union([new Psalm\Type\Atomic\TString()]);
$expr_identifier = (strtolower($statements_source->getFQCLN()) . '::' . strtolower($classlike_storage->cased_name) . '#' . ($i+1));
$expr_identifier = (strtolower($statements_source->getFQCLN()) . '::' . strtolower($classlike_storage->cased_name) . '#' . ($i + 1));


if ($expr_type) { if ($expr_type) {
$codebase->addTaintSource( $codebase->addTaintSource(

+ 1
- 1
composer.json View File

"ext-xmlreader": "*" "ext-xmlreader": "*"
}, },
"require-dev": { "require-dev": {
"nextcloud/coding-standard": "^0.3.0",
"nextcloud/coding-standard": "^0.5.0",
"vimeo/psalm": "^4.0" "vimeo/psalm": "^4.0"
}, },
"scripts": { "scripts": {

+ 185
- 243
composer.lock
File diff suppressed because it is too large
View File


+ 1
- 1
core/Command/L10n/CreateJs.php View File

} }


private function writeFiles($app, $path, $lang, OutputInterface $output) { private function writeFiles($app, $path, $lang, OutputInterface $output) {
list($translations, $plurals) = $this->loadTranslations($path, $lang);
[$translations, $plurals] = $this->loadTranslations($path, $lang);
$this->writeJsFile($app, $path, $lang, $output, $translations, $plurals); $this->writeJsFile($app, $path, $lang, $output, $translations, $plurals);
$this->writeJsonFile($path, $lang, $output, $translations, $plurals); $this->writeJsonFile($path, $lang, $output, $translations, $plurals);
} }

+ 1
- 1
core/Command/TwoFactorAuth/State.php View File



$providerStates = $this->registry->getProviderStates($user); $providerStates = $this->registry->getProviderStates($user);
$filtered = $this->filterEnabledDisabledUnknownProviders($providerStates); $filtered = $this->filterEnabledDisabledUnknownProviders($providerStates);
list($enabled, $disabled) = $filtered;
[$enabled, $disabled] = $filtered;


if (!empty($enabled)) { if (!empty($enabled)) {
$output->writeln("Two-factor authentication is enabled for user $uid"); $output->writeln("Two-factor authentication is enabled for user $uid");

+ 1
- 1
core/Controller/LoginController.php View File



$loginMessages = $this->session->get('loginMessages'); $loginMessages = $this->session->get('loginMessages');
if (is_array($loginMessages)) { if (is_array($loginMessages)) {
list($errors, $messages) = $loginMessages;
[$errors, $messages] = $loginMessages;
$this->initialStateService->provideInitialState('core', 'loginMessages', $messages); $this->initialStateService->provideInitialState('core', 'loginMessages', $messages);
$this->initialStateService->provideInitialState('core', 'loginErrors', $errors); $this->initialStateService->provideInitialState('core', 'loginErrors', $errors);
} }

+ 1
- 1
core/Controller/OCSController.php View File

*/ */
public function getCapabilities() { public function getCapabilities() {
$result = []; $result = [];
list($major, $minor, $micro) = \OCP\Util::getVersion();
[$major, $minor, $micro] = \OCP\Util::getVersion();
$result['version'] = [ $result['version'] = [
'major' => $major, 'major' => $major,
'minor' => $minor, 'minor' => $minor,

+ 1
- 1
core/Controller/TwoFactorChallengeController.php View File

$user = $this->userSession->getUser(); $user = $this->userSession->getUser();
$providerSet = $this->twoFactorManager->getProviderSet($user); $providerSet = $this->twoFactorManager->getProviderSet($user);
$allProviders = $providerSet->getProviders(); $allProviders = $providerSet->getProviders();
list($providers, $backupProvider) = $this->splitProvidersAndBackupCodes($allProviders);
[$providers, $backupProvider] = $this->splitProvidersAndBackupCodes($allProviders);
$setupProviders = $this->twoFactorManager->getLoginSetupProviders($user); $setupProviders = $this->twoFactorManager->getLoginSetupProviders($user);


$data = [ $data = [

+ 1
- 1
lib/autoloader.php View File

} elseif (strpos($class, 'OC_') === 0) { } elseif (strpos($class, 'OC_') === 0) {
$paths[] = \OC::$SERVERROOT . '/lib/private/legacy/' . strtolower(str_replace('_', '/', substr($class, 3)) . '.php'); $paths[] = \OC::$SERVERROOT . '/lib/private/legacy/' . strtolower(str_replace('_', '/', substr($class, 3)) . '.php');
} elseif (strpos($class, 'OCA\\') === 0) { } elseif (strpos($class, 'OCA\\') === 0) {
list(, $app, $rest) = explode('\\', $class, 3);
[, $app, $rest] = explode('\\', $class, 3);
$app = strtolower($app); $app = strtolower($app);
$appPath = \OC_App::getAppPath($app); $appPath = \OC_App::getAppPath($app);
if ($appPath && stream_resolve_include_path($appPath)) { if ($appPath && stream_resolve_include_path($appPath)) {

+ 1
- 1
lib/private/Activity/EventMerger.php View File



// Other parameters are not the same => can not combine // Other parameters are not the same => can not combine
try { try {
list($combined, $parameters) = $this->combineParameters($mergeParameter, $event, $previousEvent);
[$combined, $parameters] = $this->combineParameters($mergeParameter, $event, $previousEvent);
} catch (\UnexpectedValueException $e) { } catch (\UnexpectedValueException $e) {
return $event; return $event;
} }

+ 1
- 1
lib/private/App/DependencyAnalyzer.php View File

// version string but null. In case one parameter is null normalization // version string but null. In case one parameter is null normalization
// will therefore be skipped // will therefore be skipped
if ($first !== null && $second !== null) { if ($first !== null && $second !== null) {
list($first, $second) = $this->normalizeVersions($first, $second);
[$first, $second] = $this->normalizeVersions($first, $second);
} }


return version_compare($first, $second, $operator); return version_compare($first, $second, $operator);

+ 3
- 3
lib/private/AppFramework/App.php View File

/** @var Dispatcher $dispatcher */ /** @var Dispatcher $dispatcher */
$dispatcher = $container['Dispatcher']; $dispatcher = $container['Dispatcher'];


list(
[
$httpHeaders, $httpHeaders,
$responseHeaders, $responseHeaders,
$responseCookies, $responseCookies,
$output, $output,
$response $response
) = $dispatcher->dispatch($controller, $methodName);
] = $dispatcher->dispatch($controller, $methodName);


$io = $container[IOutput::class]; $io = $container[IOutput::class];




$dispatcher = $container['Dispatcher']; $dispatcher = $container['Dispatcher'];


list(, , $output) = $dispatcher->dispatch($controller, $methodName);
[, , $output] = $dispatcher->dispatch($controller, $methodName);
return $output; return $output;
} }
} }

+ 1
- 1
lib/private/AppFramework/Http/Request.php View File



// strip off the script name's dir and file name // strip off the script name's dir and file name
// FIXME: Sabre does not really belong here // FIXME: Sabre does not really belong here
list($path, $name) = \Sabre\Uri\split($scriptName);
[$path, $name] = \Sabre\Uri\split($scriptName);
if (!empty($path)) { if (!empty($path)) {
if ($path === $pathInfo || strpos($pathInfo, $path.'/') === 0) { if ($path === $pathInfo || strpos($pathInfo, $path.'/') === 0) {
$pathInfo = substr($pathInfo, \strlen($path)); $pathInfo = substr($pathInfo, \strlen($path));

+ 1
- 1
lib/private/AppFramework/Routing/RouteConfig.php View File

if (count($split) !== 2) { if (count($split) !== 2) {
throw new \UnexpectedValueException('Invalid route name'); throw new \UnexpectedValueException('Invalid route name');
} }
list($controller, $action) = $split;
[$controller, $action] = $split;


$controllerName = $this->buildControllerName($controller); $controllerName = $this->buildControllerName($controller);
$actionName = $this->buildActionName($action); $actionName = $this->buildActionName($action);

+ 1
- 1
lib/private/AppFramework/Routing/RouteParser.php View File

if (count($split) !== 2) { if (count($split) !== 2) {
throw new \UnexpectedValueException('Invalid route name'); throw new \UnexpectedValueException('Invalid route name');
} }
list($controller, $action) = $split;
[$controller, $action] = $split;


$controllerName = $this->buildControllerName($controller); $controllerName = $this->buildControllerName($controller);
$actionName = $this->buildActionName($action); $actionName = $this->buildActionName($action);

+ 1
- 1
lib/private/AppFramework/Utility/ControllerMethodReflector.php View File

$cutString = str_replace(' ', '', $cutString); $cutString = str_replace(' ', '', $cutString);
$splittedArray = explode(',', $cutString); $splittedArray = explode(',', $cutString);
foreach ($splittedArray as $annotationValues) { foreach ($splittedArray as $annotationValues) {
list($key, $value) = explode('=', $annotationValues);
[$key, $value] = explode('=', $annotationValues);
$this->annotations[$annontation][$key] = $value; $this->annotations[$annontation][$key] = $value;
} }
continue; continue;

+ 1
- 1
lib/private/Avatar/Avatar.php View File

$font = __DIR__ . '/../../../core/fonts/NotoSans-Regular.ttf'; $font = __DIR__ . '/../../../core/fonts/NotoSans-Regular.ttf';


$fontSize = $size * 0.4; $fontSize = $size * 0.4;
list($x, $y) = $this->imageTTFCenter(
[$x, $y] = $this->imageTTFCenter(
$im, $text, $font, (int)$fontSize $im, $text, $font, (int)$fontSize
); );



+ 1
- 1
lib/private/Collaboration/Collaborators/RemoteGroupPlugin.php View File

$resultType = new SearchResultType('remote_groups'); $resultType = new SearchResultType('remote_groups');


if ($this->enabled && $this->cloudIdManager->isValidCloudId($search) && $offset === 0) { if ($this->enabled && $this->cloudIdManager->isValidCloudId($search) && $offset === 0) {
list($remoteGroup, $serverUrl) = $this->splitGroupRemote($search);
[$remoteGroup, $serverUrl] = $this->splitGroupRemote($search);
$result['exact'][] = [ $result['exact'][] = [
'label' => $remoteGroup . " ($serverUrl)", 'label' => $remoteGroup . " ($serverUrl)",
'guid' => $remoteGroup, 'guid' => $remoteGroup,

+ 2
- 2
lib/private/Collaboration/Collaborators/RemotePlugin.php View File

$cloudIdType = $cloudIdData['type']; $cloudIdType = $cloudIdData['type'];
} }
try { try {
list($remoteUser, $serverUrl) = $this->splitUserRemote($cloudId);
[$remoteUser, $serverUrl] = $this->splitUserRemote($cloudId);
} catch (\InvalidArgumentException $e) { } catch (\InvalidArgumentException $e) {
continue; continue;
} }
*/ */
if (!$searchResult->hasExactIdMatch($resultType) && $this->cloudIdManager->isValidCloudId($search) && $offset === 0) { if (!$searchResult->hasExactIdMatch($resultType) && $this->cloudIdManager->isValidCloudId($search) && $offset === 0) {
try { try {
list($remoteUser, $serverUrl) = $this->splitUserRemote($search);
[$remoteUser, $serverUrl] = $this->splitUserRemote($search);
$localUser = $this->userManager->get($remoteUser); $localUser = $this->userManager->get($remoteUser);
if ($localUser === null || $search !== $localUser->getCloudId()) { if ($localUser === null || $search !== $localUser->getCloudId()) {
$result['exact'][] = [ $result['exact'][] = [

+ 1
- 1
lib/private/DB/QueryBuilder/QuoteHelper.php View File

} }


if (substr_count($string, '.')) { if (substr_count($string, '.')) {
list($alias, $columnName) = explode('.', $string, 2);
[$alias, $columnName] = explode('.', $string, 2);


if ($columnName === '*') { if ($columnName === '*') {
return '`' . $alias . '`.*'; return '`' . $alias . '`.*';

+ 1
- 1
lib/private/Encryption/File.php View File

public function getAccessList($path) { public function getAccessList($path) {


// Make sure that a share key is generated for the owner too // Make sure that a share key is generated for the owner too
list($owner, $ownerPath) = $this->util->getUidAndFilename($path);
[$owner, $ownerPath] = $this->util->getUidAndFilename($path);


// always add owner to the list of users with access to the file // always add owner to the list of users with access to the file
$userIds = [$owner]; $userIds = [$owner];

+ 2
- 2
lib/private/Encryption/Keys/Storage.php View File

* @return string * @return string
*/ */
private function getFileKeyDir($encryptionModuleId, $path) { private function getFileKeyDir($encryptionModuleId, $path) {
list($owner, $filename) = $this->util->getUidAndFilename($path);
[$owner, $filename] = $this->util->getUidAndFilename($path);


// in case of system wide mount points the keys are stored directly in the data directory // in case of system wide mount points the keys are stored directly in the data directory
if ($this->util->isSystemWideMountPoint($filename, $owner)) { if ($this->util->isSystemWideMountPoint($filename, $owner)) {
* @return string * @return string
*/ */
protected function getPathToKeys($path) { protected function getPathToKeys($path) {
list($owner, $relativePath) = $this->util->getUidAndFilename($path);
[$owner, $relativePath] = $this->util->getUidAndFilename($path);
$systemWideMountPoint = $this->util->isSystemWideMountPoint($relativePath, $owner); $systemWideMountPoint = $this->util->isSystemWideMountPoint($relativePath, $owner);


if ($systemWideMountPoint) { if ($systemWideMountPoint) {

+ 3
- 3
lib/private/Encryption/Update.php View File

if ($this->encryptionManager->isEnabled()) { if ($this->encryptionManager->isEnabled()) {
if ($params['itemType'] === 'file' || $params['itemType'] === 'folder') { if ($params['itemType'] === 'file' || $params['itemType'] === 'folder') {
$path = Filesystem::getPath($params['fileSource']); $path = Filesystem::getPath($params['fileSource']);
list($owner, $ownerPath) = $this->getOwnerPath($path);
[$owner, $ownerPath] = $this->getOwnerPath($path);
$absPath = '/' . $owner . '/files/' . $ownerPath; $absPath = '/' . $owner . '/files/' . $ownerPath;
$this->update($absPath); $this->update($absPath);
} }
if ($this->encryptionManager->isEnabled()) { if ($this->encryptionManager->isEnabled()) {
if ($params['itemType'] === 'file' || $params['itemType'] === 'folder') { if ($params['itemType'] === 'file' || $params['itemType'] === 'folder') {
$path = Filesystem::getPath($params['fileSource']); $path = Filesystem::getPath($params['fileSource']);
list($owner, $ownerPath) = $this->getOwnerPath($path);
[$owner, $ownerPath] = $this->getOwnerPath($path);
$absPath = '/' . $owner . '/files/' . $ownerPath; $absPath = '/' . $owner . '/files/' . $ownerPath;
$this->update($absPath); $this->update($absPath);
} }
$this->encryptionManager->isEnabled() && $this->encryptionManager->isEnabled() &&
dirname($source) !== dirname($target) dirname($source) !== dirname($target)
) { ) {
list($owner, $ownerPath) = $this->getOwnerPath($target);
[$owner, $ownerPath] = $this->getOwnerPath($target);
$absPath = '/' . $owner . '/files/' . $ownerPath; $absPath = '/' . $owner . '/files/' . $ownerPath;
$this->update($absPath); $this->update($absPath);
} }

+ 1
- 1
lib/private/Files/Cache/HomeCache.php View File

$result->closeCursor(); $result->closeCursor();


if ($row) { if ($row) {
list($sum) = array_values($row);
[$sum] = array_values($row);
$totalSize = 0 + $sum; $totalSize = 0 + $sum;
$entry['size'] += 0; $entry['size'] += 0;
if ($entry['size'] !== $totalSize) { if ($entry['size'] !== $totalSize) {

+ 1
- 1
lib/private/Files/Cache/HomePropagator.php View File

* @param int $sizeDifference number of bytes the file has grown * @param int $sizeDifference number of bytes the file has grown
*/ */
public function propagateChange($internalPath, $time, $sizeDifference = 0) { public function propagateChange($internalPath, $time, $sizeDifference = 0) {
list($baseFolder) = explode('/', $internalPath, 2);
[$baseFolder] = explode('/', $internalPath, 2);
if (in_array($baseFolder, $this->ignoredBaseFolders)) { if (in_array($baseFolder, $this->ignoredBaseFolders)) {
return []; return [];
} else { } else {

+ 1
- 1
lib/private/Files/Cache/QuerySearchHelper.php View File

private function searchComparisonToDBExpr(IQueryBuilder $builder, ISearchComparison $comparison, array $operatorMap) { private function searchComparisonToDBExpr(IQueryBuilder $builder, ISearchComparison $comparison, array $operatorMap) {
$this->validateComparison($comparison); $this->validateComparison($comparison);


list($field, $value, $type) = $this->getOperatorFieldAndValue($comparison);
[$field, $value, $type] = $this->getOperatorFieldAndValue($comparison);
if (isset($operatorMap[$type])) { if (isset($operatorMap[$type])) {
$queryOperator = $operatorMap[$type]; $queryOperator = $operatorMap[$type];
return $builder->expr()->$queryOperator($field, $this->getParameterForValue($builder, $value)); return $builder->expr()->$queryOperator($field, $this->getParameterForValue($builder, $value));

+ 1
- 1
lib/private/Files/Cache/Wrapper/JailPropagator.php View File

*/ */
public function propagateChange($internalPath, $time, $sizeDifference = 0) { public function propagateChange($internalPath, $time, $sizeDifference = 0) {
/** @var \OC\Files\Storage\Storage $storage */ /** @var \OC\Files\Storage\Storage $storage */
list($storage, $sourceInternalPath) = $this->storage->resolvePath($internalPath);
[$storage, $sourceInternalPath] = $this->storage->resolvePath($internalPath);
$storage->getPropagator()->propagateChange($sourceInternalPath, $time, $sizeDifference); $storage->getPropagator()->propagateChange($sourceInternalPath, $time, $sizeDifference);
} }
} }

+ 1
- 1
lib/private/Files/Config/UserMountCache.php View File

*/ */
public function getMountsForFileId($fileId, $user = null) { public function getMountsForFileId($fileId, $user = null) {
try { try {
list($storageId, $internalPath) = $this->getCacheInfoFromFileId($fileId);
[$storageId, $internalPath] = $this->getCacheInfoFromFileId($fileId);
} catch (NotFoundException $e) { } catch (NotFoundException $e) {
return []; return [];
} }

+ 1
- 1
lib/private/Files/Node/Folder.php View File

public function getById($id) { public function getById($id) {
$mountCache = $this->root->getUserMountCache(); $mountCache = $this->root->getUserMountCache();
if (strpos($this->getPath(), '/', 1) > 0) { if (strpos($this->getPath(), '/', 1) > 0) {
list(, $user) = explode('/', $this->getPath());
[, $user] = explode('/', $this->getPath());
} else { } else {
$user = null; $user = null;
} }

+ 0
- 0
lib/private/Files/Node/Node.php View File


Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save