PMCORE-1527 PMCORE-1421 - Regenerate PM Report Tables Asynchronously
This commit is contained in:
@@ -1,74 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use ProcessMaker\Core\System;
|
||||
|
||||
CLI::taskName("generate-data-report");
|
||||
CLI::taskRun("generateDataReport");
|
||||
CLI::taskDescription("\nGenerate data report by process in a respective workspace, you must pass through arguments the project identifier and the processing interval.");
|
||||
CLI::taskArg("workspace", false);
|
||||
CLI::taskOpt("uid", "Identifier that represents the process, must be 32 characters.", "", "process=");
|
||||
CLI::taskOpt("start", "The start option skips so many rows before returning results.", "", "start=");
|
||||
CLI::taskOpt("limit", "The limit option restricts the number of rows returned.", "", "limit=");
|
||||
|
||||
/**
|
||||
* Generate data report by process in a respective workspace, you must pass through
|
||||
* arguments the project identifier and the processing interval.
|
||||
* @param array $options
|
||||
* @return void
|
||||
*/
|
||||
function generateDataReport(array $options): void
|
||||
{
|
||||
//get workspace
|
||||
if (empty($options[0])) {
|
||||
CLI::logging("Workspace undefined!\n");
|
||||
return;
|
||||
}
|
||||
$workspace = $options[0];
|
||||
|
||||
//get options
|
||||
$parameters = [
|
||||
"tableName=" => "",
|
||||
"type=" => "",
|
||||
"process=" => "",
|
||||
"gridKey=" => "",
|
||||
"additionalTable=" => "",
|
||||
"className=" => "",
|
||||
"pathWorkspace=" => "",
|
||||
"start=" => "",
|
||||
"limit=" => ""
|
||||
];
|
||||
foreach ($parameters as $key => $value) {
|
||||
for ($i = 1; $i < count($options); $i++) {
|
||||
if (strpos($options[$i], $key) !== false) {
|
||||
$parameters[$key] = str_replace($key, "", $options[$i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//validations
|
||||
$needed = [
|
||||
"process="
|
||||
];
|
||||
foreach ($needed as $value) {
|
||||
if (empty($parameters[$value])) {
|
||||
CLI::logging("Missing options {$value}.\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//run method
|
||||
$workspaceTools = new WorkspaceTools($workspace);
|
||||
$workspaceTools->generateDataReport(
|
||||
$parameters["tableName="],
|
||||
$parameters["type="],
|
||||
$parameters["process="],
|
||||
$parameters["gridKey="],
|
||||
$parameters["additionalTable="],
|
||||
$parameters["className="],
|
||||
$parameters["pathWorkspace="],
|
||||
(int) $parameters["start="],
|
||||
(int) $parameters["limit="]
|
||||
);
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
<?php
|
||||
|
||||
CLI::taskName("populate-table");
|
||||
CLI::taskRun("populateTable");
|
||||
CLI::taskDescription("\nThis function populates the report table with the APP_DATA data");
|
||||
CLI::taskArg("workspace", false);
|
||||
|
||||
/**
|
||||
* This function populates the report table with the APP_DATA data.
|
||||
* @return void
|
||||
*/
|
||||
function populateTable($options): void
|
||||
{
|
||||
//get options
|
||||
$workspaceName = $options[0];
|
||||
$query = base64_decode($options[1]);
|
||||
$isRbac = (bool) $options[2];
|
||||
|
||||
$workspace = new WorkspaceTools($workspaceName);
|
||||
$workspace->populateTableReport($query, $isRbac);
|
||||
}
|
||||
Reference in New Issue
Block a user