HOR-4146: Monolog improvement

HOR-4303
HOR-4302
HOR-4471
HOR-4428
HOR-4146: We removed loggin_level
This commit is contained in:
Marco Antonio Nina Mena
2018-01-15 12:00:22 +00:00
committed by Paula Quispe
parent 8487e072d9
commit 087f5e1ce6
26 changed files with 3830 additions and 2300 deletions

View File

@@ -4180,7 +4180,7 @@
<column name="ADDON_NICK" type="VARCHAR" size="255" required="true"/>
<column name="ADDON_DOWNLOAD_FILENAME" type="VARCHAR" size="1024" required="false"/>
<column name="ADDON_DESCRIPTION" type="VARCHAR" size="2048" required="false"/>
<column name="ADDON_STATE" type="VARCHAR" size="255" required="true"/>
<column name="ADDON_STATE" type="VARCHAR" size="255" required="true" default=""/>
<column name="ADDON_STATE_CHANGED" type="TIMESTAMP" required="false"/>
<column name="ADDON_STATUS" type="VARCHAR" size="255" required="true"/>
<column name="ADDON_VERSION" type="VARCHAR" size="255" required="true"/>

View File

@@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ProcessMaker (Branch 3.2.3)\n"
"POT-Creation-Date: \n"
"PO-Revision-Date: 2017-11-22 20:50:02\n"
"PO-Revision-Date: 2018-02-19 20:22:41\n"
"Last-Translator: \n"
"Language-Team: Colosa Developers Team <developers@colosa.com>\n"
"MIME-Version: 1.0\n"
@@ -8321,6 +8321,18 @@ msgstr "The file {filename} doesn't contain class: {className}"
msgid "File \"{0}\" imported successfully."
msgstr "File \"{0}\" imported successfully."
# TRANSLATION
# LABEL/ID_FILE_LOG_CREATED
#: LABEL/ID_FILE_LOG_CREATED
msgid "Created on"
msgstr "Created on"
# TRANSLATION
# LABEL/ID_FILE_LOG_SIZE
#: LABEL/ID_FILE_LOG_SIZE
msgid "File size"
msgstr "File size"
# TRANSLATION
# LABEL/ID_FILE_NAME
#: LABEL/ID_FILE_NAME
@@ -8783,6 +8795,12 @@ msgstr "Displaying emails {0} - {1} of {2}"
msgid "Displaying events {0} - {1} of {2}"
msgstr "Displaying events {0} - {1} of {2}"
# TRANSLATION
# LABEL/ID_GRID_PAGE_DISPLAYING_FILE_LOGS
#: LABEL/ID_GRID_PAGE_DISPLAYING_FILE_LOGS
msgid "Displaying log files {0} - {1} of {2}"
msgstr "Displaying log files {0} - {1} of {2}"
# TRANSLATION
# LABEL/ID_GRID_PAGE_DISPLAYING_GROUPS_MESSAGE
#: LABEL/ID_GRID_PAGE_DISPLAYING_GROUPS_MESSAGE
@@ -10199,12 +10217,6 @@ msgstr "Issued to"
msgid "is not registered!"
msgstr "is not registered!"
# TRANSLATION
# LABEL/ID_THE_USERNAME_EMAIL_IS_INCORRECT
#: LABEL/ID_THE_USERNAME_EMAIL_IS_INCORRECT
msgid "The username or email is incorrect"
msgstr "The username or email is incorrect"
# TRANSLATION
# LABEL/ID_IS_REQUIRED
#: LABEL/ID_IS_REQUIRED
@@ -10949,6 +10961,12 @@ msgstr "toolbar placement"
msgid "(HH:MM) Format 24 hrs."
msgstr "(HH:MM) Format 24 hrs."
# TRANSLATION
# LABEL/ID_MAFE_0a10134c1999989ce854ac519eb97249
#: LABEL/ID_MAFE_0a10134c1999989ce854ac519eb97249
msgid "Web Entry Anonymous Authentication"
msgstr "Web Entry Anonymous Authentication"
# TRANSLATION
# LABEL/ID_MAFE_0a33cdf242201623275b9897d8b4d8c4
#: LABEL/ID_MAFE_0a33cdf242201623275b9897d8b4d8c4
@@ -10997,12 +11015,24 @@ msgstr "View all"
msgid "Please configure a script to send a signal."
msgstr "Please configure a script to send a signal."
# TRANSLATION
# LABEL/ID_MAFE_0b9d04ab06dac3da0142bb369637bfa4
#: LABEL/ID_MAFE_0b9d04ab06dac3da0142bb369637bfa4
msgid "qr code"
msgstr "qr code"
# TRANSLATION
# LABEL/ID_MAFE_0bb8309239953b782fec18706fe60b4a
#: LABEL/ID_MAFE_0bb8309239953b782fec18706fe60b4a
msgid "Digital"
msgstr "Digital"
# TRANSLATION
# LABEL/ID_MAFE_0bf7c19f7eac3bfa5ad960a50ad602dc
#: LABEL/ID_MAFE_0bf7c19f7eac3bfa5ad960a50ad602dc
msgid "[LABEL/ID_MAFE_0bf7c19f7eac3bfa5ad960a50ad602dc] subtitle"
msgstr "subtitle"
# TRANSLATION
# LABEL/ID_MAFE_0c06d45a9f58aba5f4c4d50b03f65b04
#: LABEL/ID_MAFE_0c06d45a9f58aba5f4c4d50b03f65b04
@@ -11837,6 +11867,12 @@ msgstr "An unexpected error while deleting the step, please try again later."
msgid "B5"
msgstr "B5"
# TRANSLATION
# LABEL/ID_MAFE_2a304a1348456ccd2234cd71a81bd338
#: LABEL/ID_MAFE_2a304a1348456ccd2234cd71a81bd338
msgid "[LABEL/ID_MAFE_2a304a1348456ccd2234cd71a81bd338] link"
msgstr "link"
# TRANSLATION
# LABEL/ID_MAFE_2a37d240713f300cf06d390798b0efad
#: LABEL/ID_MAFE_2a37d240713f300cf06d390798b0efad
@@ -11993,6 +12029,18 @@ msgstr "Store value in"
msgid "is duplicated."
msgstr "is duplicated."
# TRANSLATION
# LABEL/ID_MAFE_30a2dae0a135701b862050465b3e4e97
#: LABEL/ID_MAFE_30a2dae0a135701b862050465b3e4e97
msgid "Triggers after and before a step are not supported when working offline"
msgstr "Triggers after and before a step are not supported when working offline"
# TRANSLATION
# LABEL/ID_MAFE_30c40215e6d00c574ca23451003db9b9
#: LABEL/ID_MAFE_30c40215e6d00c574ca23451003db9b9
msgid "[LABEL/ID_MAFE_30c40215e6d00c574ca23451003db9b9] checkgroup"
msgstr "checkgroup"
# TRANSLATION
# LABEL/ID_MAFE_3120001274fa32a921770c1b41e6dc0a
#: LABEL/ID_MAFE_3120001274fa32a921770c1b41e6dc0a
@@ -12467,6 +12515,12 @@ msgstr "August"
msgid "Messages"
msgstr "Messages"
# TRANSLATION
# LABEL/ID_MAFE_41e80c3ce414de15ab19d996f7072429
#: LABEL/ID_MAFE_41e80c3ce414de15ab19d996f7072429
msgid "fileupload"
msgstr "fileupload"
# TRANSLATION
# LABEL/ID_MAFE_41fffd09332a35491d3bed5a34f91410
#: LABEL/ID_MAFE_41fffd09332a35491d3bed5a34f91410
@@ -12479,6 +12533,12 @@ msgstr "http://eonasdan.github.io/bootstrap-datetimepicker/</a>"
msgid "[LABEL/ID_MAFE_42184184a95464c63c790acc3a69e564] Routing History"
msgstr "Routing History"
# TRANSLATION
# LABEL/ID_MAFE_421b47ffd946ca083b65cd668c6b17e6
#: LABEL/ID_MAFE_421b47ffd946ca083b65cd668c6b17e6
msgid "video"
msgstr "video"
# TRANSLATION
# LABEL/ID_MAFE_4252b72e6ebcd4d4b4c2e46a786f03d2
#: LABEL/ID_MAFE_4252b72e6ebcd4d4b4c2e46a786f03d2
@@ -12833,6 +12893,12 @@ msgstr "Generate Link"
msgid "Please insert variable before adding to the list."
msgstr "Please insert variable before adding to the list."
# TRANSLATION
# LABEL/ID_MAFE_5174307b9097d47b1a506bc8171c2bb3
#: LABEL/ID_MAFE_5174307b9097d47b1a506bc8171c2bb3
msgid "textbox"
msgstr "textbox"
# TRANSLATION
# LABEL/ID_MAFE_5174d1309f275ba6f275db3af9eb3e18
#: LABEL/ID_MAFE_5174d1309f275ba6f275db3af9eb3e18
@@ -13607,6 +13673,12 @@ msgstr "Inclusive Gateway"
msgid "Assignee saved successfully"
msgstr "Assignee saved successfully"
# TRANSLATION
# LABEL/ID_MAFE_6be8bfc7078373aa92b3a862b5253e7e
#: LABEL/ID_MAFE_6be8bfc7078373aa92b3a862b5253e7e
msgid "Mobile controls"
msgstr "Mobile controls"
# TRANSLATION
# LABEL/ID_MAFE_6c24f6923944d3f9d84bcf924661abff
#: LABEL/ID_MAFE_6c24f6923944d3f9d84bcf924661abff
@@ -13769,12 +13841,6 @@ msgstr "Properties saved successfully"
msgid "Error Update File"
msgstr "Error Update File"
# TRANSLATION
# LABEL/ID_MAFE_7215ee9c7d9dc229d2921a40e899ec5f
#: LABEL/ID_MAFE_7215ee9c7d9dc229d2921a40e899ec5f
msgid "[LABEL/ID_MAFE_7215ee9c7d9dc229d2921a40e899ec5f] "
msgstr ""
# TRANSLATION
# LABEL/ID_MAFE_725255d7ccc0cf426c1da6abe0afe7e4
#: LABEL/ID_MAFE_725255d7ccc0cf426c1da6abe0afe7e4
@@ -13907,6 +13973,12 @@ msgstr "Sub-process"
msgid "Routing"
msgstr "Routing"
# TRANSLATION
# LABEL/ID_MAFE_78805a221a988e79ef3f42d7c5bfd418
#: LABEL/ID_MAFE_78805a221a988e79ef3f42d7c5bfd418
msgid "image"
msgstr "image"
# TRANSLATION
# LABEL/ID_MAFE_788287625aa640447c5d9fff50644915
#: LABEL/ID_MAFE_788287625aa640447c5d9fff50644915
@@ -15335,6 +15407,12 @@ msgstr "Do you want to delete this permission?"
msgid "setOrientation(): parameter is not valid"
msgstr "setOrientation(): parameter is not valid"
# TRANSLATION
# LABEL/ID_MAFE_a5ca0b5894324f8bb54bb9fffad29d1e
#: LABEL/ID_MAFE_a5ca0b5894324f8bb54bb9fffad29d1e
msgid "audio"
msgstr "audio"
# TRANSLATION
# LABEL/ID_MAFE_a603905470e2a5b8c13e96b579ef0dba
#: LABEL/ID_MAFE_a603905470e2a5b8c13e96b579ef0dba
@@ -15509,6 +15587,12 @@ msgstr "Text to search"
msgid "Create Message Type"
msgstr "Create Message Type"
# TRANSLATION
# LABEL/ID_MAFE_ac201fd270c3b96beab24f2829780ab2
#: LABEL/ID_MAFE_ac201fd270c3b96beab24f2829780ab2
msgid "signature"
msgstr "signature"
# TRANSLATION
# LABEL/ID_MAFE_ac48a7776ff0e8dc13b0a1300fc0a75f
#: LABEL/ID_MAFE_ac48a7776ff0e8dc13b0a1300fc0a75f
@@ -15533,6 +15617,12 @@ msgstr "required"
msgid "forms"
msgstr "forms"
# TRANSLATION
# LABEL/ID_MAFE_acd6337dfeb8a29685e3856bfa76756c
#: LABEL/ID_MAFE_acd6337dfeb8a29685e3856bfa76756c
msgid "History of use"
msgstr "History of use"
# TRANSLATION
# LABEL/ID_MAFE_ad7bdeed2bf3d72e17abe1a8d0508958
#: LABEL/ID_MAFE_ad7bdeed2bf3d72e17abe1a8d0508958
@@ -15761,6 +15851,12 @@ msgstr "<tr><td><b>Hour</b></td><td>H</td><td>0 1 ... 22 23</td></tr><tr><td></t
msgid "[LABEL/ID_MAFE_b5a7adde1af5c87d7fd797b6245c2a39] Description"
msgstr "Description"
# TRANSLATION
# LABEL/ID_MAFE_b5ceb80c90c6b834060fcd7e0d2c0c28
#: LABEL/ID_MAFE_b5ceb80c90c6b834060fcd7e0d2c0c28
msgid "subform"
msgstr "subform"
# TRANSLATION
# LABEL/ID_MAFE_b5d4d25fe3fa9f8263b5f279a372b709
#: LABEL/ID_MAFE_b5d4d25fe3fa9f8263b5f279a372b709
@@ -16259,6 +16355,12 @@ msgstr "OutPut Document (s)"
msgid "Execute a trigger when a case is opened"
msgstr "Execute a trigger when a case is opened"
# TRANSLATION
# LABEL/ID_MAFE_c79bdf421714f5087fc34b7c538b6807
#: LABEL/ID_MAFE_c79bdf421714f5087fc34b7c538b6807
msgid "[LABEL/ID_MAFE_c79bdf421714f5087fc34b7c538b6807] submit"
msgstr "submit"
# TRANSLATION
# LABEL/ID_MAFE_c7f8f8652db6d74e086d297129179d2f
#: LABEL/ID_MAFE_c7f8f8652db6d74e086d297129179d2f
@@ -16451,6 +16553,12 @@ msgstr "multiple"
msgid "[LABEL/ID_MAFE_ce4d4b319a571fda7b689cee71432d5d] Custom Trigger"
msgstr "Custom Trigger"
# TRANSLATION
# LABEL/ID_MAFE_ce50a09343724eb82df11390e2c1de18
#: LABEL/ID_MAFE_ce50a09343724eb82df11390e2c1de18
msgid "[LABEL/ID_MAFE_ce50a09343724eb82df11390e2c1de18] button"
msgstr "button"
# TRANSLATION
# LABEL/ID_MAFE_ce5f8a0a2fea8e45ddfd3fe51ae60703
#: LABEL/ID_MAFE_ce5f8a0a2fea8e45ddfd3fe51ae60703
@@ -16901,6 +17009,12 @@ msgstr "Variable for Case priority"
msgid "Parallel gateway"
msgstr "Parallel gateway"
# TRANSLATION
# LABEL/ID_MAFE_dfeaaeb4316477bd556ea5e8c3295887
#: LABEL/ID_MAFE_dfeaaeb4316477bd556ea5e8c3295887
msgid "datetime"
msgstr "datetime"
# TRANSLATION
# LABEL/ID_MAFE_e019dd49d439bb6d6765f7d2f6915333
#: LABEL/ID_MAFE_e019dd49d439bb6d6765f7d2f6915333
@@ -17147,6 +17261,12 @@ msgstr "Days"
msgid "- Select an input document -"
msgstr "- Select an input document -"
# TRANSLATION
# LABEL/ID_MAFE_e889b1ca9624a9fbe23c4f062d7e5f01
#: LABEL/ID_MAFE_e889b1ca9624a9fbe23c4f062d7e5f01
msgid "geomap"
msgstr "geomap"
# TRANSLATION
# LABEL/ID_MAFE_e8be55bf3a30501aef09d2e74de97976
#: LABEL/ID_MAFE_e8be55bf3a30501aef09d2e74de97976
@@ -17435,6 +17555,12 @@ msgstr "Flow"
msgid "Step editing successfully."
msgstr "Step editing successfully."
# TRANSLATION
# LABEL/ID_MAFE_f1e5d7a5fe13498abbdeb0f1f19136a8
#: LABEL/ID_MAFE_f1e5d7a5fe13498abbdeb0f1f19136a8
msgid "panel"
msgstr "panel"
# TRANSLATION
# LABEL/ID_MAFE_f217bd2ed27f82d5c856035f95801373
#: LABEL/ID_MAFE_f217bd2ed27f82d5c856035f95801373
@@ -17765,6 +17891,12 @@ msgstr "Saved correctly"
msgid "textfield"
msgstr "textfield"
# TRANSLATION
# LABEL/ID_MAFE_ff4a008470319a22d9cf3d14af485977
#: LABEL/ID_MAFE_ff4a008470319a22d9cf3d14af485977
msgid "[LABEL/ID_MAFE_ff4a008470319a22d9cf3d14af485977] grid"
msgstr "grid"
# TRANSLATION
# LABEL/ID_MAFE_ffc1dca70df11105d22d9f427a9e260b
#: LABEL/ID_MAFE_ffc1dca70df11105d22d9f427a9e260b
@@ -20111,18 +20243,18 @@ msgstr "Photo"
msgid "PHP Information"
msgstr "PHP Information"
# TRANSLATION
# LABEL/ID_PHP_MYSQLI_NOT_INSTALL
#: LABEL/ID_PHP_MYSQLI_NOT_INSTALL
msgid "php-mysqli is Not Installed"
msgstr "php-mysqli is Not Installed"
# TRANSLATION
# LABEL/ID_PHP_MSSQL_NOT_INSTALLED
#: LABEL/ID_PHP_MSSQL_NOT_INSTALLED
msgid "php-mssql is Not Installed"
msgstr "php-mssql is Not Installed"
# TRANSLATION
# LABEL/ID_PHP_MYSQLI_NOT_INSTALL
#: LABEL/ID_PHP_MYSQLI_NOT_INSTALL
msgid "php-mysqli is Not Installed"
msgstr "php-mysqli is Not Installed"
# TRANSLATION
# LABEL/ID_PHP_MYSQL_NOT _INSTALL
#: LABEL/ID_PHP_MYSQL_NOT _INSTALL
@@ -23777,6 +23909,12 @@ msgstr "Stage"
msgid "Stages"
msgstr "Stages"
# TRANSLATION
# LABEL/ID_STANDARD_LOGGING
#: LABEL/ID_STANDARD_LOGGING
msgid "Log Files"
msgstr "Log Files"
# TRANSLATION
# LABEL/ID_STARTED_CASES
#: LABEL/ID_STARTED_CASES
@@ -24551,6 +24689,12 @@ msgstr "The change might cause data loss in the PM table. Do you want to continu
msgid "Please complete the reassign reason."
msgstr "Please complete the reassign reason."
# TRANSLATION
# LABEL/ID_THE_USERNAME_EMAIL_IS_INCORRECT
#: LABEL/ID_THE_USERNAME_EMAIL_IS_INCORRECT
msgid "The username or email is incorrect"
msgstr "The username or email is incorrect"
# TRANSLATION
# LABEL/ID_THIS_MONTH
#: LABEL/ID_THIS_MONTH
@@ -28130,7 +28274,7 @@ msgstr "File"
# additionalTables/doExport.xml?SIZE
# additionalTables/doExport.xml
#: caption - SIZE
msgid "File size"
msgid "[additionalTables/doExport.xml?SIZE] File size"
msgstr "File size"
# additionalTables/doExport.xml?META

View File

@@ -0,0 +1,107 @@
<?php
use ProcessMaker\Core\System;
/**
* File Logs controller
* @inherits Controller
*
* @access public
*/
class FileLogs extends Controller
{
// Class properties
private $urlProxy;
private $credentials;
const version = '1.0';
// Class constructor
public function __construct()
{
global $RBAC;
if ($RBAC->userCanAccess('PM_SETUP_LOG_FILES') !== 1) {
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
exit(0);
}
$designer = new Designer();
$this->setCredentials(base64_encode(G::json_encode($designer->getCredentials())));
$this->setUrlProxy(System::getHttpServerHostnameRequestsFrontEnd() . '/api/' . self::version . '/' . config('system.workspace') . '/');
}
/**
* Return server host
*
* @return string
*/
public function getUrlProxy()
{
return $this->urlProxy;
}
/**
* Set server host
*
* @param string $urlProxy
*/
public function setUrlProxy($urlProxy)
{
$this->urlProxy = $urlProxy;
}
/**
* Get credential oauth
*
* @return string
*/
public function getCredentials()
{
return $this->credentials;
}
/**
* Set Credentials
*
* @param string $credentials
*/
public function setCredentials($credentials)
{
$this->credentials = $credentials;
}
/**
* Render list file logs
*/
public function fileList()
{
try {
global $RBAC;
if (isset($_SESSION['__FILE_LOGS_ERROR__'])) {
$this->setJSVar('__FILE_LOGS_ERROR__', $_SESSION['__FILE_LOGS_ERROR__']);
unset($_SESSION['__FILE_LOGS_ERROR__']);
}
$this->setView('fileLogs/list');
$c = new Configurations();
$configPage = $c->getConfiguration('usersList', 'pageSize', null, $RBAC->aUserInfo['USER_INFO']['USR_UID']);
$config = [];
$config['pageSize'] = isset($configPage['pageSize']) ? $configPage['pageSize'] : 20;
$this->setJSVar('urlProxy', $this->getUrlProxy());
$this->setJSVar('credentials', $this->getCredentials());
$this->setJSVar('CONFIG', $config);
$this->includeExtJS('fileLogs/list');
G::RenderPage('publish', 'extJs');
} catch (Exception $error) {
$_SESSION['__FILE_LOGS_ERROR__'] = $error->getMessage();
die();
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -2297,7 +2297,7 @@ CREATE TABLE `ADDONS_MANAGER`
`ADDON_NICK` VARCHAR(255) NOT NULL,
`ADDON_DOWNLOAD_FILENAME` VARCHAR(1024),
`ADDON_DESCRIPTION` VARCHAR(2048),
`ADDON_STATE` VARCHAR(255) NOT NULL,
`ADDON_STATE` VARCHAR(255) NOT NULL DEFAULT '',
`ADDON_STATE_CHANGED` DATETIME,
`ADDON_STATUS` VARCHAR(255) NOT NULL,
`ADDON_VERSION` VARCHAR(255) NOT NULL,

View File

@@ -1,27 +1,4 @@
<?php
/**
* setup.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* 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.
*
*/
use ProcessMaker\Plugins\PluginRegistry;
@@ -228,6 +205,16 @@ if ($RBAC->userCanAccess('PM_SETUP') === 1 && $RBAC->userCanAccess('PM_SETUP_LOG
/*----------------------------------********---------------------------------*/
}
/*----------------------------------********---------------------------------*/
if ($RBAC->userCanAccess('PM_SETUP_LOG_FILES') === 1) {
$G_TMP_MENU->AddIdRawOption(
'STANDARD_LOGGING', '../FileLogs/fileList',
G::LoadTranslation('ID_STANDARD_LOGGING'), '', '', 'logs'
);
}
/*----------------------------------********---------------------------------*/
if ($RBAC->userCanAccess('PM_SETUP') === 1) {
$G_TMP_MENU->AddIdRawOption(
'PM_REQUIREMENTS', '../setup/systemInfo',

View File

@@ -1,4 +1,7 @@
<?php
use ProcessMaker\AuditLog\AuditLog;
global $RBAC;
if ($RBAC->userCanAccess("PM_SETUP") != 1) {
@@ -6,166 +9,11 @@ if ($RBAC->userCanAccess("PM_SETUP") != 1) {
exit(0);
}
$c = new Configurations();
$configPage = $c->getConfiguration("auditLogList", "pageSize", null, $_SESSION["USER_LOGGED"]);
$config = array();
$config["pageSize"] = (isset($configPage["pageSize"])) ? $configPage["pageSize"] : 20;
$arrayAction = array(
"CreateUser" => G::LoadTranslation("ID_CREATE_USER"),
"UpdateUser" => G::LoadTranslation("ID_UPDATE_USER"),
"DeleteUser" => G::LoadTranslation("ID_DELETE_USER"),
"EnableUser" => G::LoadTranslation("ID_ENABLE_USER"),
"DisableUser" => G::LoadTranslation("ID_DISABLE_USER"),
"AssignAuthenticationSource" => G::LoadTranslation("ID_ASSIGN_AUTHENTICATION_SOURCE"),
"AssignUserToGroup" => G::LoadTranslation("ID_ASSIGN_USER_TO_GROUP"),
"CreateAuthSource" => G::LoadTranslation("ID_CREATE_AUTH_SOURCE"),
"UpdateAuthSource" => G::LoadTranslation("ID_UPDATE_AUTH_SOURCE"),
"DeleteAuthSource" => G::LoadTranslation("ID_DELETE_AUTH_SOURCE"),
"CreateRole" => G::LoadTranslation("ID_CREATE_ROLE"),
"UpdateRole" => G::LoadTranslation("ID_UPDATE_ROLE"),
"DeleteRole" => G::LoadTranslation("ID_DELETE_ROLE"),
"AssignUserToRole" => G::LoadTranslation("ID_ASSIGN_USER_TO_ROLE"),
"DeleteUserToRole" => G::LoadTranslation("ID_DELETE_USER_TO_ROLE"),
"AddPermissionToRole" => G::LoadTranslation("ID_ADD_PERMISSION_TO_ROLE"),
"DeletePermissionToRole" => G::LoadTranslation("ID_DELETE_PERMISSION_TO_ROLE"),
"CreateSkin" => G::LoadTranslation("ID_CREATE_SKIN"),
"ImportSkin" => G::LoadTranslation("ID_IMPORT_SKIN"),
"ExportSkin" => G::LoadTranslation("ID_EXPORT_SKIN"),
"DeleteSkin" => G::LoadTranslation("ID_DELETE_SKIN"),
"CreateGroup" => G::LoadTranslation("ID_CREATE_GROUP"),
"UpdateGroup" => G::LoadTranslation("ID_UPDATE_GROUP"),
"DeleteGroup" => G::LoadTranslation("ID_DELETE_GROUP"),
"CreateCategory" => G::LoadTranslation("ID_CREATE_CATEGORY"),
"UpdateCategory" => G::LoadTranslation("ID_UPDATE_CATEGORY"),
"DeleteCategory" => G::LoadTranslation("ID_DELETE_CATEGORY"),
"BuildCache" => G::LoadTranslation("ID_BUILD_CACHE"),
"ClearCache" => G::LoadTranslation("ID_CLEAR_CACHE"),
"ClearCron" => G::LoadTranslation("ID_CLEAR_CRON"),
"UpdateEnvironmentSettings" => G::LoadTranslation("ID_UPDATE_ENVIRONMENT_SETTINGS"),
"UpdateLoginSettings" => G::LoadTranslation("ID_UPDATE_LOGIN_SETTINGS"),
"EnableHeartBeat" => G::LoadTranslation("ID_ENABLE_HEART_BEAT"),
"DisableHeartBeat" => G::LoadTranslation("ID_DISABLE_HEART_BEAT"),
"CreatePmtable" => G::LoadTranslation("ID_CREATE_PMTABLE"),
"UpdatePmtable" => G::LoadTranslation("ID_UPDATE_PMTABLE"),
"DeletePmtable" => G::LoadTranslation("ID_DELETE_PMTABLE"),
"AddDataPmtable" => G::LoadTranslation("ID_ADD_DATA_PMTABLE"),
"UpdateDataPmtable" => G::LoadTranslation("ID_UPDATE_DATA_PMTABLE"),
"DeleteDataPmtable" => G::LoadTranslation("ID_DELETE_DATA_PMTABLE"),
"ImportTable" => G::LoadTranslation("ID_IMPORT_TABLE"),
"ExportTable" => G::LoadTranslation("ID_EXPORT_TABLE"),
"CreateCalendar" => G::LoadTranslation("ID_CREATE_CALENDAR"),
"UpdateCalendar" => G::LoadTranslation("ID_UPDATE_CALENDAR"),
"DeleteCalendar" => G::LoadTranslation("ID_DELETE_CALENDAR"),
"CreateDashletInstance" => G::LoadTranslation("ID_CREATE_DASHLET_INSTANCE"),
"UpdateDashletInstance" => G::LoadTranslation("ID_UPDATE_DASHLET_INSTANCE"),
"DeleteDashletInstance" => G::LoadTranslation("ID_DELETE_DASHLET_INSTANCE"),
"CreateDepartament" => G::LoadTranslation("ID_CREATE_DEPARTAMENT"),
"CreateSubDepartament" => G::LoadTranslation("ID_CREATE_SUB_DEPARTAMENT"),
"UpdateDepartament" => G::LoadTranslation("ID_UPDATE_DEPARTAMENT"),
"UpdateSubDepartament" => G::LoadTranslation("ID_UPDATE_SUB_DEPARTAMENT"),
"DeleteDepartament" => G::LoadTranslation("ID_DELETE_DEPARTAMENT"),
"AssignManagerToDepartament" => G::LoadTranslation("ID_ASSIGN_MANAGER_TO_DEPARTAMENT"),
"AssignUserToDepartament" => G::LoadTranslation("ID_ASSIGN_USER_TO_DEPARTAMENT"),
"RemoveUsersFromDepartament" => G::LoadTranslation("ID_REMOVE_USERS_FROM_DEPARTAMENT"),
"AssignUserToGroup" => G::LoadTranslation("ID_ASSIGN_USER_TO_GROUP"),
"UploadLanguage" => G::LoadTranslation("ID_UPLOAD_LANGUAGE"),
"ExportLanguage" => G::LoadTranslation("ID_EXPORT_LANGUAGE"),
"DeleteLanguage" => G::LoadTranslation("ID_DELETE_LAGUAGE"),
"UploadSystemSettings" => G::LoadTranslation("ID_UPLOAD_SYSTEM_SETTINGS"),
"UpdateEmailSettings" => G::LoadTranslation("ID_UPDATE_EMAIL_SETTINGS"),
"CreateEmailSettings" => G::LoadTranslation("ID_CREATE_EMAIL_SETTINGS"),
"UploadLogo" => G::LoadTranslation("ID_UPLOAD_LOGO"),
"DeleteLogo" => G::LoadTranslation("ID_DELETE_LOGO"),
"RestoreLogo" => G::LoadTranslation("ID_RESTORE_LOGO"),
"ReplaceLogo" => G::LoadTranslation("ID_REPLACE_LOGO"),
"InstallPlugin" => G::LoadTranslation("ID_INSTALL_PLUGIN"),
"EnablePlugin" => G::LoadTranslation("ID_ENABLE_PLUGIN"),
"DisablePlugin" => G::LoadTranslation("ID_DISABLE_PLUGIN"),
"RemovePlugin" => G::LoadTranslation("ID_REMOVE_PLUGIN"),
"SetColumns" => G::LoadTranslation("ID_SET_COLUMNS"),
"EnableAuditLog" => G::LoadTranslation("ID_ENABLE_AUDIT_LOG"),
"DisableAuditLog" => G::LoadTranslation("ID_DISABLE_AUDIT_LOG"),
"EditProcess" => G::LoadTranslation("ID_EDIT_PROCESS"),
"ExportProcess" => G::LoadTranslation("ID_EXPORT_PROCESS"),
"WebEntry" => G::LoadTranslation("ID_WEB_ENTRY"),
"AssignRole" => G::LoadTranslation("ID_ASSIGN_ROLE"),
"RemoveUser" => G::LoadTranslation("ID_REMOVE_USER"),
"AddTask" => G::LoadTranslation("ID_ADD_TASK"),
"AddSubProcess" => G::LoadTranslation("ID_ADD_SUB_PROCESS"),
"SaveTaskPosition" => G::LoadTranslation("ID_SAVE_TASK_POSITION"),
"AddHorizontalLine" => G::LoadTranslation("ID_ADD_HORIZONTAL_LINE"),
"AddVerticalLine" => G::LoadTranslation("ID_ADD_VERTICAL_LINE"),
"SaveGuidePosition" => G::LoadTranslation("ID_SAVE_GUIDE_POSITION"),
"DeleteLine" => G::LoadTranslation("ID_DELETE_LINE"),
"DeleteLines" => G::LoadTranslation("ID_DELETE_LINES"),
"AddText" => G::LoadTranslation("ID_ADD_TEXT"),
"UpdateText" => G::LoadTranslation("ID_UPDATE_TEXT"),
"SaveTextPosition" => G::LoadTranslation("ID_SAVE_TEXT_POSITION"),
"DeleteText" => G::LoadTranslation("ID_DELETE_TEXT"),
"ProcessFileManager" => G::LoadTranslation("ID_PROCESS_FILE_MANAGER"),
"ProcessPermissions" => G::LoadTranslation("ID_PROCESS_PERMISSIONS"),
"DeletePermissions" => G::LoadTranslation("ID_DELETE_PERMISSIONS"),
"AssignSupervisorDynaform" => G::LoadTranslation("ID_ASSIGN_SUPERVISOR_DYNAFORM"),
"RemoveSupervisorDynaform" => G::LoadTranslation("ID_REMOVE_SUPERVISOR_DYNAFORM"),
"AssignSupervisorInput" => G::LoadTranslation("ID_ASSIGN_SUPERVISOR_INPUT"),
"RemoveSupervisorInput" => G::LoadTranslation("ID_REMOVE_SUPERVISOR_INPUT"),
"CaseTrackers" => G::LoadTranslation("ID_CASE_TRACKERS"),
"EditEvent" => G::LoadTranslation("ID_EDIT_EVENT"),
"DeleteEvent" => G::LoadTranslation("ID_EVENT_DELETED"),
"CreateDynaform" => G::LoadTranslation("ID_CREATE_DYNAFORM"),
"UpdateDynaform" => G::LoadTranslation("ID_UPDATE_DYNAFORM"),
"DeleteDynaform" => G::LoadTranslation("ID_DELETE_DYNAFORM"),
"ConditionsEditorDynaform" => G::LoadTranslation("ID_CONDITIONS_EDITOR_DYNAFORM"),
"CreateCaseScheduler" => G::LoadTranslation("ID_CREATE_CASE_SCHEDULER"),
"UpdateCaseScheduler" => G::LoadTranslation("ID_UPDATE_CASE_SCHEDULER"),
"DeleteCaseScheduler" => G::LoadTranslation("ID_DELETE_CASE_SCHEDULER"),
"CreateDatabaseConnection" => G::LoadTranslation("ID_CREATE_DATABASE_CONNECTION"),
"UpdateDatabaseConnection" => G::LoadTranslation("ID_UPDATE_DATABASE_CONNECTION"),
"DeleteDatabaseConnection" => G::LoadTranslation("ID_DELETE_DATABASE_CONNECTION"),
"CreateInputDocument" => G::LoadTranslation("ID_CREATE_INPUT_DOCUMENT"),
"UpdateInputDocument" => G::LoadTranslation("ID_UPDATE_INPUT_DOCUMENT"),
"DeleteInputDocument" => G::LoadTranslation("ID_DELETE_INPUT_DOCUMENT"),
"CreateOutputDocument" => G::LoadTranslation("ID_CREATE_OUTPUT_DOCUMENT"),
"UpdateOutputDocument" => G::LoadTranslation("ID_UPDATE_OUTPUT_DOCUMENT"),
"DeleteOutputDocument" => G::LoadTranslation("ID_DELETE_OUTPUT_DOCUMENT"),
"CreateTrigger" => G::LoadTranslation("ID_CREATE_TRIGGER"),
"UpdateTrigger" => G::LoadTranslation("ID_UPDATE_TRIGGER"),
"DeleteTrigger" => G::LoadTranslation("ID_DELETE_TRIGGER"),
"DerivationRule" => G::LoadTranslation("ID_DERIVATION_RULE"),
"DeleteTask" => G::LoadTranslation("ID_DELETE_TASK"),
"DeleteSubProcess" => G::LoadTranslation("ID_DELETE_SUB_PROCESS"),
"OptionsMenuTask" => G::LoadTranslation("ID_OPTIONS_MENU_TASK"),
"SaveTaskProperties" => G::LoadTranslation("ID_SAVE_TASK_PROPERTIES"),
"DeleteRoutes" => G::LoadTranslation("ID_DELETE_ROUTES"),
"NewConditionFromStep" => G::LoadTranslation("ID_NEW_CONDITION_FROM_STEP"),
"AssignTrigger" => G::LoadTranslation("ID_ASSIGN_TRIGGER"),
"UpTrigger" => G::LoadTranslation("ID_UP_TRIGGER"),
"DownTrigger" => G::LoadTranslation("ID_DOWN_TRIGGER"),
"StepDelete" => G::LoadTranslation("ID_STEP_DELETE"),
"StepUp" => G::LoadTranslation("ID_STEP_UP"),
"StepDown" => G::LoadTranslation("ID_STEP_DOWN"),
"SaveNewStep" => G::LoadTranslation("ID_SAVE_NEW_STEP"),
"AssignUserTask" => G::LoadTranslation("ID_ASSIGN_USER_TASK"),
"AssignGroupTask" => G::LoadTranslation("ID_ASSIGN_GROUP_TASK"),
"DeleteUserTask" => G::LoadTranslation("ID_DELETE_USER_TASK"),
"DeleteGroupTask" => G::LoadTranslation("ID_DELETE_GROUP_TASK"),
"ImportProcess" => G::LoadTranslation("ID_IMPORT_PROCESS"),
"DeleteProcess" => G::LoadTranslation("ID_DELETE_PROCESS")
);
asort($arrayAction);
$arrayActionAux = $arrayAction;
$arrayAction = array(array("ALL", G::LoadTranslation("ID_ALL")));
foreach ($arrayActionAux as $key => $value) {
$arrayAction[] = array($key, $value);
}
$auditLog = new AuditLog();
$auditLog->setUserLogged($_SESSION["USER_LOGGED"]);
$oHeadPublisher = headPublisher::getSingleton();
$oHeadPublisher->addExtJsScript("setup/auditLog", true);
$oHeadPublisher->assign("CONFIG", $config);
$oHeadPublisher->assign("ACTION", $arrayAction);
$oHeadPublisher->assign("CONFIG", $auditLog->getConfig());
$oHeadPublisher->assign("ACTION", $auditLog->getActions());
G::RenderPage("publish", "extJs");

View File

@@ -1,111 +1,13 @@
<?php
function mktimeDate ($date)
{
$arrayAux = getdate( strtotime( $date ) );
$mktDate = mktime( $arrayAux["hours"], $arrayAux["minutes"], $arrayAux["seconds"], $arrayAux["mon"], $arrayAux["mday"], $arrayAux["year"] );
return $mktDate;
}
use ProcessMaker\AuditLog\AuditLog;
function auditLogArraySet ($str, $filter)
{
$arrayAux = explode( "|", $str );
$date = "";
$workspace = "";
$action = "";
$ip = "";
$user = "";
$description = "";
if (count( $arrayAux ) > 1) {
$date = (isset( $arrayAux[0] )) ? trim( $arrayAux[0] ) : "";
$workspace = (isset( $arrayAux[1] )) ? trim( $arrayAux[1] ) : "";
$ip = (isset( $arrayAux[2] )) ? trim( $arrayAux[2] ) : "";
$user = (isset( $arrayAux[4] )) ? trim( $arrayAux[4] ) : "";
$action = (isset( $arrayAux[5] )) ? trim( $arrayAux[5] ) : "";
$description = (isset( $arrayAux[6] )) ? trim( $arrayAux[6] ) : "";
}
$auditLog = new AuditLog();
$auditLog->setUserLogged($_SESSION["USER_LOGGED"]);
$mktDate = (! empty( $date )) ? mktimeDate( $date ) : 0;
//Filter
$sw = 1;
if ($workspace != $filter["workspace"]) {
$sw = 0;
}
$response = [];
if ($filter["action"] != "ALL") {
if ($action != $filter["action"]) {
$sw = 0;
}
}
if ($filter["dateFrom"] && $mktDate > 0) {
if (! (mktimeDate( $filter["dateFrom"] ) <= $mktDate)) {
$sw = 0;
}
}
if ($filter["dateTo"] && $mktDate > 0) {
if (! ($mktDate <= mktimeDate( $filter["dateTo"] . " 23:59:59" ))) {
$sw = 0;
}
}
if ($filter["description"]) {
$sw = 0;
$string = $filter["description"];
if ( (stristr($date, $string) !== false) || (stristr($ip, $string) !== false) || (stristr($user, $string) !== false) || (stristr($action, $string) !== false) || (stristr($description, $string) !== false) ) {
$sw = 1;
}
}
$arrayData = array ();
$newAction = preg_replace('/([A-Z])/', '_$1', $action);
$newAction = "ID".strtoupper($newAction);
if ($sw == 1) {
$arrayData = array ("DATE" => $date, "USER" => $user, "IP" =>$ip, "ACTION" => G::LoadTranslation($newAction), "DESCRIPTION" => $description);
}
return $arrayData;
}
function getAuditLogData ($filter, $r, $i)
{
$arrayData = array ();
$strAux = null;
$count = 0;
$file = PATH_DATA . "log" . PATH_SEP . "audit.log";
if (file_exists($file)) {
$arrayFileData = file($file);
for ($k = 0; $k < count($arrayFileData); $k++) {
$strAux = $arrayFileData[$k];
if ($strAux) {
$arrayAux = auditLogArraySet($strAux, $filter);
if (count($arrayAux) > 0) {
$count = $count + 1;
if ($count > $i && count($arrayData) < $r) {
$arrayData[] = $arrayAux;
}
}
}
}
}
return array($count, $arrayData);
}
$option = (isset( $_REQUEST["option"] )) ? $_REQUEST["option"] : null;
$response = array ();
$option = (isset($_REQUEST["option"])) ? $_REQUEST["option"] : null;
switch ($option) {
case "LST":
@@ -116,15 +18,23 @@ switch ($option) {
$dateFrom = $_REQUEST["dateFrom"];
$dateTo = $_REQUEST["dateTo"];
$arrayFilter = array ("workspace" => $workspace, "action" => $action, "description" => $description,"dateFrom" => str_replace( "T00:00:00", null, $dateFrom ),"dateTo" => str_replace( "T00:00:00", null, $dateTo )
);
$arrayFilter = [
"workspace" => $workspace,
"action" => $action,
"description" => $description,
"dateFrom" => str_replace("T00:00:00", null, $dateFrom),
"dateTo" => str_replace("T00:00:00", null, $dateTo)
];
$limit = isset( $_REQUEST["limit"] ) ? $_REQUEST["limit"] : $pageSize;
$start = isset( $_REQUEST["start"] ) ? $_REQUEST["start"] : 0;
$limit = isset($_REQUEST["limit"]) ? $_REQUEST["limit"] : $pageSize;
$start = isset($_REQUEST["start"]) ? $_REQUEST["start"] : 0;
list ($count, $data) = getAuditLogData( $arrayFilter, $limit, $start );
$response = array ("success" => true,"resultTotal" => $count,"resultRoot" => $data
);
list ($count, $data) = $auditLog->getAuditLogData($arrayFilter, $limit, $start);
$response = [
"success" => true,
"resultTotal" => $count,
"resultRoot" => $data
];
break;
case "EMPTY":
$status = 1;
@@ -132,8 +42,8 @@ switch ($option) {
try {
$file = PATH_DATA . "log" . PATH_SEP . "cron.log";
if (file_exists( $file )) {
unlink( $file );
if (file_exists($file)) {
unlink($file);
}
$response["status"] = "OK";
@@ -148,4 +58,4 @@ switch ($option) {
break;
}
echo G::json_encode( $response );
echo G::json_encode($response);

View File

@@ -890,6 +890,10 @@ antes funcionaba.
width: 16px !important;
height: 16px !important;
}
.ICON_STANDARD_LOGGING{
background-image: url(/images/import.gif) !important;
}
.ICON_EMAILS {
/*ss_email_edit*/

View File

@@ -0,0 +1,485 @@
<?php
namespace ProcessMaker\AuditLog;
use Bootstrap;
use Configurations;
use Exception;
use G;
use ProcessMaker\Core\System;
use Symfony\Component\Finder\Finder;
class AuditLog
{
private $actions = [];
private $columns;
private $pageSizeDefault = 20;
private $pathGlobalLog;
private $userFullname = "";
private $userLogged = "";
/**
* Class constructor.
*/
function __construct()
{
$this->pathGlobalLog = PATH_DATA . 'log';
$this->columns = ['date', 'workspace', 'ip', 'id', 'user', 'action', 'description'];
$this->actions = [
"CreateUser" => G::LoadTranslation("ID_CREATE_USER"),
"UpdateUser" => G::LoadTranslation("ID_UPDATE_USER"),
"DeleteUser" => G::LoadTranslation("ID_DELETE_USER"),
"EnableUser" => G::LoadTranslation("ID_ENABLE_USER"),
"DisableUser" => G::LoadTranslation("ID_DISABLE_USER"),
"AssignAuthenticationSource" => G::LoadTranslation("ID_ASSIGN_AUTHENTICATION_SOURCE"),
"AssignUserToGroup" => G::LoadTranslation("ID_ASSIGN_USER_TO_GROUP"),
"CreateAuthSource" => G::LoadTranslation("ID_CREATE_AUTH_SOURCE"),
"UpdateAuthSource" => G::LoadTranslation("ID_UPDATE_AUTH_SOURCE"),
"DeleteAuthSource" => G::LoadTranslation("ID_DELETE_AUTH_SOURCE"),
"CreateRole" => G::LoadTranslation("ID_CREATE_ROLE"),
"UpdateRole" => G::LoadTranslation("ID_UPDATE_ROLE"),
"DeleteRole" => G::LoadTranslation("ID_DELETE_ROLE"),
"AssignUserToRole" => G::LoadTranslation("ID_ASSIGN_USER_TO_ROLE"),
"DeleteUserToRole" => G::LoadTranslation("ID_DELETE_USER_TO_ROLE"),
"AddPermissionToRole" => G::LoadTranslation("ID_ADD_PERMISSION_TO_ROLE"),
"DeletePermissionToRole" => G::LoadTranslation("ID_DELETE_PERMISSION_TO_ROLE"),
"CreateSkin" => G::LoadTranslation("ID_CREATE_SKIN"),
"ImportSkin" => G::LoadTranslation("ID_IMPORT_SKIN"),
"ExportSkin" => G::LoadTranslation("ID_EXPORT_SKIN"),
"DeleteSkin" => G::LoadTranslation("ID_DELETE_SKIN"),
"CreateGroup" => G::LoadTranslation("ID_CREATE_GROUP"),
"UpdateGroup" => G::LoadTranslation("ID_UPDATE_GROUP"),
"DeleteGroup" => G::LoadTranslation("ID_DELETE_GROUP"),
"CreateCategory" => G::LoadTranslation("ID_CREATE_CATEGORY"),
"UpdateCategory" => G::LoadTranslation("ID_UPDATE_CATEGORY"),
"DeleteCategory" => G::LoadTranslation("ID_DELETE_CATEGORY"),
"BuildCache" => G::LoadTranslation("ID_BUILD_CACHE"),
"ClearCache" => G::LoadTranslation("ID_CLEAR_CACHE"),
"ClearCron" => G::LoadTranslation("ID_CLEAR_CRON"),
"UpdateEnvironmentSettings" => G::LoadTranslation("ID_UPDATE_ENVIRONMENT_SETTINGS"),
"UpdateLoginSettings" => G::LoadTranslation("ID_UPDATE_LOGIN_SETTINGS"),
"EnableHeartBeat" => G::LoadTranslation("ID_ENABLE_HEART_BEAT"),
"DisableHeartBeat" => G::LoadTranslation("ID_DISABLE_HEART_BEAT"),
"CreatePmtable" => G::LoadTranslation("ID_CREATE_PMTABLE"),
"UpdatePmtable" => G::LoadTranslation("ID_UPDATE_PMTABLE"),
"DeletePmtable" => G::LoadTranslation("ID_DELETE_PMTABLE"),
"AddDataPmtable" => G::LoadTranslation("ID_ADD_DATA_PMTABLE"),
"UpdateDataPmtable" => G::LoadTranslation("ID_UPDATE_DATA_PMTABLE"),
"DeleteDataPmtable" => G::LoadTranslation("ID_DELETE_DATA_PMTABLE"),
"ImportTable" => G::LoadTranslation("ID_IMPORT_TABLE"),
"ExportTable" => G::LoadTranslation("ID_EXPORT_TABLE"),
"CreateCalendar" => G::LoadTranslation("ID_CREATE_CALENDAR"),
"UpdateCalendar" => G::LoadTranslation("ID_UPDATE_CALENDAR"),
"DeleteCalendar" => G::LoadTranslation("ID_DELETE_CALENDAR"),
"CreateDashletInstance" => G::LoadTranslation("ID_CREATE_DASHLET_INSTANCE"),
"UpdateDashletInstance" => G::LoadTranslation("ID_UPDATE_DASHLET_INSTANCE"),
"DeleteDashletInstance" => G::LoadTranslation("ID_DELETE_DASHLET_INSTANCE"),
"CreateDepartament" => G::LoadTranslation("ID_CREATE_DEPARTAMENT"),
"CreateSubDepartament" => G::LoadTranslation("ID_CREATE_SUB_DEPARTAMENT"),
"UpdateDepartament" => G::LoadTranslation("ID_UPDATE_DEPARTAMENT"),
"UpdateSubDepartament" => G::LoadTranslation("ID_UPDATE_SUB_DEPARTAMENT"),
"DeleteDepartament" => G::LoadTranslation("ID_DELETE_DEPARTAMENT"),
"AssignManagerToDepartament" => G::LoadTranslation("ID_ASSIGN_MANAGER_TO_DEPARTAMENT"),
"AssignUserToDepartament" => G::LoadTranslation("ID_ASSIGN_USER_TO_DEPARTAMENT"),
"RemoveUsersFromDepartament" => G::LoadTranslation("ID_REMOVE_USERS_FROM_DEPARTAMENT"),
"AssignUserToGroup" => G::LoadTranslation("ID_ASSIGN_USER_TO_GROUP"),
"UploadLanguage" => G::LoadTranslation("ID_UPLOAD_LANGUAGE"),
"ExportLanguage" => G::LoadTranslation("ID_EXPORT_LANGUAGE"),
"DeleteLanguage" => G::LoadTranslation("ID_DELETE_LAGUAGE"),
"UploadSystemSettings" => G::LoadTranslation("ID_UPLOAD_SYSTEM_SETTINGS"),
"UpdateEmailSettings" => G::LoadTranslation("ID_UPDATE_EMAIL_SETTINGS"),
"CreateEmailSettings" => G::LoadTranslation("ID_CREATE_EMAIL_SETTINGS"),
"UploadLogo" => G::LoadTranslation("ID_UPLOAD_LOGO"),
"DeleteLogo" => G::LoadTranslation("ID_DELETE_LOGO"),
"RestoreLogo" => G::LoadTranslation("ID_RESTORE_LOGO"),
"ReplaceLogo" => G::LoadTranslation("ID_REPLACE_LOGO"),
"InstallPlugin" => G::LoadTranslation("ID_INSTALL_PLUGIN"),
"EnablePlugin" => G::LoadTranslation("ID_ENABLE_PLUGIN"),
"DisablePlugin" => G::LoadTranslation("ID_DISABLE_PLUGIN"),
"RemovePlugin" => G::LoadTranslation("ID_REMOVE_PLUGIN"),
"SetColumns" => G::LoadTranslation("ID_SET_COLUMNS"),
"EnableAuditLog" => G::LoadTranslation("ID_ENABLE_AUDIT_LOG"),
"DisableAuditLog" => G::LoadTranslation("ID_DISABLE_AUDIT_LOG"),
"EditProcess" => G::LoadTranslation("ID_EDIT_PROCESS"),
"ExportProcess" => G::LoadTranslation("ID_EXPORT_PROCESS"),
"WebEntry" => G::LoadTranslation("ID_WEB_ENTRY"),
"AssignRole" => G::LoadTranslation("ID_ASSIGN_ROLE"),
"RemoveUser" => G::LoadTranslation("ID_REMOVE_USER"),
"AddTask" => G::LoadTranslation("ID_ADD_TASK"),
"AddSubProcess" => G::LoadTranslation("ID_ADD_SUB_PROCESS"),
"SaveTaskPosition" => G::LoadTranslation("ID_SAVE_TASK_POSITION"),
"AddHorizontalLine" => G::LoadTranslation("ID_ADD_HORIZONTAL_LINE"),
"AddVerticalLine" => G::LoadTranslation("ID_ADD_VERTICAL_LINE"),
"SaveGuidePosition" => G::LoadTranslation("ID_SAVE_GUIDE_POSITION"),
"DeleteLine" => G::LoadTranslation("ID_DELETE_LINE"),
"DeleteLines" => G::LoadTranslation("ID_DELETE_LINES"),
"AddText" => G::LoadTranslation("ID_ADD_TEXT"),
"UpdateText" => G::LoadTranslation("ID_UPDATE_TEXT"),
"SaveTextPosition" => G::LoadTranslation("ID_SAVE_TEXT_POSITION"),
"DeleteText" => G::LoadTranslation("ID_DELETE_TEXT"),
"ProcessFileManager" => G::LoadTranslation("ID_PROCESS_FILE_MANAGER"),
"ProcessPermissions" => G::LoadTranslation("ID_PROCESS_PERMISSIONS"),
"DeletePermissions" => G::LoadTranslation("ID_DELETE_PERMISSIONS"),
"AssignSupervisorDynaform" => G::LoadTranslation("ID_ASSIGN_SUPERVISOR_DYNAFORM"),
"RemoveSupervisorDynaform" => G::LoadTranslation("ID_REMOVE_SUPERVISOR_DYNAFORM"),
"AssignSupervisorInput" => G::LoadTranslation("ID_ASSIGN_SUPERVISOR_INPUT"),
"RemoveSupervisorInput" => G::LoadTranslation("ID_REMOVE_SUPERVISOR_INPUT"),
"CaseTrackers" => G::LoadTranslation("ID_CASE_TRACKERS"),
"EditEvent" => G::LoadTranslation("ID_EDIT_EVENT"),
"DeleteEvent" => G::LoadTranslation("ID_EVENT_DELETED"),
"CreateDynaform" => G::LoadTranslation("ID_CREATE_DYNAFORM"),
"UpdateDynaform" => G::LoadTranslation("ID_UPDATE_DYNAFORM"),
"DeleteDynaform" => G::LoadTranslation("ID_DELETE_DYNAFORM"),
"ConditionsEditorDynaform" => G::LoadTranslation("ID_CONDITIONS_EDITOR_DYNAFORM"),
"CreateCaseScheduler" => G::LoadTranslation("ID_CREATE_CASE_SCHEDULER"),
"UpdateCaseScheduler" => G::LoadTranslation("ID_UPDATE_CASE_SCHEDULER"),
"DeleteCaseScheduler" => G::LoadTranslation("ID_DELETE_CASE_SCHEDULER"),
"CreateDatabaseConnection" => G::LoadTranslation("ID_CREATE_DATABASE_CONNECTION"),
"UpdateDatabaseConnection" => G::LoadTranslation("ID_UPDATE_DATABASE_CONNECTION"),
"DeleteDatabaseConnection" => G::LoadTranslation("ID_DELETE_DATABASE_CONNECTION"),
"CreateInputDocument" => G::LoadTranslation("ID_CREATE_INPUT_DOCUMENT"),
"UpdateInputDocument" => G::LoadTranslation("ID_UPDATE_INPUT_DOCUMENT"),
"DeleteInputDocument" => G::LoadTranslation("ID_DELETE_INPUT_DOCUMENT"),
"CreateOutputDocument" => G::LoadTranslation("ID_CREATE_OUTPUT_DOCUMENT"),
"UpdateOutputDocument" => G::LoadTranslation("ID_UPDATE_OUTPUT_DOCUMENT"),
"DeleteOutputDocument" => G::LoadTranslation("ID_DELETE_OUTPUT_DOCUMENT"),
"CreateTrigger" => G::LoadTranslation("ID_CREATE_TRIGGER"),
"UpdateTrigger" => G::LoadTranslation("ID_UPDATE_TRIGGER"),
"DeleteTrigger" => G::LoadTranslation("ID_DELETE_TRIGGER"),
"DerivationRule" => G::LoadTranslation("ID_DERIVATION_RULE"),
"DeleteTask" => G::LoadTranslation("ID_DELETE_TASK"),
"DeleteSubProcess" => G::LoadTranslation("ID_DELETE_SUB_PROCESS"),
"OptionsMenuTask" => G::LoadTranslation("ID_OPTIONS_MENU_TASK"),
"SaveTaskProperties" => G::LoadTranslation("ID_SAVE_TASK_PROPERTIES"),
"DeleteRoutes" => G::LoadTranslation("ID_DELETE_ROUTES"),
"NewConditionFromStep" => G::LoadTranslation("ID_NEW_CONDITION_FROM_STEP"),
"AssignTrigger" => G::LoadTranslation("ID_ASSIGN_TRIGGER"),
"UpTrigger" => G::LoadTranslation("ID_UP_TRIGGER"),
"DownTrigger" => G::LoadTranslation("ID_DOWN_TRIGGER"),
"StepDelete" => G::LoadTranslation("ID_STEP_DELETE"),
"StepUp" => G::LoadTranslation("ID_STEP_UP"),
"StepDown" => G::LoadTranslation("ID_STEP_DOWN"),
"SaveNewStep" => G::LoadTranslation("ID_SAVE_NEW_STEP"),
"AssignUserTask" => G::LoadTranslation("ID_ASSIGN_USER_TASK"),
"AssignGroupTask" => G::LoadTranslation("ID_ASSIGN_GROUP_TASK"),
"DeleteUserTask" => G::LoadTranslation("ID_DELETE_USER_TASK"),
"DeleteGroupTask" => G::LoadTranslation("ID_DELETE_GROUP_TASK"),
"ImportProcess" => G::LoadTranslation("ID_IMPORT_PROCESS"),
"DeleteProcess" => G::LoadTranslation("ID_DELETE_PROCESS")
];
}
/**
* Set the identifier of the logged user.
*
* @param string $userLogged
*/
function setUserLogged($userLogged)
{
$this->userLogged = $userLogged;
}
/**
* Set the full name of the logged user.
*
* @param string $userFullname
*/
function setUserFullname($userFullname)
{
$this->userFullname = $userFullname;
}
/**
* Get the configuration for the Audit Log.
*
* @return array
*/
public function getConfig()
{
$configurations = new Configurations();
$configPage = $configurations->getConfiguration("auditLogList", "pageSize", null, $this->userLogged);
$config = [];
$config["pageSize"] = isset($configPage["pageSize"]) ? $configPage["pageSize"] : $this->pageSizeDefault;
return $config;
}
/**
* Get the actions for Audit Log.
*
* @return array
*/
public function getActions()
{
$actions = [];
$actions[] = ["ALL", G::LoadTranslation("ID_ALL")];
/**
* We arrange the arrangement to create an ordered list and that the option
* 'All' be found at the beginning.
*/
asort($this->actions);
foreach ($this->actions as $key => $value) {
$actions[] = [$key, $value];
}
return $actions;
}
/**
* Get the data of the files registered by Audit Log.
*
* @param array $filter
* @param int $limit
* @param int $start
* @return array
*/
public function getAuditLogData($filter, $limit, $start)
{
$result = [];
$count = 0;
$files = $this->getFiles($this->pathGlobalLog, 'audit*.log');
foreach ($files as $file) {
$lines = file($file->getPathname());
foreach ($lines as $line) {
if ($start <= $count && count($result) < $limit) {
$data = $this->lineToObject($line);
if ($this->validate($filter, $data)) {
$result[] = $this->lineToArray($data);
}
}
$count = $count + 1;
}
}
//from workspace
$system = System::getSystemConfiguration();
$path = PATH_DATA . 'sites' . PATH_SEP . config('system.workspace') . PATH_SEP . 'log' . PATH_SEP;
if (isset($system['logs_location']) && !empty($system['logs_location']) && is_dir($system['logs_location'])) {
$path = $system['logs_location'];
}
$files = $this->getFiles($path, 'audit*.log');
foreach ($files as $file) {
$lines = file($file->getPathname());
foreach ($lines as $line) {
if ($start <= $count && count($result) < $limit) {
/**
* processmaker/gulliver/system/class.monologProvider.php
* "<%level%> %datetime% %channel% %level_name%: %message% %context% %extra%\n"
*/
$data = $this->lineToObject($line, '/([A-Z][a-z][a-z]\s{1,2}\d{1,2}\s\d{2}[:]\d{2}[:]\d{2})\s([\w][\w\d\.@-]*)\s(.*)$/');
if ($this->validate($filter, $data)) {
$result[] = $this->lineToArray($data);
}
}
$count = $count + 1;
}
}
return [$count, $result];
}
/**
* Register an action for Audit Log.
*
* @param string $action
* @param string $value
*/
public function register($action, $value = '')
{
$context = Bootstrap::getDefaultContextLog();
$context['usrUid'] = $this->userLogged;
$context['usrName'] = $this->userFullname;
$context['action'] = $action;
$context['description'] = $value;
Bootstrap::registerMonolog($action, 200, $action, $context, $context['workspace'], 'audit.log');
}
/**
* Get the Audit Log files.
*
* @param string $path
* @param string $pattern
* @param string $dir
* @return array
*/
private function getFiles($path, $pattern = '', $dir = 'ASC')
{
$finder = new Finder();
$finder->files()
->in($path)
->name($pattern);
$files = iterator_to_array($finder->getIterator());
uasort($files, function ($a, $b) use ($dir) {
$name1 = $a->getFilename();
$name2 = $b->getFilename();
if ($dir === 'ASC') {
return strcmp($name1, $name2);
} else {
return strcmp($name2, $name1);
}
});
return $files;
}
/**
* Transforms a line of content from the file into an object.
*
* @param string $line
* @param string $pattern
* @return object
*/
private function lineToObject($line, $pattern = '|')
{
$result = [];
$data = [];
if ($pattern === '|') {
$data = explode("|", $line);
} else {
$data = $this->getDataFromJson($line, $pattern);
}
foreach ($this->columns as $index => $column) {
$result[$column] = isset($data[$index]) ? trim($data[$index]) : '';
}
return (object) $result;
}
/**
* Gets the Json data stored from a line of contents of Audit Log files.
*
* @param string $line
* @param string $pattern
* @return array
*/
private function getDataFromJson($line, $pattern)
{
/**
* $matches[0]: datetime
* $matches[1]: channel
* $matches[2]: level_name + message + context
*/
preg_match($pattern, $line, $matches);
array_shift($matches);
if (!isset($matches[2])) {
return [];
}
$data = $matches[2];
$position = strpos($data, ' {');
if ($position === false) {
return [];
}
$data = substr($data, $position);
$data = str_replace('} {', '}, {', $data);
$data = '[' . $data . ']';
try {
$data = G::json_decode($data);
} catch (Exception $e) {
return [];
}
$join = [];
foreach ($data as $value) {
$value = (array) $value;
$join = array_merge($join, $value);
}
$join = (object) $join;
return [
empty($join->timeZone) ? '' : $join->timeZone,
empty($join->workspace) ? '' : $join->workspace,
empty($join->ip) ? '' : $join->ip,
empty($join->usrUid) ? '' : $join->usrUid,
empty($join->usrName) ? '' : $join->usrName,
empty($join->action) ? '' : $join->action,
empty($join->description) ? '' : $join->description
];
}
/**
* Apply filters to an Audit Log record.
*
* @param array $filter
* @param object $data
* @return boolean
*/
private function validate($filter, $data)
{
$result = true;
$date = !empty($data->date) ? $this->mktimeDate($data->date) : 0;
if ($filter["workspace"] != $data->workspace) {
$result = false;
}
if ($filter["action"] != "ALL") {
if ($data->action != $filter["action"]) {
$result = false;
}
}
if ($filter["dateFrom"] && $date > 0) {
if (!($this->mktimeDate($filter["dateFrom"]) <= $date)) {
$result = false;
}
}
if ($filter["dateTo"] && $date > 0) {
if (!($date <= $this->mktimeDate($filter["dateTo"] . " 23:59:59"))) {
$result = false;
}
}
if ($filter["description"]) {
$result = false;
$string = $filter["description"];
if ((stristr($data->date, $string) !== false) ||
(stristr($data->ip, $string) !== false) ||
(stristr($data->user, $string) !== false) ||
(stristr($data->action, $string) !== false) ||
(stristr($data->description, $string) !== false)) {
$result = true;
}
}
return $result;
}
/**
* Get the timestamp of the date given.
*
* @param string $date
* @return int
*/
private function mktimeDate($date)
{
$array = getdate(strtotime($date));
$mktime = mktime($array["hours"], $array["minutes"], $array["seconds"], $array["mon"], $array["mday"], $array["year"]);
return $mktime;
}
/**
* Obtain the corresponding arrangement for the columns of the Audit Log user
* interface.
*
* @param array $data
* @return array
*/
private function lineToArray($data)
{
$action = $data->action;
$action = preg_replace('/([A-Z])/', '_$1', $data->action);
$action = "ID" . strtoupper($action);
$action = G::LoadTranslation($action);
return [
"DATE" => $data->date,
"USER" => $data->user,
"IP" => $data->ip,
"ACTION" => $action,
"DESCRIPTION" => $data->description
];
}
}

View File

@@ -0,0 +1,59 @@
<?php
namespace ProcessMaker\BusinessModel\Files;
abstract class Files
{
/**
* @var string Path of the directory where the files are stored.
*/
protected $pathFiles;
/**
* Files constructor.
*
* @param $path
*/
public function __construct($path)
{
$this->pathFiles = $path;
}
/**
* Get path files
*
* @return string
*/
public function getPathFiles()
{
return $this->pathFiles;
}
/**
* This function get the list of the log files
*
* @param string $filter
* @param string $sort
* @param int $start
* @param int $limit
* @param string $dir related to order the column
*
* @return array
*/
abstract public function getAllFiles(
$filter = '',
$sort = '',
$start = 0,
$limit = 20,
$dir = 'ASC'
);
/**
* Download file
*
* @param array files
*/
abstract public function download($files);
}

View File

@@ -0,0 +1,283 @@
<?php
namespace ProcessMaker\BusinessModel\Files;
use Chumper\Zipper\Zipper;
use Configurations;
use Exception;
use G;
use ProcessMaker\Core\System;
use SplFileInfo;
use Symfony\Component\Finder\Finder;
class FilesLogs extends Files
{
/**
* Date format in list
* @var string
*/
private $dateFormat = 'Y-m-d H:i:s';
/**
* Path of the directory where the files are stored.
*
* @var string
*/
private $pathData = '';
/**
* FilesLogs constructor .
*/
public function __construct()
{
$system = System::getSystemConfiguration();
$configuration = new Configurations();
$generalConfig = $configuration->getConfiguration('ENVIRONMENT_SETTINGS', '');
if (isset($generalConfig['casesListDateFormat']) && !empty($generalConfig['casesListDateFormat'])) {
$this->setDateFormat($generalConfig['casesListDateFormat']);
}
$path = PATH_DATA . 'sites' . PATH_SEP . config('system.workspace') . PATH_SEP . 'log' . PATH_SEP;
if (isset($system['logs_location']) && !empty($system['logs_location']) && is_dir($system['logs_location'])) {
$path = $system['logs_location'];
}
$this->setPathDataSaveFile(PATH_DATA_PUBLIC);
parent::__construct($path);
}
/**
* Get Date Format
*
* @return string
*/
public function getDateFormat()
{
return $this->dateFormat;
}
/**
* Set Date Format
*
* @param string $dateFormat
*/
public function setDateFormat($dateFormat)
{
$this->dateFormat = $dateFormat;
}
/**
* Get Path data
*
* @return string
*/
public function getPathDataSaveFile()
{
return $this->pathData;
}
/**
* Set path data
*
* @param string $pathData
*/
public function setPathDataSaveFile($pathData)
{
G::mk_dir($pathData);
$this->pathData = $pathData;
}
/**
* This function get the list of the log files
*
* @param string $filter
* @param string $sort
* @param int $start
* @param int $limit
* @param string $dir related to order the column
*
* @return array
*/
public function getAllFiles($filter = '', $sort = 'fileCreated', $start = 0, $limit = 20, $dir = 'DESC')
{
if (!file_exists($this->getPathFiles())) {
return [
'totalRows' => 0,
'data' => []
];
}
$finder = new Finder();
$finder->files()
->in($this->getPathFiles())
->name('processmaker*.log')
->name('audit*.log');
if (!empty($filter)) {
$finder->filter(function (SplFileInfo $file) use ($filter) {
if (stristr($file->getFilename(), $filter) === false &&
stristr($file->getSize(), $filter) === false &&
stristr($file->getMTime(), $filter) === false
) {
return false;
}
});
}
//get files
$iterator = $finder->getIterator();
$files = iterator_to_array($iterator);
//sort files
switch ($sort) {
case 'fileSize':
uasort($files, function (SplFileInfo $a, SplFileInfo $b) use ($dir) {
$size1 = $a->getSize();
$size2 = $b->getSize();
if ($dir === 'ASC') {
return $size1 > $size2;
} else {
return $size1 < $size2;
}
});
break;
case 'fileCreated':
uasort($files, function ($a, $b) use ($dir) {
$time1 = $a->getMTime();
$time2 = $b->getMTime();
if ($dir === 'ASC') {
return $time1 > $time2;
} else {
return $time1 < $time2;
}
});
break;
case 'fileName':
default:
uasort($files, function ($a, $b) use ($dir) {
$name1 = $a->getFilename();
$name2 = $b->getFilename();
if ($dir === 'ASC') {
return strcmp($name1, $name2);
} else {
return strcmp($name2, $name1);
}
});
break;
}
//count files
$total = count($files);
//limit files
$files = array_slice(
$files, !empty($start) ? $start : 0, !empty($limit) ? $limit : 20
);
//create out element
$result = [];
foreach ($files as $file) {
$result[] = [
'fileName' => $file->getFilename(),
'fileSize' => $this->size($file->getSize()),
'fileCreated' => date($this->getDateFormat(), $file->getMTime())
];
}
return [
'totalRows' => $total,
'data' => $result
];
}
/**
* Change the size of a file in bytes to its literal equivalent
*
* @param int $size file size in bytes
* @param string $format
* @return string
*/
private function size($size, $format = null)
{
$sizes = ['Bytes', 'Kbytes', 'Mbytes', 'Gbytes', 'Tbytes', 'Pbytes', 'Ebytes', 'Zbytes', 'Ybytes'];
if ($format === null) {
$format = ' % 01.2f % s';
}
$lastSizesLabel = end($sizes);
foreach ($sizes as $sizeLabel) {
if ($size < 1024) {
break;
}
if ($sizeLabel !== $lastSizesLabel) {
$size /= 1024;
}
}
if ($sizeLabel === $sizes[0]) {
// Format bytes
$format = '%01d %s';
}
return sprintf($format, $size, $sizeLabel);
}
/**
* Create file zip
*
* @param array $files file name
*
* @return string path file
* @throws Exception
*/
private function createZip($files)
{
try {
$zipper = new Zipper();
$name = str_replace('.log', '.zip', $files[0]);
if (count($files) > 1) {
$name = 'processmaker_logs.zip';
}
$zipper->zip($this->getPathDataSaveFile() . $name);
$pathFileLogs = $this->getPathFiles();
$pathSep = '/';
if (strpos($pathFileLogs, '\\') !== false) {
$pathSep = '\\';
}
if (substr($pathFileLogs, -1, strlen($pathSep)) !== $pathSep) {
$pathFileLogs .= $pathSep;
}
foreach ($files as $key => $file) {
$info = pathinfo($file);
if (file_exists($pathFileLogs . $info['basename'])) {
$zipper->add($pathFileLogs . $info['basename']);
}
}
$zipper->close();
return $this->getPathDataSaveFile() . $name;
} catch (Exception $error) {
throw $error;
}
}
/**
* Download log files compressed in a Zip format
*
* @param array $files files names
*
* @throws Exception
*/
public function download($files)
{
try {
$fileZip = $this->createZip($files);
if (file_exists($fileZip)) {
G::streamFile($fileZip, true);
} else {
throw new Exception('File not exist.');
}
G::rm_dir($fileZip);
} catch (Exception $error) {
throw $error;
}
}
}

View File

@@ -1,6 +1,7 @@
<?php
namespace ProcessMaker\Core;
use Configurations;
use DomDocument;
use Exception;
@@ -59,7 +60,8 @@ class System
'load_headers_ie' => 0,
'redirect_to_mobile' => 0,
'disable_php_upload_execution' => 0,
'disable_download_documents_session_validation' => 0
'disable_download_documents_session_validation' => 0,
'logs_max_files' => 60
);
/**
@@ -1129,18 +1131,26 @@ class System
}
if (empty($wsIniFile)) {
if (defined('PATH_DB')) {
// if we're on a valid workspace env.
if (empty($wsName)) {
$uriParts = explode('/', getenv("REQUEST_URI"));
if (isset($uriParts[1])) {
if (substr($uriParts[1], 0, 3) == 'sys') {
$wsName = substr($uriParts[1], 3);
try {
if (function_exists('config')) {
$wsName = config("system.workspace");
}
} catch (Exception $exception) {
$wsName = '';
}
if (empty($wsName)) {
$uriParts = explode('/', getenv("REQUEST_URI"));
if (isset($uriParts[1])) {
if (substr($uriParts[1], 0, 3) === 'sys') {
$wsName = substr($uriParts[1], 3);
}
}
}
}
$wsIniFile = PATH_DB . $wsName . PATH_SEP . 'env.ini';
}
}

View File

@@ -0,0 +1,73 @@
<?php
namespace ProcessMaker\Services\Api;
use Exception;
use G;
use ProcessMaker\BusinessModel\Files\FilesLogs;
use \ProcessMaker\Services\Api;
use \Luracast\Restler\RestException;
/**
* Log Files Api Controller
*
* @protected
*/
class FileLogs extends Api
{
/**
* Get the list of the log files
*
* @url GET /list
*
* @param int $start {@from path}
* @param int $limit {@from path}
* @param string $sort {@from path}
* @param string $dir {@from path}
* @param string $filter {@from path}
*
* @return array
* @throws RestException
*
* @access protected
* @class AccessControl {@permission PM_SETUP_LOG_FILES}
*/
public function doGetListFileLogs(
$start = 0,
$limit = 0,
$sort = 'fileCreated',
$dir = 'DESC',
$filter = ''
)
{
try {
$file = new FilesLogs();
return $file->getAllFiles($filter, $sort, $start, $limit, $dir);
} catch (Exception $e) {
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
}
/**
* Download file.
*
* @url POST /download
*
* @param array $request_data name of the files
*
* @throws RestException
*
* @access protected
* @class AccessControl {@permission PM_SETUP_LOG_FILES}
*/
public function doPostDownload($request_data)
{
try {
$file = new FilesLogs();
$file->download(G::json_decode($request_data['files']));
} catch (Exception $e) {
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
}
}

View File

@@ -121,8 +121,11 @@ debug = 1
authentication = "ProcessMaker\Services\Api\Google\Authentication"
[alias: gmailIntegration]
gmailIntegration = "ProcessMaker\Services\Api\GmailIntegration"
token = "ProcessMaker\Services\Api\GmailToken"
gmailIntegration = "ProcessMaker\Services\Api\GmailIntegration"
token = "ProcessMaker\Services\Api\GmailToken"
[alias: reportingIndicators]
reportingIndicators = "ProcessMaker\Services\Api\ReportingIndicators"
reportingIndicators = "ProcessMaker\Services\Api\ReportingIndicators"
[alias: logs]
log = "ProcessMaker\Services\Api\FileLogs"

View File

@@ -0,0 +1,4 @@
<script type="text/javascript" src="/lib/js/restclient.min.js"></script>
<div style="padding: 15px">
<div id="list-panel"></div>
</div>

View File

@@ -0,0 +1,174 @@
Ext.namespace('fileLogs');
fileLogs.application = {
init: function () {
var loading = new Ext.LoadMask(Ext.getBody(), {msg: _('ID_LOADING_GRID')});
var downloadFiles = function () {
var records = gridFileLog.getSelectionModel().getSelections(),
data = [], headers = {}, fd = new FormData();
records.forEach(function (row) {
data.push(row.data.fileName)
});
fd.append('files', JSON.stringify(data));
headers['Authorization'] = 'Bearer ' + getToken();
downloadFile('POST', urlProxy + 'filelogs/download', headers, fd);
};
var pageSize = parseInt(CONFIG.pageSize);
var token = '';
var getToken = function () {
if (token === '') {
credentials = RCBase64.decode(credentials);
token = (credentials === '') ? "" : JSON.parse(credentials);
}
return token.access_token;
};
var storeFileLogs = new Ext.data.GroupingStore({
remoteSort: true,
proxy: new Ext.data.HttpProxy({
api: {
read: urlProxy + 'filelogs/list'
},
method: 'GET',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer ' + getToken()
}
}),
reader: new Ext.data.JsonReader({
root: 'data',
totalProperty: 'totalRows',
fields: [
{name: 'fileName'},
{name: 'fileCreated'},
{name: 'fileSize'}
]
}),
sortInfo: {
field: 'fileCreated',
direction: 'DESC'
},
listeners: {
beforeload: function (store) {
loading.show();
},
load: function (store, record, opt) {
loading.hide();
}
}
});
var storePageSize = new Ext.data.SimpleStore({
fields: ['size'],
data: [['20'], ['30'], ['40'], ['50'], ['100']],
autoLoad: true
});
var cboPageSize = new Ext.form.ComboBox({
id: 'cboPageSize',
mode: 'local',
triggerAction: 'all',
store: storePageSize,
valueField: 'size',
displayField: 'size',
width: 50,
editable: false,
listeners: {
select: function (combo, record, index) {
pageSize = parseInt(record.data['size']);
paging.pageSize = pageSize;
paging.moveFirst();
}
}
});
var paging = new Ext.PagingToolbar({
id: 'paging',
pageSize: pageSize,
store: storeFileLogs,
displayInfo: true,
displayMsg: _('ID_GRID_PAGE_DISPLAYING_FILE_LOGS'),
emptyMsg: _('ID_NO_RECORDS_FOUND'),
items: ['-', _('ID_PAGE_SIZE') + '&nbsp;', cboPageSize]
});
var cmodel = new Ext.grid.ColumnModel({
defaults: {
width: 50,
sortable: true
},
columns: [
{header: _('ID_FILE_NAME'), dataIndex: 'fileName', width: 15},
{header: _('ID_FILE_LOG_CREATED'), dataIndex: 'fileCreated', width: 15},
{header: _('ID_FILE_LOG_SIZE'), dataIndex: 'fileSize', width: 10}
]
});
var smodel = new Ext.grid.RowSelectionModel({
singleSelect: false,
disableSelection: true,
listeners: {
beforerowselect: function (sm, rowIndex, keepExisting, record) {
sm.suspendEvents();
if (sm.isSelected(rowIndex)) {
// row already selected, deselect it
sm.deselectRow(rowIndex);
} else {
Ext.getCmp('btnDownload').enable();
sm.selectRow(rowIndex, true)
}
sm.resumeEvents();
return false;
}
}
});
var gridFileLog = new Ext.grid.GridPanel({
id: 'gridFileLog',
title: _('ID_STANDARD_LOGGING'),
store: storeFileLogs,
colModel: cmodel,
selModel: smodel,
cls: 'grid_with_checkbox',
columnLines: true,
viewConfig: {forceFit: true},
enableColumnResize: true,
enableHdMenu: false,
tbar: [
{
id: 'btnDownload',
text: _('ID_DOWNLOAD') + '&nbsp;',
iconCls: 'button_menu_ext ICON_STANDARD_LOGGING',
disabled: true,
handler: downloadFiles
}
],
bbar: paging,
border: true
});
storeFileLogs.load();
cboPageSize.setValue(pageSize);
var viewport = new Ext.Viewport({
layout: 'fit',
autoScroll: false,
items: [gridFileLog]
});
if (typeof(__FILE_LOGS_ERROR__) !== 'undefined') {
PMExt.notify(_('ID_STANDARD_LOGGING'), __FILE_LOGS_ERROR__);
}
}
};
Ext.onReady(fileLogs.application.init, fileLogs.application);