diff --git a/gulliver/system/class.bootstrap.php b/gulliver/system/class.bootstrap.php
index 29110df55..9cbcccb03 100644
--- a/gulliver/system/class.bootstrap.php
+++ b/gulliver/system/class.bootstrap.php
@@ -121,6 +121,10 @@ class Bootstrap
public static function registerSystemClasses()
{
+ self::registerClass("Propel", PATH_THIRDPARTY . "propel" . PATH_SEP . "Propel.php");
+ self::registerClass("Creole", PATH_THIRDPARTY . "creole" . PATH_SEP . "Creole.php");
+ self::registerClass("Criteria", PATH_THIRDPARTY . "propel" . PATH_SEP . "util" . PATH_SEP . "Criteria.php");
+
//DATABASE propel classes used in "Cases" Options
self::registerClass("Entity_Base", PATH_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "entities" . PATH_SEP . "Base.php");
@@ -191,7 +195,9 @@ class Bootstrap
self::registerClass("AppOwnerPeer", PATH_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "AppOwnerPeer.php");
self::registerClass("BaseAppSolrQueue", PATH_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "om" . PATH_SEP . "BaseAppSolrQueue.php");
- self::registerClass("Entity_AppSolrQueue", PATH_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "entities" . PATH_SEP . "AppSolrQueue.php");
+ self::registerClass("Entity_SolrRequestData", PATH_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "entities" . PATH_SEP . "SolrRequestData.php");
+ self::registerClass("Entity_SolrUpdateDocument", PATH_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "entities" . PATH_SEP . "SolrUpdateDocument.php");
+ self::registerClass("Entity_AppSolrQueue", PATH_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "entities" . PATH_SEP . "AppSolrQueue.php");
self::registerClass("AppSolrQueue", PATH_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "AppSolrQueue.php");
self::registerClass("AppSolrQueuePeer", PATH_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "AppSolrQueuePeer.php");
@@ -314,10 +320,6 @@ class Bootstrap
self::registerClass("StepTrigger", PATH_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "StepTrigger.php");
self::registerClass("StepTriggerPeer", PATH_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "StepTriggerPeer.php");
- self::registerClass("SolrRequestData", PATH_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "entities" . PATH_SEP . "SolrRequestData.php");
-
- self::registerClass("SolrUpdateDocument", PATH_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "entities" . PATH_SEP . "SolrUpdateDocument.php");
-
self::registerClass("BaseSwimlanesElements",PATH_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "om" . PATH_SEP . "BaseSwimlanesElements.php");
self::registerClass("SwimlanesElements", PATH_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "SwimlanesElements.php");
self::registerClass("BaseSwimlanesElementsPeer",PATH_HOME ."engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "om" . PATH_SEP . "BaseSwimlanesElementsPeer.php");
diff --git a/workflow/engine/bin/reindex_solr.php b/workflow/engine/bin/reindex_solr.php
index 2a989c092..bcc230176 100644
--- a/workflow/engine/bin/reindex_solr.php
+++ b/workflow/engine/bin/reindex_solr.php
@@ -1,6 +1,6 @@
3) {
if($argv [$argNumber] == '-appuid') {
//use skip option
$appUid = $argv [$argNumber + 1];
- }
+ }
}
else {
print $commandLineSyntaxMsg;
@@ -98,13 +98,13 @@ if (! defined ('PATH_HOME')) {
array_pop ($docuroot);
$pathOutTrunk = implode (PATH_SEP, $docuroot) . PATH_SEP;
// to do: check previous algorith for Windows $pathTrunk = "c:/home/";
-
+
define ('PATH_HOME', $pathhome);
define ('PATH_TRUNK', $pathTrunk);
define ('PATH_OUTTRUNK', $pathOutTrunk);
-
+
require_once (PATH_HOME . 'engine' . PATH_SEP . 'config' . PATH_SEP . 'paths.php');
-
+
G::LoadThirdParty ('pear/json', 'class.json');
G::LoadThirdParty ('smarty/libs', 'Smarty.class');
G::LoadSystem ('error');
@@ -129,10 +129,23 @@ if (! defined ('PATH_HOME')) {
require_once ("creole/Creole.php");
}
-require_once 'classes/model/AppDelegation.php';
-require_once 'classes/model/Event.php';
-require_once 'classes/model/AppEvent.php';
-require_once 'classes/model/CaseScheduler.php';
+if (file_exists(PATH_HOME . "engine" . PATH_SEP . "config" . PATH_SEP . "paths_installed.php")) {
+ require_once (PATH_HOME . "engine" . PATH_SEP . "config" . PATH_SEP . "paths_installed.php");
+}
+
+require_once (PATH_HOME . "engine" . PATH_SEP . "config" . PATH_SEP . "paths.php");
+require_once (PATH_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "class.system.php");
+
+require_once (PATH_GULLIVER . "class.bootstrap.php");
+
+spl_autoload_register(array("Bootstrap", "autoloadClass"));
+
+Bootstrap::registerSystemClasses();
+
+//require_once 'classes/model/AppDelegation.php';
+//require_once 'classes/model/Event.php';
+//require_once 'classes/model/AppEvent.php';
+//require_once 'classes/model/CaseScheduler.php';
// G::loadClass('pmScript');
// //default values
@@ -158,36 +171,36 @@ if (! defined ('SYS_SYS')) {
$sObject = $workspaceName;
$sNow = ''; // $argv[2];
$sFilter = '';
-
+
for ($i = 3; $i < count ($argv); $i++) {
$sFilter .= ' ' . $argv [$i];
}
-
+
$oDirectory = dir (PATH_DB);
-
+
if (is_dir (PATH_DB . $sObject)) {
saveLog ('main', 'action', "checking folder " . PATH_DB . $sObject);
if (file_exists (PATH_DB . $sObject . PATH_SEP . 'db.php')) {
-
+
define ('SYS_SYS', $sObject);
-
+
// ****************************************
// read initialize file
- require_once PATH_HOME . 'engine' . PATH_SEP . 'classes' . PATH_SEP . 'class.system.php';
+ //require_once PATH_HOME . 'engine' . PATH_SEP . 'classes' . PATH_SEP . 'class.system.php';
$config = System::getSystemConfiguration ('', '', SYS_SYS);
define ('MEMCACHED_ENABLED', $config ['memcached']);
define ('MEMCACHED_SERVER', $config ['memcached_server']);
define ('TIME_ZONE', $config ['time_zone']);
-
+
date_default_timezone_set (TIME_ZONE);
print "TIME_ZONE: " . TIME_ZONE . "\n";
print "MEMCACHED_ENABLED: " . MEMCACHED_ENABLED . "\n";
print "MEMCACHED_SERVER: " . MEMCACHED_SERVER . "\n";
// ****************************************
-
- include_once (PATH_HOME . 'engine' . PATH_SEP . 'config' . PATH_SEP . 'paths_installed.php');
- include_once (PATH_HOME . 'engine' . PATH_SEP . 'config' . PATH_SEP . 'paths.php');
-
+
+ //include_once (PATH_HOME . 'engine' . PATH_SEP . 'config' . PATH_SEP . 'paths_installed.php');
+ //include_once (PATH_HOME . 'engine' . PATH_SEP . 'config' . PATH_SEP . 'paths.php');
+
// ***************** PM Paths DATA **************************
define ('PATH_DATA_SITE', PATH_DATA . 'sites/' . SYS_SYS . '/');
define ('PATH_DOCUMENT', PATH_DATA_SITE . 'files/');
@@ -197,7 +210,7 @@ if (! defined ('SYS_SYS')) {
define ('PATH_DYNAFORM', PATH_DATA_SITE . 'xmlForms/');
define ('PATH_IMAGES_ENVIRONMENT_FILES', PATH_DATA_SITE . 'usersFiles' . PATH_SEP);
define ('PATH_IMAGES_ENVIRONMENT_USERS', PATH_DATA_SITE . 'usersPhotographies' . PATH_SEP);
-
+
// server info file
if (is_file (PATH_DATA_SITE . PATH_SEP . '.server_info')) {
$SERVER_INFO = file_get_contents (PATH_DATA_SITE . PATH_SEP . '.server_info');
@@ -209,10 +222,10 @@ if (! defined ('SYS_SYS')) {
else {
eprintln ("WARNING! No server info found!", 'red');
}
-
+
// read db configuration
$sContent = file_get_contents (PATH_DB . $sObject . PATH_SEP . 'db.php');
-
+
$sContent = str_replace ('', '', $sContent);
@@ -220,7 +233,7 @@ if (! defined ('SYS_SYS')) {
$sContent = str_replace ("('", "$", $sContent);
$sContent = str_replace ("',", '=', $sContent);
$sContent = str_replace (");", ';', $sContent);
-
+
eval ($sContent);
$dsn = $DB_ADAPTER . '://' . $DB_USER . ':' . $DB_PASS . '@' . $DB_HOST . '/' . $DB_NAME;
$dsnRbac = $DB_ADAPTER . '://' . $DB_RBAC_USER . ':' . $DB_RBAC_PASS . '@' . $DB_RBAC_HOST . '/' . $DB_RBAC_NAME;
@@ -252,7 +265,7 @@ if (! defined ('SYS_SYS')) {
fclose ($oFile);
Propel::init (PATH_CORE . 'config/_databases_.php');
// Creole::registerDriver('dbarray', 'creole.contrib.DBArrayConnection');
-
+
eprintln ("Processing workspace: " . $sObject, 'green');
try {
processWorkspace ();
@@ -282,16 +295,16 @@ function processWorkspace()
global $SkipRecords;
global $TrunkSize;
global $appUid;
-
+
try {
-
+
if (($solrConf = System::solrEnv (SYS_SYS)) !== false) {
G::LoadClass ('AppSolr');
print "Solr Configuration file: " . PATH_DATA_SITE . "env.ini\n";
print "solr_enabled: " . $solrConf ['solr_enabled'] . "\n";
print "solr_host: " . $solrConf ['solr_host'] . "\n";
print "solr_instance: " . $solrConf ['solr_instance'] . "\n";
-
+
$oAppSolr = new AppSolr ($solrConf ['solr_enabled'], $solrConf ['solr_host'], $solrConf ['solr_instance']);
if ($ScriptAction == "reindexall") {
$oAppSolr->reindexAllApplications ($SkipRecords, $TrunkSize);
@@ -312,7 +325,7 @@ function processWorkspace()
else {
print "Incomplete Solr configuration. See configuration file: " . PATH_DATA_SITE . "env.ini";
}
-
+
}
catch (Exception $oError) {
saveLog ("main", "error", "Error processing workspace : " . $oError->getMessage () . "\n");
@@ -326,7 +339,7 @@ function saveLog($sSource, $sType, $sDescription)
if ($isDebug)
print date ('H:i:s') . " ($sSource) $sType $sDescription
\n";
@fwrite ($oFile, date ('Y-m-d H:i:s') . '(' . $sSource . ') ' . $sDescription . "\n");
-
+
G::verifyPath (PATH_DATA . 'log' . PATH_SEP, true);
if ($sType == 'action') {
$oFile = @fopen (PATH_DATA . 'log' . PATH_SEP . 'cron.log', 'a+');
@@ -347,7 +360,7 @@ function setExecutionMessage($m)
$len = strlen ($m);
$linesize = 60;
$rOffset = $linesize - $len;
-
+
eprint ("* $m");
for ($i = 0; $i < $rOffset; $i++)
eprint ('.');
@@ -362,3 +375,4 @@ function setExecutionResultMessage($m, $t = '')
$c = 'yellow';
eprintln ("[$m]", $c);
}
+
diff --git a/workflow/engine/classes/class.AppSolr.php b/workflow/engine/classes/class.AppSolr.php
index cff4a82de..b46056cf5 100644
--- a/workflow/engine/classes/class.AppSolr.php
+++ b/workflow/engine/classes/class.AppSolr.php
@@ -162,13 +162,20 @@ class AppSolr
}
/**
- * Return if the Solr functionality is enabled.
+ * Return if the Solr server is currently working.
*
* @return boolean true:enabled functionality, false:disabled functionality
*/
public function isSolrEnabled ()
{
- return $this->_solrIsEnabled;
+ G::LoadClass("searchIndex");
+
+ $searchIndex = new BpmnEngine_Services_SearchIndex($this->_solrIsEnabled, $this->_solrHost);
+
+ //Execute query
+ $solrStatusResult = $searchIndex->isEnabled($this->_solrInstance);
+
+ return $solrStatusResult;
}
/**
@@ -470,8 +477,18 @@ class AppSolr
}
// the array of data that must be returned with placeholders
- $columsToInclude = array ('APP_CREATE_DATE','','','','APP_NUMBER','','APP_PRO_TITLE','APP_STATUS','','','APP_TITLE','APP_UID','DEL_LAST_UPDATE_DATE','','','','','','','','','DEL_MAX_PRIORITY','','','','','','PRO_UID','',''
+ $columsToInclude = array(
+ "APP_CREATE_DATE",
+ "APP_NUMBER",
+ "APP_PRO_TITLE",
+ "APP_STATUS",
+ "APP_TITLE",
+ "APP_UID",
+ "DEL_LAST_UPDATE_DATE",
+ "DEL_MAX_PRIORITY",
+ "PRO_UID"
);
+
// create pagination data
$solrSearchText = null;
$sortableCols = array ();
@@ -487,28 +504,28 @@ class AppSolr
switch ($sort) {
case 'APP_CACHE_VIEW.APP_NUMBER':
case 'APP_NUMBER':
- $sortCols[0] = 4;
+ $sortCols[0] = 1; //4;
$sortableCols[0] = 'true';
$sortDir[0] = $dir;
break;
// multivalue field can't be ordered
case 'APP_TITLE':
- $sortCols[0] = 10;
+ $sortCols[0] = 4; //10;
$sortableCols[0] = 'true';
$sortDir[0] = $dir;
break;
case 'APP_PRO_TITLE':
- $sortCols[0] = 6;
+ $sortCols[0] = 2; //6;
$sortableCols[0] = 'true';
$sortDir[0] = $dir;
break;
case 'APP_UPDATE_DATE':
- $sortCols[0] = 12;
+ $sortCols[0] = 6; //12;
$sortableCols[0] = 'true';
$sortDir[0] = $dir;
break;
default:
- $sortCols[0] = 4;
+ $sortCols[0] = 1; //4;
$sortableCols[0] = 'true';
$sortDir[0] = 'desc';
break;
@@ -657,27 +674,39 @@ class AppSolr
$solrSearchText .= "(" . $search . ")";
}
}
+
// add del_index dynamic fields to list of resulting columns
- // the fields begin in the 30th column and more
- $columsToInclude = array_merge( $columsToInclude, $delegationIndexes );
+ $columsToIncludeFinal = array();
+ $columsToIncludeFinal = array_merge($columsToInclude, $delegationIndexes);
// if is a counter no records are returned
if ($doCount) {
$start = 0;
$limit = 0;
$numSortingCols = 0;
- $columsToInclude = array ();
+ $columsToIncludeFinal = array();
}
- $data = array ('workspace' => $this->_solrInstance, // solr instance
- 'startAfter' => intval( $start ),'pageSize' => intval( $limit ),'searchText' => $solrSearchText,'filterText' => '', // $filter, //ex:'field1:value1,field2:[value2.1
- // TO value2.2],field3:value3'
- 'numSortingCols' => $numSortingCols,'sortableCols' => $sortableCols,'sortCols' => $sortCols,'sortDir' => $sortDir,'includeCols' => $columsToInclude,'resultFormat' => 'json'
+ $data = array(
+ "workspace" => $this->_solrInstance, // solr instance
+ "startAfter" => intval($start),
+ "pageSize" => intval($limit),
+ "searchText" => $solrSearchText,
+ "filterText" => "", // $filter, //ex:"field1:value1,field2:[value2.1
+ // TO value2.2],field3:value3"
+ "numSortingCols" => $numSortingCols,
+ "sortableCols" => $sortableCols,
+ "sortCols" => $sortCols,
+ "sortDir" => $sortDir,
+ "includeCols" => $columsToIncludeFinal,
+ "resultFormat" => "json"
);
$solrRequestData = Entity_SolrRequestData::createForRequestPagination( $data );
+
// use search index to return list of cases
$searchIndex = new BpmnEngine_Services_SearchIndex( $this->_solrIsEnabled, $this->_solrHost );
+
// execute query
$solrQueryResult = $searchIndex->getDataTablePaginatedList( $solrRequestData );
@@ -702,10 +731,10 @@ class AppSolr
// number of found records
$result['totalCount'] = $solrQueryResult->iTotalDisplayRecords;
- //get all the data from database
+ // get the missing data from database
$appUids = array ();
foreach ($solrQueryResult->aaData as $i => $data) {
- $appUids[] = $data[11];
+ $appUids[] = $data["APP_UID"]; //APP_UID
}
$aaappsDBData = $this->getListApplicationDelegationData($appUids, $action, $status);
@@ -713,18 +742,20 @@ class AppSolr
if ($this->debug) {
$this->afterDbQueryTime = microtime( true );
}
+
// complete the missing data to display it in the grid.
$delIndexes = array (); //store all the delegation indexes
foreach ($solrQueryResult->aaData as $i => $data) {
//initialize array
$delIndexes = array ();
+
// complete empty values
- $appUID = $data[11];
+ $appUID = $data["APP_UID"]; //APP_UID
//get all the delindexes
- for ($i = 30; $i < count( $data ); $i ++) {
- if (is_array( $data[$i] )) {
- foreach ($data[$i] as $delIndex) {
+ for ($i = count($columsToInclude); $i <= count($data) - 1; $i++) {
+ if (is_array($data[$columsToIncludeFinal[$i]])) {
+ foreach ($data[$columsToIncludeFinal[$i]] as $delIndex) {
$delIndexes[] = $delIndex;
}
}
@@ -756,7 +787,15 @@ class AppSolr
$arrayRowAux = array();
foreach ($resultColumns as $j => $columnName) {
- $arrayRowAux[$columnName] = $data[$j];
+ if (isset($data[$columnName])) {
+ $arrayRowAux[$columnName] = $data[$columnName];
+ } else {
+ if ($columnName == "DEL_PRIORITY") {
+ $arrayRowAux[$columnName] = $data["DEL_MAX_PRIORITY"]; //different name
+ } else {
+ $arrayRowAux[$columnName] = ""; //placeholder
+ }
+ }
}
//Remove duplicated
@@ -773,11 +812,11 @@ class AppSolr
$aRow = $arrayRowAux;
// convert date from solr format UTC to local time in MySQL format
- $solrdate = $data[0];
+ $solrdate = $data["APP_CREATE_DATE"];
$localDate = date( 'Y-m-d H:i:s', strtotime( $solrdate ) );
$aRow['APP_CREATE_DATE'] = $localDate;
- $solrdate = $data[12];
+ $solrdate = $data["DEL_LAST_UPDATE_DATE"];
$localDate = date( 'Y-m-d H:i:s', strtotime( $solrdate ) );
$aRow['APP_UPDATE_DATE'] = $localDate;
@@ -940,11 +979,11 @@ class AppSolr
$c->addSelectColumn( AppDelegationPeer::DEL_THREAD_STATUS );
$c->addSelectColumn( AppDelegationPeer::TAS_UID );
- $c->addAlias("u", "USERS");
- $c->addAlias("uprev", "USERS");
- $c->addAlias("adprev", "APP_DELEGATION");
- $c->addAlias("ctastitle", "CONTENT");
- $c->addAlias("at", "APP_THREAD");
+ $c->addAlias("u", UsersPeer::TABLE_NAME);
+ $c->addAlias("uprev", UsersPeer::TABLE_NAME);
+ $c->addAlias("adprev", AppDelegationPeer::TABLE_NAME);
+ $c->addAlias("ctastitle", ContentPeer::TABLE_NAME);
+ $c->addAlias("at", AppThreadPeer::TABLE_NAME);
$arrayCondition = array();
$arrayCondition[] = array(AppDelegationPeer::APP_UID, ApplicationPeer::APP_UID);
@@ -1106,11 +1145,11 @@ class AppSolr
$c->addSelectColumn( AppDelegationPeer::DEL_THREAD_STATUS );
$c->addSelectColumn( AppDelegationPeer::TAS_UID );
- $c->addAlias( 'u', 'USERS' );
- $c->addAlias( 'uprev', 'USERS' );
- $c->addAlias( 'adprev', 'APP_DELEGATION' );
- $c->addAlias( 'ctastitle', 'CONTENT' );
- $c->addAlias( 'at', 'APP_THREAD' );
+ $c->addAlias("u", UsersPeer::TABLE_NAME);
+ $c->addAlias("uprev", UsersPeer::TABLE_NAME);
+ $c->addAlias("adprev", AppDelegationPeer::TABLE_NAME);
+ $c->addAlias("ctastitle", ContentPeer::TABLE_NAME);
+ $c->addAlias("at", AppThreadPeer::TABLE_NAME);
$aConditions = array ();
$aConditions[] = array (AppDelegationPeer::USR_UID,'u.USR_UID'
@@ -1379,7 +1418,7 @@ class AppSolr
* @param array $aaAPPUIDs Array of arrays of App_UID that must be updated,
* APP_UID is permitted also
*/
- public function updateApplicationSearchIndex ($aaAPPUIDs)
+ public function updateApplicationSearchIndex($aaAPPUIDs, $saveDBRecord = true)
{
if (empty( $aaAPPUIDs )) {
return;
@@ -1392,20 +1431,29 @@ class AppSolr
$aaAPPUIDs[] = array ('APP_UID' => $APPUID
);
}
- // check if index server is available
- if (! $this->isSolrEnabled()) {
- // store update in table and return
- foreach ($aaAPPUIDs as $aAPPUID) {
- $this->applicationChangedUpdateSolrQueue( $aAPPUID['APP_UID'], true );
+
+ //Check if index server is available
+ if ($saveDBRecord) {
+ if ($this->isSolrEnabled()) {
+ //Store update in table but with status updated
+ foreach ($aaAPPUIDs as $aAPPUID) {
+ $this->applicationChangedUpdateSolrQueue($aAPPUID["APP_UID"], 0);
+ }
+ } else{
+ //Store update in table and return
+ foreach ($aaAPPUIDs as $aAPPUID) {
+ $this->applicationChangedUpdateSolrQueue($aAPPUID["APP_UID"], true);
+ }
+
+ return;
}
- return;
}
if ($this->debug) {
$this->getApplicationDataDBTime = 0;
$this->getPreparedApplicationDataDBTime = 0;
$this->getBuilXMLDocTime = 0;
-
+ $this->afterUpdateSolrXMLDocTime = 0;
$this->beforeCreateSolrXMLDocTime = microtime( true );
}
// create XML document
@@ -1448,13 +1496,13 @@ class AppSolr
$this->totalTimeAcumulated += ($this->afterUpdateSolrXMLDocTime - $this->beforeCreateSolrXMLDocTime);
//Solr App trunk size| Get Data from DB (s)| Prepare DB data (s) | Create XML file (s)| Create XML Document total (s)| Update Solr Document (s)
- fwrite($fh, sprintf("%s|%s|%s|%s|%s|%s|%s|%s\r\n",
+ fwrite($fh, sprintf("%s|%s|%s|%s|%s|%s|%s|%s\r\n",
$this->trunkSizeAcumulated,
$this->totalTimeAcumulated,
- $this->getApplicationDataDBTime,
- $this->getPreparedApplicationDataDBTime,
+ $this->getApplicationDataDBTime,
+ $this->getPreparedApplicationDataDBTime,
$this->getBuilXMLDocTime,
- ($this->afterCreateSolrXMLDocTime - $this->beforeCreateSolrXMLDocTime),
+ ($this->afterCreateSolrXMLDocTime - $this->beforeCreateSolrXMLDocTime),
($this->afterUpdateSolrXMLDocTime - $this->afterCreateSolrXMLDocTime),
($this->afterUpdateSolrXMLDocTime - $this->beforeCreateSolrXMLDocTime)
));
@@ -1476,17 +1524,18 @@ class AppSolr
*
* @param string $appUID Application identifier
*/
- public function deleteApplicationSearchIndex ($appUID)
+ public function deleteApplicationSearchIndex($appUID, $saveDBRecord = true)
{
if (empty( $appUID )) {
return;
}
// check if index server is available
- if (! $this->_solrIsEnabled) {
+ if ($saveDBRecord) {
// store update in table and return
$this->applicationChangedUpdateSolrQueue( $appUID['APP_UID'], 2 ); // delete
- return;
+
+ //return;
}
$idQuery = "APP_UID:" . $appUID;
@@ -1514,7 +1563,7 @@ class AppSolr
if ($this->debug) {
$this->getApplicationDataDBTime = 0;
$this->getPreparedApplicationDataDBTime = 0;
- $this->getBuilXMLDocTime = 0;
+ $this->getBuilXMLDocTime = 0;
}
// search data from DB
$xmlDoc = "\n";
@@ -1531,7 +1580,7 @@ class AppSolr
$aaAllAppDelData = $this->getListApplicationUpdateDelegationData( $aAPPUIDs );
if ($this->debug) {
$this->afterGetApplicationDataDBTime = microtime (true);
-
+
$this->getApplicationDataDBTime = $this->afterGetApplicationDataDBTime - $this->beforeGetApplicationDataDBTime;
}
foreach ($aaAPPUIDs as $aAPPUID) {
@@ -1553,10 +1602,10 @@ class AppSolr
$result = $this->getApplicationIndexData( $aAPPUID['APP_UID'], $aaAppData );
if ($this->debug) {
-
+
$this->afterPrepareApplicationDataDBTime = microtime (true);
-
- $this->getPreparedApplicationDataDBTime += $this->afterPrepareApplicationDataDBTime - $this->beforePrepareApplicationDataDBTime;
+
+ $this->getPreparedApplicationDataDBTime += $this->afterPrepareApplicationDataDBTime - $this->beforePrepareApplicationDataDBTime;
}
} catch (ApplicationWithoutDelegationRecordsException $ex) {
@@ -1617,8 +1666,8 @@ class AppSolr
if ($this->debug) {
$this->afterBuilXMLDocTime = microtime (true);
-
- $this->getBuilXMLDocTime += $this->afterBuilXMLDocTime - $this->afterPrepareApplicationDataDBTime;
+
+ $this->getBuilXMLDocTime += $this->afterBuilXMLDocTime - $this->afterPrepareApplicationDataDBTime;
}
} catch (ApplicationAPP_DATAUnserializeException $ex) {
// exception trying to get application information
@@ -1637,12 +1686,12 @@ class AppSolr
if($this->debugAppInfo)
{
$fh = fopen("SolrAPPUIDIndexSize.txt", 'a') or die("can't open file to store Solr index time.");
- //fwrite($fh, sprintf("APP UID %s => doc size: %s\r\n",
+ //fwrite($fh, sprintf("APP UID %s => doc size: %s\r\n",
// $aAPPUID['APP_UID'], strlen($xmlCurrentDoc)));
- fwrite($fh, sprintf("%s|%s|%s\r\n",
+ fwrite($fh, sprintf("%s|%s|%s\r\n",
$documentInformation ['APP_NUMBER'], $aAPPUID['APP_UID'], strlen($xmlCurrentDoc)));
fclose($fh);
- }
+ }
}//end foreach
@@ -2487,10 +2536,10 @@ class AppSolr
$c->addSelectColumn( 'at.APP_THREAD_PARENT' );
$c->addSelectColumn( 'at.APP_THREAD_STATUS' );
- $c->addAlias( 'capp', 'CONTENT' );
- $c->addAlias( 'cpro', 'CONTENT' );
- $c->addAlias( 'ad', 'APP_DELEGATION' );
- $c->addAlias( 'at', 'APP_THREAD' );
+ $c->addAlias("capp", ContentPeer::TABLE_NAME);
+ $c->addAlias("cpro", ContentPeer::TABLE_NAME);
+ $c->addAlias("ad", AppDelegationPeer::TABLE_NAME);
+ $c->addAlias("at", AppThreadPeer::TABLE_NAME);
$aConditions = array ();
$aConditions[] = array (ApplicationPeer::APP_UID,'capp.CON_ID'
@@ -2589,12 +2638,12 @@ class AppSolr
$c->addAsColumn("PRO_CATEGORY_UID", "pro.PRO_CATEGORY");
- $c->addAlias("capp", "CONTENT");
- $c->addAlias("cpro", "CONTENT");
- $c->addAlias("ad", "APP_DELEGATION");
- $c->addAlias("at", "APP_THREAD");
- $c->addAlias("appDely", "APP_DELAY");
- $c->addAlias("pro", "PROCESS");
+ $c->addAlias("capp", ContentPeer::TABLE_NAME);
+ $c->addAlias("cpro", ContentPeer::TABLE_NAME);
+ $c->addAlias("ad", AppDelegationPeer::TABLE_NAME);
+ $c->addAlias("at", AppThreadPeer::TABLE_NAME);
+ $c->addAlias("appDely", AppDelayPeer::TABLE_NAME);
+ $c->addAlias("pro", ProcessPeer::TABLE_NAME);
$arrayCondition = array();
$arrayCondition[] = array(ApplicationPeer::APP_UID, "capp.CON_ID");
@@ -2720,9 +2769,25 @@ class AppSolr
*/
public function applicationChangedUpdateSolrQueue ($AppUid, $updated)
{
+ $traceData = $this->getCurrentTraceInfo();
+
$oAppSolrQueue = new AppSolrQueue();
- $oAppSolrQueue->createUpdate( $AppUid, $updated );
+ $oAppSolrQueue->createUpdate($AppUid, $traceData, $updated);
+ }
+
+ private function getCurrentTraceInfo()
+ {
+ $traceData = debug_backtrace();
+ $resultTraceString = "";
+
+ foreach ($traceData as $key => $value) {
+ if ($value["function"] != "getCurrentTraceInfo" && $value["function"] != "require_once") {
+ $resultTraceString .= $value["file"] . " (" . $value["line"] . ") " . $value["function"] . "\n";
+ }
+ }
+
+ return $resultTraceString;
}
/**
@@ -2730,6 +2795,10 @@ class AppSolr
*/
public function synchronizePendingApplications ()
{
+ if (!$this->isSolrEnabled()) {
+ throw new Exception("Error connecting to solr server.");
+ }
+
// check table of pending updates
$oAppSolrQueue = new AppSolrQueue();
@@ -2738,10 +2807,10 @@ class AppSolr
foreach ($aAppSolrQueue as $oAppSolrQueueEntity) {
// call the syncronization function
if ($oAppSolrQueueEntity->appUpdated == 1) {
- $this->updateApplicationSearchIndex( $oAppSolrQueueEntity->appUid );
+ $this->updateApplicationSearchIndex($oAppSolrQueueEntity->appUid, false);
}
if ($oAppSolrQueueEntity->appUpdated == 2) {
- $this->deleteApplicationSearchIndex( $oAppSolrQueueEntity->appUid );
+ $this->deleteApplicationSearchIndex($oAppSolrQueueEntity->appUid, false);
}
$this->applicationChangedUpdateSolrQueue( $oAppSolrQueueEntity->appUid, 0 );
}
@@ -2831,7 +2900,12 @@ class AppSolr
*/
public function reindexAllApplications ($SkipRecords = 0, $indexTrunkSize = 1000)
{
+ if (!$this->isSolrEnabled()) {
+ throw new Exception("Error connecting to solr server.");
+ }
+
$trunk = $indexTrunkSize;
+
// delete all documents to begin reindex
// deleteAllDocuments();
// commitChanges();
@@ -2846,7 +2920,7 @@ class AppSolr
printf( "Indexing %d to %d \n", $skip, $skip + $trunk );
$initTimeDoc = microtime( true );
- $this->updateApplicationSearchIndex( $aaAPPUIds );
+ $this->updateApplicationSearchIndex($aaAPPUIds, false);
$curTimeDoc = gmdate( 'H:i:s', (microtime( true ) - $initTimeDoc) );
printf( "Indexing document time: %s \n", $curTimeDoc );
diff --git a/workflow/engine/classes/class.searchIndex.php b/workflow/engine/classes/class.searchIndex.php
index 16815c66d..3ea5497d0 100644
--- a/workflow/engine/classes/class.searchIndex.php
+++ b/workflow/engine/classes/class.searchIndex.php
@@ -1,5 +1,4 @@
_solrIsEnabled, $this->_solrHost );
- return $solr->isEnabled();
+
+ return $solr->isEnabled($workspace);
}
/**
@@ -394,9 +394,9 @@ class BpmnEngine_Services_SearchIndex
$data['aaData'][$i][] = ''; // placeholder
} else {
if (isset( $doc->$columnName )) {
- $data['aaData'][$i][] = $doc->$columnName;
+ $data["aaData"][$i][$columnName] = $doc->$columnName;
} else {
- $data['aaData'][$i][] = '';
+ $data["aaData"][$i][$columnName] = "";
}
}
}
@@ -442,4 +442,5 @@ class BpmnEngine_Services_SearchIndex
return $listFields;
}
-}
\ No newline at end of file
+}
+
diff --git a/workflow/engine/classes/class.solr.php b/workflow/engine/classes/class.solr.php
index 6aa025006..f8a7f7272 100644
--- a/workflow/engine/classes/class.solr.php
+++ b/workflow/engine/classes/class.solr.php
@@ -1,5 +1,4 @@
_solrIsEnabled != true) {
+ return $resultServerStatus;
+ }
- return $this->_solrIsEnabled;
+ //Verify solr server response
+ try{
+ $resultServerStatus = $this->ping($workspace);
+ } catch (Exception $e) {
+ $resultServerStatus = false;
+ }
+
+ return $resultServerStatus;
}
/**
@@ -435,6 +444,65 @@ class BpmnEngine_SearchIndexAccess_Solr
return $responseSolr;
}
+ /**
+ * Ping the Solr Server to check his health
+ *
+ * @param string $workspace
+ * Solr instance name
+ * @throws Exception
+ * @return void mixed of field names
+ */
+ public function ping($workspace)
+ {
+ if (!$this->_solrIsEnabled) {
+ return;
+ }
+
+ $solrIntruct = "";
+
+ //Get configuration information in base to workspace parameter
+ $solrIntruct = (substr($this->_solrHost, -1) == "/")? $this->_solrHost : $this->_solrHost . "/";
+ $solrIntruct .= $workspace;
+ $solrIntruct .= "/admin/ping?wt=json";
+
+ $handler = curl_init($solrIntruct);
+ curl_setopt($handler, CURLOPT_RETURNTRANSFER, true);
+
+ //Apply proxy settings
+ $sysConf = System::getSystemConfiguration();
+
+ if ($sysConf["proxy_host"] != "") {
+ curl_setopt($handler, CURLOPT_PROXY, $sysConf["proxy_host"] . (($sysConf["proxy_port"] != "")? ":" . $sysConf["proxy_port"] : ""));
+
+ if ($sysConf["proxy_port"] != "") {
+ curl_setopt($handler, CURLOPT_PROXYPORT, $sysConf["proxy_port"]);
+ }
+
+ if ($sysConf["proxy_user"] != "") {
+ curl_setopt($handler, CURLOPT_PROXYUSERPWD, $sysConf["proxy_user"] . (($sysConf["proxy_pass"] != "")? ":" . $sysConf["proxy_pass"] : ""));
+ }
+
+ curl_setopt($handler, CURLOPT_HTTPHEADER, array("Expect:"));
+ }
+
+ $response = curl_exec($handler);
+ curl_close($handler);
+
+ //There's no response
+ if (!$response) {
+ return false;
+ }
+
+ //Decode
+ $responseSolr = G::json_decode ($response);
+
+ if ($responseSolr->responseHeader->status != "OK") {
+ throw new Exception("Error pinging Solr server." . $solrIntruct . " response error: " . $response . "\n");
+ }
+
+ return true;
+ }
+
/**
* Delete all documents from index
* @gearman = false
@@ -630,3 +698,4 @@ class BpmnEngine_SearchIndexAccess_Solr
return $responseSolr;
}
}
+
diff --git a/workflow/engine/classes/entities/AppSolrQueue.php b/workflow/engine/classes/entities/AppSolrQueue.php
index 3e7d6d9f0..6c3ef1290 100644
--- a/workflow/engine/classes/entities/AppSolrQueue.php
+++ b/workflow/engine/classes/entities/AppSolrQueue.php
@@ -6,7 +6,9 @@
*/
class Entity_AppSolrQueue extends Entity_Base
{
- public $appUid = '';
+ public $appUid = "";
+ public $appChangeDate = "";
+ public $appChangeTrace = "";
public $appUpdated = 0;
private function __construct ()
@@ -26,7 +28,11 @@ class Entity_AppSolrQueue extends Entity_Base
$obj->initializeObject( $data );
- $requiredFields = array ("appUid","appUpdated"
+ $requiredFields = array(
+ "appUid",
+ "appChangeDate",
+ "appChangeTrace",
+ "appUpdated"
);
$obj->validateRequiredFields( $requiredFields );
diff --git a/workflow/engine/classes/model/AppSolrQueue.php b/workflow/engine/classes/model/AppSolrQueue.php
index b85ce67ca..fbe3fffa4 100644
--- a/workflow/engine/classes/model/AppSolrQueue.php
+++ b/workflow/engine/classes/model/AppSolrQueue.php
@@ -1,5 +1,4 @@
fromArray($aFields,BasePeer::TYPE_FIELDNAME);
$this->setNew( false );
//set field
- $this->setAppUid( $sAppUid );
- $this->setAppUpdated( $iUpdated );
+ $this->setAppUid($sAppUid);
+ $this->setAppChangeDate("now");
+ $this->setAppChangeTrace($sAppChangeTrace);
+ $this->setAppUpdated($iUpdated);
if ($this->validate()) {
$result = $this->save();
} else {
@@ -56,8 +57,10 @@ class AppSolrQueue extends BaseAppSolrQueue
} else {
//create record
//set values
- $this->setAppUid( $sAppUid );
- $this->setAppUpdated( $iUpdated );
+ $this->setAppUid($sAppUid);
+ $this->setAppChangeDate("now");
+ $this->setAppChangeTrace($sAppChangeTrace);
+ $this->setAppUpdated($iUpdated);
if ($this->validate()) {
$result = $this->save();
} else {
@@ -84,8 +87,10 @@ class AppSolrQueue extends BaseAppSolrQueue
try {
$c = new Criteria();
- $c->addSelectColumn( AppSolrQueuePeer::APP_UID );
- $c->addSelectColumn( AppSolrQueuePeer::APP_UPDATED );
+ $c->addSelectColumn(AppSolrQueuePeer::APP_UID);
+ $c->addSelectColumn(AppSolrQueuePeer::APP_CHANGE_DATE);
+ $c->addSelectColumn(AppSolrQueuePeer::APP_CHANGE_TRACE);
+ $c->addSelectColumn(AppSolrQueuePeer::APP_UPDATED);
//"WHERE
$c->add( AppSolrQueuePeer::APP_UPDATED, 0, Criteria::NOT_EQUAL );
@@ -98,8 +103,10 @@ class AppSolrQueue extends BaseAppSolrQueue
while (is_array( $row )) {
$appSolrQueue = Entity_AppSolrQueue::createEmpty();
- $appSolrQueue->appUid = $row['APP_UID'];
- $appSolrQueue->appUpdated = $row['APP_UPDATED'];
+ $appSolrQueue->appUid = $row["APP_UID"];
+ $appSolrQueue->appChangeDate = $row["APP_CHANGE_DATE"];
+ $appSolrQueue->appChangeTrace = $row["APP_CHANGE_TRACE"];
+ $appSolrQueue->appUpdated = $row["APP_UPDATED"];
$updatedApplications[] = $appSolrQueue;
$rs->next();
$row = $rs->getRow();
diff --git a/workflow/engine/classes/model/map/AppSolrQueueMapBuilder.php b/workflow/engine/classes/model/map/AppSolrQueueMapBuilder.php
index 9a7f9f2e7..f22ccb794 100644
--- a/workflow/engine/classes/model/map/AppSolrQueueMapBuilder.php
+++ b/workflow/engine/classes/model/map/AppSolrQueueMapBuilder.php
@@ -67,6 +67,10 @@ class AppSolrQueueMapBuilder
$tMap->addPrimaryKey('APP_UID', 'AppUid', 'string', CreoleTypes::VARCHAR, true, 32);
+ $tMap->addColumn('APP_CHANGE_DATE', 'AppChangeDate', 'int', CreoleTypes::TIMESTAMP, true, null);
+
+ $tMap->addColumn('APP_CHANGE_TRACE', 'AppChangeTrace', 'string', CreoleTypes::VARCHAR, true, 500);
+
$tMap->addColumn('APP_UPDATED', 'AppUpdated', 'int', CreoleTypes::TINYINT, true, null);
} // doBuild()
diff --git a/workflow/engine/classes/model/om/BaseAppSolrQueue.php b/workflow/engine/classes/model/om/BaseAppSolrQueue.php
index 0cd4abaa7..e3c4a8dd4 100644
--- a/workflow/engine/classes/model/om/BaseAppSolrQueue.php
+++ b/workflow/engine/classes/model/om/BaseAppSolrQueue.php
@@ -33,6 +33,18 @@ abstract class BaseAppSolrQueue extends BaseObject implements Persistent
*/
protected $app_uid = '';
+ /**
+ * The value for the app_change_date field.
+ * @var int
+ */
+ protected $app_change_date;
+
+ /**
+ * The value for the app_change_trace field.
+ * @var string
+ */
+ protected $app_change_trace;
+
/**
* The value for the app_updated field.
* @var int
@@ -64,6 +76,49 @@ abstract class BaseAppSolrQueue extends BaseObject implements Persistent
return $this->app_uid;
}
+ /**
+ * Get the [optionally formatted] [app_change_date] column value.
+ *
+ * @param string $format The date/time format string (either date()-style or strftime()-style).
+ * If format is NULL, then the integer unix timestamp will be returned.
+ * @return mixed Formatted date/time value as string or integer unix timestamp (if format is NULL).
+ * @throws PropelException - if unable to convert the date/time to timestamp.
+ */
+ public function getAppChangeDate($format = 'Y-m-d H:i:s')
+ {
+
+ if ($this->app_change_date === null || $this->app_change_date === '') {
+ return null;
+ } elseif (!is_int($this->app_change_date)) {
+ // a non-timestamp value was set externally, so we convert it
+ $ts = strtotime($this->app_change_date);
+ if ($ts === -1 || $ts === false) {
+ throw new PropelException("Unable to parse value of [app_change_date] as date/time value: " .
+ var_export($this->app_change_date, true));
+ }
+ } else {
+ $ts = $this->app_change_date;
+ }
+ if ($format === null) {
+ return $ts;
+ } elseif (strpos($format, '%') !== false) {
+ return strftime($format, $ts);
+ } else {
+ return date($format, $ts);
+ }
+ }
+
+ /**
+ * Get the [app_change_trace] column value.
+ *
+ * @return string
+ */
+ public function getAppChangeTrace()
+ {
+
+ return $this->app_change_trace;
+ }
+
/**
* Get the [app_updated] column value.
*
@@ -97,6 +152,53 @@ abstract class BaseAppSolrQueue extends BaseObject implements Persistent
} // setAppUid()
+ /**
+ * Set the value of [app_change_date] column.
+ *
+ * @param int $v new value
+ * @return void
+ */
+ public function setAppChangeDate($v)
+ {
+
+ if ($v !== null && !is_int($v)) {
+ $ts = strtotime($v);
+ if ($ts === -1 || $ts === false) {
+ throw new PropelException("Unable to parse date/time value for [app_change_date] from input: " .
+ var_export($v, true));
+ }
+ } else {
+ $ts = $v;
+ }
+ if ($this->app_change_date !== $ts) {
+ $this->app_change_date = $ts;
+ $this->modifiedColumns[] = AppSolrQueuePeer::APP_CHANGE_DATE;
+ }
+
+ } // setAppChangeDate()
+
+ /**
+ * Set the value of [app_change_trace] column.
+ *
+ * @param string $v new value
+ * @return void
+ */
+ public function setAppChangeTrace($v)
+ {
+
+ // Since the native PHP type for this column is string,
+ // we will cast the input to a string (if it is not).
+ if ($v !== null && !is_string($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->app_change_trace !== $v) {
+ $this->app_change_trace = $v;
+ $this->modifiedColumns[] = AppSolrQueuePeer::APP_CHANGE_TRACE;
+ }
+
+ } // setAppChangeTrace()
+
/**
* Set the value of [app_updated] column.
*
@@ -138,14 +240,18 @@ abstract class BaseAppSolrQueue extends BaseObject implements Persistent
$this->app_uid = $rs->getString($startcol + 0);
- $this->app_updated = $rs->getInt($startcol + 1);
+ $this->app_change_date = $rs->getTimestamp($startcol + 1, null);
+
+ $this->app_change_trace = $rs->getString($startcol + 2);
+
+ $this->app_updated = $rs->getInt($startcol + 3);
$this->resetModified();
$this->setNew(false);
// FIXME - using NUM_COLUMNS may be clearer.
- return $startcol + 2; // 2 = AppSolrQueuePeer::NUM_COLUMNS - AppSolrQueuePeer::NUM_LAZY_LOAD_COLUMNS).
+ return $startcol + 4; // 4 = AppSolrQueuePeer::NUM_COLUMNS - AppSolrQueuePeer::NUM_LAZY_LOAD_COLUMNS).
} catch (Exception $e) {
throw new PropelException("Error populating AppSolrQueue object", $e);
@@ -353,6 +459,12 @@ abstract class BaseAppSolrQueue extends BaseObject implements Persistent
return $this->getAppUid();
break;
case 1:
+ return $this->getAppChangeDate();
+ break;
+ case 2:
+ return $this->getAppChangeTrace();
+ break;
+ case 3:
return $this->getAppUpdated();
break;
default:
@@ -376,7 +488,9 @@ abstract class BaseAppSolrQueue extends BaseObject implements Persistent
$keys = AppSolrQueuePeer::getFieldNames($keyType);
$result = array(
$keys[0] => $this->getAppUid(),
- $keys[1] => $this->getAppUpdated(),
+ $keys[1] => $this->getAppChangeDate(),
+ $keys[2] => $this->getAppChangeTrace(),
+ $keys[3] => $this->getAppUpdated(),
);
return $result;
}
@@ -412,6 +526,12 @@ abstract class BaseAppSolrQueue extends BaseObject implements Persistent
$this->setAppUid($value);
break;
case 1:
+ $this->setAppChangeDate($value);
+ break;
+ case 2:
+ $this->setAppChangeTrace($value);
+ break;
+ case 3:
$this->setAppUpdated($value);
break;
} // switch()
@@ -442,7 +562,15 @@ abstract class BaseAppSolrQueue extends BaseObject implements Persistent
}
if (array_key_exists($keys[1], $arr)) {
- $this->setAppUpdated($arr[$keys[1]]);
+ $this->setAppChangeDate($arr[$keys[1]]);
+ }
+
+ if (array_key_exists($keys[2], $arr)) {
+ $this->setAppChangeTrace($arr[$keys[2]]);
+ }
+
+ if (array_key_exists($keys[3], $arr)) {
+ $this->setAppUpdated($arr[$keys[3]]);
}
}
@@ -460,6 +588,14 @@ abstract class BaseAppSolrQueue extends BaseObject implements Persistent
$criteria->add(AppSolrQueuePeer::APP_UID, $this->app_uid);
}
+ if ($this->isColumnModified(AppSolrQueuePeer::APP_CHANGE_DATE)) {
+ $criteria->add(AppSolrQueuePeer::APP_CHANGE_DATE, $this->app_change_date);
+ }
+
+ if ($this->isColumnModified(AppSolrQueuePeer::APP_CHANGE_TRACE)) {
+ $criteria->add(AppSolrQueuePeer::APP_CHANGE_TRACE, $this->app_change_trace);
+ }
+
if ($this->isColumnModified(AppSolrQueuePeer::APP_UPDATED)) {
$criteria->add(AppSolrQueuePeer::APP_UPDATED, $this->app_updated);
}
@@ -518,6 +654,10 @@ abstract class BaseAppSolrQueue extends BaseObject implements Persistent
public function copyInto($copyObj, $deepCopy = false)
{
+ $copyObj->setAppChangeDate($this->app_change_date);
+
+ $copyObj->setAppChangeTrace($this->app_change_trace);
+
$copyObj->setAppUpdated($this->app_updated);
diff --git a/workflow/engine/classes/model/om/BaseAppSolrQueuePeer.php b/workflow/engine/classes/model/om/BaseAppSolrQueuePeer.php
index 5d72338fd..bf05c7bf5 100644
--- a/workflow/engine/classes/model/om/BaseAppSolrQueuePeer.php
+++ b/workflow/engine/classes/model/om/BaseAppSolrQueuePeer.php
@@ -25,7 +25,7 @@ abstract class BaseAppSolrQueuePeer
const CLASS_DEFAULT = 'classes.model.AppSolrQueue';
/** The total number of columns. */
- const NUM_COLUMNS = 2;
+ const NUM_COLUMNS = 4;
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
@@ -34,6 +34,12 @@ abstract class BaseAppSolrQueuePeer
/** the column name for the APP_UID field */
const APP_UID = 'APP_SOLR_QUEUE.APP_UID';
+ /** the column name for the APP_CHANGE_DATE field */
+ const APP_CHANGE_DATE = 'APP_SOLR_QUEUE.APP_CHANGE_DATE';
+
+ /** the column name for the APP_CHANGE_TRACE field */
+ const APP_CHANGE_TRACE = 'APP_SOLR_QUEUE.APP_CHANGE_TRACE';
+
/** the column name for the APP_UPDATED field */
const APP_UPDATED = 'APP_SOLR_QUEUE.APP_UPDATED';
@@ -48,10 +54,10 @@ abstract class BaseAppSolrQueuePeer
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
private static $fieldNames = array (
- BasePeer::TYPE_PHPNAME => array ('AppUid', 'AppUpdated', ),
- BasePeer::TYPE_COLNAME => array (AppSolrQueuePeer::APP_UID, AppSolrQueuePeer::APP_UPDATED, ),
- BasePeer::TYPE_FIELDNAME => array ('APP_UID', 'APP_UPDATED', ),
- BasePeer::TYPE_NUM => array (0, 1, )
+ BasePeer::TYPE_PHPNAME => array ('AppUid', 'AppChangeDate', 'AppChangeTrace', 'AppUpdated', ),
+ BasePeer::TYPE_COLNAME => array (AppSolrQueuePeer::APP_UID, AppSolrQueuePeer::APP_CHANGE_DATE, AppSolrQueuePeer::APP_CHANGE_TRACE, AppSolrQueuePeer::APP_UPDATED, ),
+ BasePeer::TYPE_FIELDNAME => array ('APP_UID', 'APP_CHANGE_DATE', 'APP_CHANGE_TRACE', 'APP_UPDATED', ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, )
);
/**
@@ -61,10 +67,10 @@ abstract class BaseAppSolrQueuePeer
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
private static $fieldKeys = array (
- BasePeer::TYPE_PHPNAME => array ('AppUid' => 0, 'AppUpdated' => 1, ),
- BasePeer::TYPE_COLNAME => array (AppSolrQueuePeer::APP_UID => 0, AppSolrQueuePeer::APP_UPDATED => 1, ),
- BasePeer::TYPE_FIELDNAME => array ('APP_UID' => 0, 'APP_UPDATED' => 1, ),
- BasePeer::TYPE_NUM => array (0, 1, )
+ BasePeer::TYPE_PHPNAME => array ('AppUid' => 0, 'AppChangeDate' => 1, 'AppChangeTrace' => 2, 'AppUpdated' => 3, ),
+ BasePeer::TYPE_COLNAME => array (AppSolrQueuePeer::APP_UID => 0, AppSolrQueuePeer::APP_CHANGE_DATE => 1, AppSolrQueuePeer::APP_CHANGE_TRACE => 2, AppSolrQueuePeer::APP_UPDATED => 3, ),
+ BasePeer::TYPE_FIELDNAME => array ('APP_UID' => 0, 'APP_CHANGE_DATE' => 1, 'APP_CHANGE_TRACE' => 2, 'APP_UPDATED' => 3, ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, )
);
/**
@@ -167,6 +173,10 @@ abstract class BaseAppSolrQueuePeer
$criteria->addSelectColumn(AppSolrQueuePeer::APP_UID);
+ $criteria->addSelectColumn(AppSolrQueuePeer::APP_CHANGE_DATE);
+
+ $criteria->addSelectColumn(AppSolrQueuePeer::APP_CHANGE_TRACE);
+
$criteria->addSelectColumn(AppSolrQueuePeer::APP_UPDATED);
}
diff --git a/workflow/engine/config/schema.xml b/workflow/engine/config/schema.xml
index 8b42bbf7a..075d45641 100755
--- a/workflow/engine/config/schema.xml
+++ b/workflow/engine/config/schema.xml
@@ -2940,6 +2940,8 @@
+
+
diff --git a/workflow/engine/data/mssql/schema.sql b/workflow/engine/data/mssql/schema.sql
index fbe9133ce..15b714bb1 100755
--- a/workflow/engine/data/mssql/schema.sql
+++ b/workflow/engine/data/mssql/schema.sql
@@ -3164,6 +3164,8 @@ END
CREATE TABLE [APP_SOLR_QUEUE]
(
[APP_UID] VARCHAR(32) default '' NOT NULL,
+ [APP_CHANGE_DATE] CHAR(19) NOT NULL,
+ [APP_CHANGE_TRACE] VARCHAR(500) NOT NULL,
[APP_UPDATED] TINYINT default 1 NOT NULL,
CONSTRAINT APP_SOLR_QUEUE_PK PRIMARY KEY ([APP_UID])
);
diff --git a/workflow/engine/data/mysql/schema.sql b/workflow/engine/data/mysql/schema.sql
index f68def40d..062c8d185 100755
--- a/workflow/engine/data/mysql/schema.sql
+++ b/workflow/engine/data/mysql/schema.sql
@@ -1432,6 +1432,8 @@ DROP TABLE IF EXISTS `APP_SOLR_QUEUE`;
CREATE TABLE `APP_SOLR_QUEUE`
(
`APP_UID` VARCHAR(32) default '' NOT NULL,
+ `APP_CHANGE_DATE` DATETIME NOT NULL,
+ `APP_CHANGE_TRACE` VARCHAR(500) NOT NULL,
`APP_UPDATED` TINYINT default 1 NOT NULL,
PRIMARY KEY (`APP_UID`)
)ENGINE=MyISAM DEFAULT CHARSET='utf8' COMMENT='APP_SOLR_QUEUE';
diff --git a/workflow/engine/methods/cases/casesMenuLoader.php b/workflow/engine/methods/cases/casesMenuLoader.php
index 10309e40a..e47eb6325 100755
--- a/workflow/engine/methods/cases/casesMenuLoader.php
+++ b/workflow/engine/methods/cases/casesMenuLoader.php
@@ -175,11 +175,20 @@ function getAllCounters ()
$aTypes['selfservice'] = 'CASES_SELFSERVICE';
//$aTypes['to_revise'] = 'CASES_TO_REVISE';
//$aTypes['to_reassign'] = 'CASES_TO_REASSIGN';
+ $solrEnabled = false;
if ((($solrConf = System::solrEnv()) !== false)) {
G::LoadClass( 'AppSolr' );
$ApplicationSolrIndex = new AppSolr( $solrConf['solr_enabled'], $solrConf['solr_host'], $solrConf['solr_instance'] );
+ if ($ApplicationSolrIndex->isSolrEnabled()) {
+ $solrEnabled = true;
+ } else {
+ $solrEnabled = false;
+ }
+ }
+
+ if ($solrEnabled) {
$aCount = $ApplicationSolrIndex->getCasesCount( $userUid );
//get paused count
diff --git a/workflow/engine/methods/cases/proxyCasesList.php b/workflow/engine/methods/cases/proxyCasesList.php
index 3895d7f22..011793889 100755
--- a/workflow/engine/methods/cases/proxyCasesList.php
+++ b/workflow/engine/methods/cases/proxyCasesList.php
@@ -19,6 +19,7 @@ $dateTo = isset( $_POST["dateTo"] ) ? substr( $_POST["dateTo"], 0, 10 ) : "";
try {
$userUid = (isset($_SESSION["USER_LOGGED"]) && $_SESSION["USER_LOGGED"] != "")? $_SESSION["USER_LOGGED"] : null;
$result = "";
+ $solrEnabled = false;
switch ($action) {
case "search":
@@ -44,6 +45,16 @@ try {
$solrConf["solr_instance"]
);
+ if ($ApplicationSolrIndex->isSolrEnabled()) {
+ //Check if there are missing records to reindex and reindex them
+ $ApplicationSolrIndex->synchronizePendingApplications();
+ $solrEnabled = true;
+ } else{
+ $solrEnabled = false;
+ }
+ }
+
+ if ($solrEnabled) {
$data = $ApplicationSolrIndex->getAppGridData(
$userUid,
$start,
diff --git a/workflow/public_html/sysGeneric.php b/workflow/public_html/sysGeneric.php
index 13915b450..dda85695b 100755
--- a/workflow/public_html/sysGeneric.php
+++ b/workflow/public_html/sysGeneric.php
@@ -422,9 +422,6 @@ Bootstrap::registerClass('Controller', PATH_GULLIVER . "class.controlle
Bootstrap::registerClass('HttpProxyController', PATH_GULLIVER . "class.httpProxyController.php");
Bootstrap::registerClass('templatePower', PATH_GULLIVER . "class.templatePower.php");
Bootstrap::registerClass('XmlForm_Field_SimpleText', PATH_GULLIVER . "class.xmlformExtension.php");
-Bootstrap::registerClass('Propel', PATH_THIRDPARTY . "propel/Propel.php");
-Bootstrap::registerClass('Creole', PATH_THIRDPARTY . "creole/Creole.php");
-Bootstrap::registerClass('Criteria', PATH_THIRDPARTY . "propel/util/Criteria.php");
Bootstrap::registerClass('Groups', PATH_HOME . "engine/classes/class.groups.php");
Bootstrap::registerClass('Tasks', PATH_HOME . "engine/classes/class.tasks.php");
Bootstrap::registerClass('Calendar', PATH_HOME . "engine/classes/class.calendar.php");