Merge pull request #53946 from nextcloud/chore/remove-hierarchical-shares

This commit is contained in:
Kate 2025-07-29 13:26:03 +02:00 committed by GitHub
commit 49618b30a7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 33 additions and 55 deletions

View file

@ -431,13 +431,7 @@ class FederatedShareProvider implements IShareProvider, IShareProviderSupportsAl
return $share;
}
/**
* Get all children of this share
*
* @param IShare $parent
* @return IShare[]
*/
public function getChildren(IShare $parent) {
public function getChildren(IShare $parent): array {
$children = [];
$qb = $this->dbConnection->getQueryBuilder();

View file

@ -637,11 +637,6 @@ class ShareByMailProvider extends DefaultShareProvider implements IShareProvider
return $token;
}
/**
* Get all children of this share
*
* @return IShare[]
*/
public function getChildren(IShare $parent): array {
$children = [];

View file

@ -4250,9 +4250,6 @@
<code><![CDATA[$share->getId()]]></code>
<code><![CDATA[(int)$data['id']]]></code>
</InvalidArgument>
<UndefinedInterfaceMethod>
<code><![CDATA[getParent]]></code>
</UndefinedInterfaceMethod>
</file>
<file src="lib/private/Share20/Manager.php">
<InvalidArgument>
@ -4261,9 +4258,6 @@
<UndefinedClass>
<code><![CDATA[\OCA\Circles\Api\v1\Circles]]></code>
</UndefinedClass>
<UndefinedInterfaceMethod>
<code><![CDATA[getChildren]]></code>
</UndefinedInterfaceMethod>
</file>
<file src="lib/private/Share20/ProviderFactory.php">
<InvalidReturnStatement>

View file

@ -130,9 +130,7 @@ class DefaultShareProvider implements IShareProviderWithNotification, IShareProv
$qb->setValue('expiration', $qb->createNamedParameter($expirationDate, 'datetime'));
}
if (method_exists($share, 'getParent')) {
$qb->setValue('parent', $qb->createNamedParameter($share->getParent()));
}
$qb->setValue('parent', $qb->createNamedParameter($share->getParent()));
$qb->setValue('hide_download', $qb->createNamedParameter($share->getHideDownload() ? 1 : 0, IQueryBuilder::PARAM_INT));
} else {
@ -361,14 +359,7 @@ class DefaultShareProvider implements IShareProviderWithNotification, IShareProv
return $share;
}
/**
* Get all children of this share
* FIXME: remove once https://github.com/owncloud/core/pull/21660 is in
*
* @param \OCP\Share\IShare $parent
* @return \OCP\Share\IShare[]
*/
public function getChildren(\OCP\Share\IShare $parent) {
public function getChildren(IShare $parent): array {
$children = [];
$qb = $this->dbConn->getQueryBuilder();

View file

@ -82,7 +82,7 @@ class LegacyHooks {
'itemSource' => $share->getNodeId(),
'shareType' => $shareType,
'shareWith' => $sharedWith,
'itemparent' => method_exists($share, 'getParent') ? $share->getParent() : '',
'itemparent' => $share->getParent(),
'uidOwner' => $share->getSharedBy(),
'fileSource' => $share->getNodeId(),
'fileTarget' => $share->getTarget()

View file

@ -581,13 +581,10 @@ class Manager implements IManager {
* @param IShare $share
*/
protected function setLinkParent(IShare $share) {
// No sense in checking if the method is not there.
if (method_exists($share, 'setParent')) {
$storage = $share->getNode()->getStorage();
if ($storage->instanceOfStorage(SharedStorage::class)) {
/** @var \OCA\Files_Sharing\SharedStorage $storage */
$share->setParent($storage->getShareId());
}
$storage = $share->getNode()->getStorage();
if ($storage->instanceOfStorage(SharedStorage::class)) {
/** @var \OCA\Files_Sharing\SharedStorage $storage */
$share->setParent((int)$storage->getShareId());
}
}
@ -1009,7 +1006,6 @@ class Manager implements IManager {
/**
* Delete all the children of this share
* FIXME: remove once https://github.com/owncloud/core/pull/21660 is in
*
* @param IShare $share
* @return IShare[] List of deleted shares

View file

@ -60,8 +60,7 @@ class Share implements IShare {
private $sendPasswordByTalk = false;
/** @var string */
private $token;
/** @var int */
private $parent;
private ?int $parent = null;
/** @var string */
private $target;
/** @var \DateTime */
@ -526,25 +525,12 @@ class Share implements IShare {
return $this->token;
}
/**
* Set the parent of this share
*
* @param int $parent
* @return IShare
* @deprecated 12.0.0 The new shares do not have parents. This is just here for legacy reasons.
*/
public function setParent($parent) {
public function setParent(int $parent): self {
$this->parent = $parent;
return $this;
}
/**
* Get the parent of this share.
*
* @return int
* @deprecated 12.0.0 The new shares do not have parents. This is just here for legacy reasons.
*/
public function getParent() {
public function getParent(): ?int {
return $this->parent;
}

View file

@ -529,6 +529,20 @@ interface IShare {
*/
public function getToken();
/**
* Set the parent of this share
*
* @since 9.0.0
*/
public function setParent(int $parent): self;
/**
* Get the parent of this share.
*
* @since 9.0.0
*/
public function getParent(): ?int;
/**
* Set the target path of this share relative to the recipients user folder.
*

View file

@ -208,4 +208,12 @@ interface IShareProvider {
* @since 18.0.0
*/
public function getAllShares(): iterable;
/**
* Get all children of this share
*
* @return IShare[]
* @since 9.0.0
*/
public function getChildren(IShare $parent);
}