Skip to content

Commit

Permalink
Merge pull request #3352 from nextcloud/chore/deps/update-nextcloud-o…
Browse files Browse the repository at this point in the history
…cp-master
  • Loading branch information
provokateurin authored Oct 14, 2024
2 parents d5e5ee3 + 8b8a18b commit 2994e18
Show file tree
Hide file tree
Showing 24 changed files with 506 additions and 545 deletions.
28 changes: 14 additions & 14 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

58 changes: 29 additions & 29 deletions lib/ACL/ACLStorageWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,33 +43,33 @@ private function checkPermissions(string $path, int $permissions): bool {
return ($this->getACLPermissionsForPath($path) & $permissions) === $permissions;
}

public function isReadable($path): bool {
public function isReadable(string $path): bool {
return $this->checkPermissions($path, Constants::PERMISSION_READ) && parent::isReadable($path);
}

public function isUpdatable($path): bool {
public function isUpdatable(string $path): bool {
return $this->checkPermissions($path, Constants::PERMISSION_UPDATE) && parent::isUpdatable($path);
}

public function isCreatable($path): bool {
public function isCreatable(string $path): bool {
return $this->checkPermissions($path, Constants::PERMISSION_CREATE) && parent::isCreatable($path);
}

public function isDeletable($path): bool {
public function isDeletable(string $path): bool {
return $this->checkPermissions($path, Constants::PERMISSION_DELETE)
&& $this->canDeleteTree($path)
&& parent::isDeletable($path);
}

public function isSharable($path): bool {
public function isSharable(string $path): bool {
return $this->checkPermissions($path, Constants::PERMISSION_SHARE) && parent::isSharable($path);
}

public function getPermissions($path): int {
public function getPermissions(string $path): int {
return $this->storage->getPermissions($path) & $this->getACLPermissionsForPath($path);
}

public function rename($source, $target): bool {
public function rename(string $source, string $target): bool {
if (str_starts_with($source, $target)) {
$part = substr($source, strlen($target));
//This is a rename of the transfer file to the original file
Expand All @@ -96,7 +96,7 @@ public function rename($source, $target): bool {
parent::rename($source, $target);
}

public function opendir($path) {
public function opendir(string $path) {
if (!$this->checkPermissions($path, Constants::PERMISSION_READ)) {
return false;
}
Expand All @@ -118,29 +118,29 @@ public function opendir($path) {
return IteratorDirectory::wrap($items);
}

public function copy($source, $target): bool {
public function copy(string $source, string $target): bool {
$permissions = $this->file_exists($target) ? Constants::PERMISSION_UPDATE : Constants::PERMISSION_CREATE;
return $this->checkPermissions($target, $permissions) &&
$this->checkPermissions($source, Constants::PERMISSION_READ) &&
parent::copy($source, $target);
}

public function touch($path, $mtime = null): bool {
public function touch(string $path, ?int $mtime = null): bool {
$permissions = $this->file_exists($path) ? Constants::PERMISSION_UPDATE : Constants::PERMISSION_CREATE;
return $this->checkPermissions($path, $permissions) && parent::touch($path, $mtime);
}

public function mkdir($path): bool {
public function mkdir(string $path): bool {
return $this->checkPermissions($path, Constants::PERMISSION_CREATE) && parent::mkdir($path);
}

public function rmdir($path): bool {
public function rmdir(string $path): bool {
return $this->checkPermissions($path, Constants::PERMISSION_DELETE)
&& $this->canDeleteTree($path)
&& parent::rmdir($path);
}

public function unlink($path): bool {
public function unlink(string $path): bool {
return $this->checkPermissions($path, Constants::PERMISSION_DELETE)
&& $this->canDeleteTree($path)
&& parent::unlink($path);
Expand All @@ -154,12 +154,12 @@ private function canDeleteTree(string $path): int {
return $this->aclManager->getPermissionsForTree($path) & Constants::PERMISSION_DELETE;
}

public function file_put_contents($path, $data): int|float|false {
public function file_put_contents(string $path, mixed $data): int|float|false {
$permissions = $this->file_exists($path) ? Constants::PERMISSION_UPDATE : Constants::PERMISSION_CREATE;
return $this->checkPermissions($path, $permissions) ? parent::file_put_contents($path, $data) : false;
}

public function fopen($path, $mode) {
public function fopen(string $path, string $mode) {
if ($mode === 'r' or $mode === 'rb') {
$permissions = Constants::PERMISSION_READ;
} else {
Expand Down Expand Up @@ -189,7 +189,7 @@ public function getCache($path = '', $storage = null): ICache {
return new ACLCacheWrapper($sourceCache, $this->aclManager, $this->inShare);
}

public function getMetaData($path): ?array {
public function getMetaData(string $path): ?array {
$data = parent::getMetaData($path);

if ($data && isset($data['permissions'])) {
Expand All @@ -213,94 +213,94 @@ public function getScanner($path = '', $storage = null): IScanner {
return parent::getScanner($path, $storage);
}

public function is_dir($path): bool {
public function is_dir(string $path): bool {
return $this->checkPermissions($path, Constants::PERMISSION_READ) &&
parent::is_dir($path);
}

public function is_file($path): bool {
public function is_file(string $path): bool {
return $this->checkPermissions($path, Constants::PERMISSION_READ) &&
parent::is_file($path);
}

public function stat($path): array|false {
public function stat(string $path): array|false {
if (!$this->checkPermissions($path, Constants::PERMISSION_READ)) {
return false;
}

return parent::stat($path);
}

public function filetype($path): string|false {
public function filetype(string $path): string|false {
if (!$this->checkPermissions($path, Constants::PERMISSION_READ)) {
return false;
}

return parent::filetype($path);
}

public function filesize($path): false|int|float {
public function filesize(string $path): false|int|float {
if (!$this->checkPermissions($path, Constants::PERMISSION_READ)) {
return false;
}

return parent::filesize($path);
}

public function file_exists($path): bool {
public function file_exists(string $path): bool {
return $this->checkPermissions($path, Constants::PERMISSION_READ) &&
parent::file_exists($path);
}

public function filemtime($path): int|false {
public function filemtime(string $path): int|false {
if (!$this->checkPermissions($path, Constants::PERMISSION_READ)) {
return false;
}

return parent::filemtime($path);
}

public function file_get_contents($path): string|false {
public function file_get_contents(string $path): string|false {
if (!$this->checkPermissions($path, Constants::PERMISSION_READ)) {
return false;
}

return parent::file_get_contents($path);
}

public function getMimeType($path): string|false {
public function getMimeType(string $path): string|false {
if (!$this->checkPermissions($path, Constants::PERMISSION_READ)) {
return false;
}

return parent::getMimeType($path);
}

public function hash($type, $path, $raw = false): string|false {
public function hash(string $type, string $path, bool $raw = false): string|false {
if (!$this->checkPermissions($path, Constants::PERMISSION_READ)) {
return false;
}

return parent::hash($type, $path, $raw);
}

public function getETag($path): string|false {
public function getETag(string $path): string|false {
if (!$this->checkPermissions($path, Constants::PERMISSION_READ)) {
return false;
}

return parent::getETag($path);
}

public function getDirectDownload($path): array|false {
public function getDirectDownload(string $path): array|false {
if (!$this->checkPermissions($path, Constants::PERMISSION_READ)) {
return false;
}

return parent::getDirectDownload($path);
}

public function getDirectoryContent($directory): \Traversable {
public function getDirectoryContent(string $directory): \Traversable {
$content = $this->getWrapperStorage()->getDirectoryContent($directory);
foreach ($content as $data) {
$data['scan_permissions'] ??= $data['permissions'];
Expand Down
2 changes: 2 additions & 0 deletions lib/Command/Trashbin/Cleanup.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use OCA\GroupFolders\Trash\TrashBackend;
use OCP\App\IAppManager;
use OCP\Server;
use Symfony\Component\Console\Helper\QuestionHelper;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
Expand Down Expand Up @@ -46,6 +47,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
return -1;
}

/** @var QuestionHelper $helper */
$helper = $this->getHelper('question');

$folders = $this->folderManager->getAllFolders();
Expand Down
2 changes: 1 addition & 1 deletion lib/Mount/GroupFolderStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function getFolderId(): int {
return $this->folderId;
}

public function getOwner($path): string|false {
public function getOwner(string $path): string|false {
$user = $this->userSession->getUser();
if ($user !== null) {
return $user->getUID();
Expand Down
12 changes: 6 additions & 6 deletions lib/Mount/RootPermissionsMask.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,47 +37,47 @@ private function checkMask(int $permissions): bool {
return ($this->mask & $permissions) === $permissions;
}

public function isUpdatable($path): bool {
public function isUpdatable(string $path): bool {
if ($path === '') {
return $this->checkMask(Constants::PERMISSION_UPDATE) and parent::isUpdatable($path);
} else {
return parent::isUpdatable($path);
}
}

public function isCreatable($path): bool {
public function isCreatable(string $path): bool {
if ($path === '') {
return $this->checkMask(Constants::PERMISSION_CREATE) and parent::isCreatable($path);
} else {
return parent::isCreatable($path);
}
}

public function isDeletable($path): bool {
public function isDeletable(string $path): bool {
if ($path === '') {
return $this->checkMask(Constants::PERMISSION_DELETE) and parent::isDeletable($path);
} else {
return parent::isDeletable($path);
}
}

public function isSharable($path): bool {
public function isSharable(string $path): bool {
if ($path === '') {
return $this->checkMask(Constants::PERMISSION_SHARE) and parent::isSharable($path);
} else {
return parent::isSharable($path);
}
}

public function getPermissions($path): int {
public function getPermissions(string $path): int {
if ($path === '') {
return $this->storage->getPermissions($path) & $this->mask;
} else {
return $this->storage->getPermissions($path);
}
}

public function getMetaData($path): ?array {
public function getMetaData(string $path): ?array {
$data = parent::getMetaData($path);

if ($data && $path === '' && isset($data['permissions'])) {
Expand Down
3 changes: 2 additions & 1 deletion tests/stubs/doctrine_dbal_schema_abstractasset.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
* The abstract asset allows to reset the name of all assets without publishing this to the public userland.
*
* This encapsulation hack is necessary to keep a consistent state of the database schema. Say we have a list of tables
* array($tableName => Table($tableName)); if you want to rename the table, you have to make sure
* array($tableName => Table($tableName)); if you want to rename the table, you have to make sure this does not get
* recreated during schema migration.
*/
abstract class AbstractAsset
{
Expand Down
2 changes: 1 addition & 1 deletion tests/stubs/oc_core_command_base.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function cancelOperation(): void
{
}

public function run(InputInterface $input, OutputInterface $output)
public function run(InputInterface $input, OutputInterface $output): int
{
}

Expand Down
Loading

0 comments on commit 2994e18

Please sign in to comment.