本文整理汇总了PHP中CLI::taskRun方法的典型用法代码示例。如果您正苦于以下问题:PHP CLI::taskRun方法的具体用法?PHP CLI::taskRun怎么用?PHP CLI::taskRun使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CLI
的用法示例。
在下文中一共展示了CLI::taskRun方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: minify_javascript
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
* @author Alexandre Rosenfeld <alexandre@colosa.com>
* @package workflow-engine-bin-tasks
*/
CLI::taskName('build-js');
CLI::taskDescription(<<<EOT
Generate Javascript Files
This command should be run after any modification of javascript files in
folder gulliver/js/*.
EOT
);
//CLI::taskOpt("minify", "If the option is enabled, performs the build only with minified files", "min", "buildmin");
CLI::taskRun("minify_javascript");
function minify_javascript($command, $args)
{
CLI::logging("BUILD-JS\n");
//disabling the rakefile version, until we have updated the dev environment
//CLI::logging("Checking if rake is installed...\n");
//$rakeFile = PROCESSMAKER_PATH . "workflow/engine/bin/tasks/Rakefile";
//system('rake -f ' . $rakeFile);
require_once (PATH_THIRDPARTY . 'jsmin/jsmin.php');
$libraries = json_decode( file_get_contents ( PATH_HOME . 'engine/bin/tasks/libraries.json' ));
//print_r($libraries);
foreach ($libraries as $k=>$library ) {
示例2: minify_javascript
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
* @author Alexandre Rosenfeld <alexandre@colosa.com>
* @package workflow-engine-bin-tasks
*/
CLI::taskName('build-js');
CLI::taskDescription(<<<EOT
Generate Javascript Files
This command should be run after any modification of javascript files in
folder gulliver/js/*.
EOT
);
//CLI::taskOpt("minify", "If the option is enabled, performs the build only with minified files", "min", "buildmin");
CLI::taskRun(minify_javascript);
function minify_javascript($command, $args)
{
CLI::logging("BUILD-JS\n");
//disabling the rakefile version, until we have updated the dev environment
//CLI::logging("Checking if rake is installed...\n");
//$rakeFile = PROCESSMAKER_PATH . "workflow/engine/bin/tasks/Rakefile";
//system('rake -f ' . $rakeFile);
require_once PATH_THIRDPARTY . 'jsmin/jsmin.php';
$libraries = json_decode(file_get_contents(PATH_HOME . 'engine/bin/tasks/libraries.json'));
//print_r($libraries);
foreach ($libraries as $k => $library) {
$build = $library->build;
if ($build) {
$bufferMini = "";
$sum1 = 0;
示例3: run_flush_cache
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
* @package workflow-engine-bin-tasks
*/
G::LoadSystem("g");
CLI::taskName('flush-cache');
CLI::taskDescription(<<<EOT
Flush cache of all workspaces of a given workspace
EOT
);
CLI::taskArg('workspace', true, true);
CLI::taskRun('run_flush_cache');
function run_flush_cache($args, $opts)
{
$rootDir = realpath(__DIR__."/../../../../");
$app = new Maveriks\WebApplication();
$app->setRootDir($rootDir);
$loadConstants = false;
$workspaces = get_workspaces_from_args($args);
if (! defined("PATH_C")) {
die("ERROR: seems processmaker is not properly installed (System constants are missing).".PHP_EOL);
}
CLI::logging("Flush ".pakeColor::colorize("system", "INFO")." cache ... ");
G::rm_dir(PATH_C);
示例4: run_create_translation
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
* @package workflow-engine-bin-tasks
*/
G::LoadClass("system");
G::LoadClass("wsTools");
CLI::taskName('mafe-translation');
CLI::taskDescription(<<<EOT
Creates labels of mafe for the database
If no workspace is specified, then the translation labels will be created in all available workspaces.
EOT
);
CLI::taskArg('workspace', true, true);
CLI::taskOpt("lang", "Specify the language to create the translation labels. If not specified then the language will be 'en' (English) by default.\n Ex: -lfr (French)\n Ex: --lang=zh-CN (Mainland Chinese)", "lLANG", "lang=LANG");
CLI::taskRun('run_create_translation');
function run_create_translation($args, $opts)
{
G::LoadSystem('inputfilter');
$filter = new InputFilter();
$opts = $filter->xssFilterHard($opts);
$args = $filter->xssFilterHard($args);
$rootDir = realpath(__DIR__ . "/../../../../");
$app = new Maveriks\WebApplication();
$app->setRootDir($rootDir);
$loadConstants = false;
$workspaces = get_workspaces_from_args($args);
$lang = array_key_exists("lang", $opts) ? $opts['lang'] : 'en';
$translation = new Translation();
CLI::logging("Updating labels Mafe ...\n");
foreach ($workspaces as $workspace) {
示例5:
a task it's defined with "Self Service Value Based Assignment" in "Assignment Rules".
If no workspace is specified, the command will be run in all workspaces. More
than one workspace can be specified.
EOT
);
CLI::taskArg("workspace-name", true, true);
CLI::taskRun("run_database_generate_self_service_by_value");
/*----------------------------------********---------------------------------*/
/**
* Function run_info
* access public
*/
示例6: run_info
update this workspace translations to match the current version of
ProcessMaker.
EOT
);
CLI::taskArg('workspace-name', true, true);
CLI::taskRun(run_translation_upgrade);
CLI::taskName('migrate-cases-folders');
CLI::taskDescription(<<<EOT
Migrating cases folders of the workspaces
Specify the WORKSPACE to migrate from a existing workspace.
EOT
);
//CLI::taskArg('workspace', true);
CLI::taskOpt("workspace", "Select which workspace to migrate the cases folders, if multiple workspaces are present in the server.", "w:", "workspace=");
CLI::taskRun(runStructureDirectories);
/**
* Function run_info
* access public
*/
function run_info($args, $opts)
{
$workspaces = get_workspaces_from_args($args);
workspaceTools::printSysInfo();
foreach ($workspaces as $workspace) {
echo "\n";
$workspace->printMetadata(false);
}
}
function run_workspace_upgrade($args, $opts)
{
示例7: workspace
CLI::taskArg('workspace-name', true, true);
CLI::taskRun(run_workspace_upgrade);
CLI::taskName('translation-repair');
CLI::taskDescription(<<<EOT
Upgrade or repair translations for the specified workspace(s).
If no workspace is specified, the command will be run in all workspaces. More
than one workspace can be specified.
This command will go through each language installed in ProcessMaker and
update this workspace translations to match the current version of
ProcessMaker.
EOT
);
CLI::taskArg('workspace-name', true, true);
CLI::taskRun(run_translation_upgrade);
/**
* Function run_info
* access public
*/
function run_info($args, $opts)
{
$workspaces = get_workspaces_from_args($args);
workspaceTools::printSysInfo();
foreach ($workspaces as $workspace) {
echo "\n";
$workspace->printMetadata(false);
}
}
function run_workspace_upgrade($args, $opts)
{
示例8: run
/**
* Run the CLI task, which will check which command is specified and run it.
*/
public static function run()
{
CLI::taskName("help");
CLI::taskRun(array('self', 'help'));
global $argv;
$args = $argv;
$cliname = array_shift($args);
$taskName = array_shift($args);
while ($taskName[0] == '-') {
$taskName = array_shift($args);
}
if (!$taskName) {
echo self::error("Specify a task from the list below.") . "\n\n";
self::help(null, null);
return;
}
$taskData = null;
foreach (self::$tasks as $name => $data) {
if (strcasecmp($name, $taskName) === 0) {
$taskData = $data;
break;
}
}
if (!$taskData) {
echo self::error("Command not found: '{$taskName}'") . "\n\n";
self::help(null, null);
return;
}
G::LoadThirdParty('pear/Console', 'Getopt');
$short = "h" . $taskData['opt']['short'];
$long = array_merge(array("help"), $taskData['opt']['long']);
$getopt = Console_GetOpt::getopt2($args, $short, $long);
if (!is_array($getopt)) {
echo self::error("Invalid options (" . $getopt->getMessage() . ")") . "\n\n";
self::help($taskName);
return;
}
list($options, $arguments) = $getopt;
foreach ($taskData['opt']['descriptions'] as $optName => $optDescription) {
$short = str_replace(":", "", $optDescription['short']);
$long = str_replace("=", "", $optDescription['long']);
$validOpts[$short] = $optName;
$validOpts[$long] = $optName;
}
$taskOpts = array();
try {
foreach ($options as $opt) {
list($optName, $optArg) = $opt;
if ($optName === "h" || $optName === "--help") {
self::help($taskName);
return;
}
if (strpos($optName, '--') === 0) {
$optName = substr($optName, 2);
}
if (!array_key_exists($optName, $validOpts)) {
throw new Exception("option not found: {$optName}");
}
if (array_key_exists($validOpts[$optName], $taskOpts)) {
throw new Exception("'{$optName}' specified more then once");
}
$taskOpts[$validOpts[$optName]] = $optArg;
}
} catch (Exception $e) {
echo self::error("Invalid options: " . $e->getMessage()) . "\n\n";
self::help($taskName);
return;
}
try {
call_user_func($taskData['function'], $arguments, $taskOpts);
} catch (Exception $e) {
echo self::error("\n Error executing '{$taskName}':\n\n {$e->getMessage()}\n") . "\n";
}
}
示例9: runHotfixInstall
<?php
CLI::taskName("hotfix-install");
CLI::taskDescription(<<<EOT
Install hotfix to system
This command installs a hotfix, which updates ProcessMaker in order to add improvements or fix bugs.
EOT
);
CLI::taskRun("runHotfixInstall");
function runHotfixInstall($command, $args)
{
CLI::logging("HOTFIX", PATH_DATA . "log" . PATH_SEP . "upgrades.log");
CLI::logging("Install hotfix to system\n");
$arrayFile = $command;
if (count($arrayFile) > 0) {
//Install hotfix
foreach ($arrayFile as $value) {
$f = $value;
$result = workspaceTools::hotfixInstall($f);
CLI::logging($result["message"] . "\n");
}
//Clear server's cache
CLI::logging("\nClearing cache...\n");
if (defined("PATH_C")) {
G::rm_dir(PATH_C);
G::mk_dir(PATH_C, 0777);
}
//Safe upgrade for JavaScript files
CLI::logging("\nSafe upgrade for files cached by the browser\n\n");
G::browserCacheFilesSetUid();
示例10: runHotfixInstall
<?php
CLI::taskName("hotfix-install");
CLI::taskDescription(<<<EOT
Install hotfix to system
This command is executed when you want to update certain files, which have improvements or bugs solutions.
EOT
);
CLI::taskRun(runHotfixInstall);
function runHotfixInstall($command, $args)
{
CLI::logging("HOTFIX", PATH_DATA . "log" . PATH_SEP . "upgrades.log");
CLI::logging("Install hotfix to system\n");
$arrayFile = $command;
if (count($arrayFile) > 0) {
//Install hotfix
foreach ($arrayFile as $value) {
$f = $value;
$result = workspaceTools::hotfixInstall($f);
CLI::logging($result["message"] . "\n");
}
//Clear server's cache
CLI::logging("\nClearing cache...\n");
if (defined("PATH_C")) {
G::rm_dir(PATH_C);
G::mk_dir(PATH_C, 0777);
}
//Safe upgrade for JavaScript files
CLI::logging("\nSafe upgrade for files cached by the browser\n\n");
G::browserCacheFilesSetUid();
示例11: rm_dir
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
* @author Alexandre Rosenfeld <alexandre@colosa.com>
* @package workflow-engine-bin-tasks
*/
G::LoadClass("system");
G::LoadClass("wsTools");
G::LoadSystem("dbMaintenance");
G::LoadClass("cli");
CLI::taskName('upgrade');
CLI::taskDescription("Upgrade workspaces.\n\n This command should be run after upgrading ProcessMaker to a new version so that all workspaces are also upgraded to the\n new version.");
CLI::taskOpt("buildACV", "If this option is enabled, the Cache View is built.", "ACV", "buildACV");
CLI::taskRun("run_upgrade");
/*----------------------------------********---------------------------------*/
CLI::taskArg('workspace');
/*----------------------------------********---------------------------------*/
/**
* A version of rm_dir which does not exits on error.
*
* @param string $filename directory or file to remove
* @param bool $filesOnly either to remove the containing directory as well or not
*/
function rm_dir($filename, $filesOnly = false)
{
if (is_file($filename)) {
@unlink($filename) or CLI::logging(CLI::error("Could not remove file {$filename}") . "\n");
} else {
foreach (glob("{$filename}/*") as $f) {
示例12: run_create
EOT
);
CLI::taskArg('plugin', false);
CLI::taskArg('lang', false);
CLI::taskRun("run_update");
CLI::taskName('plugins-translation-create');
CLI::taskDescription(<<<EOT
Create .po file for the plugin
LANG is the language, such as 'fr' (French) or 'zh-CN' (mainland Chinese).
If the language is not specified, then it is 'en' (English) by default.
EOT
);
CLI::taskArg('plugin', true);
CLI::taskArg('lang', true);
CLI::taskRun("run_create");
function run_create($command, $args)
{
CLI::logging("Create .po file ...\n");
$language = new Language();
$language->createLanguagePlugin($command[0], $command[1]);
CLI::logging("Create successful\n");
}
function run_update($command, $args)
{
CLI::logging("Updating...\n");
$language = new Language();
$language->updateLanguagePlugin($command[0], $command[1]);
CLI::logging("Update successful\n");
}
示例13: rm_dir
*
* @author Alexandre Rosenfeld <alexandre@colosa.com>
* @package workflow-engine-bin-tasks
*/
G::LoadClass("system");
G::LoadClass("wsTools");
CLI::taskName('upgrade');
CLI::taskDescription(<<<EOT
Upgrade workspaces.
This command should be run after ProcessMaker files are upgraded so that all
workspaces are upgraded to the current version.
EOT
);
CLI::taskOpt("buildACV", "If the option is enabled, performs the Build Cache View.", "ACV", "buildACV");
CLI::taskRun(run_upgrade);
/**
* A version of rm_dir which does not exits on error.
*
* @param string $filename directory or file to remove
* @param bool $filesOnly either to remove the containing directory as well or not
*/
function rm_dir($filename, $filesOnly = false)
{
if (is_file($filename)) {
@unlink($filename) or CLI::logging(CLI::error("Could not remove file {$filename}") . "\n");
} else {
foreach (glob("{$filename}/*") as $f) {
rm_dir($f);
}
if (!$filesOnly) {
示例14: runBrowserCacheFiles
<?php
CLI::taskName("browser-cache-files-upgrade");
CLI::taskDescription(<<<EOT
Safe upgrade for files cached by the browser
This command should be run after any upgrade/modification of files cached by the browser.
EOT
);
CLI::taskRun(runBrowserCacheFiles);
function runBrowserCacheFiles($command, $args)
{
CLI::logging("Safe upgrade for files cached by the browser\n");
G::browserCacheFilesSetUid();
CLI::logging("Upgrade successful\n");
}
示例15: runBrowserCacheFiles
<?php
CLI::taskName("browser-cache-files-upgrade");
CLI::taskDescription(<<<EOT
Safe upgrade for files cached by the browser
This command should be run after any upgrade/modification of files cached by the browser.
EOT
);
CLI::taskRun("runBrowserCacheFiles");
function runBrowserCacheFiles($command, $args)
{
CLI::logging("Safe upgrade for files cached by the browser\n");
G::browserCacheFilesSetUid();
CLI::logging("Upgrade successful\n");
}