Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
die_coolen_jungs
our_own_cloud_project
Commits
64421d76
Commit
64421d76
authored
Nov 20, 2014
by
Joas Schilling
Browse files
Deduplicate function by moving it to the OC_Helper
parent
e32968cf
Changes
3
Hide whitespace changes
Inline
Side-by-side
lib/private/helper.php
View file @
64421d76
...
...
@@ -872,6 +872,23 @@ class OC_Helper {
return
true
;
}
/**
* Try to find a program
* Note: currently windows is not supported
*
* @param string $program
* @return null|string
*/
public
static
function
findBinaryPath
(
$program
)
{
if
(
!
\
OC_Util
::
runningOnWindows
()
&&
self
::
is_function_enabled
(
'exec'
))
{
exec
(
'command -v '
.
escapeshellarg
(
$program
)
.
' 2> /dev/null'
,
$output
,
$returnCode
);
if
(
$returnCode
===
0
&&
count
(
$output
)
>
0
)
{
return
escapeshellcmd
(
$output
[
0
]);
}
}
return
null
;
}
/**
* Calculate the disc space for the given path
*
...
...
lib/private/preview/movies.php
View file @
64421d76
...
...
@@ -8,14 +8,6 @@
*/
namespace
OC\Preview
;
function
findBinaryPath
(
$program
)
{
exec
(
'command -v '
.
escapeshellarg
(
$program
)
.
' 2> /dev/null'
,
$output
,
$returnCode
);
if
(
$returnCode
===
0
&&
count
(
$output
)
>
0
)
{
return
escapeshellcmd
(
$output
[
0
]);
}
return
null
;
}
// movie preview is currently not supported on Windows
if
(
!
\
OC_Util
::
runningOnWindows
())
{
$isExecEnabled
=
\
OC_Helper
::
is_function_enabled
(
'exec'
);
...
...
@@ -23,9 +15,9 @@ if (!\OC_Util::runningOnWindows()) {
$avconvBinary
=
null
;
if
(
$isExecEnabled
)
{
$avconvBinary
=
findBinaryPath
(
'avconv'
);
$avconvBinary
=
\
OC_Helper
::
findBinaryPath
(
'avconv'
);
if
(
!
$avconvBinary
)
{
$ffmpegBinary
=
findBinaryPath
(
'ffmpeg'
);
$ffmpegBinary
=
\
OC_Helper
::
findBinaryPath
(
'ffmpeg'
);
}
}
...
...
settings/admin.php
View file @
64421d76
...
...
@@ -17,7 +17,7 @@ $config = \OC::$server->getConfig();
$appConfig
=
\
OC
::
$server
->
getAppConfig
();
// Should we display sendmail as an option?
$template
->
assign
(
'sendmail_is_available'
,
(
bool
)
findBinaryPath
(
'sendmail'
));
$template
->
assign
(
'sendmail_is_available'
,
(
bool
)
\
OC_Helper
::
findBinaryPath
(
'sendmail'
));
$template
->
assign
(
'loglevel'
,
$config
->
getSystemValue
(
"loglevel"
,
2
));
$template
->
assign
(
'mail_domain'
,
$config
->
getSystemValue
(
"mail_domain"
,
''
));
...
...
@@ -115,19 +115,3 @@ $formsAndMore[] = array('anchor' => 'log-section', 'section-name' => $l->t('Log'
$template
->
assign
(
'forms'
,
$formsAndMore
);
$template
->
printPage
();
/**
* Try to find a program
*
* @param string $program
* @return null|string
*/
function
findBinaryPath
(
$program
)
{
if
(
!
\
OC_Util
::
runningOnWindows
()
&&
\
OC_Helper
::
is_function_enabled
(
'exec'
))
{
exec
(
'command -v '
.
escapeshellarg
(
$program
)
.
' 2> /dev/null'
,
$output
,
$returnCode
);
if
(
$returnCode
===
0
&&
count
(
$output
)
>
0
)
{
return
escapeshellcmd
(
$output
[
0
]);
}
}
return
null
;
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment