Merge branch 'seeddms-5.1.x' into seeddms-6.0.x

This commit is contained in:
Uwe Steinmann 2023-02-12 14:36:17 +01:00
commit d86b2cc883
6 changed files with 125 additions and 2 deletions

View File

@ -49,6 +49,7 @@ class SeedDMS_ConversionServiceExec extends SeedDMS_ConversionServiceBase {
); );
$pipes = array(); $pipes = array();
$orgtimeout = $timeout;
$timeout += time(); $timeout += time();
// Putting an 'exec' before the command will not fork the command // Putting an 'exec' before the command will not fork the command
// and therefore not create any child process. proc_terminate will // and therefore not create any child process. proc_terminate will
@ -84,7 +85,7 @@ class SeedDMS_ConversionServiceExec extends SeedDMS_ConversionServiceBase {
fclose($pipes[2]); fclose($pipes[2]);
if ($timeleft <= 0) { if ($timeleft <= 0) {
proc_terminate($process); proc_terminate($process);
throw new Exception("command timeout on: " . $cmd); throw new Exception("command timeout after ".$orgtimeout." secs on: " . $cmd);
} else { } else {
$return_value = proc_close($process); $return_value = proc_close($process);
return array('stdout'=>$output, 'stderr'=>$error, 'return'=>$return_value); return array('stdout'=>$output, 'stderr'=>$error, 'return'=>$return_value);
@ -169,6 +170,9 @@ class SeedDMS_ConversionServiceExec extends SeedDMS_ConversionServiceBase {
if($hastempfile) if($hastempfile)
unlink($tmpfile); unlink($tmpfile);
$this->success = false; $this->success = false;
if($this->logger) {
$this->logger->log('Conversion from '.$this->from.' to '.$this->to.' with cmd "'.$this->cmd.'" failed: '.$e->getMessage(), PEAR_LOG_ERR);
}
return false; return false;
} }
$end = microtime(true); $end = microtime(true);

View File

@ -0,0 +1,47 @@
<?php
// MyDMS. Document Management System
// Copyright (C) 2010 Matteo Lucarelli
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
if(!isset($settings))
require_once("../inc/inc.Settings.php");
require_once("inc/inc.Utils.php");
require_once("inc/inc.LogInit.php");
require_once("inc/inc.Language.php");
require_once("inc/inc.Init.php");
require_once("inc/inc.Extension.php");
require_once("inc/inc.DBInit.php");
require_once("inc/inc.ClassUI.php");
require_once("inc/inc.Authentication.php");
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user));
$accessop = new SeedDMS_AccessOperation($dms, $user, $settings);
if (!$settings->_enableDebugMode) {
UI::exitError(getMLText("admin_tools"),getMLText("access_denied"));
}
if (!$accessop->check_view_access($view, $_GET)) {
UI::exitError(getMLText("admin_tools"),getMLText("access_denied"));
}
if($view) {
$view->setParam('settings', $settings);
$view->setParam('accessobject', $accessop);
$view->setParam('conversionmgr', $conversionmgr);
$view($_GET);
exit;
}

View File

@ -1041,6 +1041,8 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
$menuitems['debug']['children']['hooks'] = array('link'=>"../out/out.Hooks.php", 'label'=>getMLText('list_hooks')); $menuitems['debug']['children']['hooks'] = array('link'=>"../out/out.Hooks.php", 'label'=>getMLText('list_hooks'));
if ($accessobject->check_view_access('NotificationServices')) if ($accessobject->check_view_access('NotificationServices'))
$menuitems['debug']['children']['notification_services'] = array('link'=>"../out/out.NotificationServices.php", 'label'=>getMLText('list_notification_services')); $menuitems['debug']['children']['notification_services'] = array('link'=>"../out/out.NotificationServices.php", 'label'=>getMLText('list_notification_services'));
if ($accessobject->check_view_access('ConversionServices'))
$menuitems['debug']['children']['conversion_services'] = array('link'=>"../out/out.ConversionServices.php", 'label'=>getMLText('list_conversion_services'));
} }
} }

View File

@ -0,0 +1,68 @@
<?php
/**
* Implementation of Conversion Services view
*
* @category DMS
* @package SeedDMS
* @license GPL 2
* @version @version@
* @author Uwe Steinmann <uwe@steinmann.cx>
* @copyright Copyright (C) 2010-2023 Uwe Steinmann
* @version Release: @package_version@
*/
/**
* Class which outputs the html page for Conversion Services view
*
* @category DMS
* @package SeedDMS
* @author Uwe Steinmann <uwe@steinmann.cx>
* @copyright Copyright (C) 2016 Uwe Steinmann
* @version Release: @package_version@
*/
class SeedDMS_View_ConversionServices extends SeedDMS_Theme_Style {
/**
* List all registered conversion services
*
*/
function list_conversion_services($conversionmgr) { /* {{{ */
if(!$conversionmgr)
return;
$allservices = $conversionmgr->getServices();
echo "<table class=\"table table-condensed table-sm\">\n";
echo "<thead>";
echo "<tr><th>".getMLText('service_list_from')."</th><th>".getMLText('service_list_to')."</th><th>".getMLText('class_name')."</th><th>".getMLText('service_list_info')."</th></tr>\n";
echo "</thead>";
echo "<tbody>";
foreach($allservices as $from=>$tos) {
foreach($tos as $to=>$services) {
foreach($services as $service) {
echo "<tr><td>".$from."</td><td>".$to."</td><td>".get_class($service)."</td><td>".$service->getInfo()."</td></tr>";
}
}
}
echo "</tbody>";
echo "</table>\n";
} /* }}} */
function show() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$conversionmgr = $this->params['conversionmgr'];
$this->htmlStartPage(getMLText("admin_tools"));
$this->globalNavigation();
$this->contentStart();
$this->pageNavigation(getMLText("admin_tools"), "admin_tools");
$this->contentHeading(getMLText("list_conversion_services"));
self::list_conversion_services($conversionmgr);
$this->contentEnd();
$this->htmlEndPage();
} /* }}} */
}

View File

@ -1894,7 +1894,7 @@ $(document).ready( function() {
if ($document->getAccessMode($user) >= M_READWRITE){ if ($document->getAccessMode($user) >= M_READWRITE){
if($enableDropUpload){ if($enableDropUpload){
?> ?>
<div id="draganddrophandler" class="well alert alert-warning" data-droptarget="attachment_<?= $document->getID(); ?>" data-target="<?= $document->getID(); ?>" data-uploadformtoken="<?= createFormKey('addfile'); ?>"><?php echo $this->html_link('AddFile', array('documentid'=>$documentid), array('class'=>'alert alert-warning'), getMLText('drop_files_here_or_click'), false, true); ?></div> <div id="draganddrophandler" class="well alert alert-warning" data-droptarget="attachment_<?= $document->getID(); ?>" data-target="<?= $document->getID(); ?>" data-uploadformtoken="<?= createFormKey('addfile'); ?>"><?php echo $this->html_link('AddFile', array('documentid'=>$documentid), array(), getMLText('drop_files_here_or_click'), false, true); ?></div>
<?php <?php
} else { } else {
print $this->html_link('AddFile', array('documentid'=>$documentid), array('class'=>'btn btn-primary'), getMLText("add"), false, true)."\n"; print $this->html_link('AddFile', array('documentid'=>$documentid), array('class'=>'btn btn-primary'), getMLText("add"), false, true)."\n";

View File

@ -951,6 +951,8 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
$menuitems['debug']['children']['hooks'] = array('link'=>"../out/out.Hooks.php", 'label'=>getMLText('list_hooks')); $menuitems['debug']['children']['hooks'] = array('link'=>"../out/out.Hooks.php", 'label'=>getMLText('list_hooks'));
if ($accessobject->check_view_access('NotificationServices')) if ($accessobject->check_view_access('NotificationServices'))
$menuitems['debug']['children']['notification_services'] = array('link'=>"../out/out.NotificationServices.php", 'label'=>getMLText('list_notification_services')); $menuitems['debug']['children']['notification_services'] = array('link'=>"../out/out.NotificationServices.php", 'label'=>getMLText('list_notification_services'));
if ($accessobject->check_view_access('ConversionServices'))
$menuitems['debug']['children']['conversion_services'] = array('link'=>"../out/out.ConversionServices.php", 'label'=>getMLText('list_conversion_services'));
} }
} }