Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
our_own_cloud_project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
die_coolen_jungs
our_own_cloud_project
Commits
c652d307
Commit
c652d307
authored
10 years ago
by
Daniel Hansson
Browse files
Options
Downloads
Plain Diff
Merge pull request #14293 from owncloud/issue/14270-fix-public-share-download-activities
Correctly create activities for public downloads
parents
ac13cf04
0833a6e3
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
apps/files_sharing/lib/controllers/sharecontroller.php
+35
-13
35 additions, 13 deletions
apps/files_sharing/lib/controllers/sharecontroller.php
with
35 additions
and
13 deletions
apps/files_sharing/lib/controllers/sharecontroller.php
+
35
−
13
View file @
c652d307
...
...
@@ -230,26 +230,48 @@ class ShareController extends Controller {
}
}
$files_list
=
null
;
if
(
!
is_null
(
$files
))
{
// download selected files
$files_list
=
json_decode
(
$files
);
// in case we get only a single file
if
(
$files_list
===
null
)
{
$files_list
=
array
(
$files
);
}
}
$originalSharePath
=
self
::
getPath
(
$token
);
// Create the activities
if
(
isset
(
$originalSharePath
)
&&
Filesystem
::
isReadable
(
$originalSharePath
.
$path
))
{
$originalSharePath
=
Filesystem
::
normalizePath
(
$originalSharePath
.
$path
);
$type
=
\OC\Files\Filesystem
::
is_dir
(
$originalSharePath
)
?
'folder'
:
'file'
;
$args
=
$type
===
'folder'
?
array
(
'dir'
=>
$originalSharePath
)
:
array
(
'dir'
=>
dirname
(
$originalSharePath
),
'scrollto'
=>
basename
(
$originalSharePath
));
$linkToFile
=
\OCP\Util
::
linkToAbsolute
(
'files'
,
'index.php'
,
$args
);
$subject
=
$type
===
'folder'
?
Activity
::
SUBJECT_PUBLIC_SHARED_FOLDER_DOWNLOADED
:
Activity
::
SUBJECT_PUBLIC_SHARED_FILE_DOWNLOADED
;
$this
->
activityManager
->
publishActivity
(
'files_sharing'
,
$subject
,
array
(
$originalSharePath
),
''
,
array
(),
$originalSharePath
,
$linkToFile
,
$linkItem
[
'uid_owner'
],
Activity
::
TYPE_PUBLIC_LINKS
,
Activity
::
PRIORITY_MEDIUM
);
}
$isDir
=
\OC\Files\Filesystem
::
is_dir
(
$originalSharePath
);
if
(
!
is_null
(
$files
))
{
// download selected files
$files_list
=
json_decode
(
$files
);
// in case we get only a single file
if
(
$files_list
===
NULL
)
{
$files_list
=
array
(
$files
);
$activities
=
[];
if
(
!
$isDir
)
{
// Single file public share
$activities
[
$originalSharePath
]
=
Activity
::
SUBJECT_PUBLIC_SHARED_FILE_DOWNLOADED
;
}
else
if
(
!
empty
(
$files_list
))
{
// Only some files are downloaded
foreach
(
$files_list
as
$file
)
{
$filePath
=
Filesystem
::
normalizePath
(
$originalSharePath
.
'/'
.
$file
);
$isDir
=
\OC\Files\Filesystem
::
is_dir
(
$filePath
);
$activities
[
$filePath
]
=
(
$isDir
)
?
Activity
::
SUBJECT_PUBLIC_SHARED_FOLDER_DOWNLOADED
:
Activity
::
SUBJECT_PUBLIC_SHARED_FILE_DOWNLOADED
;
}
}
else
{
// The folder is downloaded
$activities
[
$originalSharePath
]
=
Activity
::
SUBJECT_PUBLIC_SHARED_FOLDER_DOWNLOADED
;
}
foreach
(
$activities
as
$filePath
=>
$subject
)
{
$this
->
activityManager
->
publishActivity
(
'files_sharing'
,
$subject
,
array
(
$filePath
),
''
,
array
(),
$filePath
,
''
,
$linkItem
[
'uid_owner'
],
Activity
::
TYPE_PUBLIC_LINKS
,
Activity
::
PRIORITY_MEDIUM
);
}
}
// download selected files
if
(
!
is_null
(
$files
))
{
// FIXME: The exit is required here because otherwise the AppFramework is trying to add headers as well
// after dispatching the request which results in a "Cannot modify header information" notice.
OC_Files
::
get
(
$originalSharePath
,
$files_list
,
$_SERVER
[
'REQUEST_METHOD'
]
==
'HEAD'
);
...
...
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