diff --git a/CHANGELOG b/CHANGELOG index f42752f10..d54bf2b04 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -4,6 +4,7 @@ - fix setting expire date when editing a document (Closes: #225) - MyDocumets: list only documents to approve which have passed review - show preview image in Review/Approval summary +- timeout for external commands for creating fulltext index can be set -------------------------------------------------------------------------------- Changes in version 4.3.19 diff --git a/SeedDMS_Lucene/Lucene/IndexedDocument.php b/SeedDMS_Lucene/Lucene/IndexedDocument.php index 40035c1ca..8d24b3793 100644 --- a/SeedDMS_Lucene/Lucene/IndexedDocument.php +++ b/SeedDMS_Lucene/Lucene/IndexedDocument.php @@ -23,11 +23,45 @@ * @version Release: @package_version@ */ class SeedDMS_Lucene_IndexedDocument extends Zend_Search_Lucene_Document { + + static function execWithTimeout($cmd, $timeout=2) { /* {{{ */ + $descriptorspec = array( + 0 => array("pipe", "r"), + 1 => array("pipe", "w"), + 2 => array("pipe", "w") + ); + $pipes = array(); + + $timeout += time(); + $process = proc_open($cmd, $descriptorspec, $pipes); + if (!is_resource($process)) { + throw new Exception("proc_open failed on: " . $cmd); + } + + $output = ''; + do { + $timeleft = $timeout - time(); + $read = array($pipes[1]); + stream_select($read, $write = NULL, $exeptions = NULL, $timeleft, NULL); + + if (!empty($read)) { + $output .= fread($pipes[1], 8192); + } + } while (!feof($pipes[1]) && $timeleft > 0); + + if ($timeleft <= 0) { + proc_terminate($process); + throw new Exception("command timeout on: " . $cmd); + } else { + return $output; + } + } /* }}} */ + /** * Constructor. Creates our indexable document and adds all * necessary fields to it using the passed in document */ - public function __construct($dms, $document, $convcmd=null, $nocontent=false) { + public function __construct($dms, $document, $convcmd=null, $nocontent=false, $timeout=5) { $_convcmd = array( 'application/pdf' => 'pdftotext -enc UTF-8 -nopgbrk %s - |sed -e \'s/ [a-zA-Z0-9.]\{1\} / /g\' -e \'s/[0-9.]//g\'', 'application/msword' => 'catdoc %s', @@ -90,6 +124,8 @@ class SeedDMS_Lucene_IndexedDocument extends Zend_Search_Lucene_Document { $mimetype = $version->getMimeType(); if(isset($_convcmd[$mimetype])) { $cmd = sprintf($_convcmd[$mimetype], $path); + $content = self::execWithTimeout($cmd); + /* $fp = popen($cmd, 'r'); if($fp) { $content = ''; @@ -98,6 +134,7 @@ class SeedDMS_Lucene_IndexedDocument extends Zend_Search_Lucene_Document { } pclose($fp); } + */ if($content) { $this->addField(Zend_Search_Lucene_Field::UnStored('content', $content, 'utf-8')); } diff --git a/SeedDMS_Lucene/package.xml b/SeedDMS_Lucene/package.xml index cfc66bb68..1b6f36d80 100644 --- a/SeedDMS_Lucene/package.xml +++ b/SeedDMS_Lucene/package.xml @@ -11,11 +11,11 @@ uwe@steinmann.cx yes - 2014-07-30 - + 2015-08-05 + - 1.1.5 - 1.1.5 + 1.1.6 + 1.1.6 stable @@ -23,8 +23,7 @@ GPL License -field for original filename is treated as utf-8 -declare SeeDMS_Lucene_Indexer::open() static +run external commands with a timeout @@ -170,5 +169,22 @@ do not check if deleting document from index fails, update it in any case class SeedDMS_Lucene_Search::search returns false if query is invalid instead of an empty result record + + 2014-07-30 + + + 1.1.5 + 1.1.5 + + + stable + stable + + GPL License + +field for original filename is treated as utf-8 +declare SeeDMS_Lucene_Indexer::open() static + + diff --git a/inc/inc.ClassSettings.php b/inc/inc.ClassSettings.php index c7a7479ce..72e8347f1 100644 --- a/inc/inc.ClassSettings.php +++ b/inc/inc.ClassSettings.php @@ -197,6 +197,8 @@ class Settings { /* {{{ */ var $_adminIP = ""; // Max Execution Time var $_maxExecutionTime = null; + // command timeout + var $_cmdTimeout = 5; // Preview image width in lists var $_previewWidthList = 40; // Preview image width on document details page @@ -543,6 +545,7 @@ class Settings { /* {{{ */ $this->_contentOffsetDir = strval($tab["contentOffsetDir"]); $this->_maxDirID = intval($tab["maxDirID"]); $this->_updateNotifyTime = intval($tab["updateNotifyTime"]); + $this->_cmdTimeout = intval($tab["cmdTimeout"]); if (isset($tab["maxExecutionTime"])) $this->_maxExecutionTime = intval($tab["maxExecutionTime"]); else @@ -837,6 +840,7 @@ class Settings { /* {{{ */ $this->setXMLAttributValue($node, "maxDirID", $this->_maxDirID); $this->setXMLAttributValue($node, "updateNotifyTime", $this->_updateNotifyTime); $this->setXMLAttributValue($node, "maxExecutionTime", $this->_maxExecutionTime); + $this->setXMLAttributValue($node, "cmdTimeout", $this->_cmdTimeout); // XML Path: /configuration/advanced/converters foreach($this->_converters as $type=>$converters) { diff --git a/languages/ar_EG/lang.inc b/languages/ar_EG/lang.inc index 1685373be..dee269d0f 100644 --- a/languages/ar_EG/lang.inc +++ b/languages/ar_EG/lang.inc @@ -886,6 +886,8 @@ URL: [url]', 'settings_cannot_disable' => '', 'settings_checkOutDir' => '', 'settings_checkOutDir_desc' => '', +'settings_cmdTimeout' => '', +'settings_cmdTimeout_desc' => '', 'settings_contentDir' => 'مجلد المحتوى', 'settings_contentDir_desc' => '', 'settings_contentOffsetDir' => '', diff --git a/languages/bg_BG/lang.inc b/languages/bg_BG/lang.inc index 88fb4453e..c39730581 100644 --- a/languages/bg_BG/lang.inc +++ b/languages/bg_BG/lang.inc @@ -751,6 +751,8 @@ $text = array( 'settings_cannot_disable' => 'Невозможно е да се изтрие ENABLE_INSTALL_TOOL', 'settings_checkOutDir' => '', 'settings_checkOutDir_desc' => '', +'settings_cmdTimeout' => '', +'settings_cmdTimeout_desc' => '', 'settings_contentDir' => 'Папка със данните', 'settings_contentDir_desc' => 'Къде да съхранява качените файлове (най-добре изберете папка, недостъпна за уеб-сървъра)', 'settings_contentOffsetDir' => 'Content Offset Directory', diff --git a/languages/ca_ES/lang.inc b/languages/ca_ES/lang.inc index a5e134685..29d070f08 100644 --- a/languages/ca_ES/lang.inc +++ b/languages/ca_ES/lang.inc @@ -756,6 +756,8 @@ URL: [url]', 'settings_cannot_disable' => '', 'settings_checkOutDir' => '', 'settings_checkOutDir_desc' => '', +'settings_cmdTimeout' => '', +'settings_cmdTimeout_desc' => '', 'settings_contentDir' => '', 'settings_contentDir_desc' => '', 'settings_contentOffsetDir' => '', diff --git a/languages/cs_CZ/lang.inc b/languages/cs_CZ/lang.inc index 4ce561bb5..8536655a5 100644 --- a/languages/cs_CZ/lang.inc +++ b/languages/cs_CZ/lang.inc @@ -895,6 +895,8 @@ URL: [url]', 'settings_cannot_disable' => 'Soubor ENABLE_INSTALL_TOOL nejde vymazat', 'settings_checkOutDir' => '', 'settings_checkOutDir_desc' => '', +'settings_cmdTimeout' => '', +'settings_cmdTimeout_desc' => '', 'settings_contentDir' => 'Obsah adresáře', 'settings_contentDir_desc' => 'Místo, kde jsou nahrané soubory uloženy (nejlepší zvolit adresář, který není přístupný přes váš web-server)', 'settings_contentOffsetDir' => '', diff --git a/languages/de_DE/lang.inc b/languages/de_DE/lang.inc index 836507b40..f62314e2b 100644 --- a/languages/de_DE/lang.inc +++ b/languages/de_DE/lang.inc @@ -19,7 +19,7 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -// Translators: Admin (2099), dgrutsch (18) +// Translators: Admin (2101), dgrutsch (18) $text = array( 'accept' => 'Übernehmen', @@ -915,6 +915,8 @@ URL: [url]', 'settings_cannot_disable' => 'Datei ENABLE_INSTALL_TOOL konnte nicht gelöscht werden.', 'settings_checkOutDir' => 'Verzeichnis für ausgecheckte Dokumente', 'settings_checkOutDir_desc' => 'Dies ist das Verzeichnis, in das Dokumenteninhalte bei einem Check out kopiert werden. Wenn dieses Verzeichnis für die Benutzer erreichbar ist, können die Dateien editiert und dann wieder eingecheckt werden.', +'settings_cmdTimeout' => 'Timeout für externe Programme', +'settings_cmdTimeout_desc' => 'Diese Zeit in Sekunden legt fest, wann ein externes Programm (z.B. für die Erstellung des Volltextindex) beendet wird.', 'settings_contentDir' => 'Content-Verzeichnis', 'settings_contentDir_desc' => 'Verzeichnis, in dem die Dokumente gespeichert werden. Sie sollten ein Verzeichnis wählen, das nicht durch den Web-Server erreichbar ist.', 'settings_contentOffsetDir' => 'Content Offset Directory', diff --git a/languages/en_GB/lang.inc b/languages/en_GB/lang.inc index 4bcbf4c97..a3b8ff5bb 100644 --- a/languages/en_GB/lang.inc +++ b/languages/en_GB/lang.inc @@ -19,7 +19,7 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -// Translators: Admin (1230), dgrutsch (3), netixw (14) +// Translators: Admin (1232), dgrutsch (3), netixw (14) $text = array( 'accept' => 'Accept', @@ -922,6 +922,8 @@ URL: [url]', 'settings_cannot_disable' => 'File ENABLE_INSTALL_TOOL could not deleted', 'settings_checkOutDir' => 'Directory for checked out documents', 'settings_checkOutDir_desc' => 'This is the directory where the latest content of a document is copied if the document is checked out. If you make this directory accessible for users, they can edit the file and check it back in when finished.', +'settings_cmdTimeout' => 'Timeout for external commands', +'settings_cmdTimeout_desc' => 'This duration in seconds determines when an external command (e.g. for creating the full text index) will be terminatd.', 'settings_contentDir' => 'Content directory', 'settings_contentDir_desc' => 'Where the uploaded files are stored (best to choose a directory that is not accessible through your web-server)', 'settings_contentOffsetDir' => 'Content Offset Directory', diff --git a/languages/es_ES/lang.inc b/languages/es_ES/lang.inc index 8395ecdbc..d0c8f2838 100644 --- a/languages/es_ES/lang.inc +++ b/languages/es_ES/lang.inc @@ -901,6 +901,8 @@ URL: [url]', 'settings_cannot_disable' => 'No es posible eliminar el archivo ENABLE_INSTALL_TOOL', 'settings_checkOutDir' => '', 'settings_checkOutDir_desc' => '', +'settings_cmdTimeout' => '', +'settings_cmdTimeout_desc' => '', 'settings_contentDir' => 'Carpeta de contenidos', 'settings_contentDir_desc' => 'Donde se almacenan los archivos subidos (es preferible seleccionar una carpeta que no sea accesible a través del servidor web)', 'settings_contentOffsetDir' => 'Carpeta de contenidos de desplazamiento', diff --git a/languages/fr_FR/lang.inc b/languages/fr_FR/lang.inc index 8f5ac2fbd..d41e8601e 100644 --- a/languages/fr_FR/lang.inc +++ b/languages/fr_FR/lang.inc @@ -877,6 +877,8 @@ URL: [url]', 'settings_cannot_disable' => 'Le fichier ENABLE_INSTALL_TOOL ne peut pas être supprimé', 'settings_checkOutDir' => '', 'settings_checkOutDir_desc' => '', +'settings_cmdTimeout' => '', +'settings_cmdTimeout_desc' => '', 'settings_contentDir' => 'Contenu du répertoire', 'settings_contentDir_desc' => 'Endroit ou les fichiers téléchargés sont stockés (il est préférable de choisir un répertoire qui n\'est pas accessible par votre serveur web)', 'settings_contentOffsetDir' => 'Content Offset Directory', diff --git a/languages/hu_HU/lang.inc b/languages/hu_HU/lang.inc index 80f4bc5da..2e46a530f 100644 --- a/languages/hu_HU/lang.inc +++ b/languages/hu_HU/lang.inc @@ -900,6 +900,8 @@ URL: [url]', 'settings_cannot_disable' => 'ENABLE_INSTALL_TOOL állomány nem került törlésre', 'settings_checkOutDir' => '', 'settings_checkOutDir_desc' => '', +'settings_cmdTimeout' => '', +'settings_cmdTimeout_desc' => '', 'settings_contentDir' => 'Tartalom könyvtár', 'settings_contentDir_desc' => 'Feltöltött állományok tárolási helye (olyan könyvtárat érdemes választani, amelyhez nem lehet a webszerveren keresztül hozzáférni)', 'settings_contentOffsetDir' => 'Tartalom eltérési könyvtár', diff --git a/languages/it_IT/lang.inc b/languages/it_IT/lang.inc index 6960a63ab..a43386ea3 100644 --- a/languages/it_IT/lang.inc +++ b/languages/it_IT/lang.inc @@ -924,6 +924,8 @@ URL: [url]', 'settings_cannot_disable' => 'Il file ENABLE_INSTALL_TOOL non può essere cancellato', 'settings_checkOutDir' => 'Cartella per i documenti approvati', 'settings_checkOutDir_desc' => 'Questa eultima versione del documento viene copiata se approvato. Se accessibile agli utenti, possono editare il documento e ricopiarlo quando finito.', +'settings_cmdTimeout' => '', +'settings_cmdTimeout_desc' => '', 'settings_contentDir' => 'Cartella contenitore', 'settings_contentDir_desc' => 'Cartella in cui vengono conservati i files caricati, si consiglia di scegliere una cartella sul web-server che non sia direttamente accessibile.', 'settings_contentOffsetDir' => 'Cartella Offset', diff --git a/languages/ko_KR/lang.inc b/languages/ko_KR/lang.inc index 3d19d8e13..427ee8958 100644 --- a/languages/ko_KR/lang.inc +++ b/languages/ko_KR/lang.inc @@ -915,6 +915,8 @@ URL : [url]', 'settings_cannot_disable' => '파일 ENABLE_INSTALL_TOOL 삭제할 수 없습니다', 'settings_checkOutDir' => '체크아웃 문서 디렉토리', 'settings_checkOutDir_desc' => '이것은 문서가 체크아웃된 문서의 최신 내용이 복사되는 디렉토리입니다. 사용자를 위해 이 디렉토리에 액세스 할 수 있도록 하면 파일을 편집하고 종료시 그것을 다시 확인할 수 있습니다.', +'settings_cmdTimeout' => '', +'settings_cmdTimeout_desc' => '', 'settings_contentDir' => '내용 디렉토리', 'settings_contentDir_desc' => '업로드 된 파일의 저장 위치(웹 서버를 통해 액세스 할 수없는 디렉토리를 선택하는 것이 가장 좋습니다)', 'settings_contentOffsetDir' => '내용 오프셋 디렉토리', diff --git a/languages/nl_NL/lang.inc b/languages/nl_NL/lang.inc index bd15318a1..3a3f28351 100644 --- a/languages/nl_NL/lang.inc +++ b/languages/nl_NL/lang.inc @@ -892,6 +892,8 @@ URL: [url]', 'settings_cannot_disable' => 'Bestand ENABLE_INSTALL_TOOL kon niet verwijderd worden', 'settings_checkOutDir' => '', 'settings_checkOutDir_desc' => '', +'settings_cmdTimeout' => '', +'settings_cmdTimeout_desc' => '', 'settings_contentDir' => 'Inhoud map', 'settings_contentDir_desc' => 'Waar de verzonden bestande opgeslagen worden (Kan het beste een map zijn die niet benaderbaar is voor de webserver.)', 'settings_contentOffsetDir' => 'Inhouds Basis Map', diff --git a/languages/pl_PL/lang.inc b/languages/pl_PL/lang.inc index 3d3d3b7ad..32622981f 100644 --- a/languages/pl_PL/lang.inc +++ b/languages/pl_PL/lang.inc @@ -880,6 +880,8 @@ URL: [url]', 'settings_cannot_disable' => 'Plik ENABLE_INSTALL_TOOL nie może zostać usunięty', 'settings_checkOutDir' => '', 'settings_checkOutDir_desc' => '', +'settings_cmdTimeout' => '', +'settings_cmdTimeout_desc' => '', 'settings_contentDir' => 'Katalog treści', 'settings_contentDir_desc' => 'Miejsce, gdzie będą przechowywane wczytane pliki (najlepien wybrać katalog, który nie jest dostępny dla serwera http)', 'settings_contentOffsetDir' => 'Offset katalogu treści', diff --git a/languages/pt_BR/lang.inc b/languages/pt_BR/lang.inc index bbf66bd6b..9f7b1f42b 100644 --- a/languages/pt_BR/lang.inc +++ b/languages/pt_BR/lang.inc @@ -898,6 +898,8 @@ URL: [url]', 'settings_cannot_disable' => 'Arquivo ENABLE_INSTALL_TOOL não pode ser eliminado', 'settings_checkOutDir' => '', 'settings_checkOutDir_desc' => '', +'settings_cmdTimeout' => '', +'settings_cmdTimeout_desc' => '', 'settings_contentDir' => 'Diretório de conteúdo', 'settings_contentDir_desc' => 'Onde arquivos enviados são armazenados (melhor escolher um diretório que não é acessível através de seu web-server)', 'settings_contentOffsetDir' => 'Pasta de Compensação de Conteúdo', diff --git a/languages/ro_RO/lang.inc b/languages/ro_RO/lang.inc index ea0c0d388..0656513fb 100644 --- a/languages/ro_RO/lang.inc +++ b/languages/ro_RO/lang.inc @@ -923,6 +923,8 @@ URL: [url]', 'settings_cannot_disable' => 'Fișierul ENABLE_INSTALL_TOOL nu a putut fi șters', 'settings_checkOutDir' => 'Director pentru documente verificate', 'settings_checkOutDir_desc' => 'Acesta este directorul unde se copie ultimul continut al unui document daca documentul este verificat. Daca faceti acest director accesibil pentru utilizatori, ei pot edita fisierul si ii pot face iar check in cand au terminat.', +'settings_cmdTimeout' => '', +'settings_cmdTimeout_desc' => '', 'settings_contentDir' => 'Director conținut', 'settings_contentDir_desc' => 'Unde sunt stocate fișierele încărcate (este recomandat sa alegeti un director care nu este accesibil prin intermediul web-server-ului dumneavoastră)', 'settings_contentOffsetDir' => 'Conținut Director Offset', diff --git a/languages/ru_RU/lang.inc b/languages/ru_RU/lang.inc index 7b6b5e95d..31b4f60ab 100644 --- a/languages/ru_RU/lang.inc +++ b/languages/ru_RU/lang.inc @@ -891,6 +891,8 @@ URL: [url]', 'settings_cannot_disable' => 'Невозможно удалить ENABLE_INSTALL_TOOL', 'settings_checkOutDir' => '', 'settings_checkOutDir_desc' => '', +'settings_cmdTimeout' => '', +'settings_cmdTimeout_desc' => '', 'settings_contentDir' => 'Каталог содержимого', 'settings_contentDir_desc' => 'Куда сохраняются загруженные файлы (лучше выбрать каталог недоступный веб-серверу).', 'settings_contentOffsetDir' => 'Базовый начальный каталог', diff --git a/languages/sk_SK/lang.inc b/languages/sk_SK/lang.inc index 9b4f40749..d8c73afda 100644 --- a/languages/sk_SK/lang.inc +++ b/languages/sk_SK/lang.inc @@ -751,6 +751,8 @@ $text = array( 'settings_cannot_disable' => '', 'settings_checkOutDir' => '', 'settings_checkOutDir_desc' => '', +'settings_cmdTimeout' => '', +'settings_cmdTimeout_desc' => '', 'settings_contentDir' => '', 'settings_contentDir_desc' => '', 'settings_contentOffsetDir' => '', diff --git a/languages/sv_SE/lang.inc b/languages/sv_SE/lang.inc index 79542fece..6a09baa18 100644 --- a/languages/sv_SE/lang.inc +++ b/languages/sv_SE/lang.inc @@ -886,6 +886,8 @@ URL: [url]', 'settings_cannot_disable' => 'Filen ENABLE_INSTALL_TOOL kunde inte tas bort', 'settings_checkOutDir' => '', 'settings_checkOutDir_desc' => '', +'settings_cmdTimeout' => '', +'settings_cmdTimeout_desc' => '', 'settings_contentDir' => 'Mapp för innehållet', 'settings_contentDir_desc' => 'Mappen där alla uppladdade filer kommer att sparas. (Det bästa är att välja en mapp som inte är tillgänglig från webbservern)', 'settings_contentOffsetDir' => 'Innehåll offset-mapp', diff --git a/languages/tr_TR/lang.inc b/languages/tr_TR/lang.inc index ff355e9a7..a9b8b65d5 100644 --- a/languages/tr_TR/lang.inc +++ b/languages/tr_TR/lang.inc @@ -902,6 +902,8 @@ URL: [url]', 'settings_cannot_disable' => 'ENABLE_INSTALL_TOOL dosyası silinemedi', 'settings_checkOutDir' => '', 'settings_checkOutDir_desc' => '', +'settings_cmdTimeout' => '', +'settings_cmdTimeout_desc' => '', 'settings_contentDir' => 'İçerik dizini', 'settings_contentDir_desc' => 'Yüklenecek dosyaların depolanacağı yer (web üzerinden erişilemeyen bir yer tercih etmeniz önerilir.)', 'settings_contentOffsetDir' => 'İçerik Ofset Klasörü', diff --git a/languages/uk_UA/lang.inc b/languages/uk_UA/lang.inc index 5cae87ce7..1988d3644 100644 --- a/languages/uk_UA/lang.inc +++ b/languages/uk_UA/lang.inc @@ -913,6 +913,8 @@ URL: [url]', 'settings_cannot_disable' => 'Неможливо видалити ENABLE_INSTALL_TOOL', 'settings_checkOutDir' => 'Каталог для документів на опрацюванні', 'settings_checkOutDir_desc' => 'Це каталог, куди скопійовано останній вміст документу, якщо він на опрацюванні. Якщо ви зробите цей каталог доступний користувачам, вони зможуть редагувати файл і завантажувати його назад по завершенні роботи.', +'settings_cmdTimeout' => '', +'settings_cmdTimeout_desc' => '', 'settings_contentDir' => 'Каталог вмісту', 'settings_contentDir_desc' => 'Куди зберігаються завантажені файли (краще вибрати каталог, недоступний веб-серверові).', 'settings_contentOffsetDir' => 'Базовий початковий каталог', diff --git a/languages/zh_CN/lang.inc b/languages/zh_CN/lang.inc index 253e06eef..e2859c6f7 100644 --- a/languages/zh_CN/lang.inc +++ b/languages/zh_CN/lang.inc @@ -757,6 +757,8 @@ URL: [url]', 'settings_cannot_disable' => '', 'settings_checkOutDir' => '', 'settings_checkOutDir_desc' => '', +'settings_cmdTimeout' => '', +'settings_cmdTimeout_desc' => '', 'settings_contentDir' => '', 'settings_contentDir_desc' => '', 'settings_contentOffsetDir' => '内容偏移目录', diff --git a/languages/zh_TW/lang.inc b/languages/zh_TW/lang.inc index f0012fa39..909accb13 100644 --- a/languages/zh_TW/lang.inc +++ b/languages/zh_TW/lang.inc @@ -755,6 +755,8 @@ URL: [url]', 'settings_cannot_disable' => '', 'settings_checkOutDir' => '', 'settings_checkOutDir_desc' => '', +'settings_cmdTimeout' => '', +'settings_cmdTimeout_desc' => '', 'settings_contentDir' => '', 'settings_contentDir_desc' => '', 'settings_contentOffsetDir' => '內容偏移目錄', diff --git a/op/op.Settings.php b/op/op.Settings.php index ee45499d0..374b28dc1 100644 --- a/op/op.Settings.php +++ b/op/op.Settings.php @@ -175,6 +175,7 @@ if ($action == "saveSettings") $settings->_maxDirID = intval($_POST["maxDirID"]); $settings->_updateNotifyTime = intval($_POST["updateNotifyTime"]); $settings->_maxExecutionTime = intval($_POST["maxExecutionTime"]); + $settings->_cmdTimeout = (intval($_POST["cmdTimeout"]) > 0) ?intval($_POST["cmdTimeout"]) : 1; // SETTINGS - ADVANCED - INDEX CMD if(isset($_POST["converters"]["fulltext"])) diff --git a/out/out.Indexer.php b/out/out.Indexer.php index 2900ef55f..ce4ab48f7 100644 --- a/out/out.Indexer.php +++ b/out/out.Indexer.php @@ -67,7 +67,7 @@ else { $folder = $dms->getFolder($folderid); $tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); -$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'index'=>$index, 'recreate'=>(isset($_GET['create']) && $_GET['create']==1), 'folder'=>$folder, 'converters'=>$settings->_converters['fulltext'])); +$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'index'=>$index, 'recreate'=>(isset($_GET['create']) && $_GET['create']==1), 'folder'=>$folder, 'converters'=>$settings->_converters['fulltext'], 'timeout'=>$settings->_cmdTimeout)); if($view) { $view->show(); exit; diff --git a/utils/xmlimport.php b/utils/xmlimport.php index 611c7faee..5c997e8d1 100644 --- a/utils/xmlimport.php +++ b/utils/xmlimport.php @@ -94,6 +94,23 @@ function insert_user($user) { /* {{{ */ return $newUser; } /* }}} */ +function set_homefolders() { /* {{{ */ + global $dms, $debug, $defaultUser, $users, $objmap; + + foreach($users as $user) { + if(isset($user['attributes']['homefolder'])) { + if(array_key_exists($user['id'], $objmap['users'])) { + $userobj = $dms->getUser($objmap['users'][$user['id']]); + if(!array_key_exists((int) $user['attributes']['homefolder'], $objmap['folders'])) { + echo "Error: homefolder cannot be found\n"; + } else { + $userobj->setHomeFolder($objmap['folders'][(int) $user['attributes']['homefolder']]); + } + } + } + } +} /* }}} */ + function insert_group($group) { /* {{{ */ global $dms, $debug, $objmap, $sections, $users; @@ -1239,6 +1256,8 @@ while ($data = fread($fp, 65535)) { resolve_links(); +set_homefolders(); + if($exportmapping) { if($fp = fopen($exportmapping, 'w')) { fputcsv($fp, array('object type', 'old id', 'new id')); diff --git a/views/bootstrap/class.Indexer.php b/views/bootstrap/class.Indexer.php index 53648feec..6219a14aa 100644 --- a/views/bootstrap/class.Indexer.php +++ b/views/bootstrap/class.Indexer.php @@ -43,8 +43,12 @@ class SeedDMS_View_Indexer extends SeedDMS_Bootstrap_Style { echo $indent." ".$document->getId().":".htmlspecialchars($document->getName())." "; /* If the document wasn't indexed before then just add it */ if(!($hits = $index->find('document_id:'.$document->getId()))) { - $index->addDocument(new SeedDMS_Lucene_IndexedDocument($dms, $document, $this->converters ? $this->converters : null)); - echo "(document added)"; + try { + $index->addDocument(new SeedDMS_Lucene_IndexedDocument($dms, $document, $this->converters ? $this->converters : null, false, $this->timeout)); + echo "(document added)"; + } catch(Exception $e) { + echo $indent."(adding document failed '".$e->getMessage()."')"; + } } else { $hit = $hits[0]; /* Check if the attribute created is set or has a value older @@ -62,8 +66,13 @@ class SeedDMS_View_Indexer extends SeedDMS_Bootstrap_Style { echo $indent."(document unchanged)"; } else { $index->delete($hit->id); - $index->addDocument(new SeedDMS_Lucene_IndexedDocument($dms, $document, $this->converters ? $this->converters : null)); - echo $indent."(document updated)"; + try { + $index->addDocument(new SeedDMS_Lucene_IndexedDocument($dms, $document, $this->converters ? $this->converters : null, false, $this->timeout)); + echo $indent."(document updated)"; + } catch(Exception $e) { + print_r($e); + echo $indent."(updating document failed)"; + } } } echo "\n"; @@ -77,6 +86,7 @@ class SeedDMS_View_Indexer extends SeedDMS_Bootstrap_Style { $recreate = $this->params['recreate']; $folder = $this->params['folder']; $this->converters = $this->params['converters']; + $this->timeout = $this->params['timeout']; $this->htmlStartPage(getMLText("admin_tools")); $this->globalNavigation(); diff --git a/views/bootstrap/class.Settings.php b/views/bootstrap/class.Settings.php index 2495ae059..5cbbaed26 100644 --- a/views/bootstrap/class.Settings.php +++ b/views/bootstrap/class.Settings.php @@ -611,6 +611,10 @@ if(!is_writeable($settings->_configFilePath)) { : + "> + : + +