本文整理汇总了PHP中Symfony\Component\Process\Process::isSuccessful方法的典型用法代码示例。如果您正苦于以下问题:PHP Process::isSuccessful方法的具体用法?PHP Process::isSuccessful怎么用?PHP Process::isSuccessful使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\Process\Process
的用法示例。
在下文中一共展示了Process::isSuccessful方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isSuccessful
/**
* @inheritDoc
*/
public function isSuccessful()
{
if ($this->symfonyProcess->isSuccessful()) {
echo "[33m{$this->job->jobName()}: [36mHas finished without errors.\n";
}
return $this->symfonyProcess->isSuccessful();
}
示例2: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->downloadConfiguration();
$library = new GLibc();
try {
$this->download()->extract();
$library->setEnv($this->env)->setProjectDir($this->baseDir)->initialize()->boot($input, $output);
$configure = $this->projectDir . '/' . $library->configure();
$this->projectDir = dirname($this->projectDir) . '/glibc-build';
$this->fs->mkdir($this->projectDir);
$this->output->write(' Building : ');
$process = new Process($configure, $this->projectDir, $this->env->toArray());
$process->setTimeout(0);
$process->run();
if ($process->isSuccessful()) {
$process->setCommandLine('make -j4 && make -j4 install');
$process->run();
}
if ($process->isSuccessful()) {
$message = '<info>✔</info>';
} else {
$message = '<error>✕</error>';
}
$this->output->writeln($message);
} catch (\Exception $e) {
$this->cleanUp();
throw $e;
}
$this->createConfiguration();
$this->output->writeln(sprintf(" <info>%s</info> Droidphp Installer <info>successfully configured</info> Now you can:\n" . " * Run :\n" . " 1. Execute the <comment>%s build:components</comment> command.\n" . " To Build the project\n\n", defined('PHP_WINDOWS_VERSION_BUILD') ? 'OK' : '✔', basename($_SERVER['PHP_SELF'])));
}
示例3: isSuccessful
private function isSuccessful()
{
if (null === $this->isSuccessful) {
$this->process->wait();
$this->isSuccessful = $this->process->isSuccessful();
}
return $this->isSuccessful;
}
示例4: process
/**
* @param $command
* @throws ShellProcessFailed
* @throws \Symfony\Component\Process\Exception\LogicException
*/
public function process($command)
{
if (empty($command)) {
return;
}
$this->process->setCommandLine($command);
$this->process->run();
if (!$this->process->isSuccessful()) {
throw new ShellProcessFailed($this->process->getErrorOutput());
}
}
示例5: execucte
/**
* @param string $command
* @return array
*/
protected function execucte($command)
{
$command = (string) $command;
$process = new Process($command);
$process->run();
if (!$process->isSuccessful()) {
$this->failed++;
$this->success = false;
} else {
$this->succeeded++;
}
return array('success' => $process->isSuccessful(), 'output' => $process->getOutput());
}
示例6: execute
public function execute()
{
$logger = $this->getRunConfig()->getLogger();
$this->process = new Process($this->command);
$logger->info('Start command:' . $this->command);
$this->process->setTimeout($this->timeout);
$this->process->setWorkingDirectory($this->getRunConfig()->getRepositoryDirectory());
$this->process->run();
$output = trim($this->process->getOutput());
$logger->info($output);
if (!$this->process->isSuccessful()) {
$logger->emergency($this->process->getErrorOutput());
throw new \RuntimeException('Command not successful:' . $this->command);
}
}
示例7: execute
/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$apply = $input->getOption('apply');
$filename = 'app/config/parameters.yml';
if (!file_exists($filename)) {
throw new RuntimeException("No such file: " . $filename);
}
$data = file_get_contents($filename);
$config = Yaml::parse($data);
if (isset($config['pdo'])) {
$pdo = $config['pdo'];
} else {
if (!isset($config['parameters']['pdo'])) {
throw new RuntimeException("Can't find pdo configuration");
}
$pdo = $config['parameters']['pdo'];
}
$cmd = 'vendor/bin/dbtk-schema-loader schema:load app/schema.xml ' . $pdo;
if ($apply) {
$cmd .= ' --apply';
}
$process = new Process($cmd);
$output->writeLn($process->getCommandLine());
$process->run();
if (!$process->isSuccessful()) {
throw new ProcessFailedException($process);
}
$output->write($process->getOutput());
}
示例8: dump
public static function dump()
{
$ret = '';
if (!isset(\Kwf_Setup::$configClass)) {
throw new Exception("Run Kwf_Setup::setUp() before using this method");
}
$dbConfig = \Kwf_Registry::get('dao')->getDbConfig();
$cacheTables = \Kwf_Util_ClearCache::getInstance()->getDbCacheTables();
$dumpCmd = "mysqldump";
$dumpCmd .= " --host=" . escapeshellarg($dbConfig['host']);
$dumpCmd .= " --user=" . escapeshellarg($dbConfig['username']);
$dumpCmd .= " --password=" . escapeshellarg($dbConfig['password']);
$cmd = $dumpCmd;
foreach ($cacheTables as $t) {
$cmd .= " --ignore-table=" . escapeshellarg($dbConfig['dbname'] . '.' . $t);
}
$cmd .= " {$dbConfig['dbname']}";
$process = new Process($cmd);
$process->run();
if (!$process->isSuccessful()) {
throw new \RuntimeException($process->getErrorOutput());
}
$ret .= $process->getOutput();
foreach ($cacheTables as $t) {
$cmd = $dumpCmd;
$cmd .= " --no-data " . escapeshellarg($dbConfig['dbname']) . " " . escapeshellarg($t);
$process = new Process($cmd);
$process->run();
if (!$process->isSuccessful()) {
throw new \RuntimeException($process->getErrorOutput());
}
$ret .= $process->getOutput();
}
return $ret;
}
示例9: dump_base
protected function dump_base(base $base, InputInterface $input, OutputInterface $output)
{
$date_obj = new DateTime();
$filename = sprintf('%s%s_%s.sql', p4string::addEndSlash($input->getArgument('directory')), $base->get_dbname(), $date_obj->format('Y_m_d_H_i_s'));
$command = sprintf('mysqldump %s %s %s %s %s %s --default-character-set=utf8', '--host=' . escapeshellarg($base->get_host()), '--port=' . escapeshellarg($base->get_port()), '--user=' . escapeshellarg($base->get_user()), '--password=' . escapeshellarg($base->get_passwd()), '--databases', escapeshellarg($base->get_dbname()));
if ($input->getOption('gzip')) {
$filename .= '.gz';
$command .= ' | gzip -9';
} elseif ($input->getOption('bzip')) {
$filename .= '.bz2';
$command .= ' | bzip2 -9';
}
$output->write(sprintf('Generating <info>%s</info> ... ', $filename));
$command .= ' > ' . escapeshellarg($filename);
$process = new Process($command);
$process->setTimeout((int) $input->getOption('timeout'));
$process->run();
if (!$process->isSuccessful()) {
$output->writeln('<error>Failed</error>');
return 1;
}
if (file_exists($filename) && filesize($filename) > 0) {
$output->writeln('OK');
return 0;
} else {
$output->writeln('<error>Failed</error>');
return 1;
}
}
示例10: execute
/**
* Execute the command.
*
* @param \Symfony\Component\Console\Input\InputInterface $input
* @param \Symfony\Component\Console\Output\OutputInterface $output
* @return void
*/
public function execute(InputInterface $input, OutputInterface $output)
{
// Useful for working on pubstack-shell.
if ($input->getOption('clean')) {
// Since it'd be easy for some shell script to change the PUBSTACK_PATH
// variable, confirm this every time.
$helper = $this->getHelper('question');
$question = new ConfirmationQuestion('Are you sure you want to delete ' . $_ENV['PUBSTACK_PATH'] . '? This operation cannot be undone.', false);
if (!$helper->ask($input, $output, $question)) {
return;
}
// Remove the existing pubstack directory.
$process = new Process('rm -rf ' . $_ENV['PUBSTACK_PATH']);
$process->run();
if (!$process->isSuccessful()) {
throw new \RuntimeException($process->getErrorOutput());
}
}
// Only complain if --clean isn't specified.
if (is_dir($_ENV['PUBSTACK_PATH']) && !$input->getOption('clean')) {
throw new \RuntimeException("Pubstack has already been initialized.");
}
$output->writeln('<comment>Cloning pubstack...</comment>');
$process = new Process('git clone ' . $_ENV['PUBSTACK_REPO'] . ' ' . $_ENV['PUBSTACK_PATH']);
$process->run();
if (!$process->isSuccessful()) {
throw new \RuntimeException($process->getErrorOutput());
}
$output->writeln('<info>Done!</info>');
$output->writeln('<comment>Now run "pubstack configure"</comment>');
}
示例11: uploadFileAction
/**
* @Route("/file-upload", name="uploadFile")
* @Template()
*/
public function uploadFileAction(Request $request)
{
$allow = $request->get('private', false);
/** @var File $file */
$file = $request->files->get('file');
$imageName = uniqid('legofy-online') . '.png';
$command = sprintf('legofy %s/%s %s/../../../web/images/%s', $file->getPath(), $file->getFilename(), __DIR__, $imageName);
$process = new Process($command);
$process->run();
if (!$process->isSuccessful()) {
throw new ProcessFailedException($process);
}
$imagine = new Imagine();
$imageFile = $imagine->open(sprintf('%s/../../../web/images/%s', __DIR__, $imageName));
$box = $imageFile->getSize();
if ($box->getHeight() > $box->getWidth()) {
$imageFile->resize(new Box(400, $box->getHeight() * (400 / $box->getWidth())))->crop(new Point(0, 0), new Box(400, 400));
} else {
$newWidth = $box->getWidth() * (400 / $box->getHeight());
$imageFile->resize(new Box($newWidth, 400))->crop(new Point(($newWidth - 400) / 2, 0), new Box(400, 400));
}
$imageFile->save(sprintf('%s/../../../web/images/thumbnails/%s', __DIR__, $imageName));
$image = new Image();
$image->setPrivate($allow)->setName($imageName)->setCreationDate(new \DateTime());
$em = $this->getDoctrine()->getManager();
$em->persist($image);
$em->flush();
return new JsonResponse(['url' => $this->generateUrl('editImage', ['id' => $image->getId(), 'name' => $image->getName()])]);
}
示例12: createTerra
/**
* Creates a Terra instance.
*
* @return Terra
* A configured Flo instance.
*/
private function createTerra()
{
$terra = new Terra();
// Get config from env variables or files.
if ($config_env = getenv('TERRA')) {
$config_env = Yaml::parse($config_env);
$config = new Config($config_env);
} else {
$fs = new Filesystem();
$user_config = array();
$user_config_file = getenv('HOME') . '/.terra/terra';
if ($fs->exists($user_config_file)) {
$user_config = Yaml::parse($user_config_file);
}
$project_config = array();
$process = new Process('git rev-parse --show-toplevel');
$process->run();
if ($process->isSuccessful()) {
$project_config_file = trim($process->getOutput()) . '/terra.yml';
if ($fs->exists($project_config_file)) {
$project_config = Yaml::parse($project_config_file);
}
}
$config = new Config($user_config, $project_config);
}
$terra->setConfig($config);
return $terra;
}
示例13: backup
/**
* Perform the database backup.
*
* @return bool Whether the backup completed successfully or not.
*/
public function backup()
{
if (!$this->get_mysqldump_executable_path()) {
return false;
}
// Grab the database connections args
$args = $this->get_mysql_connection_args();
// Allow lock-tables to be overridden
if (defined('HMBKP_MYSQLDUMP_SINGLE_TRANSACTION') && HMBKP_MYSQLDUMP_SINGLE_TRANSACTION) {
$args[] = '--single-transaction';
}
// Make sure binary data is exported properly
$args[] = '--hex-blob';
// The file we're saving too
$args[] = '-r ' . escapeshellarg($this->get_backup_filepath());
// The database we're dumping
$args[] = escapeshellarg($this->get_name());
$process = new Process($this->get_mysqldump_executable_path() . ' ' . implode(' ', $args));
$process->setTimeout(HOUR_IN_SECONDS);
try {
$process->run();
} catch (\Exception $e) {
$this->error(__CLASS__, $e->getMessage());
}
if (!$process->isSuccessful()) {
$this->error(__CLASS__, $process->getErrorOutput());
}
return $this->verify_backup();
}
示例14: dump
public function dump()
{
if ($this->user != '' && $this->pass != "") {
$this->auth = sprintf("--host='%s' --port='%d' --username='%s' --password='%s'", $this->host, $this->port, $this->user, $this->pass);
} else {
if ($this->user != '' && $this->pass == "") {
$this->auth = sprintf("--host='%s' --port='%d' --username='%s'", $this->host, $this->port, $this->user);
} else {
$this->auth = sprintf("--host='%s' --port='%d'", $this->host, $this->port);
}
}
if ($this->database != '') {
$command = sprintf('mongodump %s -db %s -out %s', $this->auth, $this->database, $this->backupPath . $this->backupFilename);
} else {
$command = sprintf('mongodump %s -out %s', $this->auth, $this->backupPath . $this->backupFilename);
}
$process = new Process($command);
$process->setTimeout(null);
$process->run();
if (!$process->isSuccessful()) {
$this->result['status'] = 0;
$this->result['message'] = $process->getErrorOutput();
} else {
$this->result['status'] = 1;
$this->result['message'] = "Successful backup of Mongodb in local file: " . $this->backupPath . $this->backupFilename;
$this->result['backup_path'] = $this->backupPath;
$this->result['backup_filename'] = $this->backupFilename;
$this->result['backup_name'] = $this->backupName;
$this->result['full_path'] = $this->backupPath . $this->backupFilename;
$this->result['host'] = $this->host;
}
return $this->result;
}
示例15: kanjiToRomaji
public static function kanjiToRomaji($input, &$returnCode = '')
{
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
return $input;
}
$japanese = "/([\\x{3000}-\\x{303f}\\x{3040}-\\x{309f}\\x{30a0}-\\x{30ff}\\x{ff00}-\\x{ff9f}\\x{4e00}-\\x{9faf}\\x{3400}-\\x{4dbf}])+/iu";
preg_match_all($japanese, $input, $matches);
if (empty($matches[0]) || !is_array($matches[0])) {
return $input;
}
$placeholders = ['in' => $matches[0], 'out' => []];
$uniq = uniqid();
$kakasi = 'kakasi -i euc -w | kakasi -i euc -Ha -Ka -Ja -Ea -ka';
$process = new Process($kakasi);
$words = implode($uniq, $placeholders['in']);
$convertedWords = mb_convert_encoding($words, 'eucjp', 'utf-8');
$process->setInput($convertedWords);
$process->run();
if (!$process->isSuccessful()) {
return IRCHelper::colorText('ERROR', IRCHelper::COLOR_RED) . ': can\'t run kakasi';
}
$romaji = $process->getOutput();
$placeholders['out'] = explode($uniq, $romaji);
$input = str_replace($placeholders['in'], $placeholders['out'], $input);
return $input;
}