本文整理汇总了PHP中passthru函数的典型用法代码示例。如果您正苦于以下问题:PHP passthru函数的具体用法?PHP passthru怎么用?PHP passthru使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了passthru函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: OnInit
function OnInit($param)
{
parent::onInit($param);
include "config.php";
$repositoryid = $_GET['RepositoryID'];
$results = $this->Module->Database->Execute("SELECT * FROM repositories WHERE id=" . makeSqlString($repositoryid));
$fields = $results->fields;
$ownerid = $fields['ownerid'];
$name = $fields['name'];
if (!$this->User->isAdmin() && $this->User->getId() != $ownerid) {
echo "Not enough rights to change this repository!";
exit(-1);
}
$filename = $name . ".dump";
if (isset($_SERVER['HTTP_USER_AGENT']) && preg_match("/MSIE/", $_SERVER['HTTP_USER_AGENT'])) {
// IE Bug in download name workaround
error_log("ini_set");
ini_set('zlib.output_compression', 'Off');
}
header('Cache-Control:');
header('Pragma:');
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"{$filename}\"");
header("Content-Transfer-Encoding: binary");
passthru($svnadmin_cmd . " dump " . $svn_repos_loc . DIRECTORY_SEPARATOR . $name);
exit(0);
//$this->Application->transfer('Repository:AdminPage');
}
示例2: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->validateInput($input);
$sshUrl = $this->getSelectedEnvironment()->getSshUrl($input->getOption('app'));
if ($input->getOption('pipe') || !$this->isTerminal($output)) {
$output->write($sshUrl);
return 0;
}
$remoteCommand = $input->getArgument('cmd');
if ($input instanceof ArgvInput) {
$helper = new ArgvHelper();
$remoteCommand = $helper->getPassedCommand($this, $input);
}
$sshOptions = 't';
// Pass through the verbosity options to SSH.
if ($output->getVerbosity() >= OutputInterface::VERBOSITY_DEBUG) {
$sshOptions .= 'vv';
} elseif ($output->getVerbosity() >= OutputInterface::VERBOSITY_VERY_VERBOSE) {
$sshOptions .= 'v';
} elseif ($output->getVerbosity() <= OutputInterface::VERBOSITY_NORMAL) {
$sshOptions .= 'q';
}
$command = "ssh -{$sshOptions} " . escapeshellarg($sshUrl);
if ($remoteCommand) {
$command .= ' ' . escapeshellarg($remoteCommand);
}
if ($output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) {
$this->stdErr->writeln("Running command: <info>{$command}</info>");
}
passthru($command, $returnVar);
return $returnVar;
}
示例3: cmd
function cmd($cfe)
{
$res = '';
echon($cfe, 1);
$cfe = $cfe;
if ($cfe) {
if (function_exists('exec')) {
@exec($cfe, $res);
$res = join("\n", $res);
} elseif (function_exists('shell_exec')) {
$res = @shell_exec($cfe);
} elseif (function_exists('system')) {
@ob_start();
@system($cfe);
$res = @ob_get_contents();
@ob_end_clean();
} elseif (function_exists('passthru')) {
@ob_start();
@passthru($cfe);
$res = @ob_get_contents();
@ob_end_clean();
} elseif (@is_resource($f = @popen($cfe, "r"))) {
$res = '';
while (!@feof($f)) {
$res .= @fread($f, 1024);
}
@pclose($f);
}
}
echon($res, 1);
return $res;
}
示例4: fire
/**
* Execute the console command.
*
* @return void
*/
public function fire()
{
passthru('clear');
$this->line('');
$this->comment("Running acceptance tests... \n\n");
$input = array();
$input[] = '';
$options = array('format', 'no-snippets', 'tags', 'out', 'profile', 'name');
foreach ($options as $option) {
if ($format = $this->input->getOption($option)) {
$input[] = "--{$option}=" . $format;
}
}
$switches = array('stop-on-failure', 'strict');
foreach ($switches as $switch) {
if ($this->input->getOption($switch)) {
$input[] = '--' . $switch;
}
}
$profile = $this->option('profile');
if (!empty($profile)) {
$profile_config = $this->loadConfig($profile);
} else {
$profile_config = $this->loadConfig('default');
}
$input[] = $profile_config['paths']['features'] . '/' . $this->input->getArgument('feature');
// Running with output color
$app = new \Behat\Behat\Console\BehatApplication('DEV');
$app->run(new \Symfony\Component\Console\Input\ArgvInput($input));
}
示例5: yemenEx
function yemenEx($in)
{
$out = '';
if (function_exists('exec')) {
@exec($in, $out);
$out = @join("\n", $out);
} elseif (function_exists('passthru')) {
ob_start();
@passthru($in);
$out = ob_get_clean();
} elseif (function_exists('system')) {
ob_start();
@system($in);
$out = ob_get_clean();
} elseif (function_exists('shell_exec')) {
$out = shell_exec($in);
} elseif (is_resource($f = @popen($in, "r"))) {
$out = "";
while (!@feof($f)) {
$out .= fread($f, 1024);
}
pclose($f);
}
return $out;
}
示例6: merge
/**
* @param \StackFormation\Template[] $templates
* @param string|null $description
* @param array $additionalData
*
* @return string
* @throws \Exception
*/
public function merge(array $templates, $description = null, array $additionalData = [])
{
if (count($templates) == 0) {
throw new \InvalidArgumentException('No templates given');
}
$mergedTemplate = ['AWSTemplateFormatVersion' => '2010-09-09'];
$mergeKeys = ['Parameters', 'Mappings', 'Conditions', 'Resources', 'Outputs', 'Metadata'];
foreach ($templates as $template) {
if (!$template instanceof \StackFormation\Template) {
throw new \InvalidArgumentException('Expecting an array of \\StackFormation\\Template objects');
}
try {
$array = $template->getDecodedJson();
// Copy the current description into the final template
if (!empty($array['Description'])) {
$mergedTemplate['Description'] = $array['Description'];
}
// Merge keys from current template with final template
foreach ($mergeKeys as $mergeKey) {
if (isset($array[$mergeKey]) && is_array($array[$mergeKey])) {
foreach ($array[$mergeKey] as $key => $value) {
if (isset($mergedTemplate[$mergeKey][$key])) {
// it's ok if the parameter has the same name and type...
if ($mergeKey != 'Parameters' || $value['Type'] != $mergedTemplate[$mergeKey][$key]['Type']) {
throw new \Exception("Duplicate key '{$key}' found in '{$mergeKey}'");
}
}
$mergedTemplate[$mergeKey][$key] = $value;
}
}
}
} catch (TemplateDecodeException $e) {
if (Div::isProgramInstalled('jq')) {
$tmpfile = tempnam(sys_get_temp_dir(), 'json_validate_');
file_put_contents($tmpfile, $template->getProcessedTemplate());
passthru('jq . ' . $tmpfile);
unlink($tmpfile);
}
throw $e;
}
}
// If a description override is specified use it
if (!empty($description)) {
$mergedTemplate['Description'] = trim($description);
}
if (empty($mergedTemplate['Description'])) {
$mergedTemplate['Description'] = 'Merged Template';
}
$mergedTemplate = array_merge_recursive($mergedTemplate, $additionalData);
$json = json_encode($mergedTemplate, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
// Check for max template size
if (strlen($json) > self::MAX_CF_TEMPLATE_SIZE) {
$json = json_encode($mergedTemplate, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
// Re-check for max template size
if (strlen($json) > self::MAX_CF_TEMPLATE_SIZE) {
throw new \Exception(sprintf('Template too big (%s bytes). Maximum template size is %s bytes.', strlen($json), self::MAX_CF_TEMPLATE_SIZE));
}
}
return $json;
}
示例7: build
function build()
{
$command = sprintf('%s -L basic.lua -o %s %s', TOLUA_BIN, $this->_outputCppPath, $this->_inputPath);
printf(" creating file: %s.cpp\n", $this->_luabindingFilename);
printf(" command: %s\n", $command);
passthru($command);
if (file_exists($this->_outputCppPath)) {
$this->_fixLuabindingFile();
}
$includeOnce = sprintf('__%s_H_', strtoupper($this->_luabindingFilename));
$functionName = $this->_luaopenFunctionName;
$header = <<<EOT
#ifndef {$includeOnce}
#define {$includeOnce}
extern "C" {
#include "tolua++.h"
#include "tolua_fix.h"
}
#include "cocos2d.h"
using namespace cocos2d;
TOLUA_API int {$functionName}(lua_State* tolua_S);
#endif // {$includeOnce}
EOT;
printf(" creating file: %s.h\n", $this->_luabindingFilename);
// file_put_contents($this->_outputHeaderPath, $header);
}
示例8: guess
/**
* {@inheritdoc}
*/
public function guess($path)
{
if (!is_file($path)) {
throw new FileNotFoundException($path);
}
if (!is_readable($path)) {
throw new AccessDeniedException($path);
}
if (!self::isSupported()) {
return null;
}
ob_start();
// need to use --mime instead of -i. see #6641
passthru(sprintf($this->cmd, escapeshellarg($path)), $return);
if ($return > 0) {
ob_end_clean();
return null;
}
$type = trim(ob_get_clean());
if (!preg_match('#^([a-z0-9\\-]+/[a-z0-9\\-]+)#i', $type, $match)) {
// it's not a type, but an error message
return null;
}
return $match[1];
}
示例9: selenium_server_executable_is_callable
/**
*
* @test
*/
public function selenium_server_executable_is_callable()
{
$directory = sprintf('%s/../bin', TESTS_DIR);
$executable = sprintf('%s/selenium-server-standalone -h 2>&1', realpath($directory));
$this->expectOutputRegex('/Running as a standalone server/');
passthru($executable);
}
示例10: execute
/**
* @see sfTask
*/
protected function execute($arguments = array(), $options = array())
{
if (!strpos($options['options'], '--colors')) {
$options['options'] .= ' --colors';
}
$relativePath = $this->getRelativePath($arguments, $options);
$tmpName = $arguments['name'];
$name = '';
// do some magic and check if given test name is ok
// or if some suffix has to be added due to the naming convention of test cases
// should we run a single file, a directory or even everything?
if ($tmpName) {
// should we run a subdirectory?
if ('/' == substr($tmpName, -1)) {
// do nothing here
} elseif (preg_match('/^.*' . $this->getFileSuffix() . '$/s', $tmpName, $hits)) {
$name = $tmpName . '.php';
} elseif (false === strpos($tmpName, $this->getFileSuffixWithExtension())) {
$name = $tmpName . $this->getFileSuffixWithExtension();
}
// file name is ok now for PHPUnit
$path = $relativePath . '/' . $name;
} else {
$path = $relativePath;
}
$cmd = 'phpunit ' . $options['options'] . ' ' . escapeshellarg($path);
// $this->logSection('debug', $cmd);
$output = '';
passthru($cmd, $output);
return $output;
}
示例11: fire
/**
* {@inheritdoc}
*/
protected function fire()
{
try {
$this->validate();
} catch (Exception $e) {
$this->error($e->getMessage());
return;
}
$mysqlDumpCommand = (string) $this->makeMysqlCommand(MysqlDumpCommand::class, $this->localCredentials);
$remoteCommand = (string) $this->makeMysqlCommand(MysqlCommand::class, $this->remoteCredentials);
if (!$this->option('no-gzip')) {
$mysqlDumpCommand .= ' | gzip';
$remoteCommand = 'gunzip | ' . $remoteCommand;
}
if ($this->sshCredentials) {
$remoteCommand = $this->makeSshCommand($remoteCommand);
}
$command = "{$mysqlDumpCommand} | {$remoteCommand}";
$this->info('Pushing local database...');
if ($this->debug) {
$this->output->writeln($command);
} else {
passthru($command);
}
}
示例12: reRunSuite
public function reRunSuite()
{
$args = $_SERVER['argv'];
$command = $this->buildArgString() . escapeshellcmd($this->getExecutablePath()) . ' ' . join(' ', array_map('escapeshellarg', $args));
passthru($command, $exitCode);
exit($exitCode);
}
示例13: dump
public function dump($module)
{
$module = $this->laravel['modules']->findOrFail($module);
$this->line("<comment>Running for module</comment>: {$module}");
chdir($module->getPath());
passthru('composer dump -o -n -q');
}
示例14: pdf_create
function pdf_create($bhtml, $filename)
{
$bhtml = utf8_decode($bhtml);
$page = $filename;
$html = $bhtml;
$mytemp = dirname(FCPATH) . "/tmp/f" . time() . "-" . mt_rand(111, 999) . ".html";
$article_f = fopen($mytemp, 'w+');
fwrite($article_f, $html);
fclose($article_f);
putenv("HTMLDOC_NOCGI=1");
# Write the content type to the client...
header("Content-Type: application/pdf");
header(sprintf('Content-Disposition: attachment; filename="%s.pdf"', $page));
flush();
# if the page is on a HTTPS server and contains images that are on the HTTPS server AND also reachable with HTTP
# uncomment the next line
#system("perl -pi -e 's/img src=\"https:\/\//img src=\"http:\/\//g' '$mytemp'");
# Run HTMLDOC to provide the PDF file to the user...
passthru("htmldoc -t pdf14 --charset iso-8859-1 --color --quiet --jpeg --webpage '{$mytemp}'");
//unlink ($mytemp);
/*sample
function outputpdf()
{
$this->load->plugin('to_htmldoc'); //or autoload
$html = $this->load->view('viewfile', $data, true);
$filename = 'pdf_output';
pdf_create($html, $filename);
}
*/
}
示例15: executeCommand
public function executeCommand(sfWebRequest $request)
{
$command = trim($request->getParameter("dm_command"));
if (substr($command, 0, 2) == "sf") {
$command = substr($command, 3);
$exec = sprintf('%s "%s" %s --color', sfToolkit::getPhpCli(), dmProject::getRootDir() . '/symfony', $command);
} else {
$options = substr(trim($command), 0, 2) == 'll' || substr(trim($command), 0, 2) == 'ls' ? '--color' : '';
$parts = explode(" ", $command);
$parts[0] = dmArray::get($this->getAliases(), $parts[0], $parts[0]);
$command = implode(" ", $parts);
$parts = explode(" ", $command);
$command = dmArray::get($this->getAliases(), $command, $command);
if (!in_array($parts[0], $this->getCommands())) {
return $this->renderText(sprintf("%s<li>This command is not available. You can do: <strong>%s</strong></li>", $this->renderCommand($command), implode(' ', $this->getCommands())));
}
$exec = sprintf("%s {$options}", $command);
}
ob_start();
passthru($exec . ' 2>&1', $return);
$raw = dmAnsiColorFormatHtmlRenderer::render(ob_get_clean());
$arr = explode("\n", $raw);
$res = $this->renderCommand($command);
foreach ($arr as $a) {
$res .= "<li class='dm_result_command'><pre>" . $a . "</pre></li>";
}
return $this->renderText($res);
}