BUG 0000 Change Solr configuration environment variables

Now the Solr configuration variables are read from the env.ini file that
is stored in the shared//sites/SYS_SYS/ folder.

The system class is used to get the environment variables using the
solrenv function.
This commit is contained in:
Herbert Saal Gutierrez
2012-05-15 17:41:12 -04:00
parent d4fcb868cd
commit 7e07db9348
6 changed files with 338 additions and 443 deletions

View File

@@ -19,7 +19,8 @@ if (!defined('PATH_HOME')) {
array_pop ( $docuroot );
array_pop ( $docuroot );
$pathhome = implode ( PATH_SEP, $docuroot ) . PATH_SEP;
//try to find automatically the trunk directory where are placed the RBAC and Gulliver directories
// try to find automatically the trunk directory where are placed the RBAC and
// Gulliver directories
// in a normal installation you don't need to change it.
array_pop ( $docuroot );
$pathTrunk = implode ( PATH_SEP, $docuroot ) . PATH_SEP;
@@ -52,6 +53,7 @@ if (!defined('PATH_HOME')) {
G::LoadSystem ( 'dvEditor' );
G::LoadSystem ( 'table' );
G::LoadSystem ( 'pagedTable' );
G::LoadSystem ( 'system' );
require_once ("propel/Propel.php");
require_once ("creole/Creole.php");
}
@@ -72,14 +74,14 @@ require_once 'classes/model/CaseScheduler.php';
// }
// else {
// //if not exists the file, just create a new one with current date
// @file_put_contents(PATH_DATA . 'cron', serialize(array('bCronIsRunning' => '1', 'sLastExecution' => date('Y-m-d H:i:s'))));
// @file_put_contents(PATH_DATA . 'cron', serialize(array('bCronIsRunning' =>
// '1', 'sLastExecution' => date('Y-m-d H:i:s'))));
// }
print "PATH_HOME: " . PATH_HOME . "\n";
print "PATH_DB: " . PATH_DB . "\n";
print "PATH_CORE: " . PATH_CORE . "\n";
// define the site name (instance name)
if (! defined ( 'SYS_SYS' )) {
$sObject = $argv [1];
@@ -132,7 +134,8 @@ if (!defined('SYS_SYS')) {
// print_r($SERVER_INFO);
define ( 'SERVER_NAME', $SERVER_INFO ['SERVER_NAME'] );
define ( 'SERVER_PORT', $SERVER_INFO ['SERVER_PORT'] );
} else {
}
else {
eprintln ( "WARNING! No server info found!", 'red' );
}
@@ -170,7 +173,8 @@ if (!defined('SYS_SYS')) {
$pro ['datasources'] ['rbac'] ['adapter'] = $DB_ADAPTER;
$pro ['datasources'] ['rp'] ['connection'] = $dsnRp;
$pro ['datasources'] ['rp'] ['adapter'] = $DB_ADAPTER;
//$pro['datasources']['dbarray']['connection'] = 'dbarray://user:pass@localhost/pm_os';
// $pro['datasources']['dbarray']['connection'] =
// 'dbarray://user:pass@localhost/pm_os';
// $pro['datasources']['dbarray']['adapter'] = 'dbarray';
$oFile = fopen ( PATH_CORE . 'config/_databases_.php', 'w' );
fwrite ( $oFile, '<?php global $pro;return $pro; ?>' );
@@ -181,7 +185,8 @@ if (!defined('SYS_SYS')) {
eprintln ( "Processing workspace: " . $sObject, 'green' );
try {
processWorkspace ();
}catch(Exception $e){
}
catch ( Exception $e ) {
echo $e->getMessage ();
eprintln ( "Probelm in workspace: " . $sObject . ' it was omitted.', 'red' );
}
@@ -196,20 +201,22 @@ else {
}
// finally update the file
//@file_put_contents(PATH_DATA . 'cron', serialize(array('bCronIsRunning' => '0', 'sLastExecution' => date('Y-m-d H:i:s'))));
// @file_put_contents(PATH_DATA . 'cron', serialize(array('bCronIsRunning' =>
// '0', 'sLastExecution' => date('Y-m-d H:i:s'))));
function processWorkspace() {
global $sLastExecution;
G::LoadClass('AppSolr');
try {
$oAppSolr = new AppSolr();
if ($oAppSolr->isSolrEnabled()) {
if ($solrConf = System::solrEnv () !== false) {
G::LoadClass ( 'AppSolr' );
$oAppSolr = new AppSolr ( $solrConf ['solr_enabled'], $solrConf ['solr_host'], $solrConf ['solr_instance'] );
$oAppSolr->reindexAllApplications ();
//$data = $ApplicationSolrIndex->getAppGridData($start, $limit, $action, $filter, $search, $process, $user, $status, $type, $dateFrom, $dateTo, $callback, $dir, $sort);
//$result = G::json_encode($data);
}
else {
print "Incomplete Solr configuration.";
}
}
catch ( Exception $oError ) {
saveLog ( "main", "error", "Error processing workspace : " . $oError->getMessage () . "\n" );
@@ -244,12 +251,15 @@ function setExecutionMessage($m){
$rOffset = $linesize - $len;
eprint ( "* $m" );
for($i=0; $i<$rOffset; $i++) eprint('.');
for($i = 0; $i < $rOffset; $i ++)
eprint ( '.' );
}
function setExecutionResultMessage($m, $t = '') {
$c = 'green';
if($t=='error') $c = 'red';
if($t=='info') $c = 'yellow';
if ($t == 'error')
$c = 'red';
if ($t == 'info')
$c = 'yellow';
eprintln ( "[$m]", $c );
}

View File

@@ -12,7 +12,6 @@ require_once "entities/SolrRequestData.php";
require_once "entities/SolrUpdateDocument.php";
require_once "entities/AppSolrQueue.php";
require_once "classes/model/AppSolrQueue.php";
require_once PATH_DATA_SITE . "/solr.php";
class InvalidIndexSearchTextException extends Exception {
// Redefine the exception so message isn't optional
@@ -33,11 +32,11 @@ class AppSolr {
private $solrHost = "";
private $solrInstance = "";
function __construct() {
function __construct($SolrEnabled, $SolrHost, $SolrInstance) {
// define solr availability
$this->solrIsEnabled = SOLR_ENABLED;
$this->solrHost = SOLR_HOST;
$this->solrInstance = SOLR_INSTANCE;
$this->solrIsEnabled = $SolrEnabled;
$this->solrHost = $SolrHost;
$this->solrInstance = $SolrInstance;
}
public function isSolrEnabled() {

View File

@@ -67,6 +67,16 @@ G::LoadClass('pmScript');
*/
class Cases {
private $appSolr = null;
function __construct(){
//get Solr initialization variables
if(($solrConf = System::solrEnv()) !== false){
G::LoadClass('AppSolr');
$appSolr = new AppSolr($solrConf['solr_enabled'], $solrConf['solr_host'], $solrConf['solr_instance']);
}
}
/*
* Ask if an user can start a case
* @param string $sUIDUser
@@ -833,9 +843,7 @@ class Cases {
*/
function updateCase($sAppUid, $Fields = array()) {
//initialize solrindex object
G::LoadClass('AppSolr');
$appSolr = new AppSolr();
try {
$aApplicationFields = $Fields['APP_DATA'];
$Fields['APP_UID'] = $sAppUid;
@@ -909,22 +917,19 @@ class Cases {
$x = unserialize($Fields['APP_DATA']);
if (isset($x[$VAR_PRI])) {
if (trim($x[$VAR_PRI]) != '') {
$priority = 3;
if (is_numeric($x[$VAR_PRI])) {
$priority = ($x[$VAR_PRI] >= 1 && $x[$VAR_PRI] <= 5) ? $x[$VAR_PRI] : '3';
}
$oDel = new AppDelegation;
$array = array();
$array['APP_UID'] = $sAppUid;
$array['DEL_INDEX'] = $DEL_INDEX;
$array['TAS_UID'] = $TAS_UID;
$array['DEL_PRIORITY'] = $priority;
$array['DEL_PRIORITY'] = (isset($x[$VAR_PRI]) ? ($x[$VAR_PRI] >= 1 && $x[$VAR_PRI] <= 5 ? $x[$VAR_PRI] : '3') : '3');
$oDel->update($array);
}
}
}
//Update Solr Index
$appSolr->updateApplicationSearchIndex($sAppUid);
if($this->appSolr != null)
$this->appSolr->updateApplicationSearchIndex($sAppUid);
return $Fields;
}
@@ -942,9 +947,7 @@ class Cases {
*/
function removeCase($sAppUid) {
//initialize solrindex object
G::LoadClass('AppSolr');
$appSolr = new AppSolr();
try {
$oApplication = new Application();
$oAppDelegation = new AppDelegation();
@@ -1001,7 +1004,8 @@ class Cases {
$result = $oApp->remove($sAppUid);
//delete application from index
$appSolr->deleteApplicationSearchIndex($sAppUid);
if($this->appSolr != null)
$this->appSolr->deleteApplicationSearchIndex($sAppUid);
return $result;
} catch (exception $e) {
@@ -1019,15 +1023,14 @@ class Cases {
*/
function setDelInitDate($sAppUid, $iDelIndex) {
//initialize solrindex object
G::LoadClass('AppSolr');
$appSolr = new AppSolr();
try {
$oAppDel = AppDelegationPeer::retrieveByPk($sAppUid, $iDelIndex);
$oAppDel->setDelInitDate("now");
$oAppDel->save();
//update searchindex
$appSolr->updateApplicationSearchIndex($sAppUid);
if($this->appSolr != null)
$this->appSolr->updateApplicationSearchIndex($sAppUid);
} catch (exception $e) {
throw ($e);
}
@@ -1044,9 +1047,6 @@ class Cases {
*/
function setCatchUser($sAppUid, $iDelIndex, $usrId) {
//initialize solrindex object
G::LoadClass('AppSolr');
$appSolr = new AppSolr();
try {
$oAppDel = AppDelegationPeer::retrieveByPk($sAppUid, $iDelIndex);
$oAppDel->setDelInitDate("now");
@@ -1054,7 +1054,8 @@ class Cases {
$oAppDel->save();
//update searchindex
$appSolr->updateApplicationSearchIndex($sAppUid);
if($this->appSolr != null)
$this->appSolr->updateApplicationSearchIndex($sAppUid);
} catch (exception $e) {
throw ($e);
}
@@ -1460,14 +1461,13 @@ class Cases {
*/
function newAppDelegation($sProUid, $sAppUid, $sTasUid, $sUsrUid, $sPrevious, $iPriority, $sDelType, $iAppThreadIndex = 1, $nextDel=null) {
//initialize solrindex object
G::LoadClass('AppSolr');
$appSolr = new AppSolr();
try {
$appDel = new AppDelegation();
$result = $appDel->createAppDelegation($sProUid, $sAppUid, $sTasUid, $sUsrUid, $iAppThreadIndex, $iPriority, false, $sPrevious, $nextDel);
//update searchindex
$appSolr->updateApplicationSearchIndex($sAppUid);
if($this->appSolr != null)
$this->appSolr->updateApplicationSearchIndex($sAppUid);
return $result;
}
catch (exception $e) {
@@ -1487,9 +1487,7 @@ class Cases {
*/
function updateAppDelegation($sAppUid, $iDelIndex, $iAppThreadIndex) {
//initialize solrindex object
G::LoadClass('AppSolr');
$appSolr = new AppSolr();
try {
$appDelegation = new AppDelegation();
$aData = array();
@@ -1499,7 +1497,8 @@ class Cases {
$appDelegation->update($aData);
//update searchindex
$appSolr->updateApplicationSearchIndex($sAppUid);
if($this->appSolr != null)
$this->appSolr->updateApplicationSearchIndex($sAppUid);
return true;
} catch (exception $e) {
@@ -1576,9 +1575,6 @@ class Cases {
*/
function updateAppThread($sAppUid, $iAppThreadIndex, $iNewDelIndex) {
//initialize solrindex object
G::LoadClass('AppSolr');
$appSolr = new AppSolr();
try {
/// updating the DEL_INDEX value in the APP_THREAD
$con = Propel::getConnection('workflow');
@@ -1599,7 +1595,8 @@ class Cases {
$appThread->update($aData);
*/
//update searchindex
$appSolr->updateApplicationSearchIndex($sAppUid);
if($this->appSolr != null)
$this->appSolr->updateApplicationSearchIndex($sAppUid);
return $iNewDelIndex;
}
@@ -1618,9 +1615,6 @@ class Cases {
*/
function closeAppThread($sAppUid, $iAppThreadIndex) {
// //initialize solrindex object called from other functions
// G::LoadClass('AppSolr');
// $appSolr = new AppSolr();
try {
$appThread = new AppThread();
$aData = array();
@@ -1629,8 +1623,6 @@ class Cases {
$aData['APP_THREAD_STATUS'] = 'CLOSED';
$appThread->update($aData);
// //update searchindex
// $appSolr->updateApplicationSearchIndex($sAppUid);
return true;
} catch (exception $e) {
throw ($e);
@@ -1646,9 +1638,6 @@ class Cases {
*/
function closeAllThreads($sAppUid) {
//initialize solrindex object
G::LoadClass('AppSolr');
$appSolr = new AppSolr();
try {
//Execute('UPDATE APP_DELEGATION SET DEL_THREAD_STATUS="CLOSED" WHERE APP_UID="$sAppUid" AND DEL_THREAD_STATUS="OPEN"');
$c = new Criteria();
@@ -1667,7 +1656,8 @@ class Cases {
}
}
//update searchindex
$appSolr->updateApplicationSearchIndex($sAppUid);
if($this->appSolr != null)
$this->appSolr->updateApplicationSearchIndex($sAppUid);
} catch (exception $e) {
throw ($e);
}
@@ -1685,14 +1675,12 @@ class Cases {
*/
function newAppThread($sAppUid, $iNewDelIndex, $iAppParent) {
//initialize solrindex object
G::LoadClass('AppSolr');
$appSolr = new AppSolr();
try {
$appThread = new AppThread();
$result = $appThread->createAppThread($sAppUid, $iNewDelIndex, $iAppParent);
//update searchindex
$appSolr->updateApplicationSearchIndex($sAppUid);
if($this->appSolr != null)
$this->appSolr->updateApplicationSearchIndex($sAppUid);
return $result;
} catch (exception $e) {
throw ($e);
@@ -1708,9 +1696,6 @@ class Cases {
*/
function closeAllDelegations($sAppUid) {
//initialize solrindex object
G::LoadClass('AppSolr');
$appSolr = new AppSolr();
try {
//Execute('UPDATE APP_DELEGATION SET DEL_THREAD_STATUS="CLOSED" WHERE APP_UID="$sAppUid" AND DEL_THREAD_STATUS="OPEN"');
$c = new Criteria();
@@ -1729,7 +1714,8 @@ class Cases {
}
}
//update searchindex
$appSolr->updateApplicationSearchIndex($sAppUid);
if($this->appSolr != null)
$this->appSolr->updateApplicationSearchIndex($sAppUid);
} catch (exception $e) {
throw ($e);
}
@@ -1745,10 +1731,6 @@ class Cases {
*/
function CloseCurrentDelegation($sAppUid, $iDelIndex) {
//called from other functions
// //initialize solrindex object
// G::LoadClass('AppSolr');
// $appSolr = new AppSolr();
try {
//Execute('UPDATE APP_DELEGATION SET DEL_THREAD_STATUS="CLOSED" WHERE APP_UID="$sAppUid" AND DEL_THREAD_STATUS="OPEN"');
$c = new Criteria();
@@ -1770,8 +1752,6 @@ class Cases {
throw (new PropelException('The row cannot be created!', new PropelException($msg)));
}
}
// //update searchindex
// $appSolr->updateApplicationSearchIndex($sAppUid);
} catch (exception $e) {
throw ($e);
@@ -1789,9 +1769,6 @@ class Cases {
*/
function ReactivateCurrentDelegation($sAppUid, $iDelegation) {
// //initialize solrindex object called from other function
// G::LoadClass('AppSolr');
// $appSolr = new AppSolr();
try {
$c = new Criteria();
$c->add(AppDelegationPeer::APP_UID, $sAppUid);
@@ -1810,8 +1787,6 @@ class Cases {
throw (new PropelException('The row cannot be created!', new PropelException($msg)));
}
}
// //update searchindex
// $appSolr->updateApplicationSearchIndex($sAppUid);
} catch (exception $e) {
throw ($e);
}
@@ -1829,9 +1804,6 @@ class Cases {
function startCase($sTasUid, $sUsrUid, $isSubprocess=false) {
if ($sTasUid != '') {
//initialize solrindex object
G::LoadClass('AppSolr');
$appSolr = new AppSolr();
try {
$this->Task = new Task;
@@ -1875,7 +1847,8 @@ class Cases {
$oDerivation = new Derivation();
$oDerivation->setTasLastAssigned($sTasUid, $sUsrUid);
//update searchindex
$appSolr->updateApplicationSearchIndex($sAppUid);
if($this->appSolr != null)
$this->appSolr->updateApplicationSearchIndex($sAppUid);
} catch (exception $e) {
throw ($e);
}
@@ -3422,9 +3395,6 @@ class Cases {
*/
function pauseCase($sApplicationUID, $iDelegation, $sUserUID, $sUnpauseDate = null) {
//initialize solrindex object
G::LoadClass('AppSolr');
$appSolr = new AppSolr();
$this->CloseCurrentDelegation($sApplicationUID, $iDelegation);
$oApplication = new Application();
@@ -3455,7 +3425,8 @@ class Cases {
$oAppDelay->create($aData);
//update searchindex
$appSolr->updateApplicationSearchIndex($sApplicationUID);
if($this->appSolr != null)
$this->appSolr->updateApplicationSearchIndex($sApplicationUID);
}
/*
@@ -3517,7 +3488,8 @@ class Cases {
$aFieldsDelay = $oAppDelay->update($aData);
//update searchindex
$appSolr->updateApplicationSearchIndex($sApplicationUID);
if($this->appSolr != null)
$this->appSolr->updateApplicationSearchIndex($sApplicationUID);
}
/*
@@ -3531,9 +3503,6 @@ class Cases {
*/
function cancelCase($sApplicationUID, $iIndex, $user_logged) {
//initialize solrindex object
G::LoadClass('AppSolr');
$appSolr = new AppSolr();
$oApplication = new Application();
$aFields = $oApplication->load($sApplicationUID);
@@ -3593,7 +3562,8 @@ class Cases {
}
//update searchindex
$appSolr->updateApplicationSearchIndex($sApplicationUID);
if($this->appSolr != null)
$this->appSolr->updateApplicationSearchIndex($sApplicationUID);
}
/*
@@ -3607,9 +3577,6 @@ class Cases {
*/
function reactivateCase($sApplicationUID, $iIndex, $user_logged) {
//initialize solrindex object
G::LoadClass('AppSolr');
$appSolr = new AppSolr();
$oApplication = new Application();
$aFields = $oApplication->load((isset($_POST['sApplicationUID']) ? $_POST['sApplicationUID'] : $_SESSION['APPLICATION']));
@@ -3646,7 +3613,8 @@ class Cases {
$rs = $stmt->executeQuery($sql, ResultSet::FETCHMODE_ASSOC);
//update searchindex
$appSolr->updateApplicationSearchIndex($sApplicationUID);
if($this->appSolr != null)
$this->appSolr->updateApplicationSearchIndex($sApplicationUID);
}
/*
@@ -3662,9 +3630,6 @@ class Cases {
*/
function reassignCase($sApplicationUID, $iDelegation, $sUserUID, $newUserUID, $sType = 'REASSIGN') {
//initialize solrindex object
G::LoadClass('AppSolr');
$appSolr = new AppSolr();
$this->CloseCurrentDelegation($sApplicationUID, $iDelegation);
$oAppDelegation = new AppDelegation();
@@ -3700,7 +3665,8 @@ class Cases {
$oAppDelay->create($aData);
//update searchindex
$appSolr->updateApplicationSearchIndex($sApplicationUID);
if($this->appSolr != null)
$this->appSolr->updateApplicationSearchIndex($sApplicationUID);
return true;
}
@@ -5153,9 +5119,6 @@ class Cases {
*/
function executeTriggersAfterExternal($sProcess, $sTask, $sApplication, $iIndex, $iStepPosition, $aNewData = array()) {
// //initialize solrindex object UpdateCase añready calls the update
// G::LoadClass('AppSolr');
// $appSolr = new AppSolr();
//load the variables
$Fields = $this->loadCase($sApplication);
@@ -5174,8 +5137,6 @@ class Cases {
$aData['TAS_UID'] = $sTask;
$this->updateCase($sApplication, $aData);
// //update searchindex
// $appSolr->updateApplicationSearchIndex($sApplication);
}
/*
@@ -5528,9 +5489,6 @@ class Cases {
}
function discriminateCases($aData){
//initialize solrindex object
G::LoadClass('AppSolr');
$appSolr = new AppSolr();
$siblingThreadData = $this->GetAllOpenDelegation($aData);
foreach($siblingThreadData as $thread => $threadData)
@@ -5539,7 +5497,8 @@ class Cases {
$this->CloseCurrentDelegation ($aData['APP_UID'], $threadData['DEL_INDEX']); //Close Sibling AppDelegations
//update searchindex
$appSolr->updateApplicationSearchIndex($aData['APP_UID']);
if($this->appSolr != null)
$this->appSolr->updateApplicationSearchIndex($aData['APP_UID']);
}
}
@@ -5656,48 +5615,4 @@ class Cases {
$response['array']=$rows;
return $response;
}
function getCaseNotes($applicationID, $type = 'array',$userUid = '') {
require_once ( "classes/model/AppNotes.php" );
$appNotes = new AppNotes();
$appNotes = $appNotes->getNotesList($applicationID,$userUid);
$response = '';
if (is_array($appNotes)) {
switch ($type) {
case 'array':
$response = array();
foreach ($appNotes['array']['notes'] as $key => $value) {
$list = array();
$list['FULL_NAME'] = $value['USR_FIRSTNAME']." ".$value['USR_LASTNAME'];
foreach ($value as $keys => $value) {
if ($keys != 'USR_FIRSTNAME' && $keys != 'USR_LASTNAME' && $keys != 'USR_EMAIL') {
$list[$keys] = $value;
}
}
$response[$key+1] = $list;
}
break;
case 'object':
$response = new stdclass();
foreach ($appNotes['array']['notes'] as $key => $value) {
$response->$key->FULL_NAME = $value['USR_FIRSTNAME']." ".$value['USR_LASTNAME'];
foreach ($value as $keys => $value) {
if ($keys != 'USR_FIRSTNAME' && $keys != 'USR_LASTNAME' && $keys != 'USR_EMAIL') {
$response->$key->$keys = $value;
}
}
}
break;
case 'string':
$response = '';
foreach ($appNotes['array']['notes'] as $key => $value) {
$response .= $value['USR_FIRSTNAME']." ".$value['USR_LASTNAME']." "."(".$value['USR_USERNAME'].")".
" ".$value['NOTE_CONTENT']." "." (".$value['NOTE_DATE']." ) ".
" \n";
}
break;
}
}
return $response;
}
}

View File

@@ -1008,47 +1008,8 @@ class System {
return $cities;
}
public static function getSystemConfiguration($globalIniFile = '', $wsIniFile = '')
public static function getSystemConfiguration($iniFile='')
{
$readGlobalIniFile = false;
$readWsIniFile = false;
if (empty($globalIniFile)) {
$globalIniFile = PATH_CORE . 'config' . PATH_SEP . 'env.ini';
}
if (empty($wsIniFile)) {
if (defined('PATH_DB')) { // if we're on a valid workspace env.
$uriParts = explode('/', getenv("REQUEST_URI"));
if (substr($uriParts[1], 0, 3 ) == 'sys') {
$wsName = substr($uriParts[1], 3);
$wsIniFile = PATH_DB . $wsName . PATH_SEP . 'env.ini';
}
}
}
$readGlobalIniFile = file_exists($globalIniFile) ? true : false;
$readWsIniFile = file_exists($wsIniFile) ? true : false;
if (isset($_SESSION['PROCESSMAKER_ENV'])) {
$md5 = array();
if ($readGlobalIniFile)
$md5[] = md5_file($globalIniFile);
if ($readWsIniFile)
$md5[] = md5_file($wsIniFile);
$hash = implode('-', $md5);
if ($_SESSION['PROCESSMAKER_ENV_HASH'] === $hash) {
$_SESSION['PROCESSMAKER_ENV']['from_cache'] = 1;
return $_SESSION['PROCESSMAKER_ENV'];
}
}
// default configuration
$config = array(
'debug' => 0,
'debug_sql' => 0,
@@ -1063,31 +1024,20 @@ class System {
'default_lang' => 'en'
);
// read the global env.ini configuration file
if ($readGlobalIniFile && ($globalConf = @parse_ini_file($globalIniFile)) !== false) {
$config = array_merge($config, $globalConf);
if (empty($iniFile) || !file_exists($iniFile)) {
return $config;
}
// Workspace environment configuration
if ($readWsIniFile && ($wsConf = @parse_ini_file($wsIniFile)) !== false) {
$config = array_merge($config, $wsConf);
/* Read the env.ini */
$ini_contents = parse_ini_file($iniFile, false);
if ($ini_contents !== false) {
$config = array_merge($config, $ini_contents);
}
// validation debug config, only binary value is valid; debug = 1, to enable
// validation debug config, ony accept bynary values, 1 to enable
$config['debug'] = $config['debug'] == 1 ? 1 : 0;
$md5 = array();
if ($readGlobalIniFile)
$md5[] = md5_file($globalIniFile);
if ($readWsIniFile)
$md5[] = md5_file($wsIniFile);
$hash = implode('-', $md5);
$_SESSION['PROCESSMAKER_ENV'] = $config;
$_SESSION['PROCESSMAKER_ENV_HASH'] = $hash;
return $config;
}
@@ -1121,4 +1071,23 @@ class System {
return $result;
}
function solrEnv()
{
$conf = System::getSystemConfiguration();
if (!isset($conf['solr_enabled']) || !isset($conf['solr_host']) || !isset($conf['solr_instance'])) {
return false;
}
if ($conf['solr_enabled']) {
return array(
'solr_enabled' => $conf['solr_enabled'],
'solr_host' => $conf['solr_host'],
'solr_instance' => $conf['solr_instance']
);
}
return false;
}
}// end System class

View File

@@ -40,7 +40,7 @@ class Entity_Base {
protected function validateRequiredFields($requiredFields = array()) {
foreach ( $requiredFields as $k => $field ) {
if ($this->{$field} === NULL) {
throw (new Zend_Exception ( "Field $field is required in " . get_class ( $this ) ));
throw (new Exception ( "Field $field is required in " . get_class ( $this ) ));
die ();
}
}

View File

@@ -20,12 +20,12 @@
try {
$result = "";
G::LoadClass('AppSolr');
$ApplicationSolrIndex = new AppSolr();
$userUid = (isset ( $_SESSION ['USER_LOGGED'] ) && $_SESSION ['USER_LOGGED'] != '') ? $_SESSION ['USER_LOGGED'] : null;
if ($action != 'paused' && $ApplicationSolrIndex->isSolrEnabled()) {
if ((($solrConf = System::solrEnv()) !== false) && $action != 'paused') {
G::LoadClass ( 'AppSolr' );
$ApplicationSolrIndex = new AppSolr ($solrConf['solr_enabled'], $solrConf['solr_host'], $solrConf['solr_instance']);
$data = $ApplicationSolrIndex->getAppGridData ( $userUid, $start, $limit, $action, $filter, $search, $process, $user, $status, $type, $dateFrom, $dateTo, $callback, $dir, $sort );
$result = G::json_encode ( $data );
}
@@ -39,6 +39,8 @@
echo $result;
}
catch ( Exception $e ) {
$msg = array ( 'error' => $e->getMessage() );
$msg = array (
'error' => $e->getMessage ()
);
print G::json_encode ( $msg );
}