Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Nextcloud
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Nextcloud
Commits
329299e3
Commit
329299e3
authored
11 years ago
by
Andreas Fischer
Committed by
Morris Jobke
11 years ago
Browse files
Options
Downloads
Patches
Plain Diff
OCP\Share::unshareAll(): Deduplicate hook parameters.
parent
8872b881
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/public/share.php
+26
-8
26 additions, 8 deletions
lib/public/share.php
with
26 additions
and
8 deletions
lib/public/share.php
+
26
−
8
View file @
329299e3
...
...
@@ -665,19 +665,16 @@ class Share {
public
static
function
unshareAll
(
$itemType
,
$itemSource
)
{
if
(
$shares
=
self
::
getItemShared
(
$itemType
,
$itemSource
))
{
// Pass all the vars we have for now, they may be useful
\OC_Hook
::
emit
(
'OCP\Share'
,
'pre_unshareAll'
,
array
(
$hookParams
=
array
(
'itemType'
=>
$itemType
,
'itemSource'
=>
$itemSource
,
'shares'
=>
$shares
));
'shares'
=>
$shares
,
);
\OC_Hook
::
emit
(
'OCP\Share'
,
'pre_unshareAll'
,
$hookParams
);
foreach
(
$shares
as
$share
)
{
self
::
delete
(
$share
[
'id'
]);
}
\OC_Hook
::
emit
(
'OCP\Share'
,
'post_unshareAll'
,
array
(
'itemType'
=>
$itemType
,
'itemSource'
=>
$itemSource
,
'shares'
=>
$shares
));
\OC_Hook
::
emit
(
'OCP\Share'
,
'post_unshareAll'
,
$hookParams
);
return
true
;
}
return
false
;
...
...
@@ -852,6 +849,27 @@ class Share {
return
false
;
}
/**
* Unshares a share given a share data array
* @param array $item Share data (usually database row)
* @return null
*/
protected
static
function
unshareItem
(
array
$item
)
{
// Pass all the vars we have for now, they may be useful
$hookParams
=
array
(
'itemType'
=>
$item
[
'item_type'
],
'itemSource'
=>
$item
[
'item_source'
],
'shareType'
=>
$item
[
'share_type'
],
'shareWith'
=>
$item
[
'share_with'
],
'itemParent'
=>
$item
[
'parent'
],
);
\OC_Hook
::
emit
(
'OCP\Share'
,
'pre_unshare'
,
$hookParams
+
array
(
'fileSource'
=>
$item
[
'file_source'
],
));
self
::
delete
(
$item
[
'id'
]);
\OC_Hook
::
emit
(
'OCP\Share'
,
'post_unshare'
,
$hookParams
);
}
/**
* Get the backend class for the specified item type
* @param string $itemType
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment