diff options
-rw-r--r-- | build/psalm-baseline.xml | 3 | ||||
-rw-r--r-- | lib/private/Share20/DefaultShareProvider.php | 4 | ||||
-rw-r--r-- | lib/private/Share20/LegacyHooks.php | 2 | ||||
-rw-r--r-- | lib/private/Share20/Manager.php | 11 | ||||
-rw-r--r-- | lib/private/Share20/Share.php | 13 | ||||
-rw-r--r-- | lib/public/Share/IShare.php | 17 |
6 files changed, 23 insertions, 27 deletions
diff --git a/build/psalm-baseline.xml b/build/psalm-baseline.xml index cee602bbb99..a2b89ac9737 100644 --- a/build/psalm-baseline.xml +++ b/build/psalm-baseline.xml @@ -4286,9 +4286,6 @@ <TooManyArguments> <code><![CDATA[set]]></code> </TooManyArguments> - <UndefinedInterfaceMethod> - <code><![CDATA[getParent]]></code> - </UndefinedInterfaceMethod> </file> <file src="lib/private/Share20/Manager.php"> <InvalidArgument> diff --git a/lib/private/Share20/DefaultShareProvider.php b/lib/private/Share20/DefaultShareProvider.php index 3cc57570350..2d768331d93 100644 --- a/lib/private/Share20/DefaultShareProvider.php +++ b/lib/private/Share20/DefaultShareProvider.php @@ -127,9 +127,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 { diff --git a/lib/private/Share20/LegacyHooks.php b/lib/private/Share20/LegacyHooks.php index 3bce0b9560a..d54c8e3203d 100644 --- a/lib/private/Share20/LegacyHooks.php +++ b/lib/private/Share20/LegacyHooks.php @@ -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() diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php index 654aa8ff5fb..e4b00cab4b9 100644 --- a/lib/private/Share20/Manager.php +++ b/lib/private/Share20/Manager.php @@ -579,13 +579,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()); } } diff --git a/lib/private/Share20/Share.php b/lib/private/Share20/Share.php index 8caabb0898a..c5467bb276b 100644 --- a/lib/private/Share20/Share.php +++ b/lib/private/Share20/Share.php @@ -526,24 +526,11 @@ 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) { $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() { return $this->parent; } diff --git a/lib/public/Share/IShare.php b/lib/public/Share/IShare.php index 5d8c64e1314..2b3941c18ad 100644 --- a/lib/public/Share/IShare.php +++ b/lib/public/Share/IShare.php @@ -530,6 +530,23 @@ interface IShare { public function getToken(); /** + * Set the parent of this share + * + * @param int $parent + * @return IShare + * @since 9.0.0 + */ + public function setParent($parent); + + /** + * Get the parent of this share. + * + * @return int + * @since 9.0.0 + */ + public function getParent(); + + /** * Set the target path of this share relative to the recipients user folder. * * @param string $target |