本文整理汇总了PHP中Process::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Process::create方法的具体用法?PHP Process::create怎么用?PHP Process::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Process
的用法示例。
在下文中一共展示了Process::create方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateProcessRow
/**
* Update a Process register in DB, if the process doesn't exist with the same
* uid of the $row['PRO_UID'] parameter the function creates a new one based
* on the $row parameter data.
*
* @param $row array parameter with the process data
* @return $oProcess Process object
*/
public function updateProcessRow ($row)
{
$oProcess = new Process();
if ($oProcess->processExists( $row['PRO_UID'] )) {
$oProcess->update( $row );
} else {
$oProcess->create( $row );
}
}
示例2: createProcess
public function createProcess($aData)
{
try {
$oProcess = new Process();
return $oProcess->create($aData);
} catch (Exception $oError) {
throw $oError;
}
}
示例3: file_get_contents
$wp_config_path = $world->variables['RUN_DIR'] . "/wp-config.php";
$wp_config_code = file_get_contents($wp_config_path);
$world->move_files('wp-content', 'my-content');
$world->add_line_to_wp_config($wp_config_code, "define( 'WP_CONTENT_DIR', dirname(__FILE__) . '/my-content' );");
$world->move_files('my-content/plugins', 'my-plugins');
$world->add_line_to_wp_config($wp_config_code, "define( 'WP_PLUGIN_DIR', __DIR__ . '/my-plugins' );");
file_put_contents($wp_config_path, $wp_config_code);
});
$steps->Given('/^download:$/', function ($world, TableNode $table) {
foreach ($table->getHash() as $row) {
$path = $world->replace_variables($row['path']);
if (file_exists($path)) {
// assume it's the same file and skip re-download
continue;
}
\Process::create(\WP_CLI\Utils\esc_cmd('curl -sSL %s > %s', $row['url'], $path))->run_check();
}
});
$steps->Given('/^save (STDOUT|STDERR)( [\'].+[^\'])? as \\{(\\w+)\\}$/', function ($world, $stream, $output_filter, $key) {
if ($output_filter) {
$output_filter = '/' . trim(str_replace('%s', '(.+[^\\b])', $output_filter), "' ") . '/';
if (false !== preg_match($output_filter, $world->result->{$stream}, $matches)) {
$output = array_pop($matches);
} else {
$output = '';
}
} else {
$output = $world->result->{$stream};
}
$world->variables[$key] = trim($output, "\n");
});
示例4: invoke_proc
<?php
use Behat\Gherkin\Node\PyStringNode, Behat\Gherkin\Node\TableNode;
function invoke_proc($proc, $mode, $subdir = null)
{
$map = array('run' => 'run_check', 'try' => 'run');
$method = $map[$mode];
return $proc->{$method}($subdir);
}
$steps->When('/^I (run|try) `([^`]+)`$/', function ($world, $mode, $cmd) {
$cmd = $world->replace_variables($cmd);
$world->result = invoke_proc($world->proc($cmd), $mode);
});
$steps->When("/^I (run|try) `([^`]+)` from '([^\\s]+)'\$/", function ($world, $mode, $cmd, $subdir) {
$cmd = $world->replace_variables($cmd);
$world->result = invoke_proc($world->proc($cmd), $mode, $subdir);
});
$steps->When('/^I (run|try) the previous command again$/', function ($world, $mode) {
if (!isset($world->result)) {
throw new \Exception('No previous command.');
}
$proc = Process::create($world->result->command, $world->result->cwd, $world->result->env);
$world->result = invoke_proc($proc, $mode);
});
示例5: Process
//#30
$t->isa_ok($e, 'Exception', 'remove() returns error when UID is not defined');
//#31
//$t->is ( $e->getMessage(), "This row doesn't exist!", "remove() This row doesn't exist!" );
$t->todo($e->getMessage() . " <> The row ''in table Process doesn't exist! " . " line 213");
}
//remove with $fields
$Fields['PRO_UID'] = $proUid;
try {
$obj = new Process();
$res = $obj->remove($Fields);
//#32
$t->is($res, NULL, "remove() remove row {$proUid}");
} catch (Exception $e) {
//#14
$t->isa_ok($e, 'PropelException', 'remove() return error ' . $e->getMessage());
}
//remove with $proUid
$obj = new Process();
$proUid = $obj->create('1');
try {
$obj = new Process();
$res = $obj->remove($proUid);
//#33
$t->is($res, NULL, "remove() remove row {$proUid}");
} catch (Exception $e) {
//#14
$t->isa_ok($e, 'PropelException', 'remove() return error ' . $e->getMessage());
}
$t->todo('Test to verify if delete works correctly :p ...');
$t->todo('how can I change dynamically the Case Title based in a definition, right now the case title is the same as the process title. We need another field in process to have the case title definition');
示例6: download_wp
public function download_wp($subdir = '')
{
$dest_dir = $this->variables['RUN_DIR'] . "/{$subdir}";
if ($subdir) {
mkdir($dest_dir);
}
Process::create(Utils\esc_cmd("cp -r %s/* %s", self::$cache_dir, $dest_dir))->run_check();
// disable emailing
mkdir($dest_dir . '/wp-content/mu-plugins');
copy(__DIR__ . '/../extra/no-mail.php', $dest_dir . '/wp-content/mu-plugins/no-mail.php');
}