Browse Source
Move to single share event. Just emit more if needed
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
pull/24610/head
Roeland Jago Douma
5 years ago
No known key found for this signature in database
GPG Key ID: F941078878347C0C
2 changed files with
3 additions and
22 deletions
-
lib/private/Share20/Manager.php
-
lib/public/Share/Events/ShareDeletedEvent.php
|
|
|
@ -1138,6 +1138,7 @@ class Manager implements IManager { |
|
|
|
$deletedShares = array_merge($deletedShares, $deletedChildren); |
|
|
|
|
|
|
|
$provider->delete($child); |
|
|
|
$this->dispatcher->dispatchTyped(new Share\Events\ShareDeletedEvent($child)); |
|
|
|
$deletedShares[] = $child; |
|
|
|
} |
|
|
|
|
|
|
|
@ -1168,7 +1169,7 @@ class Manager implements IManager { |
|
|
|
$provider = $this->factory->getProviderForType($share->getShareType()); |
|
|
|
$provider->delete($share); |
|
|
|
|
|
|
|
$this->dispatcher->dispatchTyped(new Share\Events\ShareDeletedEvent($share, $deletedShares)); |
|
|
|
$this->dispatcher->dispatchTyped(new Share\Events\ShareDeletedEvent($share)); |
|
|
|
|
|
|
|
// All the deleted shares caused by this delete
|
|
|
|
$deletedShares[] = $share; |
|
|
|
|
|
|
|
@ -37,9 +37,6 @@ class ShareDeletedEvent extends Event { |
|
|
|
/** @var IShare */ |
|
|
|
private $share; |
|
|
|
|
|
|
|
/** @var IShare[] */ |
|
|
|
private $children; |
|
|
|
|
|
|
|
/** |
|
|
|
* |
|
|
|
* @param IShare $share |
|
|
|
@ -47,11 +44,10 @@ class ShareDeletedEvent extends Event { |
|
|
|
* |
|
|
|
* @since 21.0.0 |
|
|
|
*/ |
|
|
|
public function __construct(IShare $share, array $children = []) { |
|
|
|
public function __construct(IShare $share) { |
|
|
|
parent::__construct(); |
|
|
|
|
|
|
|
$this->share = $share; |
|
|
|
$this->children = $children; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
@ -61,20 +57,4 @@ class ShareDeletedEvent extends Event { |
|
|
|
public function getShare(): IShare { |
|
|
|
return $this->share; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @return IShare[] |
|
|
|
* @since 21.0.0 |
|
|
|
*/ |
|
|
|
public function getChildren(): array { |
|
|
|
return $this->children; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @return IShare[] |
|
|
|
* @since 21.0.0 |
|
|
|
*/ |
|
|
|
public function getAllDeletedShares(): array { |
|
|
|
return array_merge([$this->share], $this->children); |
|
|
|
} |
|
|
|
} |