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
db345e4c
Unverified
Commit
db345e4c
authored
6 years ago
by
Morris Jobke
Browse files
Options
Downloads
Patches
Plain Diff
Deprecate unused, private OC_Helper::linkToPublic
Signed-off-by:
Morris Jobke
<
hey@morrisjobke.de
>
parent
2a9e0063
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
lib/private/legacy/helper.php
+0
-17
0 additions, 17 deletions
lib/private/legacy/helper.php
lib/public/Util.php
+6
-1
6 additions, 1 deletion
lib/public/Util.php
tests/lib/LegacyHelperTest.php
+0
-38
0 additions, 38 deletions
tests/lib/LegacyHelperTest.php
with
6 additions
and
56 deletions
lib/private/legacy/helper.php
+
0
−
17
View file @
db345e4c
...
@@ -51,23 +51,6 @@ use Symfony\Component\Process\ExecutableFinder;
...
@@ -51,23 +51,6 @@ use Symfony\Component\Process\ExecutableFinder;
class
OC_Helper
{
class
OC_Helper
{
private
static
$templateManager
;
private
static
$templateManager
;
/**
* Creates an absolute url for public use
* @param string $service id
* @param bool $add_slash
* @return string the url
*
* Returns a absolute url to the given service.
*/
public
static
function
linkToPublic
(
$service
,
$add_slash
=
false
)
{
if
(
$service
===
'files'
)
{
$url
=
OC
::
$server
->
getURLGenerator
()
->
getAbsoluteURL
(
'/s'
);
}
else
{
$url
=
OC
::
$server
->
getURLGenerator
()
->
getAbsoluteURL
(
OC
::
$server
->
getURLGenerator
()
->
linkTo
(
''
,
'public.php'
)
.
'?service='
.
$service
);
}
return
$url
.
((
$add_slash
&&
$service
[
strlen
(
$service
)
-
1
]
!=
'/'
)
?
'/'
:
''
);
}
/**
/**
* Make a human file size
* Make a human file size
* @param int $bytes file size in bytes
* @param int $bytes file size in bytes
...
...
This diff is collapsed.
Click to expand it.
lib/public/Util.php
+
6
−
1
View file @
db345e4c
...
@@ -230,9 +230,14 @@ class Util {
...
@@ -230,9 +230,14 @@ class Util {
* @param string $service id
* @param string $service id
* @return string the url
* @return string the url
* @since 4.5.0
* @since 4.5.0
* @deprecated 15.0.0 - use OCP\IURLGenerator
*/
*/
public
static
function
linkToPublic
(
$service
)
{
public
static
function
linkToPublic
(
$service
)
{
return
\OC_Helper
::
linkToPublic
(
$service
);
$urlGenerator
=
\OC
::
$server
->
getURLGenerator
();
if
(
$service
===
'files'
)
{
return
$urlGenerator
->
getAbsoluteURL
(
'/s'
);
}
return
$urlGenerator
->
getAbsoluteURL
(
$urlGenerator
->
linkTo
(
''
,
'public.php'
)
.
'?service='
.
$service
);
}
}
/**
/**
...
...
This diff is collapsed.
Click to expand it.
tests/lib/LegacyHelperTest.php
+
0
−
38
View file @
db345e4c
...
@@ -222,44 +222,6 @@ class LegacyHelperTest extends \Test\TestCase {
...
@@ -222,44 +222,6 @@ class LegacyHelperTest extends \Test\TestCase {
);
);
}
}
// Url generator methods
/**
* @small
* test linkToPublic URL construction
*/
public
function
testLinkToPublic
()
{
\OC
::
$WEBROOT
=
''
;
$result
=
\OC_Helper
::
linkToPublic
(
'files'
);
$this
->
assertEquals
(
'http://localhost/s'
,
$result
);
$result
=
\OC_Helper
::
linkToPublic
(
'files'
,
false
);
$this
->
assertEquals
(
'http://localhost/s'
,
$result
);
$result
=
\OC_Helper
::
linkToPublic
(
'files'
,
true
);
$this
->
assertEquals
(
'http://localhost/s/'
,
$result
);
$result
=
\OC_Helper
::
linkToPublic
(
'other'
);
$this
->
assertEquals
(
'http://localhost/public.php?service=other'
,
$result
);
$result
=
\OC_Helper
::
linkToPublic
(
'other'
,
false
);
$this
->
assertEquals
(
'http://localhost/public.php?service=other'
,
$result
);
$result
=
\OC_Helper
::
linkToPublic
(
'other'
,
true
);
$this
->
assertEquals
(
'http://localhost/public.php?service=other/'
,
$result
);
\OC
::
$WEBROOT
=
'/owncloud'
;
$result
=
\OC_Helper
::
linkToPublic
(
'files'
);
$this
->
assertEquals
(
'http://localhost/owncloud/s'
,
$result
);
$result
=
\OC_Helper
::
linkToPublic
(
'files'
,
false
);
$this
->
assertEquals
(
'http://localhost/owncloud/s'
,
$result
);
$result
=
\OC_Helper
::
linkToPublic
(
'files'
,
true
);
$this
->
assertEquals
(
'http://localhost/owncloud/s/'
,
$result
);
$result
=
\OC_Helper
::
linkToPublic
(
'other'
);
$this
->
assertEquals
(
'http://localhost/owncloud/public.php?service=other'
,
$result
);
$result
=
\OC_Helper
::
linkToPublic
(
'other'
,
false
);
$this
->
assertEquals
(
'http://localhost/owncloud/public.php?service=other'
,
$result
);
$result
=
\OC_Helper
::
linkToPublic
(
'other'
,
true
);
$this
->
assertEquals
(
'http://localhost/owncloud/public.php?service=other/'
,
$result
);
}
/**
/**
* Tests recursive folder deletion with rmdirr()
* Tests recursive folder deletion with rmdirr()
*/
*/
...
...
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