BUG 0000 Support for php 5.2 in Solr implementation
Add support for php 5.2 in Solr implementation: - Exception function has two parameters - use of function call_user_func
This commit is contained in:
@@ -53,7 +53,7 @@ if (! defined ( 'PATH_HOME' )) {
|
||||
G::LoadSystem ( 'dvEditor' );
|
||||
G::LoadSystem ( 'table' );
|
||||
G::LoadSystem ( 'pagedTable' );
|
||||
G::LoadSystem ( 'system' );
|
||||
G::LoadClass ( 'system' );
|
||||
require_once ("propel/Propel.php");
|
||||
require_once ("creole/Creole.php");
|
||||
}
|
||||
@@ -103,7 +103,7 @@ if (! defined ( 'SYS_SYS' )) {
|
||||
// ****************************************
|
||||
// read initialize file
|
||||
require_once PATH_HOME . 'engine' . PATH_SEP . 'classes' . PATH_SEP . 'class.system.php';
|
||||
$config = System::getSystemConfiguration ( PATH_HOME . 'engine' . PATH_SEP . 'config' . PATH_SEP . 'env.ini' );
|
||||
$config = System::getSystemConfiguration ('', '', SYS_SYS);
|
||||
define ( 'MEMCACHED_ENABLED', $config ['memcached'] );
|
||||
define ( 'MEMCACHED_SERVER', $config ['memcached_server'] );
|
||||
define ( 'TIME_ZONE', $config ['time_zone'] );
|
||||
@@ -208,7 +208,8 @@ function processWorkspace() {
|
||||
global $sLastExecution;
|
||||
|
||||
try {
|
||||
if ($solrConf = System::solrEnv () !== false) {
|
||||
|
||||
if (($solrConf = System::solrEnv (SYS_SYS)) !== false) {
|
||||
G::LoadClass ( 'AppSolr' );
|
||||
$oAppSolr = new AppSolr ( $solrConf ['solr_enabled'], $solrConf ['solr_host'], $solrConf ['solr_instance'] );
|
||||
$oAppSolr->reindexAllApplications ();
|
||||
|
||||
@@ -15,10 +15,24 @@ require_once "classes/model/AppSolrQueue.php";
|
||||
|
||||
class InvalidIndexSearchTextException extends Exception {
|
||||
// Redefine the exception so message isn't optional
|
||||
public function __construct($message, $code = 0, Exception $previous = null) {
|
||||
public function __construct($message, $code = 0) {
|
||||
// some code
|
||||
// make sure everything is assigned properly
|
||||
parent::__construct ( $message, $code, $previous );
|
||||
parent::__construct ( $message, $code);
|
||||
}
|
||||
|
||||
// custom string representation of object
|
||||
public function __toString() {
|
||||
return __CLASS__ . ": [{$this->code}]: {$this->message}\n";
|
||||
}
|
||||
}
|
||||
|
||||
class ApplicationWithoutDelegationRecordsException extends Exception {
|
||||
// Redefine the exception so message isn't optional
|
||||
public function __construct($message, $code = 0) {
|
||||
// some code
|
||||
// make sure everything is assigned properly
|
||||
parent::__construct ( $message, $code);
|
||||
}
|
||||
|
||||
// custom string representation of object
|
||||
@@ -720,6 +734,7 @@ class AppSolr {
|
||||
'workspace' => $this->solrInstance,
|
||||
'document' => $xmlDoc
|
||||
);
|
||||
|
||||
$oSolrUpdateDocument = Entity_SolrUpdateDocument::CreateForRequest ( $data );
|
||||
|
||||
G::LoadClass ( 'searchIndex' );
|
||||
@@ -760,11 +775,14 @@ class AppSolr {
|
||||
$xmlDoc .= "<add>\n";
|
||||
// echo "APP Uids to index \n";
|
||||
foreach ( $aaAPPUIDs as $aAPPUID ) {
|
||||
try {
|
||||
$result = $this->getApplicationIndexData ( $aAPPUID ['APP_UID'] );
|
||||
|
||||
if ($result == null)
|
||||
}
|
||||
catch(ApplicationWithoutDelegationRecordsException $e){
|
||||
//exception trying to get application information
|
||||
//skip and continue with the next application
|
||||
continue;
|
||||
|
||||
}
|
||||
$documentInformation = $result [0];
|
||||
$dynaformFieldTypes = $result [1];
|
||||
$lastUpdateDate = $result [2];
|
||||
@@ -1049,7 +1067,7 @@ class AppSolr {
|
||||
}
|
||||
else {
|
||||
foreach ( $UnSerializedCaseData as $k => $value ) {
|
||||
if (! is_array ( $value ) && $value != '' && $k != 'SYS_LANG' && $k != 'SYS_SKIN' && $k != 'SYS_SYS') {
|
||||
if (!is_array ( $value ) && !is_object($value) && $value != '' && $k != 'SYS_LANG' && $k != 'SYS_SKIN' && $k != 'SYS_SYS') {
|
||||
// search the field type in array of dynaform fields
|
||||
if (! empty ( $dynaformFieldTypes ) && array_key_exists ( trim ( $k ), $dynaformFieldTypes )) {
|
||||
$type = $dynaformFieldTypes [trim ( $k )];
|
||||
@@ -1157,7 +1175,6 @@ class AppSolr {
|
||||
}
|
||||
|
||||
function getApplicationIndexData($AppUID) {
|
||||
|
||||
G::LoadClass ( 'memcached' );
|
||||
|
||||
// get all the application data
|
||||
@@ -1166,7 +1183,7 @@ class AppSolr {
|
||||
// this case occurs when the application doesn't have related delegation
|
||||
// records.
|
||||
if (empty ( $allAppDbData ) || ! isset ( $allAppDbData [0] )) {
|
||||
throw new Exception ( "Application without delegation records. APP_UID: " . $AppUID );
|
||||
throw new ApplicationWithoutDelegationRecordsException ( "Application without delegation records. APP_UID: " . $AppUID );
|
||||
}
|
||||
|
||||
// copy the application information
|
||||
|
||||
@@ -40,7 +40,7 @@ class BpmnEngine_SearchIndexAccess_Solr {
|
||||
// get configuration information in base to workspace parameter
|
||||
|
||||
// get total number of documents in registry
|
||||
$solrIntruct = $this->solrHost;
|
||||
$solrIntruct = (substr($this->solrHost, -1) == "/")?$this->solrHost:$this->solrHost . "/";
|
||||
$solrIntruct .= $workspace;
|
||||
$solrIntruct .= "/select/?q=*:*";
|
||||
$solrIntruct .= self::SOLR_VERSION;
|
||||
@@ -54,7 +54,7 @@ class BpmnEngine_SearchIndexAccess_Solr {
|
||||
// verify the result of solr
|
||||
$responseSolrTotal = json_decode ( $responseTotal, true );
|
||||
if ($responseSolrTotal['responseHeader']['status'] != 0) {
|
||||
throw new Exception ( "Error returning the total number of documents in Solr." );
|
||||
throw new Exception ( "Error returning the total number of documents in Solr." . $solrIntruct);
|
||||
}
|
||||
$numTotalDocs = $responseSolrTotal ['response'] ['numFound'];
|
||||
return $numTotalDocs;
|
||||
@@ -101,7 +101,7 @@ class BpmnEngine_SearchIndexAccess_Solr {
|
||||
$filters .= '&fq=' . urlencode ( $value );
|
||||
}
|
||||
|
||||
$solrIntruct = $this->solrHost;
|
||||
$solrIntruct = (substr($this->solrHost, -1) == "/")?$this->solrHost:$this->solrHost . "/";
|
||||
$solrIntruct .= $workspace;
|
||||
$solrIntruct .= "/select/?q=$query";
|
||||
$solrIntruct .= "&echoParams=none";
|
||||
@@ -123,7 +123,7 @@ class BpmnEngine_SearchIndexAccess_Solr {
|
||||
// decode
|
||||
$responseSolr = json_decode ( $response, true );
|
||||
if ($responseSolr['responseHeader']['status'] != 0) {
|
||||
throw new Exception ( "Error executing query to Solr." );
|
||||
throw new Exception ( "Error executing query to Solr." . $solrIntruct);
|
||||
}
|
||||
|
||||
return $responseSolr;
|
||||
@@ -142,7 +142,7 @@ class BpmnEngine_SearchIndexAccess_Solr {
|
||||
return;
|
||||
$solrIntruct = '';
|
||||
// get configuration information in base to workspace parameter
|
||||
$solrIntruct = $this->solrHost;
|
||||
$solrIntruct = (substr($this->solrHost, -1) == "/")?$this->solrHost:$this->solrHost . "/";
|
||||
$solrIntruct .= $solrUpdateDocument->workspace;
|
||||
$solrIntruct .= "/update";
|
||||
|
||||
@@ -154,12 +154,11 @@ class BpmnEngine_SearchIndexAccess_Solr {
|
||||
curl_setopt ( $handler, CURLOPT_BINARYTRANSFER, TRUE ); // --data-binary
|
||||
curl_setopt ( $handler, CURLOPT_POSTFIELDS, $solrUpdateDocument->document ); // data
|
||||
$response = curl_exec ( $handler );
|
||||
|
||||
curl_close ( $handler );
|
||||
|
||||
$swOk = strpos ( $response, '<int name="status">0</int>' );
|
||||
if (! $swOk) {
|
||||
throw new Exception ( "Error updating document in Solr." );
|
||||
throw new Exception ( "Error updating document in Solr." . $solrIntruct);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -176,7 +175,7 @@ class BpmnEngine_SearchIndexAccess_Solr {
|
||||
return;
|
||||
$solrIntruct = '';
|
||||
// get configuration information in base to workspace parameter
|
||||
$solrIntruct = $this->solrHost;
|
||||
$solrIntruct = (substr($this->solrHost, -1) == "/")?$this->solrHost:$this->solrHost . "/";
|
||||
$solrIntruct .= $workspace;
|
||||
$solrIntruct .= "/update";
|
||||
|
||||
@@ -192,7 +191,7 @@ class BpmnEngine_SearchIndexAccess_Solr {
|
||||
|
||||
$swOk = strpos ( $response, '<int name="status">0</int>' );
|
||||
if (! $swOk) {
|
||||
throw new Exception ( "Error commiting changes in Solr." );
|
||||
throw new Exception ( "Error commiting changes in Solr." . $solrIntruct);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -210,7 +209,7 @@ class BpmnEngine_SearchIndexAccess_Solr {
|
||||
|
||||
$solrIntruct = '';
|
||||
// get configuration information in base to workspace parameter
|
||||
$solrIntruct = $this->solrHost;
|
||||
$solrIntruct = (substr($this->solrHost, -1) == "/")?$this->solrHost:$this->solrHost . "/";
|
||||
$solrIntruct .= $workspace;
|
||||
$solrIntruct .= "/update";
|
||||
|
||||
@@ -226,7 +225,7 @@ class BpmnEngine_SearchIndexAccess_Solr {
|
||||
|
||||
$swOk = strpos ( $response, '<int name="status">0</int>' );
|
||||
if (! $swOk) {
|
||||
throw new Exception ( "Error rolling back changes in Solr." );
|
||||
throw new Exception ( "Error rolling back changes in Solr." . $solrIntruct);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -244,7 +243,7 @@ class BpmnEngine_SearchIndexAccess_Solr {
|
||||
|
||||
$solrIntruct = '';
|
||||
// get configuration information in base to workspace parameter
|
||||
$solrIntruct = $this->solrHost;
|
||||
$solrIntruct = (substr($this->solrHost, -1) == "/")?$this->solrHost:$this->solrHost . "/";
|
||||
$solrIntruct .= $workspace;
|
||||
$solrIntruct .= "/update";
|
||||
|
||||
@@ -260,7 +259,7 @@ class BpmnEngine_SearchIndexAccess_Solr {
|
||||
|
||||
$swOk = strpos ( $response, '<int name="status">0</int>' );
|
||||
if (! $swOk) {
|
||||
throw new Exception ( "Error optimizing changes in Solr." );
|
||||
throw new Exception ( "Error optimizing changes in Solr." . $solrIntruct);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -270,7 +269,7 @@ class BpmnEngine_SearchIndexAccess_Solr {
|
||||
|
||||
$solrIntruct = '';
|
||||
// get configuration information in base to workspace parameter
|
||||
$solrIntruct = $this->solrHost;
|
||||
$solrIntruct = (substr($this->solrHost, -1) == "/")?$this->solrHost:$this->solrHost . "/";
|
||||
$solrIntruct .= $workspace;
|
||||
$solrIntruct .= "/admin/luke?numTerms=0&wt=json";
|
||||
|
||||
@@ -281,7 +280,7 @@ class BpmnEngine_SearchIndexAccess_Solr {
|
||||
// decode
|
||||
$responseSolr = json_decode ( $response, true );
|
||||
if ($responseSolr['responseHeader']['status'] != 0) {
|
||||
throw new Exception ( "Error getting index fields in Solr." );
|
||||
throw new Exception ( "Error getting index fields in Solr." . $solrIntruct);
|
||||
}
|
||||
return $responseSolr;
|
||||
}
|
||||
@@ -301,7 +300,7 @@ class BpmnEngine_SearchIndexAccess_Solr {
|
||||
|
||||
$solrIntruct = '';
|
||||
// get configuration information in base to workspace parameter
|
||||
$solrIntruct = $this->solrHost;
|
||||
$solrIntruct = (substr($this->solrHost, -1) == "/")?$this->solrHost:$this->solrHost . "/";
|
||||
$solrIntruct .= $workspace;
|
||||
$solrIntruct .= "/update";
|
||||
|
||||
@@ -318,7 +317,7 @@ class BpmnEngine_SearchIndexAccess_Solr {
|
||||
|
||||
$swOk = strpos ( $response, '<int name="status">0</int>' );
|
||||
if (! $swOk) {
|
||||
throw new Exception ( "Error deleting all documents in Solr." );
|
||||
throw new Exception ( "Error deleting all documents in Solr." . $solrIntruct);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -337,7 +336,7 @@ class BpmnEngine_SearchIndexAccess_Solr {
|
||||
|
||||
$solrIntruct = '';
|
||||
// get configuration information in base to workspace parameter
|
||||
$solrIntruct = $this->solrHost;
|
||||
$solrIntruct = (substr($this->solrHost, -1) == "/")?$this->solrHost:$this->solrHost . "/";
|
||||
$solrIntruct .= $workspace;
|
||||
$solrIntruct .= "/update";
|
||||
|
||||
@@ -354,7 +353,7 @@ class BpmnEngine_SearchIndexAccess_Solr {
|
||||
|
||||
$swOk = strpos ( $response, '<int name="status">0</int>' );
|
||||
if (! $swOk) {
|
||||
throw new Exception ( "Error deleting document in Solr." );
|
||||
throw new Exception ( "Error deleting document in Solr." . $solrIntruct);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -403,7 +402,7 @@ class BpmnEngine_SearchIndexAccess_Solr {
|
||||
|
||||
$resultFormat = '&wt=json';
|
||||
|
||||
$solrIntruct = $this->solrHost;
|
||||
$solrIntruct = (substr($this->solrHost, -1) == "/")?$this->solrHost:$this->solrHost . "/";
|
||||
$solrIntruct .= $workspace;
|
||||
$solrIntruct .= "/select/?q=$query";
|
||||
$solrIntruct .= "&echoParams=none";
|
||||
@@ -424,7 +423,7 @@ class BpmnEngine_SearchIndexAccess_Solr {
|
||||
// decode
|
||||
$responseSolr = json_decode ( $response, true );
|
||||
if ($responseSolr['responseHeader']['status'] != 0) {
|
||||
throw new Exception ( "Error getting faceted list from Solr." );
|
||||
throw new Exception ( "Error getting faceted list from Solr." . $solrIntruct);
|
||||
}
|
||||
|
||||
return $responseSolr;
|
||||
|
||||
@@ -1008,7 +1008,7 @@ class System {
|
||||
return $cities;
|
||||
}
|
||||
|
||||
public static function getSystemConfiguration($globalIniFile = '', $wsIniFile = '')
|
||||
public static function getSystemConfiguration($globalIniFile = '', $wsIniFile = '', $wsName = '')
|
||||
{
|
||||
$readGlobalIniFile = false;
|
||||
$readWsIniFile = false;
|
||||
@@ -1019,13 +1019,16 @@ class System {
|
||||
|
||||
if (empty($wsIniFile)) {
|
||||
if (defined('PATH_DB')) { // if we're on a valid workspace env.
|
||||
if (empty($wsName)) {
|
||||
$uriParts = explode('/', getenv("REQUEST_URI"));
|
||||
|
||||
if (substr($uriParts[1], 0, 3 ) == 'sys') {
|
||||
$wsName = substr($uriParts[1], 3);
|
||||
$wsIniFile = PATH_DB . $wsName . PATH_SEP . 'env.ini';
|
||||
}
|
||||
}
|
||||
|
||||
$wsIniFile = PATH_DB . $wsName . PATH_SEP . 'env.ini';
|
||||
}
|
||||
}
|
||||
|
||||
$readGlobalIniFile = file_exists($globalIniFile) ? true : false;
|
||||
@@ -1121,9 +1124,14 @@ class System {
|
||||
return $result;
|
||||
}
|
||||
|
||||
function solrEnv()
|
||||
function solrEnv($sysName = '')
|
||||
{
|
||||
if (empty($sysName)) {
|
||||
$conf = System::getSystemConfiguration();
|
||||
}
|
||||
else {
|
||||
$conf = System::getSystemConfiguration('', '', $sysName);
|
||||
}
|
||||
|
||||
if (!isset($conf['solr_enabled']) || !isset($conf['solr_host']) || !isset($conf['solr_instance'])) {
|
||||
return false;
|
||||
|
||||
@@ -59,7 +59,8 @@ class Entity_Base {
|
||||
// get aliases from class
|
||||
$className = get_class ( $this );
|
||||
if (method_exists ( $className, 'GetAliases' )) {
|
||||
$aliases = $className::GetAliases ();
|
||||
$aliases = call_user_func(array($className, 'GetAliases'));
|
||||
//$aliases = $className::GetAliases ();
|
||||
foreach ( $this as $field => $value )
|
||||
if (isset ( $aliases [$field] )) {
|
||||
// echo "Field exists in Aliases: " . $field . "\n";
|
||||
@@ -84,8 +85,8 @@ class Entity_Base {
|
||||
// get aliases from class
|
||||
$className = get_class ( $this );
|
||||
if (method_exists ( $className, 'GetAliases' )) {
|
||||
$aliases = $className::GetAliases ();
|
||||
|
||||
$aliases = call_user_func(array($className, 'GetAliases'));
|
||||
//$aliases = $className::GetAliases ();
|
||||
foreach ( $this as $field => $value )
|
||||
if (isset ( $aliases [$field] ))
|
||||
$this->{$field} = $aAliasData [$aliases [$field]];
|
||||
@@ -107,7 +108,8 @@ class Entity_Base {
|
||||
$aliases = array ();
|
||||
$swAliases = false;
|
||||
if (method_exists ( $className, 'GetAliases' )) {
|
||||
$aliases = $className::GetAliases ();
|
||||
$aliases = call_user_func(array($className, 'GetAliases'));
|
||||
//$aliases = $className::GetAliases ();
|
||||
$swAliases = true;
|
||||
}
|
||||
// use object properties or aliases to initialize
|
||||
|
||||
Reference in New Issue
Block a user