本文整理汇总了PHP中Installer::locateExecutableInDefaultPaths方法的典型用法代码示例。如果您正苦于以下问题:PHP Installer::locateExecutableInDefaultPaths方法的具体用法?PHP Installer::locateExecutableInDefaultPaths怎么用?PHP Installer::locateExecutableInDefaultPaths使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Installer
的用法示例。
在下文中一共展示了Installer::locateExecutableInDefaultPaths方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkHasGzip
/**
* Skip the test if 'gzip' is not in $PATH.
*
* @return bool
*/
protected function checkHasGzip()
{
if (self::$hasGzip === null) {
self::$hasGzip = Installer::locateExecutableInDefaultPaths('gzip') !== false;
}
if (!self::$hasGzip) {
$this->markTestSkipped("Skip test, requires the gzip utility in PATH");
}
return self::$hasGzip;
}
示例2: __construct
/**
* Determine if there is a usable tidy.
*/
public function __construct($useConfiguration = false)
{
global $IP, $wgUseTidy, $wgTidyBin, $wgTidyInternal, $wgTidyConfig, $wgTidyConf, $wgTidyOpts;
$this->enabled = true;
if ($useConfiguration) {
if ($wgTidyConfig !== null) {
$this->config = $wgTidyConfig;
} elseif ($wgUseTidy) {
$this->config = ['tidyConfigFile' => $wgTidyConf, 'debugComment' => false, 'tidyBin' => $wgTidyBin, 'tidyCommandLine' => $wgTidyOpts];
if ($wgTidyInternal) {
$this->config['driver'] = wfIsHHVM() ? 'RaggettInternalHHVM' : 'RaggettInternalPHP';
} else {
$this->config['driver'] = 'RaggettExternal';
}
} else {
$this->enabled = false;
}
} else {
$this->config = ['tidyConfigFile' => "{$IP}/includes/tidy/tidy.conf", 'tidyCommandLine' => ''];
if (extension_loaded('tidy') && class_exists('tidy')) {
$this->config['driver'] = wfIsHHVM() ? 'RaggettInternalHHVM' : 'RaggettInternalPHP';
} else {
if (is_executable($wgTidyBin)) {
$this->config['driver'] = 'RaggettExternal';
$this->config['tidyBin'] = $wgTidyBin;
} else {
$path = Installer::locateExecutableInDefaultPaths($wgTidyBin);
if ($path !== false) {
$this->config['driver'] = 'RaggettExternal';
$this->config['tidyBin'] = $wgTidyBin;
} else {
$this->enabled = false;
}
}
}
}
if (!$this->enabled) {
$this->config = ['driver' => 'disabled'];
}
}
示例3: readlineEmulation
/**
* Emulate readline()
* @param $prompt String what to begin the line with, like '> '
* @return String
*/
private static function readlineEmulation($prompt)
{
$bash = Installer::locateExecutableInDefaultPaths(array('bash'));
if (!wfIsWindows() && $bash) {
$retval = false;
$encPrompt = wfEscapeShellArg($prompt);
$command = "read -er -p {$encPrompt} && echo \"\$REPLY\"";
$encCommand = wfEscapeShellArg($command);
$line = wfShellExec("{$bash} -c {$encCommand}", $retval);
if ($retval == 0) {
return $line;
} elseif ($retval == 127) {
// Couldn't execute bash even though we thought we saw it.
// Shell probably spit out an error message, sorry :(
// Fall through to fgets()...
} else {
// EOF/ctrl+D
return false;
}
}
// Fallback... we'll have no editing controls, EWWW
if (feof(STDIN)) {
return false;
}
print $prompt;
return fgets(STDIN, 1024);
}