PM-474 Support Plugin - get client information for support SOLVED

- funcion agregadat
This commit is contained in:
Marco Antonio Nina
2014-10-20 17:20:38 -04:00
parent e192ad8ee7
commit c4f5c3aa03
2 changed files with 209 additions and 65 deletions

View File

@@ -122,7 +122,7 @@ class adminProxy extends HttpProxyController
$this->url = "/sys" . SYS_SYS . "/" . (($sysConf["default_lang"] != "")? $sysConf["default_lang"] : ((defined("SYS_LANG") && SYS_LANG != "")? SYS_LANG : "en")) . "/" . $sysConf["default_skin"] . $urlPart; $this->url = "/sys" . SYS_SYS . "/" . (($sysConf["default_lang"] != "")? $sysConf["default_lang"] : ((defined("SYS_LANG") && SYS_LANG != "")? SYS_LANG : "en")) . "/" . $sysConf["default_skin"] . $urlPart;
$this->message = 'Saved Successfully'; $this->message = 'Saved Successfully';
$msg = ""; $msg = "";
if($httpData->proxy_host != '' || $httpData->proxy_port != '' || $httpData->proxy_user != '') { if ($httpData->proxy_host != '' || $httpData->proxy_port != '' || $httpData->proxy_user != '') {
$msg = " Host -> ".$httpData->proxy_host." Port -> ".$httpData->proxy_port." User -> ".$httpData->proxy_user; $msg = " Host -> ".$httpData->proxy_host." Port -> ".$httpData->proxy_port." User -> ".$httpData->proxy_user;
} }
@@ -178,7 +178,7 @@ class adminProxy extends HttpProxyController
$httpData=array_unique((array)$httpData); $httpData=array_unique((array)$httpData);
$message = ''; $message = '';
$oldName = isset($_POST['oldName'])? $_POST['oldName']:''; $oldName = isset($_POST['oldName'])? $_POST['oldName']:'';
switch ($_POST['action']){ switch ($_POST['action']){
case 'calendarName': case 'calendarName':
require_once ('classes/model/CalendarDefinition.php'); require_once ('classes/model/CalendarDefinition.php');
@@ -1356,5 +1356,133 @@ class adminProxy extends HttpProxyController
return $result; return $result;
} }
public function generateInfoSupport ()
{
require_once (PATH_CONTROLLERS . "installer.php");
$params = array ();
$oServerConf = &serverConf::getSingleton();
$pluginRegistry = &PMPluginRegistry::getSingleton();
$licenseManager = &pmLicenseManager::getSingleton();
//License Information:
$activeLicense = $licenseManager->getActiveLicense();
$params['license'] = $licenseManager;
//Operative System version (Linux, Windows)
try {
$os = '';
if (file_exists( '/etc/redhat-release' )) {
$fnewsize = filesize( '/etc/redhat-release' );
$fp = fopen( '/etc/redhat-release', 'r' );
$os = trim( fread( $fp, $fnewsize ) );
fclose( $fp );
}
$os .= " (" . PHP_OS . ")";
} catch (Exception $e) {
}
$params['system'] = $os;
//On premise or cloud
$licInfo = $oServerConf->getProperty( 'LICENSE_INFO' );
$params['licenseType'] = isset($licInfo[SYS_SYS]) ? isset($licInfo[SYS_SYS]['TYPE'])? $licInfo[SYS_SYS]['TYPE'] : '' : '';
//ProcessMaker Version
$params['pmVersion'] = System::getVersion();
if (file_exists(PATH_DATA. 'log/upgrades.log')) {
$params['pmUpgrade'] = file_get_contents(PATH_DATA. 'log/upgrades.log', 'r');
} else {
$params['pmUpgrade'] = G::LoadTranslation('ID_UPGRADE_NEVER_UPGRADE');
}
//Database server Version (MySQL version)
$installer = new Installer();
$systemInfo = $installer->getSystemInfo();
$params['dbVersion'] = mysql_get_server_info();//$systemInfo->mysql->version;
//PHP Version
$params['php'] = $systemInfo->php->version;
//Apache - IIS Version
$params['apache'] = apache_get_version();
//Installed Plugins (license info?)
$arrayAddon = array ();
if (file_exists( PATH_DATA_SITE . "ee" )) {
$arrayAddon = unserialize( trim( file_get_contents( PATH_DATA_SITE . "ee" ) ) );
}
$plugins = array();
foreach ($arrayAddon as $addon) {
$sFileName = substr( $addon["sFilename"], 0, strpos( $addon["sFilename"], "-" ) );
if (file_exists( PATH_PLUGINS . $sFileName . ".php" )) {
$plugin = array();
$addonDetails = $pluginRegistry->getPluginDetails( $sFileName . ".php" );
$plugin['name'] = $addonDetails->sNamespace;
$plugin['description'] = $addonDetails->sDescription;
$plugin['version'] = $addonDetails->iVersion;
$plugin['enable'] = $addonDetails->enabled;
$plugins[] = $plugin;
}
}
$params['plugins'] = $plugins;
//Number of Users registered in PM. Including LDAP users and PM users.
require_once ("classes/model/RbacUsers.php");
$criteria = new Criteria( "rbac" );
$criteria->addSelectColumn( RbacUsersPeer::USR_AUTH_TYPE );
$criteria->addSelectColumn( "COUNT(USERS.USR_UID) AS USERS_NUMBER" );
$criteria->add( RbacUsersPeer::USR_UID, null, Criteria::ISNOTNULL );
$criteria->addGroupByColumn(RbacUsersPeer::USR_AUTH_TYPE);
$rs = RbacUsersPeer::doSelectRS( $criteria );
$rs->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$users = array('local' => 0);
while ($rs->next()) {
$row = $rs->getRow();
if ($row['USR_AUTH_TYPE'] == '' || $row['USR_AUTH_TYPE'] == 'MYSQL') {
$users['local'] = (int)$users['local'] + (int)$row['USERS_NUMBER'];
} else {
$users['USR_AUTH_TYPE'] = $row['USERS_NUMBER'];
}
}
$params["users"] =$users;
//Number of cases.
$oSequences = new Sequences();
$maxNumber = $oSequences->getSequeceNumber("APP_NUMBER");
$params["cases"] = $maxNumber - 1;
//Number of active processes.
$criteria = new Criteria( "workflow" );
$criteria->addSelectColumn( "COUNT(PROCESS.PRO_UID) AS NUMBER_PROCESS" );
$criteria->add( ProcessPeer::PRO_STATUS, 'ACTIVE', Criteria::NOT_EQUAL);
$rs = UsersPeer::doSelectRS( $criteria );
$rs->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$rs->next();
$row = $rs->getRow();
$params["process active"] = $row["NUMBER_PROCESS"];
$criteria = new Criteria( "workflow" );
$criteria->addSelectColumn( "COUNT(PROCESS.PRO_UID) AS NUMBER_PROCESS" );
$criteria->add( ProcessPeer::PRO_STATUS, 'INACTIVE', Criteria::NOT_EQUAL);
$rs = UsersPeer::doSelectRS( $criteria );
$rs->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$rs->next();
$row = $rs->getRow();
$params["process inactive"] = $row["NUMBER_PROCESS"];
//Country/city (Timezone)
$params["Timezone"] = (defined('TIME_ZONE') && TIME_ZONE != "Unknown") ? TIME_ZONE : date_default_timezone_get();
$support = PATH_DATA_SITE . 'support.txt';
file_put_contents($support, serialize($params));
G::streamFile($support, true);
G::rm_dir($support);
}
} }

View File

@@ -458,6 +458,14 @@ Ext.onReady(function() {
}); });
} }
var enterpriseFileSupport = function () {
var myMask = new Ext.LoadMask(Ext.getBody(), {msg: _('ID_PROCESSING')});
myMask.show();
//window.location = '../../uxmodern/main/generateInfoSupport';
window.location = '../adminProxy/generateInfoSupport',
myMask.hide();
};
function enterpriseProcessAjax(option) function enterpriseProcessAjax(option)
{ {
switch (option) { switch (option) {
@@ -1006,50 +1014,76 @@ Ext.onReady(function() {
] ]
}); });
var pnlSetup = new Ext.FormPanel({ var pnlSetup = new Ext.FormPanel({
frame: true, frame: true,
height: 178, height: 160,
bodyStyle: "padding: 5px 5px 5px 5px;", disabled: !licensed,
disabled: !licensed,
items: [ items: [
{ {
layout: "column", layout: "column",
items: [ items: [
{ {
columnWidth: 0.80, columnWidth: 0.80,
xtype: "container", xtype: "container",
items: [ items: [
{ {
xtype: "checkbox", xtype: "checkbox",
id: "chkEeInternetConnection", id: "chkEeInternetConnection",
name: "chkEeInternetConnection", name: "chkEeInternetConnection",
checked: (INTERNET_CONNECTION == 1)? true : false, checked: (INTERNET_CONNECTION == 1)? true : false,
boxLabel: _('ID_CHECK_UPDATES') boxLabel: _('ID_CHECK_UPDATES')
} }
] ]
}, },
{ {
columnWidth: 0.20, columnWidth: 0.20,
xtype: "button", xtype: "button",
id: "btnEeSetup", id: "btnEeSetup",
text: _('ID_SAVE'), text: _('ID_SAVE'),
handler: function () { handler: function () {
enterpriseProcessAjax("SETUP"); enterpriseProcessAjax("SETUP");
} }
} }
] ]
} }
] ]
}); });
var pnlSupport = new Ext.FormPanel({
frame: true,
height: 160,
disabled: !licensed,
var pnlSystem = new Ext.Container({ items: [
//autoEl: "div", {
//width: 550, layout: "column",
anchor: "right 50%", items: [
//items: [pnlUpgrade, pnlSetup] {
items: [ pnlSetup] columnWidth: 0.80,
}); xtype: "container",
items: [
{
xtype:'label',
text: _('ID_GENERATE_INFO_SUPPORT'),
name: 'lblGenerateInfoSupport',
labelStyle: 'font-weight:bold;',
}
]
},
{
columnWidth: 0.20,
xtype: "button",
id: "btnGenerate",
text: _('ID_GENERATE'),
handler: function () {
enterpriseFileSupport();
}
}
]
}
]
});
var licensePanel = new Ext.FormPanel( { var licensePanel = new Ext.FormPanel( {
frame: true, frame: true,
@@ -1695,27 +1729,6 @@ Ext.onReady(function() {
} }
}); });
var topBox = new Ext.Panel({
id:'main-panel-hbox',
baseCls:'x-plain',
layout:'hbox',
flex: 0,
//defaultMargins: "5",
//autoHeight: true,
layoutConfig: {
align : 'stretchmax',
pack : 'start'
},
defaults: {
frame:true,
flex: 1,
height: 182
},
items:[licensePanel, pnlSystem]
});
var tabEnterprise = new Ext.TabPanel({ var tabEnterprise = new Ext.TabPanel({
activeTab: 0, activeTab: 0,
height: 370, height: 370,
@@ -1739,6 +1752,9 @@ Ext.onReady(function() {
},{ },{
title: _('ID_SETUP_WEBSERVICES'), title: _('ID_SETUP_WEBSERVICES'),
items : pnlSetup items : pnlSetup
},{
title: _('ID_SUPPORT'),
items : pnlSupport
} }
] ]
}); });