当前位置: 首页>>代码示例>>PHP>>正文


PHP sfToolkit::getPhpCli方法代码示例

本文整理汇总了PHP中sfToolkit::getPhpCli方法的典型用法代码示例。如果您正苦于以下问题:PHP sfToolkit::getPhpCli方法的具体用法?PHP sfToolkit::getPhpCli怎么用?PHP sfToolkit::getPhpCli使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sfToolkit的用法示例。


在下文中一共展示了sfToolkit::getPhpCli方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: findPhpBinary

  protected function findPhpBinary()
  {
    if (defined('PHP_BINARY') && PHP_BINARY)
    {
      return PHP_BINARY;
    }

    if (false !== strpos(basename($php = $_SERVER['_']), 'php'))
    {
      return $php;
    }

    // from https://github.com/symfony/Process/blob/379b35a41a2749cf7361dda0f03e04410daaca4c/PhpExecutableFinder.php
    $suffixes = DIRECTORY_SEPARATOR == '\\' ? (getenv('PATHEXT') ? explode(PATH_SEPARATOR, getenv('PATHEXT')) : array('.exe', '.bat', '.cmd', '.com')) : array('');
    foreach ($suffixes as $suffix)
    {
      if (is_executable($php = PHP_BINDIR.DIRECTORY_SEPARATOR.'php'.$suffix))
      {
        return $php;
      }
    }

    if ($php = getenv('PHP_PEAR_PHP_BIN'))
    {
      if (is_executable($php))
      {
        return $php;
      }
    }

    return sfToolkit::getPhpCli();
  }
开发者ID:nise-nabe,项目名称:opKdtPlugin,代码行数:32,代码来源:opKdtBaseTask.class.php

示例2: 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);
 }
开发者ID:theolymp,项目名称:diem,代码行数:28,代码来源:actions.class.php

示例3: executeIndex

 public function executeIndex(dmWebRequest $request)
 {
     $this->sitemap = $this->getService('xml_sitemap_generator')->setOption('domain', $this->getRequest()->getAbsoluteUrlRoot());
     if ($this->getUser()->can('system')) {
         $this->shellUser = dmConfig::canSystemCall() ? exec('whoami') : 'www-data';
         $this->phpCli = dmConfig::canSystemCall() ? sfToolkit::getPhpCli() : '/path/to/php';
         $this->rootDir = sfConfig::get('sf_root_dir');
         $this->domainName = $this->getRequest()->getHost();
     }
 }
开发者ID:theolymp,项目名称:diem,代码行数:10,代码来源:actions.class.php

示例4: sf

 public function sf($command)
 {
     try {
         $phpCli = sfToolkit::getPhpCli();
     } catch (sfException $e) {
         $this->lastExec = array('command' => $command, 'output' => $e->getMessage());
         return false;
     }
     $sfCommand = sprintf('%s "%s" %s', $phpCli, sfConfig::get('sf_root_dir') . '/symfony', $command);
     return $this->exec($sfCommand);
 }
开发者ID:jdart,项目名称:diem,代码行数:11,代码来源:dmFilesystem.php

示例5: initialize

 public function initialize($t)
 {
     $this->t = $t;
     $this->tmp_dir = sfToolkit::getTmpDir() . DIRECTORY_SEPARATOR . 'symfony_cmd';
     if (is_dir($this->tmp_dir)) {
         $this->clearTmpDir();
         rmdir($this->tmp_dir);
     }
     mkdir($this->tmp_dir, 0777);
     $this->current_dir = getcwd();
     chdir($this->tmp_dir);
     $this->php_cli = sfToolkit::getPhpCli();
 }
开发者ID:soon0009,项目名称:EMS,代码行数:13,代码来源:tasksTest.php

示例6: initialize

 public function initialize($t)
 {
     $this->t = $t;
     $this->tmp_dir = sfToolkit::getTmpDir() . DS . 'sf_test_project';
     if (is_dir($this->tmp_dir)) {
         $this->clearTmpDir();
         rmdir($this->tmp_dir);
     }
     mkdir($this->tmp_dir, 0777);
     $this->current_dir = getcwd();
     chdir($this->tmp_dir);
     $this->php_cli = sfToolkit::getPhpCli();
 }
开发者ID:lapuntasoft,项目名称:facturacionafip,代码行数:13,代码来源:tasksTest.php

示例7: listenToCommandPostCommand

 public static function listenToCommandPostCommand(sfEvent $event)
 {
     static $firstCall = array();
     $task = $event->getSubject();
     $taskClass = get_class($task);
     $isFirstCall = isset($firstCall[$taskClass]) === false;
     $firstCall[$taskClass] = true;
     switch ($taskClass) {
         case 'sfDoctrineDataLoadTask':
             if ($isFirstCall) {
                 passthru(sprintf('%s %s/symfony jmsPaymentPlugin:updateRates', sfToolkit::getPhpCli(), sfConfig::get('sf_root_dir')));
             }
             break;
     }
 }
开发者ID:schmittjoh,项目名称:jmsPaymentPlugin,代码行数:15,代码来源:jmsPaymentPluginConfiguration.class.php

示例8: executeIndex

 public function executeIndex(dmWebRequest $request)
 {
     $this->engine = $this->getService('search_engine');
     $this->form = $this->getSearchForm();
     if ($this->query = trim($request->getParameter('query'))) {
         $this->form->bind(array('query' => $this->query));
         $this->pager = $this->getSearchPager($this->query);
     } else {
         $this->pager = null;
     }
     if ($this->getUser()->can('system')) {
         $this->shellUser = dmConfig::canSystemCall() ? exec('whoami') : 'www-data';
         $this->phpCli = dmConfig::canSystemCall() ? sfToolkit::getPhpCli() : '/path/to/php';
         $this->rootDir = sfConfig::get('sf_root_dir');
     }
 }
开发者ID:jdart,项目名称:diem,代码行数:16,代码来源:actions.class.php

示例9: executeExport

 public function executeExport(sfWebRequest $request)
  { 

        $cmd = " > /dev/null &";

   exec(
        sprintf(
          '%s %s/symfony rockstep:csv --report=%s --go'.$cmd, 
            sfToolkit::getPhpCli(), 
            sfConfig::get('sf_root_dir'), 
            'classes'),
        $returnVar
    );


    // do nothing


  }
开发者ID:romankallweit,项目名称:swingmachine,代码行数:19,代码来源:actions.class.php

示例10: __construct

 public function __construct($t)
 {
     $this->t = $t;
     $this->cli = sfToolkit::getPhpCli();
 }
开发者ID:niryuu,项目名称:OpenPNE3,代码行数:5,代码来源:opInteractiveTaskTestHandler.class.php

示例11: implode

if (count($cultures) > 0) {
    $this->logSection('i18n', 'enabling i18n in Sympal with cultures: ' . implode(', ', $cultures));
    $command = sprintf('%s "%s" %s', sfToolkit::getPhpCli(), sfConfig::get('sf_root_dir') . '/symfony', 'sympal:configure ' . sprintf('i18n=true language_codes="[%s]"', implode(',', $cultures)));
    $this->logBlock($command, 'INFO');
    $this->getFilesystem()->execute($command, $out, $err);
    $this->logSection('i18n', sprintf('enabling i18n in application "%s"', $application));
    $settingsFilename = sfConfig::get('sf_apps_dir') . '/' . $application . '/config/settings.yml';
    $settings = file_get_contents($settingsFilename);
    $settings .= <<<EOF

    i18n: true
    default_culture: {$cultures[0]}
EOF;
    file_put_contents($settingsFilename, $settings);
}
// execute sympal installation
$command = sprintf('%s "%s" %s', sfToolkit::getPhpCli(), sfConfig::get('sf_root_dir') . '/symfony', 'sympal:install ' . $application . ' --force-reinstall --email-address="' . $emailAddress . '" --username="' . $username . '" --password="' . $password . '" --no-confirmation --db-dsn="' . $db['dsn'] . '" --db-username="' . $db['username'] . '" --db-password="' . $db['password'] . '" --first-name="' . $firstName . '" --last-name="' . $lastName . '"');
$this->logBlock($command, 'INFO');
$this->getFilesystem()->execute($command);
// fix permission for common directories
$fixPerms = new sfProjectPermissionsTask($this->dispatcher, $this->formatter);
$fixPerms->setCommandApplication($this->commandApplication);
$fixPerms->setConfiguration($this->configuration);
$fixPerms->run();
$this->replaceTokens();
$this->log(null);
$this->logSection('sympal', sprintf('Sympal was installed successfully...', $application));
$url = 'http://localhost/' . $application . '_dev.php/security/signin';
$this->logSection('sympal', sprintf('Open your browser to "%s"', $url));
$this->logSection('sympal', sprintf('You can signin with the username "%s" and password "%s"', $username, $password));
exit;
开发者ID:slemoigne,项目名称:sympal,代码行数:31,代码来源:installer.php

示例12: sfValidatorString

 * ****** Step4: Collecting Information & Configuring sympal ***************
 */
$application = $this->askAndValidate('What would you like your first application to be called? An application with this name will be generated for you.', new sfValidatorString(), array('style' => 'QUESTION_LARGE'));
$validator = new sfValidatorEmail();
$emailAddress = $this->askAndValidate('What is your e-mail address? (will used as author in config/properties.ini)', $validator, array('style' => 'QUESTION_LARGE'));
$this->logSection('sympal', '...setup database');
$db = setupDatabase($this);
$this->runTask('configure:database', array('dsn' => $db['dsn'], 'username' => $db['username'], 'password' => $db['password']));
$this->logSection('sympal', 'Configuring author');
$this->runTask('configure:author', sprintf("'%s'", $emailAddress));
$this->logSection('sympal', sprintf('Generating app %s', $application));
$this->runTask('generate:app', $application);
// install sympal
$this->logSection('sympal', 'Sympal is now installing itself into the symfony application.
  This will take a while, please be patient...');
$command = sprintf('%s "%s" %s', sfToolkit::getPhpCli(), sfConfig::get('sf_root_dir') . '/symfony', 'sympal:install ' . $application . ' --no-confirmation');
passthru($command);
/*
 * Fix permission for common directories
 * 
 * Must be done because we exist from the project generate task prematurely
 * so that we can show the pretty message about how to get to your site
 */
$fixPerms = new sfProjectPermissionsTask($this->dispatcher, $this->formatter);
$fixPerms->setCommandApplication($this->commandApplication);
$fixPerms->setConfiguration($this->configuration);
$fixPerms->run();
// replace tokens, do this since we exit the project install below
$this->replaceTokens();
// symlink the sf directory
$rootdir = getcwd();
开发者ID:sympal,项目名称:sympal,代码行数:31,代码来源:installer.php

示例13: usleep

/*
 * APPLY
 */
$this->logBlock('Your configuration is valid', 'INFO_LARGE');
usleep(1000000);
$sendReports = $this->askConfirmation(array('Send anonymous reports about plugins used to improve http://diem-project.org/plugins (Y/n)'), 'QUESTION_LARGE', true);
if (!$this->askConfirmation(array('The installation will remove all data in the ' . $settings['database']['name'] . ' database.', '', 'Are you sure you want to proceed? (Y/n)'), 'QUESTION_LARGE', true)) {
    $this->logSection('diem', 'installation aborted');
    exit;
}
$this->filesystem->mirror(dmOs::join(sfConfig::get('dm_core_dir'), 'data/skeleton'), sfConfig::get('sf_root_dir'), sfFinder::type('any')->discard('.sf'), array('override' => true));
$this->replaceTokens(sfConfig::get('sf_config_dir'), array('SYMFONY_CORE_AUTOLOAD' => $symfonyCoreAutoload, 'DIEM_CORE_STARTER' => var_export(dmOs::join(sfConfig::get('dm_core_dir'), 'lib/core/dm.php'), true), 'DIEM_WEB_DIR' => "sfConfig::get('sf_root_dir').'/" . $settings['web_dir_name'] . "'", 'DIEM_CULTURE' => var_export($settings['culture'], true), 'SEND_REPORTS' => var_export($sendReports, true)));
$this->filesystem->remove(array(dmProject::rootify('web/css'), dmProject::rootify('web/css/main.css'), dmProject::rootify('web/images'), dmProject::rootify('data/fixtures'), dmProject::rootify('data/fixtures/fixtures.yml')));
if ('web' != $settings['web_dir_name']) {
    $this->filesystem->rename(dmProject::rootify('web'), dmProject::rootify($settings['web_dir_name']));
}
$db = $settings['database'];
$this->runTask('configure:database', array('dsn' => $db['dsn'], 'username' => $db['user'], 'password' => $db['password']));
try {
    if ('/' !== DIRECTORY_SEPARATOR) {
        throw new Exception('Automatic install disabled for windows servers');
    }
    $this->logBlock('Installing ' . $projectKey . '. This may take some time.', 'INFO_LARGE');
    $out = $err = null;
    $this->getFilesystem()->execute(sprintf('%s "%s" %s', sfToolkit::getPhpCli(), sfConfig::get('sf_root_dir') . '/symfony', 'dm:setup --no-confirmation'), $out, $err);
    $this->logBlock('Your project is now ready to be accessed by the web. Try it out on admin_dev.php.', 'INFO_LARGE');
    $this->logBlock('Your username is "admin" and your password is ' . (empty($settings['database']['password']) ? '"admin"' : 'the database password'), 'INFO_LARGE');
} catch (Exception $e) {
    $this->logBlock('There is one last thing you need to do.  Please run "php symfony dm:setup"', 'INFO_LARGE');
}
exit;
开发者ID:jdart,项目名称:diem,代码行数:31,代码来源:installer.php

示例14: getDefaultArguments

 /**
  * @return array
  */
 protected function getDefaultArguments()
 {
     return array('php' => array(\sfToolkit::getPhpCli()), 'directories' => array(\sfConfig::get('sf_test_dir') . '/unit/'));
 }
开发者ID:atoum,项目名称:sfatoumplugin,代码行数:7,代码来源:atoumTestTask.class.php

示例15: executeTaskExecute

  public function executeTaskExecute()
  {
    if(!$this->getRequest()->isXmlHttpRequest())
    {
      $this->getResponse()->getParameterHolder()->removeNamespace('helper/asset/auto/stylesheet/last'); 
    }
    $this->php_cli = sfToolkit::getPhpCli();
    
    if($batch = $this->getRequestParameter('batch'))
    {
      $command = sprintf('%s "%s"', $this->php_cli, SF_ROOT_DIR.'/batch/'.$batch);
      $visible_command = 'php '.$batch; 
    }
    else
    {
      $command = $this->getRequestParameter('freetask');
      if(!$command)
      {
        if($args = $this->getRequestParameter('arg'))
        {
          ksort($args);
          $args = implode(' ', $args);
        }
        else
        {
          $args = '';
        }
        $command  = $this->getRequestParameter('task').' '.$args;
      }
      $visible_command = 'symfony '.$command; 
      $command = sprintf('%s "%s" %s', $this->php_cli, SF_ROOT_DIR.'/symfony', $command);
    }
    
    ob_start();
    passthru($command, $return);
    $content = ob_get_clean();

    $this->command = $visible_command;
    $this->output = $content;
  }
开发者ID:jonphipps,项目名称:Metadata-Registry,代码行数:40,代码来源:actions.class.php


注:本文中的sfToolkit::getPhpCli方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。