BUG 0000 "Added changes to solr" SOLVED

- Added changes to solr, according to:
    https://github.com/colosa/processmaker/pull/1045/files
- Solved problem with:
    php -f reindex_solr.php
* Available from version ProcessMaker-2.0.46
This commit is contained in:
Victor Saisa Lopez
2013-01-25 17:13:52 -04:00
parent cbcad06e31
commit 23a7051496
16 changed files with 503 additions and 153 deletions

View File

@@ -121,6 +121,10 @@ class Bootstrap
public static function registerSystemClasses() 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 //DATABASE propel classes used in "Cases" Options
self::registerClass("Entity_Base", PATH_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "entities" . PATH_SEP . "Base.php"); 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("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("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("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"); 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("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("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("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("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"); self::registerClass("BaseSwimlanesElementsPeer",PATH_HOME ."engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "om" . PATH_SEP . "BaseSwimlanesElementsPeer.php");

View File

@@ -1,6 +1,6 @@
<?php <?php
/** /**
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2012 Colosa Inc.23 * Copyright (C) 2004 - 2012 Colosa Inc.23
* *
@@ -19,7 +19,7 @@
* *
* For more information, contact Colosa Inc, 5304 Ventura Drive, * For more information, contact Colosa Inc, 5304 Ventura Drive,
* Delray Beach, FL, 33484, USA, or email info@colosa.com. * Delray Beach, FL, 33484, USA, or email info@colosa.com.
* *
*/ */
// check script parameters // check script parameters
@@ -28,18 +28,18 @@
//(count ($argv) == 4) || ((count ($argv) == 5) && ($argv [3] != '-skip')) //(count ($argv) == 4) || ((count ($argv) == 5) && ($argv [3] != '-skip'))
$commandLineSyntaxMsg = "Invalid command line arguments: \n " . $commandLineSyntaxMsg = "Invalid command line arguments: \n " .
"syntax: ". "syntax: ".
"php reindex_solr.php [workspace_name] [reindexall|reindexmissing|optimizeindex|reindexone] [-skip {record_number}] [-reindextrunksize {trunk_size}] [-appuid {APP_UID}]\n" . "php reindex_solr.php [workspace_name] [reindexall|reindexmissing|optimizeindex|reindexone] [-skip {record_number}] [-reindextrunksize {trunk_size}] [-appuid {APP_UID}]\n" .
" Where \n". " Where \n".
" reindexall : reindex all the database. \n" . " reindexall : reindex all the database. \n" .
" reindexmissing: reindex only the missing records stored in database. \n". " reindexmissing: reindex only the missing records stored in database. \n".
" (records defined in APP_SOLR_QUEUE table are required)\n" . " (records defined in APP_SOLR_QUEUE table are required)\n" .
" optimizeindex: optimize the changes in the search index. (used to get faster results) \n" . " optimizeindex: optimize the changes in the search index. (used to get faster results) \n" .
" Optional Options: \n" . " Optional Options: \n" .
" -skip {record_number}: used to skip a number of records. \n ex: -skip 10000 //skips the first 10000 records. \n" . " -skip {record_number}: used to skip a number of records. \n ex: -skip 10000 //skips the first 10000 records. \n" .
" -reindextrunksize {trunk_size}: specify the number of records sent to index each time. \n ex: -reindextrunksize 100 //(default = 1000) \n Reduce the trunk if using big documents, and memory is not enough. \n"; " -reindextrunksize {trunk_size}: specify the number of records sent to index each time. \n ex: -reindextrunksize 100 //(default = 1000) \n Reduce the trunk if using big documents, and memory is not enough. \n";
if ( (count ($argv) < 3) || ((count ($argv) % 2) == 0) || if ( (count ($argv) < 3) || ((count ($argv) % 2) == 0) ||
($argv [2] != 'reindexall' && $argv [2] != 'reindexmissing' && $argv [2] != 'optimizeindex' && $argv [2] != 'reindexone')) { ($argv [2] != 'reindexall' && $argv [2] != 'reindexmissing' && $argv [2] != 'optimizeindex' && $argv [2] != 'reindexone')) {
print $commandLineSyntaxMsg; print $commandLineSyntaxMsg;
die (); die ();
} }
@@ -64,7 +64,7 @@ if(count ($argv) > 3) {
if($argv [$argNumber] == '-appuid') { if($argv [$argNumber] == '-appuid') {
//use skip option //use skip option
$appUid = $argv [$argNumber + 1]; $appUid = $argv [$argNumber + 1];
} }
} }
else { else {
print $commandLineSyntaxMsg; print $commandLineSyntaxMsg;
@@ -98,13 +98,13 @@ if (! defined ('PATH_HOME')) {
array_pop ($docuroot); array_pop ($docuroot);
$pathOutTrunk = implode (PATH_SEP, $docuroot) . PATH_SEP; $pathOutTrunk = implode (PATH_SEP, $docuroot) . PATH_SEP;
// to do: check previous algorith for Windows $pathTrunk = "c:/home/"; // to do: check previous algorith for Windows $pathTrunk = "c:/home/";
define ('PATH_HOME', $pathhome); define ('PATH_HOME', $pathhome);
define ('PATH_TRUNK', $pathTrunk); define ('PATH_TRUNK', $pathTrunk);
define ('PATH_OUTTRUNK', $pathOutTrunk); define ('PATH_OUTTRUNK', $pathOutTrunk);
require_once (PATH_HOME . 'engine' . PATH_SEP . 'config' . PATH_SEP . 'paths.php'); require_once (PATH_HOME . 'engine' . PATH_SEP . 'config' . PATH_SEP . 'paths.php');
G::LoadThirdParty ('pear/json', 'class.json'); G::LoadThirdParty ('pear/json', 'class.json');
G::LoadThirdParty ('smarty/libs', 'Smarty.class'); G::LoadThirdParty ('smarty/libs', 'Smarty.class');
G::LoadSystem ('error'); G::LoadSystem ('error');
@@ -129,10 +129,23 @@ if (! defined ('PATH_HOME')) {
require_once ("creole/Creole.php"); require_once ("creole/Creole.php");
} }
require_once 'classes/model/AppDelegation.php'; if (file_exists(PATH_HOME . "engine" . PATH_SEP . "config" . PATH_SEP . "paths_installed.php")) {
require_once 'classes/model/Event.php'; require_once (PATH_HOME . "engine" . PATH_SEP . "config" . PATH_SEP . "paths_installed.php");
require_once 'classes/model/AppEvent.php'; }
require_once 'classes/model/CaseScheduler.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'); // G::loadClass('pmScript');
// //default values // //default values
@@ -158,36 +171,36 @@ if (! defined ('SYS_SYS')) {
$sObject = $workspaceName; $sObject = $workspaceName;
$sNow = ''; // $argv[2]; $sNow = ''; // $argv[2];
$sFilter = ''; $sFilter = '';
for ($i = 3; $i < count ($argv); $i++) { for ($i = 3; $i < count ($argv); $i++) {
$sFilter .= ' ' . $argv [$i]; $sFilter .= ' ' . $argv [$i];
} }
$oDirectory = dir (PATH_DB); $oDirectory = dir (PATH_DB);
if (is_dir (PATH_DB . $sObject)) { if (is_dir (PATH_DB . $sObject)) {
saveLog ('main', 'action', "checking folder " . PATH_DB . $sObject); saveLog ('main', 'action', "checking folder " . PATH_DB . $sObject);
if (file_exists (PATH_DB . $sObject . PATH_SEP . 'db.php')) { if (file_exists (PATH_DB . $sObject . PATH_SEP . 'db.php')) {
define ('SYS_SYS', $sObject); define ('SYS_SYS', $sObject);
// **************************************** // ****************************************
// read initialize file // 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); $config = System::getSystemConfiguration ('', '', SYS_SYS);
define ('MEMCACHED_ENABLED', $config ['memcached']); define ('MEMCACHED_ENABLED', $config ['memcached']);
define ('MEMCACHED_SERVER', $config ['memcached_server']); define ('MEMCACHED_SERVER', $config ['memcached_server']);
define ('TIME_ZONE', $config ['time_zone']); define ('TIME_ZONE', $config ['time_zone']);
date_default_timezone_set (TIME_ZONE); date_default_timezone_set (TIME_ZONE);
print "TIME_ZONE: " . TIME_ZONE . "\n"; print "TIME_ZONE: " . TIME_ZONE . "\n";
print "MEMCACHED_ENABLED: " . MEMCACHED_ENABLED . "\n"; print "MEMCACHED_ENABLED: " . MEMCACHED_ENABLED . "\n";
print "MEMCACHED_SERVER: " . MEMCACHED_SERVER . "\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_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.php');
// ***************** PM Paths DATA ************************** // ***************** PM Paths DATA **************************
define ('PATH_DATA_SITE', PATH_DATA . 'sites/' . SYS_SYS . '/'); define ('PATH_DATA_SITE', PATH_DATA . 'sites/' . SYS_SYS . '/');
define ('PATH_DOCUMENT', PATH_DATA_SITE . 'files/'); define ('PATH_DOCUMENT', PATH_DATA_SITE . 'files/');
@@ -197,7 +210,7 @@ if (! defined ('SYS_SYS')) {
define ('PATH_DYNAFORM', PATH_DATA_SITE . 'xmlForms/'); define ('PATH_DYNAFORM', PATH_DATA_SITE . 'xmlForms/');
define ('PATH_IMAGES_ENVIRONMENT_FILES', PATH_DATA_SITE . 'usersFiles' . PATH_SEP); define ('PATH_IMAGES_ENVIRONMENT_FILES', PATH_DATA_SITE . 'usersFiles' . PATH_SEP);
define ('PATH_IMAGES_ENVIRONMENT_USERS', PATH_DATA_SITE . 'usersPhotographies' . PATH_SEP); define ('PATH_IMAGES_ENVIRONMENT_USERS', PATH_DATA_SITE . 'usersPhotographies' . PATH_SEP);
// server info file // server info file
if (is_file (PATH_DATA_SITE . PATH_SEP . '.server_info')) { if (is_file (PATH_DATA_SITE . PATH_SEP . '.server_info')) {
$SERVER_INFO = file_get_contents (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 { else {
eprintln ("WARNING! No server info found!", 'red'); eprintln ("WARNING! No server info found!", 'red');
} }
// read db configuration // read db configuration
$sContent = file_get_contents (PATH_DB . $sObject . PATH_SEP . 'db.php'); $sContent = file_get_contents (PATH_DB . $sObject . PATH_SEP . 'db.php');
$sContent = str_replace ('<?php', '', $sContent); $sContent = str_replace ('<?php', '', $sContent);
$sContent = str_replace ('<?', '', $sContent); $sContent = str_replace ('<?', '', $sContent);
$sContent = str_replace ('?>', '', $sContent); $sContent = str_replace ('?>', '', $sContent);
@@ -220,7 +233,7 @@ if (! defined ('SYS_SYS')) {
$sContent = str_replace ("('", "$", $sContent); $sContent = str_replace ("('", "$", $sContent);
$sContent = str_replace ("',", '=', $sContent); $sContent = str_replace ("',", '=', $sContent);
$sContent = str_replace (");", ';', $sContent); $sContent = str_replace (");", ';', $sContent);
eval ($sContent); eval ($sContent);
$dsn = $DB_ADAPTER . '://' . $DB_USER . ':' . $DB_PASS . '@' . $DB_HOST . '/' . $DB_NAME; $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; $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); fclose ($oFile);
Propel::init (PATH_CORE . 'config/_databases_.php'); Propel::init (PATH_CORE . 'config/_databases_.php');
// Creole::registerDriver('dbarray', 'creole.contrib.DBArrayConnection'); // Creole::registerDriver('dbarray', 'creole.contrib.DBArrayConnection');
eprintln ("Processing workspace: " . $sObject, 'green'); eprintln ("Processing workspace: " . $sObject, 'green');
try { try {
processWorkspace (); processWorkspace ();
@@ -282,16 +295,16 @@ function processWorkspace()
global $SkipRecords; global $SkipRecords;
global $TrunkSize; global $TrunkSize;
global $appUid; global $appUid;
try { try {
if (($solrConf = System::solrEnv (SYS_SYS)) !== false) { if (($solrConf = System::solrEnv (SYS_SYS)) !== false) {
G::LoadClass ('AppSolr'); G::LoadClass ('AppSolr');
print "Solr Configuration file: " . PATH_DATA_SITE . "env.ini\n"; print "Solr Configuration file: " . PATH_DATA_SITE . "env.ini\n";
print "solr_enabled: " . $solrConf ['solr_enabled'] . "\n"; print "solr_enabled: " . $solrConf ['solr_enabled'] . "\n";
print "solr_host: " . $solrConf ['solr_host'] . "\n"; print "solr_host: " . $solrConf ['solr_host'] . "\n";
print "solr_instance: " . $solrConf ['solr_instance'] . "\n"; print "solr_instance: " . $solrConf ['solr_instance'] . "\n";
$oAppSolr = new AppSolr ($solrConf ['solr_enabled'], $solrConf ['solr_host'], $solrConf ['solr_instance']); $oAppSolr = new AppSolr ($solrConf ['solr_enabled'], $solrConf ['solr_host'], $solrConf ['solr_instance']);
if ($ScriptAction == "reindexall") { if ($ScriptAction == "reindexall") {
$oAppSolr->reindexAllApplications ($SkipRecords, $TrunkSize); $oAppSolr->reindexAllApplications ($SkipRecords, $TrunkSize);
@@ -312,7 +325,7 @@ function processWorkspace()
else { else {
print "Incomplete Solr configuration. See configuration file: " . PATH_DATA_SITE . "env.ini"; print "Incomplete Solr configuration. See configuration file: " . PATH_DATA_SITE . "env.ini";
} }
} }
catch (Exception $oError) { catch (Exception $oError) {
saveLog ("main", "error", "Error processing workspace : " . $oError->getMessage () . "\n"); saveLog ("main", "error", "Error processing workspace : " . $oError->getMessage () . "\n");
@@ -326,7 +339,7 @@ function saveLog($sSource, $sType, $sDescription)
if ($isDebug) if ($isDebug)
print date ('H:i:s') . " ($sSource) $sType $sDescription <br>\n"; print date ('H:i:s') . " ($sSource) $sType $sDescription <br>\n";
@fwrite ($oFile, date ('Y-m-d H:i:s') . '(' . $sSource . ') ' . $sDescription . "\n"); @fwrite ($oFile, date ('Y-m-d H:i:s') . '(' . $sSource . ') ' . $sDescription . "\n");
G::verifyPath (PATH_DATA . 'log' . PATH_SEP, true); G::verifyPath (PATH_DATA . 'log' . PATH_SEP, true);
if ($sType == 'action') { if ($sType == 'action') {
$oFile = @fopen (PATH_DATA . 'log' . PATH_SEP . 'cron.log', 'a+'); $oFile = @fopen (PATH_DATA . 'log' . PATH_SEP . 'cron.log', 'a+');
@@ -347,7 +360,7 @@ function setExecutionMessage($m)
$len = strlen ($m); $len = strlen ($m);
$linesize = 60; $linesize = 60;
$rOffset = $linesize - $len; $rOffset = $linesize - $len;
eprint ("* $m"); eprint ("* $m");
for ($i = 0; $i < $rOffset; $i++) for ($i = 0; $i < $rOffset; $i++)
eprint ('.'); eprint ('.');
@@ -362,3 +375,4 @@ function setExecutionResultMessage($m, $t = '')
$c = 'yellow'; $c = 'yellow';
eprintln ("[$m]", $c); eprintln ("[$m]", $c);
} }

View File

@@ -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 * @return boolean true:enabled functionality, false:disabled functionality
*/ */
public function isSolrEnabled () 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 // 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 // create pagination data
$solrSearchText = null; $solrSearchText = null;
$sortableCols = array (); $sortableCols = array ();
@@ -487,28 +504,28 @@ class AppSolr
switch ($sort) { switch ($sort) {
case 'APP_CACHE_VIEW.APP_NUMBER': case 'APP_CACHE_VIEW.APP_NUMBER':
case 'APP_NUMBER': case 'APP_NUMBER':
$sortCols[0] = 4; $sortCols[0] = 1; //4;
$sortableCols[0] = 'true'; $sortableCols[0] = 'true';
$sortDir[0] = $dir; $sortDir[0] = $dir;
break; break;
// multivalue field can't be ordered // multivalue field can't be ordered
case 'APP_TITLE': case 'APP_TITLE':
$sortCols[0] = 10; $sortCols[0] = 4; //10;
$sortableCols[0] = 'true'; $sortableCols[0] = 'true';
$sortDir[0] = $dir; $sortDir[0] = $dir;
break; break;
case 'APP_PRO_TITLE': case 'APP_PRO_TITLE':
$sortCols[0] = 6; $sortCols[0] = 2; //6;
$sortableCols[0] = 'true'; $sortableCols[0] = 'true';
$sortDir[0] = $dir; $sortDir[0] = $dir;
break; break;
case 'APP_UPDATE_DATE': case 'APP_UPDATE_DATE':
$sortCols[0] = 12; $sortCols[0] = 6; //12;
$sortableCols[0] = 'true'; $sortableCols[0] = 'true';
$sortDir[0] = $dir; $sortDir[0] = $dir;
break; break;
default: default:
$sortCols[0] = 4; $sortCols[0] = 1; //4;
$sortableCols[0] = 'true'; $sortableCols[0] = 'true';
$sortDir[0] = 'desc'; $sortDir[0] = 'desc';
break; break;
@@ -657,27 +674,39 @@ class AppSolr
$solrSearchText .= "(" . $search . ")"; $solrSearchText .= "(" . $search . ")";
} }
} }
// add del_index dynamic fields to list of resulting columns // add del_index dynamic fields to list of resulting columns
// the fields begin in the 30th column and more $columsToIncludeFinal = array();
$columsToInclude = array_merge( $columsToInclude, $delegationIndexes ); $columsToIncludeFinal = array_merge($columsToInclude, $delegationIndexes);
// if is a counter no records are returned // if is a counter no records are returned
if ($doCount) { if ($doCount) {
$start = 0; $start = 0;
$limit = 0; $limit = 0;
$numSortingCols = 0; $numSortingCols = 0;
$columsToInclude = array (); $columsToIncludeFinal = array();
} }
$data = array ('workspace' => $this->_solrInstance, // solr instance $data = array(
'startAfter' => intval( $start ),'pageSize' => intval( $limit ),'searchText' => $solrSearchText,'filterText' => '', // $filter, //ex:'field1:value1,field2:[value2.1 "workspace" => $this->_solrInstance, // solr instance
// TO value2.2],field3:value3' "startAfter" => intval($start),
'numSortingCols' => $numSortingCols,'sortableCols' => $sortableCols,'sortCols' => $sortCols,'sortDir' => $sortDir,'includeCols' => $columsToInclude,'resultFormat' => 'json' "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 ); $solrRequestData = Entity_SolrRequestData::createForRequestPagination( $data );
// use search index to return list of cases // use search index to return list of cases
$searchIndex = new BpmnEngine_Services_SearchIndex( $this->_solrIsEnabled, $this->_solrHost ); $searchIndex = new BpmnEngine_Services_SearchIndex( $this->_solrIsEnabled, $this->_solrHost );
// execute query // execute query
$solrQueryResult = $searchIndex->getDataTablePaginatedList( $solrRequestData ); $solrQueryResult = $searchIndex->getDataTablePaginatedList( $solrRequestData );
@@ -702,10 +731,10 @@ class AppSolr
// number of found records // number of found records
$result['totalCount'] = $solrQueryResult->iTotalDisplayRecords; $result['totalCount'] = $solrQueryResult->iTotalDisplayRecords;
//get all the data from database // get the missing data from database
$appUids = array (); $appUids = array ();
foreach ($solrQueryResult->aaData as $i => $data) { foreach ($solrQueryResult->aaData as $i => $data) {
$appUids[] = $data[11]; $appUids[] = $data["APP_UID"]; //APP_UID
} }
$aaappsDBData = $this->getListApplicationDelegationData($appUids, $action, $status); $aaappsDBData = $this->getListApplicationDelegationData($appUids, $action, $status);
@@ -713,18 +742,20 @@ class AppSolr
if ($this->debug) { if ($this->debug) {
$this->afterDbQueryTime = microtime( true ); $this->afterDbQueryTime = microtime( true );
} }
// complete the missing data to display it in the grid. // complete the missing data to display it in the grid.
$delIndexes = array (); //store all the delegation indexes $delIndexes = array (); //store all the delegation indexes
foreach ($solrQueryResult->aaData as $i => $data) { foreach ($solrQueryResult->aaData as $i => $data) {
//initialize array //initialize array
$delIndexes = array (); $delIndexes = array ();
// complete empty values // complete empty values
$appUID = $data[11]; $appUID = $data["APP_UID"]; //APP_UID
//get all the delindexes //get all the delindexes
for ($i = 30; $i < count( $data ); $i ++) { for ($i = count($columsToInclude); $i <= count($data) - 1; $i++) {
if (is_array( $data[$i] )) { if (is_array($data[$columsToIncludeFinal[$i]])) {
foreach ($data[$i] as $delIndex) { foreach ($data[$columsToIncludeFinal[$i]] as $delIndex) {
$delIndexes[] = $delIndex; $delIndexes[] = $delIndex;
} }
} }
@@ -756,7 +787,15 @@ class AppSolr
$arrayRowAux = array(); $arrayRowAux = array();
foreach ($resultColumns as $j => $columnName) { 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 //Remove duplicated
@@ -773,11 +812,11 @@ class AppSolr
$aRow = $arrayRowAux; $aRow = $arrayRowAux;
// convert date from solr format UTC to local time in MySQL format // 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 ) ); $localDate = date( 'Y-m-d H:i:s', strtotime( $solrdate ) );
$aRow['APP_CREATE_DATE'] = $localDate; $aRow['APP_CREATE_DATE'] = $localDate;
$solrdate = $data[12]; $solrdate = $data["DEL_LAST_UPDATE_DATE"];
$localDate = date( 'Y-m-d H:i:s', strtotime( $solrdate ) ); $localDate = date( 'Y-m-d H:i:s', strtotime( $solrdate ) );
$aRow['APP_UPDATE_DATE'] = $localDate; $aRow['APP_UPDATE_DATE'] = $localDate;
@@ -940,11 +979,11 @@ class AppSolr
$c->addSelectColumn( AppDelegationPeer::DEL_THREAD_STATUS ); $c->addSelectColumn( AppDelegationPeer::DEL_THREAD_STATUS );
$c->addSelectColumn( AppDelegationPeer::TAS_UID ); $c->addSelectColumn( AppDelegationPeer::TAS_UID );
$c->addAlias("u", "USERS"); $c->addAlias("u", UsersPeer::TABLE_NAME);
$c->addAlias("uprev", "USERS"); $c->addAlias("uprev", UsersPeer::TABLE_NAME);
$c->addAlias("adprev", "APP_DELEGATION"); $c->addAlias("adprev", AppDelegationPeer::TABLE_NAME);
$c->addAlias("ctastitle", "CONTENT"); $c->addAlias("ctastitle", ContentPeer::TABLE_NAME);
$c->addAlias("at", "APP_THREAD"); $c->addAlias("at", AppThreadPeer::TABLE_NAME);
$arrayCondition = array(); $arrayCondition = array();
$arrayCondition[] = array(AppDelegationPeer::APP_UID, ApplicationPeer::APP_UID); $arrayCondition[] = array(AppDelegationPeer::APP_UID, ApplicationPeer::APP_UID);
@@ -1106,11 +1145,11 @@ class AppSolr
$c->addSelectColumn( AppDelegationPeer::DEL_THREAD_STATUS ); $c->addSelectColumn( AppDelegationPeer::DEL_THREAD_STATUS );
$c->addSelectColumn( AppDelegationPeer::TAS_UID ); $c->addSelectColumn( AppDelegationPeer::TAS_UID );
$c->addAlias( 'u', 'USERS' ); $c->addAlias("u", UsersPeer::TABLE_NAME);
$c->addAlias( 'uprev', 'USERS' ); $c->addAlias("uprev", UsersPeer::TABLE_NAME);
$c->addAlias( 'adprev', 'APP_DELEGATION' ); $c->addAlias("adprev", AppDelegationPeer::TABLE_NAME);
$c->addAlias( 'ctastitle', 'CONTENT' ); $c->addAlias("ctastitle", ContentPeer::TABLE_NAME);
$c->addAlias( 'at', 'APP_THREAD' ); $c->addAlias("at", AppThreadPeer::TABLE_NAME);
$aConditions = array (); $aConditions = array ();
$aConditions[] = array (AppDelegationPeer::USR_UID,'u.USR_UID' $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, * @param array $aaAPPUIDs Array of arrays of App_UID that must be updated,
* APP_UID is permitted also * APP_UID is permitted also
*/ */
public function updateApplicationSearchIndex ($aaAPPUIDs) public function updateApplicationSearchIndex($aaAPPUIDs, $saveDBRecord = true)
{ {
if (empty( $aaAPPUIDs )) { if (empty( $aaAPPUIDs )) {
return; return;
@@ -1392,20 +1431,29 @@ class AppSolr
$aaAPPUIDs[] = array ('APP_UID' => $APPUID $aaAPPUIDs[] = array ('APP_UID' => $APPUID
); );
} }
// check if index server is available
if (! $this->isSolrEnabled()) { //Check if index server is available
// store update in table and return if ($saveDBRecord) {
foreach ($aaAPPUIDs as $aAPPUID) { if ($this->isSolrEnabled()) {
$this->applicationChangedUpdateSolrQueue( $aAPPUID['APP_UID'], true ); //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) { if ($this->debug) {
$this->getApplicationDataDBTime = 0; $this->getApplicationDataDBTime = 0;
$this->getPreparedApplicationDataDBTime = 0; $this->getPreparedApplicationDataDBTime = 0;
$this->getBuilXMLDocTime = 0; $this->getBuilXMLDocTime = 0;
$this->afterUpdateSolrXMLDocTime = 0;
$this->beforeCreateSolrXMLDocTime = microtime( true ); $this->beforeCreateSolrXMLDocTime = microtime( true );
} }
// create XML document // create XML document
@@ -1448,13 +1496,13 @@ class AppSolr
$this->totalTimeAcumulated += ($this->afterUpdateSolrXMLDocTime - $this->beforeCreateSolrXMLDocTime); $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) //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->trunkSizeAcumulated,
$this->totalTimeAcumulated, $this->totalTimeAcumulated,
$this->getApplicationDataDBTime, $this->getApplicationDataDBTime,
$this->getPreparedApplicationDataDBTime, $this->getPreparedApplicationDataDBTime,
$this->getBuilXMLDocTime, $this->getBuilXMLDocTime,
($this->afterCreateSolrXMLDocTime - $this->beforeCreateSolrXMLDocTime), ($this->afterCreateSolrXMLDocTime - $this->beforeCreateSolrXMLDocTime),
($this->afterUpdateSolrXMLDocTime - $this->afterCreateSolrXMLDocTime), ($this->afterUpdateSolrXMLDocTime - $this->afterCreateSolrXMLDocTime),
($this->afterUpdateSolrXMLDocTime - $this->beforeCreateSolrXMLDocTime) ($this->afterUpdateSolrXMLDocTime - $this->beforeCreateSolrXMLDocTime)
)); ));
@@ -1476,17 +1524,18 @@ class AppSolr
* *
* @param string $appUID Application identifier * @param string $appUID Application identifier
*/ */
public function deleteApplicationSearchIndex ($appUID) public function deleteApplicationSearchIndex($appUID, $saveDBRecord = true)
{ {
if (empty( $appUID )) { if (empty( $appUID )) {
return; return;
} }
// check if index server is available // check if index server is available
if (! $this->_solrIsEnabled) { if ($saveDBRecord) {
// store update in table and return // store update in table and return
$this->applicationChangedUpdateSolrQueue( $appUID['APP_UID'], 2 ); // delete $this->applicationChangedUpdateSolrQueue( $appUID['APP_UID'], 2 ); // delete
return;
//return;
} }
$idQuery = "APP_UID:" . $appUID; $idQuery = "APP_UID:" . $appUID;
@@ -1514,7 +1563,7 @@ class AppSolr
if ($this->debug) { if ($this->debug) {
$this->getApplicationDataDBTime = 0; $this->getApplicationDataDBTime = 0;
$this->getPreparedApplicationDataDBTime = 0; $this->getPreparedApplicationDataDBTime = 0;
$this->getBuilXMLDocTime = 0; $this->getBuilXMLDocTime = 0;
} }
// search data from DB // search data from DB
$xmlDoc = "<?xml version='1.0' encoding='UTF-8'?>\n"; $xmlDoc = "<?xml version='1.0' encoding='UTF-8'?>\n";
@@ -1531,7 +1580,7 @@ class AppSolr
$aaAllAppDelData = $this->getListApplicationUpdateDelegationData( $aAPPUIDs ); $aaAllAppDelData = $this->getListApplicationUpdateDelegationData( $aAPPUIDs );
if ($this->debug) { if ($this->debug) {
$this->afterGetApplicationDataDBTime = microtime (true); $this->afterGetApplicationDataDBTime = microtime (true);
$this->getApplicationDataDBTime = $this->afterGetApplicationDataDBTime - $this->beforeGetApplicationDataDBTime; $this->getApplicationDataDBTime = $this->afterGetApplicationDataDBTime - $this->beforeGetApplicationDataDBTime;
} }
foreach ($aaAPPUIDs as $aAPPUID) { foreach ($aaAPPUIDs as $aAPPUID) {
@@ -1553,10 +1602,10 @@ class AppSolr
$result = $this->getApplicationIndexData( $aAPPUID['APP_UID'], $aaAppData ); $result = $this->getApplicationIndexData( $aAPPUID['APP_UID'], $aaAppData );
if ($this->debug) { if ($this->debug) {
$this->afterPrepareApplicationDataDBTime = microtime (true); $this->afterPrepareApplicationDataDBTime = microtime (true);
$this->getPreparedApplicationDataDBTime += $this->afterPrepareApplicationDataDBTime - $this->beforePrepareApplicationDataDBTime; $this->getPreparedApplicationDataDBTime += $this->afterPrepareApplicationDataDBTime - $this->beforePrepareApplicationDataDBTime;
} }
} catch (ApplicationWithoutDelegationRecordsException $ex) { } catch (ApplicationWithoutDelegationRecordsException $ex) {
@@ -1617,8 +1666,8 @@ class AppSolr
if ($this->debug) { if ($this->debug) {
$this->afterBuilXMLDocTime = microtime (true); $this->afterBuilXMLDocTime = microtime (true);
$this->getBuilXMLDocTime += $this->afterBuilXMLDocTime - $this->afterPrepareApplicationDataDBTime; $this->getBuilXMLDocTime += $this->afterBuilXMLDocTime - $this->afterPrepareApplicationDataDBTime;
} }
} catch (ApplicationAPP_DATAUnserializeException $ex) { } catch (ApplicationAPP_DATAUnserializeException $ex) {
// exception trying to get application information // exception trying to get application information
@@ -1637,12 +1686,12 @@ class AppSolr
if($this->debugAppInfo) if($this->debugAppInfo)
{ {
$fh = fopen("SolrAPPUIDIndexSize.txt", 'a') or die("can't open file to store Solr index time."); $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))); // $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))); $documentInformation ['APP_NUMBER'], $aAPPUID['APP_UID'], strlen($xmlCurrentDoc)));
fclose($fh); fclose($fh);
} }
}//end foreach }//end foreach
@@ -2487,10 +2536,10 @@ class AppSolr
$c->addSelectColumn( 'at.APP_THREAD_PARENT' ); $c->addSelectColumn( 'at.APP_THREAD_PARENT' );
$c->addSelectColumn( 'at.APP_THREAD_STATUS' ); $c->addSelectColumn( 'at.APP_THREAD_STATUS' );
$c->addAlias( 'capp', 'CONTENT' ); $c->addAlias("capp", ContentPeer::TABLE_NAME);
$c->addAlias( 'cpro', 'CONTENT' ); $c->addAlias("cpro", ContentPeer::TABLE_NAME);
$c->addAlias( 'ad', 'APP_DELEGATION' ); $c->addAlias("ad", AppDelegationPeer::TABLE_NAME);
$c->addAlias( 'at', 'APP_THREAD' ); $c->addAlias("at", AppThreadPeer::TABLE_NAME);
$aConditions = array (); $aConditions = array ();
$aConditions[] = array (ApplicationPeer::APP_UID,'capp.CON_ID' $aConditions[] = array (ApplicationPeer::APP_UID,'capp.CON_ID'
@@ -2589,12 +2638,12 @@ class AppSolr
$c->addAsColumn("PRO_CATEGORY_UID", "pro.PRO_CATEGORY"); $c->addAsColumn("PRO_CATEGORY_UID", "pro.PRO_CATEGORY");
$c->addAlias("capp", "CONTENT"); $c->addAlias("capp", ContentPeer::TABLE_NAME);
$c->addAlias("cpro", "CONTENT"); $c->addAlias("cpro", ContentPeer::TABLE_NAME);
$c->addAlias("ad", "APP_DELEGATION"); $c->addAlias("ad", AppDelegationPeer::TABLE_NAME);
$c->addAlias("at", "APP_THREAD"); $c->addAlias("at", AppThreadPeer::TABLE_NAME);
$c->addAlias("appDely", "APP_DELAY"); $c->addAlias("appDely", AppDelayPeer::TABLE_NAME);
$c->addAlias("pro", "PROCESS"); $c->addAlias("pro", ProcessPeer::TABLE_NAME);
$arrayCondition = array(); $arrayCondition = array();
$arrayCondition[] = array(ApplicationPeer::APP_UID, "capp.CON_ID"); $arrayCondition[] = array(ApplicationPeer::APP_UID, "capp.CON_ID");
@@ -2720,9 +2769,25 @@ class AppSolr
*/ */
public function applicationChangedUpdateSolrQueue ($AppUid, $updated) public function applicationChangedUpdateSolrQueue ($AppUid, $updated)
{ {
$traceData = $this->getCurrentTraceInfo();
$oAppSolrQueue = new AppSolrQueue(); $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 () public function synchronizePendingApplications ()
{ {
if (!$this->isSolrEnabled()) {
throw new Exception("Error connecting to solr server.");
}
// check table of pending updates // check table of pending updates
$oAppSolrQueue = new AppSolrQueue(); $oAppSolrQueue = new AppSolrQueue();
@@ -2738,10 +2807,10 @@ class AppSolr
foreach ($aAppSolrQueue as $oAppSolrQueueEntity) { foreach ($aAppSolrQueue as $oAppSolrQueueEntity) {
// call the syncronization function // call the syncronization function
if ($oAppSolrQueueEntity->appUpdated == 1) { if ($oAppSolrQueueEntity->appUpdated == 1) {
$this->updateApplicationSearchIndex( $oAppSolrQueueEntity->appUid ); $this->updateApplicationSearchIndex($oAppSolrQueueEntity->appUid, false);
} }
if ($oAppSolrQueueEntity->appUpdated == 2) { if ($oAppSolrQueueEntity->appUpdated == 2) {
$this->deleteApplicationSearchIndex( $oAppSolrQueueEntity->appUid ); $this->deleteApplicationSearchIndex($oAppSolrQueueEntity->appUid, false);
} }
$this->applicationChangedUpdateSolrQueue( $oAppSolrQueueEntity->appUid, 0 ); $this->applicationChangedUpdateSolrQueue( $oAppSolrQueueEntity->appUid, 0 );
} }
@@ -2831,7 +2900,12 @@ class AppSolr
*/ */
public function reindexAllApplications ($SkipRecords = 0, $indexTrunkSize = 1000) public function reindexAllApplications ($SkipRecords = 0, $indexTrunkSize = 1000)
{ {
if (!$this->isSolrEnabled()) {
throw new Exception("Error connecting to solr server.");
}
$trunk = $indexTrunkSize; $trunk = $indexTrunkSize;
// delete all documents to begin reindex // delete all documents to begin reindex
// deleteAllDocuments(); // deleteAllDocuments();
// commitChanges(); // commitChanges();
@@ -2846,7 +2920,7 @@ class AppSolr
printf( "Indexing %d to %d \n", $skip, $skip + $trunk ); printf( "Indexing %d to %d \n", $skip, $skip + $trunk );
$initTimeDoc = microtime( true ); $initTimeDoc = microtime( true );
$this->updateApplicationSearchIndex( $aaAPPUIds ); $this->updateApplicationSearchIndex($aaAPPUIds, false);
$curTimeDoc = gmdate( 'H:i:s', (microtime( true ) - $initTimeDoc) ); $curTimeDoc = gmdate( 'H:i:s', (microtime( true ) - $initTimeDoc) );
printf( "Indexing document time: %s \n", $curTimeDoc ); printf( "Indexing document time: %s \n", $curTimeDoc );

View File

@@ -1,5 +1,4 @@
<?php <?php
/** /**
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2012 Colosa Inc.23 * Copyright (C) 2004 - 2012 Colosa Inc.23
@@ -60,13 +59,14 @@ class BpmnEngine_Services_SearchIndex
* *
* @param [out] bool true if index service is enabled false in other case * @param [out] bool true if index service is enabled false in other case
*/ */
public function isEnabled () public function isEnabled($workspace)
{ {
// require_once (ROOT_PATH . // require_once (ROOT_PATH .
// '/businessLogic/modules/SearchIndexAccess/Solr.php'); // '/businessLogic/modules/SearchIndexAccess/Solr.php');
require_once ('class.solr.php'); require_once ('class.solr.php');
$solr = new BpmnEngine_SearchIndexAccess_Solr( $this->_solrIsEnabled, $this->_solrHost ); $solr = new BpmnEngine_SearchIndexAccess_Solr( $this->_solrIsEnabled, $this->_solrHost );
return $solr->isEnabled();
return $solr->isEnabled($workspace);
} }
/** /**
@@ -394,9 +394,9 @@ class BpmnEngine_Services_SearchIndex
$data['aaData'][$i][] = ''; // placeholder $data['aaData'][$i][] = ''; // placeholder
} else { } else {
if (isset( $doc->$columnName )) { if (isset( $doc->$columnName )) {
$data['aaData'][$i][] = $doc->$columnName; $data["aaData"][$i][$columnName] = $doc->$columnName;
} else { } else {
$data['aaData'][$i][] = ''; $data["aaData"][$i][$columnName] = "";
} }
} }
} }
@@ -442,4 +442,5 @@ class BpmnEngine_Services_SearchIndex
return $listFields; return $listFields;
} }
} }

View File

@@ -1,5 +1,4 @@
<?php <?php
/** /**
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2012 Colosa Inc.23 * Copyright (C) 2004 - 2012 Colosa Inc.23
@@ -48,12 +47,22 @@ class BpmnEngine_SearchIndexAccess_Solr
* *
* @return bool * @return bool
*/ */
public function isEnabled () public function isEnabled($workspace)
{ {
// verify solr server response $resultServerStatus = false;
if ($this->_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; 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 * Delete all documents from index
* @gearman = false * @gearman = false
@@ -630,3 +698,4 @@ class BpmnEngine_SearchIndexAccess_Solr
return $responseSolr; return $responseSolr;
} }
} }

View File

@@ -6,7 +6,9 @@
*/ */
class Entity_AppSolrQueue extends Entity_Base class Entity_AppSolrQueue extends Entity_Base
{ {
public $appUid = ''; public $appUid = "";
public $appChangeDate = "";
public $appChangeTrace = "";
public $appUpdated = 0; public $appUpdated = 0;
private function __construct () private function __construct ()
@@ -26,7 +28,11 @@ class Entity_AppSolrQueue extends Entity_Base
$obj->initializeObject( $data ); $obj->initializeObject( $data );
$requiredFields = array ("appUid","appUpdated" $requiredFields = array(
"appUid",
"appChangeDate",
"appChangeTrace",
"appUpdated"
); );
$obj->validateRequiredFields( $requiredFields ); $obj->validateRequiredFields( $requiredFields );

View File

@@ -1,5 +1,4 @@
<?php <?php
//require_once 'classes/model/om/BaseAppSolrQueue.php'; //require_once 'classes/model/om/BaseAppSolrQueue.php';
//require_once 'classes/entities/AppSolrQueue.php'; //require_once 'classes/entities/AppSolrQueue.php';
@@ -31,7 +30,7 @@ class AppSolrQueue extends BaseAppSolrQueue
} }
} }
public function createUpdate ($sAppUid, $iUpdated) public function createUpdate($sAppUid, $sAppChangeTrace, $iUpdated)
{ {
$con = Propel::getConnection( AppSolrQueuePeer::DATABASE_NAME ); $con = Propel::getConnection( AppSolrQueuePeer::DATABASE_NAME );
try { try {
@@ -43,8 +42,10 @@ class AppSolrQueue extends BaseAppSolrQueue
//$this->fromArray($aFields,BasePeer::TYPE_FIELDNAME); //$this->fromArray($aFields,BasePeer::TYPE_FIELDNAME);
$this->setNew( false ); $this->setNew( false );
//set field //set field
$this->setAppUid( $sAppUid ); $this->setAppUid($sAppUid);
$this->setAppUpdated( $iUpdated ); $this->setAppChangeDate("now");
$this->setAppChangeTrace($sAppChangeTrace);
$this->setAppUpdated($iUpdated);
if ($this->validate()) { if ($this->validate()) {
$result = $this->save(); $result = $this->save();
} else { } else {
@@ -56,8 +57,10 @@ class AppSolrQueue extends BaseAppSolrQueue
} else { } else {
//create record //create record
//set values //set values
$this->setAppUid( $sAppUid ); $this->setAppUid($sAppUid);
$this->setAppUpdated( $iUpdated ); $this->setAppChangeDate("now");
$this->setAppChangeTrace($sAppChangeTrace);
$this->setAppUpdated($iUpdated);
if ($this->validate()) { if ($this->validate()) {
$result = $this->save(); $result = $this->save();
} else { } else {
@@ -84,8 +87,10 @@ class AppSolrQueue extends BaseAppSolrQueue
try { try {
$c = new Criteria(); $c = new Criteria();
$c->addSelectColumn( AppSolrQueuePeer::APP_UID ); $c->addSelectColumn(AppSolrQueuePeer::APP_UID);
$c->addSelectColumn( AppSolrQueuePeer::APP_UPDATED ); $c->addSelectColumn(AppSolrQueuePeer::APP_CHANGE_DATE);
$c->addSelectColumn(AppSolrQueuePeer::APP_CHANGE_TRACE);
$c->addSelectColumn(AppSolrQueuePeer::APP_UPDATED);
//"WHERE //"WHERE
$c->add( AppSolrQueuePeer::APP_UPDATED, 0, Criteria::NOT_EQUAL ); $c->add( AppSolrQueuePeer::APP_UPDATED, 0, Criteria::NOT_EQUAL );
@@ -98,8 +103,10 @@ class AppSolrQueue extends BaseAppSolrQueue
while (is_array( $row )) { while (is_array( $row )) {
$appSolrQueue = Entity_AppSolrQueue::createEmpty(); $appSolrQueue = Entity_AppSolrQueue::createEmpty();
$appSolrQueue->appUid = $row['APP_UID']; $appSolrQueue->appUid = $row["APP_UID"];
$appSolrQueue->appUpdated = $row['APP_UPDATED']; $appSolrQueue->appChangeDate = $row["APP_CHANGE_DATE"];
$appSolrQueue->appChangeTrace = $row["APP_CHANGE_TRACE"];
$appSolrQueue->appUpdated = $row["APP_UPDATED"];
$updatedApplications[] = $appSolrQueue; $updatedApplications[] = $appSolrQueue;
$rs->next(); $rs->next();
$row = $rs->getRow(); $row = $rs->getRow();

View File

@@ -67,6 +67,10 @@ class AppSolrQueueMapBuilder
$tMap->addPrimaryKey('APP_UID', 'AppUid', 'string', CreoleTypes::VARCHAR, true, 32); $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); $tMap->addColumn('APP_UPDATED', 'AppUpdated', 'int', CreoleTypes::TINYINT, true, null);
} // doBuild() } // doBuild()

View File

@@ -33,6 +33,18 @@ abstract class BaseAppSolrQueue extends BaseObject implements Persistent
*/ */
protected $app_uid = ''; 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. * The value for the app_updated field.
* @var int * @var int
@@ -64,6 +76,49 @@ abstract class BaseAppSolrQueue extends BaseObject implements Persistent
return $this->app_uid; 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. * Get the [app_updated] column value.
* *
@@ -97,6 +152,53 @@ abstract class BaseAppSolrQueue extends BaseObject implements Persistent
} // setAppUid() } // 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. * 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_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->resetModified();
$this->setNew(false); $this->setNew(false);
// FIXME - using NUM_COLUMNS may be clearer. // 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) { } catch (Exception $e) {
throw new PropelException("Error populating AppSolrQueue object", $e); throw new PropelException("Error populating AppSolrQueue object", $e);
@@ -353,6 +459,12 @@ abstract class BaseAppSolrQueue extends BaseObject implements Persistent
return $this->getAppUid(); return $this->getAppUid();
break; break;
case 1: case 1:
return $this->getAppChangeDate();
break;
case 2:
return $this->getAppChangeTrace();
break;
case 3:
return $this->getAppUpdated(); return $this->getAppUpdated();
break; break;
default: default:
@@ -376,7 +488,9 @@ abstract class BaseAppSolrQueue extends BaseObject implements Persistent
$keys = AppSolrQueuePeer::getFieldNames($keyType); $keys = AppSolrQueuePeer::getFieldNames($keyType);
$result = array( $result = array(
$keys[0] => $this->getAppUid(), $keys[0] => $this->getAppUid(),
$keys[1] => $this->getAppUpdated(), $keys[1] => $this->getAppChangeDate(),
$keys[2] => $this->getAppChangeTrace(),
$keys[3] => $this->getAppUpdated(),
); );
return $result; return $result;
} }
@@ -412,6 +526,12 @@ abstract class BaseAppSolrQueue extends BaseObject implements Persistent
$this->setAppUid($value); $this->setAppUid($value);
break; break;
case 1: case 1:
$this->setAppChangeDate($value);
break;
case 2:
$this->setAppChangeTrace($value);
break;
case 3:
$this->setAppUpdated($value); $this->setAppUpdated($value);
break; break;
} // switch() } // switch()
@@ -442,7 +562,15 @@ abstract class BaseAppSolrQueue extends BaseObject implements Persistent
} }
if (array_key_exists($keys[1], $arr)) { 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); $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)) { if ($this->isColumnModified(AppSolrQueuePeer::APP_UPDATED)) {
$criteria->add(AppSolrQueuePeer::APP_UPDATED, $this->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) public function copyInto($copyObj, $deepCopy = false)
{ {
$copyObj->setAppChangeDate($this->app_change_date);
$copyObj->setAppChangeTrace($this->app_change_trace);
$copyObj->setAppUpdated($this->app_updated); $copyObj->setAppUpdated($this->app_updated);

View File

@@ -25,7 +25,7 @@ abstract class BaseAppSolrQueuePeer
const CLASS_DEFAULT = 'classes.model.AppSolrQueue'; const CLASS_DEFAULT = 'classes.model.AppSolrQueue';
/** The total number of columns. */ /** The total number of columns. */
const NUM_COLUMNS = 2; const NUM_COLUMNS = 4;
/** The number of lazy-loaded columns. */ /** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0; const NUM_LAZY_LOAD_COLUMNS = 0;
@@ -34,6 +34,12 @@ abstract class BaseAppSolrQueuePeer
/** the column name for the APP_UID field */ /** the column name for the APP_UID field */
const APP_UID = 'APP_SOLR_QUEUE.APP_UID'; 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 */ /** the column name for the APP_UPDATED field */
const APP_UPDATED = 'APP_SOLR_QUEUE.APP_UPDATED'; const APP_UPDATED = 'APP_SOLR_QUEUE.APP_UPDATED';
@@ -48,10 +54,10 @@ abstract class BaseAppSolrQueuePeer
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/ */
private static $fieldNames = array ( private static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('AppUid', 'AppUpdated', ), BasePeer::TYPE_PHPNAME => array ('AppUid', 'AppChangeDate', 'AppChangeTrace', 'AppUpdated', ),
BasePeer::TYPE_COLNAME => array (AppSolrQueuePeer::APP_UID, AppSolrQueuePeer::APP_UPDATED, ), 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_UPDATED', ), BasePeer::TYPE_FIELDNAME => array ('APP_UID', 'APP_CHANGE_DATE', 'APP_CHANGE_TRACE', 'APP_UPDATED', ),
BasePeer::TYPE_NUM => array (0, 1, ) BasePeer::TYPE_NUM => array (0, 1, 2, 3, )
); );
/** /**
@@ -61,10 +67,10 @@ abstract class BaseAppSolrQueuePeer
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/ */
private static $fieldKeys = array ( private static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('AppUid' => 0, 'AppUpdated' => 1, ), BasePeer::TYPE_PHPNAME => array ('AppUid' => 0, 'AppChangeDate' => 1, 'AppChangeTrace' => 2, 'AppUpdated' => 3, ),
BasePeer::TYPE_COLNAME => array (AppSolrQueuePeer::APP_UID => 0, AppSolrQueuePeer::APP_UPDATED => 1, ), 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_UPDATED' => 1, ), BasePeer::TYPE_FIELDNAME => array ('APP_UID' => 0, 'APP_CHANGE_DATE' => 1, 'APP_CHANGE_TRACE' => 2, 'APP_UPDATED' => 3, ),
BasePeer::TYPE_NUM => array (0, 1, ) BasePeer::TYPE_NUM => array (0, 1, 2, 3, )
); );
/** /**
@@ -167,6 +173,10 @@ abstract class BaseAppSolrQueuePeer
$criteria->addSelectColumn(AppSolrQueuePeer::APP_UID); $criteria->addSelectColumn(AppSolrQueuePeer::APP_UID);
$criteria->addSelectColumn(AppSolrQueuePeer::APP_CHANGE_DATE);
$criteria->addSelectColumn(AppSolrQueuePeer::APP_CHANGE_TRACE);
$criteria->addSelectColumn(AppSolrQueuePeer::APP_UPDATED); $criteria->addSelectColumn(AppSolrQueuePeer::APP_UPDATED);
} }

View File

@@ -2940,6 +2940,8 @@
<parameter name="Comment" value="APP_SOLR_QUEUE"/> <parameter name="Comment" value="APP_SOLR_QUEUE"/>
</vendor> </vendor>
<column name="APP_UID" type="VARCHAR" size="32" required="true" primaryKey="true" default=""/> <column name="APP_UID" type="VARCHAR" size="32" required="true" primaryKey="true" default=""/>
<column name="APP_CHANGE_DATE" type="TIMESTAMP" required="true" />
<column name="APP_CHANGE_TRACE" type="VARCHAR" size="500" required="true" />
<column name="APP_UPDATED" type="TINYINT" required="true" default="1"/> <column name="APP_UPDATED" type="TINYINT" required="true" default="1"/>
</table> </table>
</database> </database>

View File

@@ -3164,6 +3164,8 @@ END
CREATE TABLE [APP_SOLR_QUEUE] CREATE TABLE [APP_SOLR_QUEUE]
( (
[APP_UID] VARCHAR(32) default '' NOT NULL, [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, [APP_UPDATED] TINYINT default 1 NOT NULL,
CONSTRAINT APP_SOLR_QUEUE_PK PRIMARY KEY ([APP_UID]) CONSTRAINT APP_SOLR_QUEUE_PK PRIMARY KEY ([APP_UID])
); );

View File

@@ -1432,6 +1432,8 @@ DROP TABLE IF EXISTS `APP_SOLR_QUEUE`;
CREATE TABLE `APP_SOLR_QUEUE` CREATE TABLE `APP_SOLR_QUEUE`
( (
`APP_UID` VARCHAR(32) default '' NOT NULL, `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, `APP_UPDATED` TINYINT default 1 NOT NULL,
PRIMARY KEY (`APP_UID`) PRIMARY KEY (`APP_UID`)
)ENGINE=MyISAM DEFAULT CHARSET='utf8' COMMENT='APP_SOLR_QUEUE'; )ENGINE=MyISAM DEFAULT CHARSET='utf8' COMMENT='APP_SOLR_QUEUE';

View File

@@ -175,11 +175,20 @@ function getAllCounters ()
$aTypes['selfservice'] = 'CASES_SELFSERVICE'; $aTypes['selfservice'] = 'CASES_SELFSERVICE';
//$aTypes['to_revise'] = 'CASES_TO_REVISE'; //$aTypes['to_revise'] = 'CASES_TO_REVISE';
//$aTypes['to_reassign'] = 'CASES_TO_REASSIGN'; //$aTypes['to_reassign'] = 'CASES_TO_REASSIGN';
$solrEnabled = false;
if ((($solrConf = System::solrEnv()) !== false)) { if ((($solrConf = System::solrEnv()) !== false)) {
G::LoadClass( 'AppSolr' ); G::LoadClass( 'AppSolr' );
$ApplicationSolrIndex = new AppSolr( $solrConf['solr_enabled'], $solrConf['solr_host'], $solrConf['solr_instance'] ); $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 ); $aCount = $ApplicationSolrIndex->getCasesCount( $userUid );
//get paused count //get paused count

View File

@@ -19,6 +19,7 @@ $dateTo = isset( $_POST["dateTo"] ) ? substr( $_POST["dateTo"], 0, 10 ) : "";
try { try {
$userUid = (isset($_SESSION["USER_LOGGED"]) && $_SESSION["USER_LOGGED"] != "")? $_SESSION["USER_LOGGED"] : null; $userUid = (isset($_SESSION["USER_LOGGED"]) && $_SESSION["USER_LOGGED"] != "")? $_SESSION["USER_LOGGED"] : null;
$result = ""; $result = "";
$solrEnabled = false;
switch ($action) { switch ($action) {
case "search": case "search":
@@ -44,6 +45,16 @@ try {
$solrConf["solr_instance"] $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( $data = $ApplicationSolrIndex->getAppGridData(
$userUid, $userUid,
$start, $start,

View File

@@ -422,9 +422,6 @@ Bootstrap::registerClass('Controller', PATH_GULLIVER . "class.controlle
Bootstrap::registerClass('HttpProxyController', PATH_GULLIVER . "class.httpProxyController.php"); Bootstrap::registerClass('HttpProxyController', PATH_GULLIVER . "class.httpProxyController.php");
Bootstrap::registerClass('templatePower', PATH_GULLIVER . "class.templatePower.php"); Bootstrap::registerClass('templatePower', PATH_GULLIVER . "class.templatePower.php");
Bootstrap::registerClass('XmlForm_Field_SimpleText', PATH_GULLIVER . "class.xmlformExtension.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('Groups', PATH_HOME . "engine/classes/class.groups.php");
Bootstrap::registerClass('Tasks', PATH_HOME . "engine/classes/class.tasks.php"); Bootstrap::registerClass('Tasks', PATH_HOME . "engine/classes/class.tasks.php");
Bootstrap::registerClass('Calendar', PATH_HOME . "engine/classes/class.calendar.php"); Bootstrap::registerClass('Calendar', PATH_HOME . "engine/classes/class.calendar.php");