From 90117fd4e3e69b78731025348b45604bb9e5675c Mon Sep 17 00:00:00 2001 From: kevin_fourie Date: Fri, 19 Oct 2007 12:21:23 +0000 Subject: [PATCH] Merged in from DEV trunk... --- lib/workflow/workflowutil.inc.php | 2 +- plugins/ktcore/admin/workflowsv2.php | 14 +++++++++++--- search2/indexing/indexerCore.inc.php | 32 ++++++++++++++++++++++---------- search2/indexing/indexers/JavaXMLRPCLuceneIndexer.inc.php | 10 ++++++++++ 4 files changed, 44 insertions(+), 14 deletions(-) diff --git a/lib/workflow/workflowutil.inc.php b/lib/workflow/workflowutil.inc.php index 6e7b0f1..6982c95 100644 --- a/lib/workflow/workflowutil.inc.php +++ b/lib/workflow/workflowutil.inc.php @@ -831,7 +831,7 @@ class KTWorkflowUtil { if (PEAR::isError($res)) { return $res; } Document::clearAllCaches(); - KTWorkflowTransitions::clearAllCaches(); + KTWorkflowTransition::clearAllCaches(); } } diff --git a/plugins/ktcore/admin/workflowsv2.php b/plugins/ktcore/admin/workflowsv2.php index a07292f..048bd9b 100644 --- a/plugins/ktcore/admin/workflowsv2.php +++ b/plugins/ktcore/admin/workflowsv2.php @@ -625,7 +625,7 @@ class KTWorkflowAdminV2 extends KTAdminDispatcher { $to = (array) KTUtil::arrayGet($_REQUEST, 'fTo'); $from = (array) KTUtil::arrayGet($_REQUEST, 'fFrom'); - + // we do not trust any of this data. $states = KTWorkflowState::getByWorkflow($this->oWorkflow); $states = KTUtil::keyArray($states); @@ -656,8 +656,16 @@ class KTWorkflowAdminV2 extends KTAdminDispatcher { $source_state_ids[] = $oState->getId(); } } - - $res = KTWorkflowAdminUtil::saveTransitionSources($oTransition, $source_state_ids); + + $aFromTransitionID = array_keys($_REQUEST['fFrom']); + //run through all transitions to change + foreach ($aFromTransitionID as $iCurrentId) + { + if($oTransition->getId() == $iCurrentId) + { + $res = KTWorkflowAdminUtil::saveTransitionSources($oTransition, $source_state_ids); + } + } if (PEAR::isError($res)) { $this->errorRedirectTo('basic', sprintf(_kt("Failed to set transition origins: %s"), $res->getMessage())); } diff --git a/search2/indexing/indexerCore.inc.php b/search2/indexing/indexerCore.inc.php index 54d7021..9a68c1e 100644 --- a/search2/indexing/indexerCore.inc.php +++ b/search2/indexing/indexerCore.inc.php @@ -32,13 +32,13 @@ class QueryResultItem protected $status; protected $folderId; - public function __construct($document_id, $rank=null, $title=null, $text=null) { - $this->document_id=$document_id; + $this->document_id=(int) $document_id; $this->rank= $rank; $this->title=$title; $this->text = $text; + $this->live = true; $this->loadDocumentInfo(); } @@ -57,14 +57,13 @@ class QueryResultItem return true; // should not be reached } - private function loadDocumentInfo() + public function loadDocumentInfo() { $sql = "SELECT - f.folder_id, f.full_path, f.name, dcv.size as filesize, dcv.major_version, + d.folder_id, f.full_path, f.name, dcv.size as filesize, dcv.major_version, dcv.minor_version, dcv.filename, cou.name as checkoutuser, w.human_name as workflow, ws.human_name as workflowstate, mt.mimetypes as mimetype, md.mime_doc as mimedoc, d.checkedout, mbu.name as modifiedbyuser, d.modified, cbu.name as createdbyuser, ou.name as owneruser, d.immutable, d.status_id, d.created - FROM documents d INNER JOIN document_metadata_version dmv ON d.metadata_version_id = dmv.id @@ -78,7 +77,6 @@ class QueryResultItem LEFT JOIN users mbu ON d.modified_user_id=mbu.id LEFT JOIN users cbu ON d.creator_id=cbu.id LEFT JOIN users ou ON d.owner_id=ou.id - WHERE d.id=$this->document_id"; @@ -87,10 +85,9 @@ class QueryResultItem if (PEAR::isError($result) || empty($result)) { $this->live = false; - return; + throw new Exception('QueryResultItem::loadDocumentInfo failed'); } - $this->live = true; if (is_null($result['name'])) { $this->fullpath = '(orphaned)'; @@ -137,7 +134,7 @@ class QueryResultItem case 'Title': return (string) $this->title; case 'FullPath': return (string) $this->fullpath; case 'IsLive': return (bool) $this->live; - case 'Filesize': return (int) $this->filesize; + case 'Filesize': return $this->filesize; case 'Version': return (string) $this->version; case 'Filename': return (int)$this->filename; case 'FolderId': return (int)$this->folderId; @@ -180,7 +177,13 @@ class QueryResultItem case 'Status': return $this->status; case 'CanBeReadByUser': - return (bool) $this->live && (Permission::userHasDocumentReadPermission($this->Document) || Permission::adminIsInAdminMode()); + if (!$this->live) + return false; + if (Permission::userHasDocumentReadPermission($this->Document)) + return true; + if (Permission::adminIsInAdminMode()) + return true; + return false; default: throw new Exception("Unknown property '$property' to get on MatchResult"); } @@ -1170,6 +1173,15 @@ abstract class Indexer } /** + * Shuts down the indexer + * + */ + public function shutdown() + { + // do nothing generally + } + + /** * Returns the name of the indexer. * * @return string diff --git a/search2/indexing/indexers/JavaXMLRPCLuceneIndexer.inc.php b/search2/indexing/indexers/JavaXMLRPCLuceneIndexer.inc.php index 70fdd64..8fb9878 100644 --- a/search2/indexing/indexers/JavaXMLRPCLuceneIndexer.inc.php +++ b/search2/indexing/indexers/JavaXMLRPCLuceneIndexer.inc.php @@ -115,6 +115,16 @@ class JavaXMLRPCLuceneIndexer extends Indexer } /** + * Shut down the java server + * + */ + public function shutdown() + { + $this->lucene->shutdown(); + } + + + /** * Enter description here... * * @param string $query -- libgit2 0.21.4