Пример #1
0
 * Coral Gables, FL, 33134, USA, or email info@colosa.com.
 *
 * @author Alexandre Rosenfeld <*****@*****.**>
 * @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
0
 * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
 * Coral Gables, FL, 33134, USA, or email info@colosa.com.
 *
 * @author Alexandre Rosenfeld <*****@*****.**>
 * @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
0
 *
 * 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
0
 * 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
0
  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
0
  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
0
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
0
 /**
  * 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
0
<?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
0
<?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
0
 * 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 <*****@*****.**>
 * @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
0
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
0
 *
 * @author Alexandre Rosenfeld <*****@*****.**>
 * @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
0
<?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");
}
<?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");
}
Пример #16
0
CLI::taskDescription(<<<EOT
    Update plugin translations

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

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");
}