mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-09 21:16:07 +00:00
call hooks
This commit is contained in:
parent
63f9170671
commit
21518adecc
|
@ -1,5 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
require_once("../inc/inc.ClassSettings.php");
|
#require_once("../inc/inc.ClassSettings.php");
|
||||||
|
include("../inc/inc.Settings.php");
|
||||||
|
include("../inc/inc.Extension.php");
|
||||||
|
|
||||||
function usage() { /* {{{ */
|
function usage() { /* {{{ */
|
||||||
echo "Usage:\n";
|
echo "Usage:\n";
|
||||||
|
@ -15,7 +17,7 @@ function usage() { /* {{{ */
|
||||||
echo " --config: set alternative config file.\n";
|
echo " --config: set alternative config file.\n";
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
$version = "0.0.1";
|
$version = "0.0.2";
|
||||||
$shortoptions = "hvc";
|
$shortoptions = "hvc";
|
||||||
$longoptions = array('help', 'version', 'config:');
|
$longoptions = array('help', 'version', 'config:');
|
||||||
if(false === ($options = getopt($shortoptions, $longoptions))) {
|
if(false === ($options = getopt($shortoptions, $longoptions))) {
|
||||||
|
@ -83,7 +85,16 @@ function tree($dms, $index, $indexconf, $folder, $indent='') { /* {{{ */
|
||||||
$lucenesearch = new $indexconf['Search']($index);
|
$lucenesearch = new $indexconf['Search']($index);
|
||||||
if(!($hit = $lucenesearch->getDocument($document->getId()))) {
|
if(!($hit = $lucenesearch->getDocument($document->getId()))) {
|
||||||
try {
|
try {
|
||||||
$index->addDocument(new $indexconf['IndexedDocument']($dms, $document, isset($settings->_converters['fulltext']) ? $settings->_converters['fulltext'] : null, false, $settings->_cmdTimeout));
|
# $index->addDocument(new $indexconf['IndexedDocument']($dms, $document, isset($settings->_converters['fulltext']) ? $settings->_converters['fulltext'] : null, false, $settings->_cmdTimeout));
|
||||||
|
$idoc = new $indexconf['IndexedDocument']($dms, $document, isset($settings->_converters['fulltext']) ? $settings->_converters['fulltext'] : null, false, $settings->_cmdTimeout);
|
||||||
|
if(isset($GLOBALS['SEEDDMS_HOOKS']['indexDocument'])) {
|
||||||
|
foreach($GLOBALS['SEEDDMS_HOOKS']['indexDocument'] as $hookObj) {
|
||||||
|
if (method_exists($hookObj, 'preIndexDocument')) {
|
||||||
|
$hookObj->preIndexDocument(null, $document, $idoc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$index->addDocument($idoc);
|
||||||
echo " (Document added)\n";
|
echo " (Document added)\n";
|
||||||
} catch(Exception $e) {
|
} catch(Exception $e) {
|
||||||
echo " (Timeout)\n";
|
echo " (Timeout)\n";
|
||||||
|
@ -100,7 +111,17 @@ function tree($dms, $index, $indexconf, $folder, $indent='') { /* {{{ */
|
||||||
} else {
|
} else {
|
||||||
$index->delete($hit->id);
|
$index->delete($hit->id);
|
||||||
try {
|
try {
|
||||||
$index->addDocument(new $indexconf['IndexedDocument']($dms, $document, isset($settings->_converters['fulltext']) ? $settings->_converters['fulltext'] : null, false, $settings->_cmdTimeout));
|
# $index->addDocument(new $indexconf['IndexedDocument']($dms, $document, isset($settings->_converters['fulltext']) ? $settings->_converters['fulltext'] : null, false, $settings->_cmdTimeout));
|
||||||
|
$idoc = new $indexconf['IndexedDocument']($dms, $document, isset($settings->_converters['fulltext']) ? $settings->_converters['fulltext'] : null, false, $settings->_cmdTimeout);
|
||||||
|
if(isset($GLOBALS['SEEDDMS_HOOKS']['indexDocument'])) {
|
||||||
|
foreach($GLOBALS['SEEDDMS_HOOKS']['indexDocument'] as $hookObj) {
|
||||||
|
if (method_exists($hookObj, 'preIndexDocument')) {
|
||||||
|
$hookObj->preIndexDocument(null, $document, $idoc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$index->addDocument($idoc);
|
||||||
|
|
||||||
echo " (Document updated)\n";
|
echo " (Document updated)\n";
|
||||||
} catch(Exception $e) {
|
} catch(Exception $e) {
|
||||||
echo " (Timeout)\n";
|
echo " (Timeout)\n";
|
||||||
|
|
Loading…
Reference in New Issue
Block a user