Move devLog to Helper

This commit is contained in:
Sebastian Meyer 2019-03-15 11:03:54 +01:00
parent d1b9e09824
commit 1e41e379a3
21 changed files with 174 additions and 330 deletions

View File

@ -130,9 +130,7 @@ abstract class AbstractPlugin extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin
if (!$this->doc->ready) {
// Destroy the incomplete object.
$this->doc = NULL;
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\AbstractPlugin->loadDocument()] Failed to load document with UID "'.$this->piVars['id'].'"', $this->extKey, SYSLOG_SEVERITY_ERROR);
}
Helper::devLog('Failed to load document with UID '.$this->piVars['id'], DEVLOG_SEVERITY_ERROR);
} else {
// Set configuration PID.
$this->doc->cPid = $this->conf['pages'];
@ -156,14 +154,10 @@ abstract class AbstractPlugin extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin
// Try to load document.
$this->loadDocument();
} else {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\AbstractPlugin->loadDocument()] Failed to load document with record ID "'.$this->piVars['recordId'].'"', $this->extKey, SYSLOG_SEVERITY_ERROR);
}
Helper::devLog('Failed to load document with record ID "'.$this->piVars['recordId'].'"', DEVLOG_SEVERITY_ERROR);
}
} else {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\AbstractPlugin->loadDocument()] Invalid UID "'.$this->piVars['id'].'" or PID "'.$this->conf['pages'].'" for document loading', $this->extKey, SYSLOG_SEVERITY_ERROR);
}
Helper::devLog('Invalid UID '.$this->piVars['id'].' or PID '.$this->conf['pages'].' for document loading', DEVLOG_SEVERITY_ERROR);
}
}

View File

@ -368,9 +368,7 @@ final class Document {
&& ($location = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="'.$id.'"]/mets:FLocat[@LOCTYPE="URL"]'))) {
return (string) $location[0]->attributes('http://www.w3.org/1999/xlink')->href;
} else {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\Document->getFileLocation('.$id.')] There is no file node with @ID "'.$id.'"', self::$extKey, SYSLOG_SEVERITY_WARNING);
}
Helper::devLog('There is no file node with @ID "'.$id.'"', DEVLOG_SEVERITY_WARNING);
return '';
}
}
@ -389,9 +387,7 @@ final class Document {
&& ($mimetype = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="'.$id.'"]/@MIMETYPE'))) {
return (string) $mimetype[0];
} else {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\Document->getFileMimeType('.$id.')] There is no file node with @ID "'.$id.'" or no MIME type specified', self::$extKey, SYSLOG_SEVERITY_WARNING);
}
Helper::devLog('There is no file node with @ID "'.$id.'" or no MIME type specified', DEVLOG_SEVERITY_WARNING);
return '';
}
}
@ -602,9 +598,7 @@ final class Document {
// Retain current PID.
$cPid = ($this->cPid ? $this->cPid : $this->pid);
} elseif (!$cPid) {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\Document->getMetadata('.$id.', '.$_cPid.')] Invalid PID "'.$cPid.'" for metadata definitions', self::$extKey, SYSLOG_SEVERITY_ERROR);
}
Helper::devLog('Invalid PID '.$cPid.' for metadata definitions', DEVLOG_SEVERITY_WARNING);
return [];
}
// Get metadata from parsed metadata array if available.
@ -651,15 +645,11 @@ final class Document {
&& ($obj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance($class)) instanceof MetadataInterface) {
$obj->extractMetadata($this->dmdSec[$dmdId]['xml'], $metadata);
} else {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\Document->getMetadata('.$id.', '.$_cPid.')] Invalid class/method "'.$class.'->extractMetadata()" for metadata format "'.$this->dmdSec[$dmdId]['type'].'"', self::$extKey, SYSLOG_SEVERITY_WARNING);
}
Helper::devLog('Invalid class/method "'.$class.'->extractMetadata()" for metadata format "'.$this->dmdSec[$dmdId]['type'].'"', DEVLOG_SEVERITY_WARNING);
}
}
} else {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\Document->getMetadata('.$id.', '.$_cPid.')] Unsupported metadata format "'.$this->dmdSec[$dmdId]['type'].'" in dmdSec with @ID "'.$dmdId.'"', self::$extKey, SYSLOG_SEVERITY_WARNING);
}
Helper::devLog('Unsupported metadata format "'.$this->dmdSec[$dmdId]['type'].'" in dmdSec with @ID "'.$dmdId.'"', DEVLOG_SEVERITY_WARNING);
return [];
}
// Get the structure's type.
@ -832,9 +822,7 @@ final class Document {
// Get the root element's name as text format.
$textFormat = strtoupper($rawTextXml->getName());
} else {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\Document->getRawText('.$id.')] Invalid structure node @ID "'.$id.'"', self::$extKey, SYSLOG_SEVERITY_WARNING);
}
Helper::devLog('Invalid structure node @ID "'.$id.'"', DEVLOG_SEVERITY_WARNING);
return $rawText;
}
// Is this text format supported?
@ -847,15 +835,11 @@ final class Document {
$rawText = $obj->getRawText($rawTextXml);
$this->rawTextArray[$id] = $rawText;
} else {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\Document->getRawText('.$id.')] Invalid class/method "'.$class.'->getRawText()" for text format "'.$textFormat.'"', self::$extKey, SYSLOG_SEVERITY_WARNING);
}
Helper::devLog('Invalid class/method "'.$class.'->getRawText()" for text format "'.$textFormat.'"', DEVLOG_SEVERITY_WARNING);
}
}
} else {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\Document->getRawText('.$id.')] Unsupported text format "'.$textFormat.'" in physical node with @ID "'.$id.'"', self::$extKey, SYSLOG_SEVERITY_WARNING);
}
Helper::devLog('Unsupported text format "'.$textFormat.'" in physical node with @ID "'.$id.'"', DEVLOG_SEVERITY_WARNING);
}
}
return $rawText;
@ -898,14 +882,10 @@ final class Document {
$title = self::getTitle($partof, TRUE);
}
} else {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\Document->getTitle('.$_uid.', ['.($recursive ? 'TRUE' : 'FALSE').'])] No document with UID "'.$uid.'" found or document not accessible', self::$extKey, SYSLOG_SEVERITY_WARNING);
}
Helper::devLog('No document with UID '.$uid.' found or document not accessible', DEVLOG_SEVERITY_WARNING);
}
} else {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\Document->getTitle('.$_uid.', ['.($recursive ? 'TRUE' : 'FALSE').'])] Invalid UID "'.$uid.'" for document', self::$extKey, SYSLOG_SEVERITY_ERROR);
}
Helper::devLog('Invalid UID '.$uid.' for document', DEVLOG_SEVERITY_ERROR);
}
return $title;
}
@ -948,9 +928,7 @@ final class Document {
// Register namespaces.
$this->registerNamespaces($this->mets);
} else {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\Document->init()] No METS part found in document with UID "'.$this->uid.'"', self::$extKey, SYSLOG_SEVERITY_ERROR);
}
Helper::devLog('No METS part found in document with UID '.$this->uid, DEVLOG_SEVERITY_ERROR);
}
}
@ -987,14 +965,10 @@ final class Document {
$this->xml = $xml;
return TRUE;
} else {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\Document->load('.$location.')] Could not load XML file from "'.$location.'"', self::$extKey, SYSLOG_SEVERITY_ERROR);
}
Helper::devLog('Could not load XML file from "'.$location.'"', DEVLOG_SEVERITY_ERROR);
}
} else {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\Document->load('.$location.')] Invalid file location "'.$location.'" for document loading', self::$extKey, SYSLOG_SEVERITY_ERROR);
}
Helper::devLog('Invalid file location "'.$location.'" for document loading', DEVLOG_SEVERITY_ERROR);
}
return FALSE;
}
@ -1047,9 +1021,7 @@ final class Document {
} elseif ($obj instanceof \DOMXPath) {
$method = 'registerNamespace';
} else {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\Document->registerNamespaces(['.get_class($obj).'])] Given object is neither a SimpleXMLElement nor a DOMXPath instance', self::$extKey, SYSLOG_SEVERITY_ERROR);
}
Helper::devLog('Given object is neither a SimpleXMLElement nor a DOMXPath instance', DEVLOG_SEVERITY_ERROR);
return;
}
// Register metadata format's namespaces.
@ -1073,9 +1045,7 @@ final class Document {
$_pid = $pid;
$_core = $core;
if (TYPO3_MODE !== 'BE') {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\Document->save('.$_pid.', '.$_core.')] Saving a document is only allowed in the backend', self::$extKey, SYSLOG_SEVERITY_ERROR);
}
Helper::devLog('Saving a document is only allowed in the backend', DEVLOG_SEVERITY_ERROR);
return FALSE;
}
// Make sure $pid is a non-negative integer.
@ -1088,9 +1058,7 @@ final class Document {
// Retain current PID.
$pid = $this->pid;
} elseif (!$pid) {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\Document->save('.$_pid.', '.$_core.')] Invalid PID "'.$pid.'" for document saving', self::$extKey, SYSLOG_SEVERITY_ERROR);
}
Helper::devLog('Invalid PID '.$pid.' for document saving', DEVLOG_SEVERITY_ERROR);
return FALSE;
}
// Set PID for metadata definitions.
@ -1103,9 +1071,7 @@ final class Document {
$metadata = $this->getTitledata($pid);
// Check for record identifier.
if (empty($metadata['record_id'][0])) {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\Document->save('.$_pid.', '.$_core.')] No record identifier found to avoid duplication', self::$extKey, SYSLOG_SEVERITY_ERROR);
}
Helper::devLog('No record identifier found to avoid duplication', DEVLOG_SEVERITY_ERROR);
return FALSE;
}
// Load plugin configuration.
@ -1122,9 +1088,7 @@ final class Document {
'1'
);
if (!$GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\Document->save('.$_pid.', '.$_core.')] Backend user "_cli_dlf" not found or disabled', self::$extKey, SYSLOG_SEVERITY_ERROR);
}
Helper::devLog('Backend user "_cli_dlf" not found or disabled', DEVLOG_SEVERITY_ERROR);
return FALSE;
}
// Get UID for structure type.
@ -1141,9 +1105,7 @@ final class Document {
if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
list ($structure) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result);
} else {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\Document->save('.$_pid.', '.$_core.')] Could not identify document/structure type '.$GLOBALS['TYPO3_DB']->fullQuoteStr($metadata['type'][0], 'tx_dlf_structures'), self::$extKey, SYSLOG_SEVERITY_ERROR);
}
Helper::devLog('Could not identify document/structure type "'.$GLOBALS['TYPO3_DB']->fullQuoteStr($metadata['type'][0], 'tx_dlf_structures').'"', DEVLOG_SEVERITY_ERROR);
return FALSE;
}
$metadata['type'][0] = $structure;
@ -1357,9 +1319,7 @@ final class Document {
if ($core) {
Indexer::add($this, $core);
} else {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\Document->save('.$_pid.', '.$_core.')] Invalid UID "'.$core.'" for Solr core', self::$extKey, SYSLOG_SEVERITY_NOTICE);
}
Helper::devLog('Invalid UID "'.$core.'" for Solr core', DEVLOG_SEVERITY_NOTICE);
}
return TRUE;
}
@ -1492,9 +1452,7 @@ final class Document {
// Set metadata definitions' PID.
$cPid = ($this->cPid ? $this->cPid : $this->pid);
if (!$cPid) {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\Document->getMetadataArray()] Invalid PID "'.$cPid.'" for metadata definitions', self::$extKey, SYSLOG_SEVERITY_ERROR);
}
Helper::devLog('Invalid PID '.$cPid.' for metadata definitions', DEVLOG_SEVERITY_ERROR);
return [];
}
if (!$this->metadataArrayLoaded
@ -1725,18 +1683,14 @@ final class Document {
// Retain current PID.
$cPid = ($this->cPid ? $this->cPid : $this->pid);
if (!$cPid) {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\Document->_getThumbnail()] Invalid PID "'.$cPid.'" for structure definitions', self::$extKey, SYSLOG_SEVERITY_ERROR);
}
Helper::devLog('Invalid PID '.$cPid.' for structure definitions', DEVLOG_SEVERITY_ERROR);
$this->thumbnailLoaded = TRUE;
return $this->thumbnail;
}
// Load extension configuration.
$extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][self::$extKey]);
if (empty($extConf['fileGrpThumbs'])) {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\Document->_getThumbnail()] No fileGrp for thumbnails specified', self::$extKey, SYSLOG_SEVERITY_WARNING);
}
Helper::devLog('No fileGrp for thumbnails specified', DEVLOG_SEVERITY_WARNING);
$this->thumbnailLoaded = TRUE;
return $this->thumbnail;
}
@ -1773,8 +1727,8 @@ final class Document {
} else {
$this->thumbnail = $this->getFileLocation($this->physicalStructureInfo[$this->physicalStructure[1]]['files'][$extConf['fileGrpThumbs']]);
}
} elseif (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\Document->_getThumbnail()] No structure of type "'.$metadata['type'][0].'" found in database', self::$extKey, SYSLOG_SEVERITY_ERROR);
} else {
Helper::devLog('No structure of type "'.$metadata['type'][0].'" found in database', DEVLOG_SEVERITY_ERROR);
}
$this->thumbnailLoaded = TRUE;
}
@ -1937,9 +1891,7 @@ final class Document {
// Document ready!
$this->ready = TRUE;
} else {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\Document->__construct('.$uid.', '.$pid.')] No document with UID "'.$uid.'" found or document not accessible', self::$extKey, SYSLOG_SEVERITY_ERROR);
}
Helper::devLog('No document with UID '.$uid.' found or document not accessible', DEVLOG_SEVERITY_ERROR);
}
}
@ -1956,9 +1908,7 @@ final class Document {
$method = '_get'.ucfirst($var);
if (!property_exists($this, $var)
|| !method_exists($this, $method)) {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\Document->__get('.$var.')] There is no getter function for property "'.$var.'"', self::$extKey, SYSLOG_SEVERITY_WARNING);
}
Helper::devLog('There is no getter function for property "'.$var.'"', DEVLOG_SEVERITY_WARNING);
return;
} else {
return $this->$method();
@ -1979,9 +1929,7 @@ final class Document {
$method = '_set'.ucfirst($var);
if (!property_exists($this, $var)
|| !method_exists($this, $method)) {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\Document->__set('.$var.', '.$value.')] There is no setter function for property "'.$var.'"', self::$extKey, SYSLOG_SEVERITY_WARNING);
}
Helper::devLog('There is no setter function for property "'.$var.'"', DEVLOG_SEVERITY_WARNING);
} else {
$this->$method($value);
}
@ -2036,9 +1984,7 @@ final class Document {
// Rebuild the unserializable properties.
$this->init();
} else {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\Document->__wakeup()] Could not load XML after deserialization', self::$extKey, SYSLOG_SEVERITY_ERROR);
}
Helper::devLog('Could not load XML after deserialization', DEVLOG_SEVERITY_ERROR);
}
}
}

View File

@ -122,9 +122,7 @@ class DocumentList implements \ArrayAccess, \Countable, \Iterator, \TYPO3\CMS\Co
if ($this->valid()) {
return $this->getRecord($this->elements[$this->position]);
} else {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\DocumentList->current()] Invalid position "'.$this->position.'" for list element', $this->extKey, SYSLOG_SEVERITY_NOTICE);
}
Helper::devLog('Invalid position "'.$this->position.'" for list element', DEVLOG_SEVERITY_NOTICE);
return;
}
}
@ -273,9 +271,7 @@ class DocumentList implements \ArrayAccess, \Countable, \Iterator, \TYPO3\CMS\Co
// Save record for later usage.
$this->records[$element['u']] = $record;
} else {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\DocumentList->getRecord([data])] No UID of list element to fetch full record', $this->extKey, SYSLOG_SEVERITY_NOTICE, $element);
}
Helper::devLog('No UID of list element to fetch full record', DEVLOG_SEVERITY_NOTICE);
$record = $element;
}
return $record;
@ -311,18 +307,14 @@ class DocumentList implements \ArrayAccess, \Countable, \Iterator, \TYPO3\CMS\Co
// Check if list position is valid.
if ($position < 0
|| $position >= $this->count) {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\DocumentList->move('.$_position.', '.$_steps.')] Invalid position "'.$position.'" for element moving', $this->extKey, SYSLOG_SEVERITY_WARNING);
}
Helper::devLog('Invalid position "'.$position.'" for element moving', DEVLOG_SEVERITY_WARNING);
return;
}
$steps = intval($steps);
// Check if moving given amount of steps is possible.
if (($position + $steps) < 0
|| ($position + $steps) >= $this->count) {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\DocumentList->move('.$_position.', '.$_steps.')] Invalid steps "'.$steps.'" for moving element at position "'.$position.'"', $this->extKey, SYSLOG_SEVERITY_WARNING);
}
Helper::devLog('Invalid steps "'.$steps.'" for moving element at position "'.$position.'"', DEVLOG_SEVERITY_WARNING);
return;
}
$element = $this->remove($position);
@ -395,9 +387,7 @@ class DocumentList implements \ArrayAccess, \Countable, \Iterator, \TYPO3\CMS\Co
if ($this->offsetExists($offset)) {
return $this->getRecord($this->elements[$offset]);
} else {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\DocumentList->offsetGet('.$offset.')] Invalid offset "'.$offset.'" for list element', $this->extKey, SYSLOG_SEVERITY_NOTICE);
}
Helper::devLog('Invalid offset "'.$offset.'" for list element', DEVLOG_SEVERITY_NOTICE);
return;
}
}
@ -439,9 +429,7 @@ class DocumentList implements \ArrayAccess, \Countable, \Iterator, \TYPO3\CMS\Co
$position = intval($position);
if ($position < 0
|| $position >= $this->count) {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\DocumentList->remove('.$_position.')] Invalid position "'.$position.'" for element removing', $this->extKey, SYSLOG_SEVERITY_WARNING);
}
Helper::devLog('Invalid position "'.$position.'" for element removing', DEVLOG_SEVERITY_WARNING);
return;
}
$removed = array_splice($this->elements, $position, 1);
@ -465,9 +453,7 @@ class DocumentList implements \ArrayAccess, \Countable, \Iterator, \TYPO3\CMS\Co
$position = intval($position);
if ($position < 0
|| $position >= $this->count) {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\DocumentList->remove('.$_position.')] Invalid position "'.$position.'" for element removing', $this->extKey, SYSLOG_SEVERITY_WARNING);
}
Helper::devLog('Invalid position "'.$position.'" for element removing', DEVLOG_SEVERITY_WARNING);
return;
}
$removed = array_splice($this->elements, $position, $length);
@ -589,9 +575,7 @@ class DocumentList implements \ArrayAccess, \Countable, \Iterator, \TYPO3\CMS\Co
if ($this->count == count($newOrder)) {
$this->elements = $newOrder;
} else {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\DocumentList->sort('.$by.', ['.($asc ? 'TRUE' : 'FALSE').'])] Sorted list elements do not match unsorted elements', $this->extKey, SYSLOG_SEVERITY_ERROR);
}
Helper::devLog('Sorted list elements do not match unsorted elements', DEVLOG_SEVERITY_ERROR);
}
}
@ -705,9 +689,7 @@ class DocumentList implements \ArrayAccess, \Countable, \Iterator, \TYPO3\CMS\Co
$method = '_get'.ucfirst($var);
if (!property_exists($this, $var)
|| !method_exists($this, $method)) {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\DocumentList->__get('.$var.')] There is no getter function for property "'.$var.'"', $this->extKey, SYSLOG_SEVERITY_WARNING);
}
Helper::devLog('There is no getter function for property "'.$var.'"', DEVLOG_SEVERITY_WARNING);
return;
} else {
return $this->$method();
@ -728,9 +710,7 @@ class DocumentList implements \ArrayAccess, \Countable, \Iterator, \TYPO3\CMS\Co
$method = '_set'.ucfirst($var);
if (!property_exists($this, $var)
|| !method_exists($this, $method)) {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\DocumentList->__set('.$var.', [data])] There is no setter function for property "'.$var.'"', $this->extKey, SYSLOG_SEVERITY_WARNING, $value);
}
Helper::devLog('There is no setter function for property "'.$var.'"', DEVLOG_SEVERITY_WARNING);
} else {
$this->$method($value);
}

View File

@ -139,9 +139,7 @@ class DocumentTypeCheck {
if (!$this->doc->ready) {
// Destroy the incomplete object.
$this->doc = NULL;
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\DocumentTypeCheck->loadDocument()] Failed to load document with UID "'.$this->piVars['id'].'"', $this->extKey, SYSLOG_SEVERITY_WARNING);
}
Helper::devLog('Failed to load document with UID '.$this->piVars['id'], DEVLOG_SEVERITY_WARNING);
}
} elseif (!empty($this->piVars['recordId'])) {
// Get UID of document with given record identifier.
@ -163,9 +161,7 @@ class DocumentTypeCheck {
// Try to load document.
$this->loadDocument();
} else {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\DocumentTypeCheck->loadDocument()] Failed to load document with record ID "'.$this->piVars['recordId'].'"', $this->extKey, SYSLOG_SEVERITY_WARNING);
}
Helper::devLog('Failed to load document with record ID "'.$this->piVars['recordId'].'"', DEVLOG_SEVERITY_WARNING);
}
}
}

View File

@ -133,22 +133,16 @@ class Helper {
$decrypted = NULL;
// Check for PHP extension "mcrypt".
if (!extension_loaded('mcrypt')) {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\Helper->decrypt('.$encrypted.', '.$hash.')] PHP extension "mcrypt" not available', self::$extKey, SYSLOG_SEVERITY_WARNING);
}
self::devLog('PHP extension "mcrypt" not available', DEVLOG_SEVERITY_WARNING);
return;
}
if (empty($encrypted)
|| empty($hash)) {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\Helper->decrypt('.$encrypted.', '.$hash.')] Invalid parameters given for decryption', self::$extKey, SYSLOG_SEVERITY_ERROR);
}
self::devLog('Invalid parameters given for decryption', DEVLOG_SEVERITY_ERROR);
return;
}
if (empty($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'])) {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\Helper->decrypt('.$encrypted.', '.$hash.')] No encryption key set in TYPO3 configuration', self::$extKey, SYSLOG_SEVERITY_ERROR);
}
self::devLog('No encryption key set in TYPO3 configuration', DEVLOG_SEVERITY_ERROR);
return;
}
$iv = substr(md5($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey']), 0, mcrypt_get_iv_size(MCRYPT_BLOWFISH, MCRYPT_MODE_CFB));
@ -156,14 +150,54 @@ class Helper {
$salt = substr($hash, 0, 10);
$hashed = $salt.substr(sha1($salt.$decrypted), -10);
if ($hashed !== $hash) {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\Helper->decrypt('.$encrypted.', '.$hash.')] Invalid hash "'.$hash.'" given for decryption', self::$extKey, SYSLOG_SEVERITY_WARNING);
}
self::devLog('Invalid hash "'.$hash.'" given for decryption', DEVLOG_SEVERITY_WARNING);
return;
}
return $decrypted;
}
/**
* Add a message to the TYPO3 developer log
*
* @access public
*
* @param string $message: The message to log
* @param integer $severity: The severity of the message
* 0 is info, 1 is notice, 2 is warning, 3 is fatal error, -1 is "OK" message
*
* @return void
*/
public static function devLog($message, $severity = 0) {
if (TYPO3_DLOG) {
$stacktrace = debug_backtrace(0, 2);
// Set some defaults.
$caller = 'Kitodo\Dlf\Default\UnknownClass::unknownMethod';
$args = [];
$data = [];
if (!empty($stacktrace[1])) {
$caller = $stacktrace[1]['class'].$stacktrace[1]['type'].$stacktrace[1]['function'];
foreach ($stacktrace[1]['args'] as $arg) {
if (is_bool($arg)) {
$args[] = ($arg ? 'TRUE' : 'FALSE');
} elseif (is_scalar($arg)) {
$args[] = (string) $arg;
} elseif (is_null($arg)) {
$args[] = 'NULL';
} elseif (is_array($arg)) {
$args[] = '[data]';
$data[] = $arg;
} elseif (is_object($arg)) {
$args[] = '['.get_class($arg).']';
$data[] = $arg;
}
}
}
$arguments = '('.implode(', ', $args).')';
$additionalData = (empty($data) ? FALSE : $data);
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('['.$caller.$arguments.'] '.$message, self::$extKey, $severity, $additionalData);
}
}
/**
* Encrypt the given string
* @see http://yavkata.co.uk/weblog/php/securing-html-hidden-input-fields-using-encryption-and-hashing/
@ -177,15 +211,11 @@ class Helper {
public static function encrypt($string) {
// Check for PHP extension "mcrypt".
if (!extension_loaded('mcrypt')) {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\Helper->encrypt('.$string.')] PHP extension "mcrypt" not available', self::$extKey, SYSLOG_SEVERITY_WARNING);
}
self::devLog('PHP extension "mcrypt" not available', DEVLOG_SEVERITY_WARNING);
return;
}
if (empty($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'])) {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\Helper->encrypt('.$string.')] No encryption key set in TYPO3 configuration', self::$extKey, SYSLOG_SEVERITY_ERROR);
}
self::devLog('No encryption key set in TYPO3 configuration', DEVLOG_SEVERITY_ERROR);
return;
}
$iv = substr(md5($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey']), 0, mcrypt_get_iv_size(MCRYPT_BLOWFISH, MCRYPT_MODE_CFB));
@ -213,9 +243,7 @@ class Helper {
$userObj->backendCheckLogin();
return $userObj;
} else {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\Helper->getBeUser()] Unexpected TYPO3_MODE "'.TYPO3_MODE.'"', self::$extKey, SYSLOG_SEVERITY_ERROR);
}
self::devLog('Unexpected TYPO3_MODE "'.TYPO3_MODE.'"', DEVLOG_SEVERITY_ERROR);
return;
}
}
@ -257,9 +285,7 @@ class Helper {
return \TYPO3\CMS\Frontend\Utility\EidUtility::initFeUser();
}
} else {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\Helper->getFeUser()] Unexpected TYPO3_MODE "'.TYPO3_MODE.'"', self::$extKey, SYSLOG_SEVERITY_ERROR);
}
self::devLog('Unexpected TYPO3_MODE "'.TYPO3_MODE.'"', DEVLOG_SEVERITY_ERROR);
}
return;
}
@ -302,9 +328,7 @@ class Helper {
$uid = max(intval($uid), 0);
if (!$uid
|| !in_array($table, ['tx_dlf_collections', 'tx_dlf_libraries', 'tx_dlf_metadata', 'tx_dlf_structures', 'tx_dlf_solrcores'])) {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\Helper->getIndexName('.$_uid.', '.$table.', '.$_pid.')] Invalid UID "'.$uid.'" or table "'.$table.'"', self::$extKey, SYSLOG_SEVERITY_ERROR);
}
self::devLog('Invalid UID "'.$uid.'" or table "'.$table.'"', DEVLOG_SEVERITY_ERROR);
return '';
}
$where = '';
@ -328,9 +352,7 @@ class Helper {
$resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
return $resArray['index_name'];
} else {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\Helper->getIndexName('.$_uid.', '.$table.', '.$_pid.')] No "index_name" with UID "'.$uid.'" and PID "'.$pid.'" found in table "'.$table.'"', self::$extKey, SYSLOG_SEVERITY_WARNING);
}
self::devLog('No "index_name" with UID '.$uid.' and PID '.$pid.' found in table "'.$table.'"', DEVLOG_SEVERITY_WARNING);
return '';
}
}
@ -352,9 +374,7 @@ class Helper {
$_pid = $pid;
if (!$index_name
|| !in_array($table, ['tx_dlf_collections', 'tx_dlf_libraries', 'tx_dlf_metadata', 'tx_dlf_structures', 'tx_dlf_solrcores'])) {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\Helper->getIdFromIndexName('.$_index_name.', '.$table.', '.$_pid.')] Invalid UID "'.$index_name.'" or table "'.$table.'"', self::$extKey, SYSLOG_SEVERITY_ERROR);
}
self::devLog('Invalid UID '.$index_name.' or table "'.$table.'"', DEVLOG_SEVERITY_ERROR);
return '';
}
$where = '';
@ -378,9 +398,7 @@ class Helper {
$resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
return $resArray['uid'];
} else {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\Helper->getIdFromIndexName('.$_index_name.', '.$table.', '.$_pid.')] No UID for given "index_name" "'.$index_name.'" and PID "'.$pid.'" found in table "'.$table.'"', self::$extKey, SYSLOG_SEVERITY_WARNING);
}
self::devLog('No UID for given index_name "'.$index_name.'" and PID '.$pid.' found in table "'.$table.'"', DEVLOG_SEVERITY_WARNING);
return '';
}
}
@ -417,17 +435,13 @@ class Helper {
$lang = $GLOBALS['LANG']->getLLL($isoCode, $iso639, FALSE);
}
} else {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\Helper->getLanguageName('.$code.')] Unexpected TYPO3_MODE "'.TYPO3_MODE.'"', self::$extKey, SYSLOG_SEVERITY_ERROR);
}
self::devLog('Unexpected TYPO3_MODE "'.TYPO3_MODE.'"', DEVLOG_SEVERITY_ERROR);
return $code;
}
if (!empty($lang)) {
return $lang;
} else {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\Helper->getLanguageName('.$code.')] Language code "'.$code.'" not found in ISO-639 table', self::$extKey, SYSLOG_SEVERITY_NOTICE);
}
self::devLog('Language code "'.$code.'" not found in ISO-639 table', DEVLOG_SEVERITY_NOTICE);
return $code;
}
}
@ -453,8 +467,8 @@ class Helper {
self::$messages = $GLOBALS['TSFE']->readLLfile($file);
} elseif (TYPO3_MODE === 'BE') {
self::$messages = $GLOBALS['LANG']->includeLLFile($file, FALSE, TRUE);
} elseif (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\Helper->getMessage('.$key.', '.$default.', ['.($hsc ? 'TRUE' : 'FALSE').'])] Unexpected TYPO3_MODE "'.TYPO3_MODE.'"', self::$extKey, SYSLOG_SEVERITY_ERROR);
} else {
self::devLog('Unexpected TYPO3_MODE "'.TYPO3_MODE.'"', DEVLOG_SEVERITY_ERROR);
}
}
// Get translation.
@ -463,8 +477,8 @@ class Helper {
$translated = $GLOBALS['TSFE']->getLLL($key, self::$messages);
} elseif (TYPO3_MODE === 'BE') {
$translated = $GLOBALS['LANG']->getLLL($key, self::$messages, FALSE);
} elseif (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\Helper->getMessage('.$key.', '.$default.', ['.($hsc ? 'TRUE' : 'FALSE').'])] Unexpected TYPO3_MODE "'.TYPO3_MODE.'"', self::$extKey, SYSLOG_SEVERITY_ERROR);
} else {
self::devLog('Unexpected TYPO3_MODE "'.TYPO3_MODE.'"', DEVLOG_SEVERITY_ERROR);
}
}
// Escape HTML characters if applicable.
@ -528,9 +542,7 @@ class Helper {
];
$urn = strtolower($base.$id);
if (preg_match('/[^a-z0-9:-]/', $urn)) {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\Helper->getURN('.$base.', '.$id.')] Invalid chars in given parameters', self::$extKey, SYSLOG_SEVERITY_WARNING);
}
self::devLog('Invalid chars in given parameters', DEVLOG_SEVERITY_WARNING);
return '';
}
$digits = '';
@ -573,9 +585,7 @@ class Helper {
// Cast to string for security reasons.
$key = (string) $key;
if (!$key) {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\Helper->loadFromSession('.$_key.')] Invalid key "'.$key.'" for session data retrieval', self::$extKey, SYSLOG_SEVERITY_WARNING);
}
self::devLog('Invalid key "'.$key.'" for session data retrieval', DEVLOG_SEVERITY_WARNING);
return;
}
// Get the session data.
@ -584,9 +594,7 @@ class Helper {
} elseif (TYPO3_MODE === 'BE') {
return $GLOBALS['BE_USER']->getSessionData($key);
} else {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\Helper->loadFromSession('.$_key.')] Unexpected TYPO3_MODE "'.TYPO3_MODE.'"', self::$extKey, SYSLOG_SEVERITY_ERROR);
}
self::devLog('Unexpected TYPO3_MODE "'.TYPO3_MODE.'"', DEVLOG_SEVERITY_ERROR);
return;
}
}
@ -650,9 +658,7 @@ class Helper {
&& $GLOBALS['BE_USER']->isAdmin()) {
return self::processDB($data, $cmd, $reverseOrder, TRUE);
} else {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\Helper->processDBasAdmin([data->data], [data->cmd], ['.($reverseOrder ? 'TRUE' : 'FALSE').'])] Current backend user has no admin privileges', self::$extKey, SYSLOG_SEVERITY_ERROR, ['data' => $data, 'cmd' => $cmd]);
}
self::devLog('Current backend user has no admin privileges', DEVLOG_SEVERITY_ERROR);
return [];
}
}
@ -703,9 +709,7 @@ class Helper {
// Cast to string for security reasons.
$key = (string) $key;
if (!$key) {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\Helper->saveToSession([data], '.$_key.')] Invalid key "'.$key.'" for session data saving', self::$extKey, SYSLOG_SEVERITY_WARNING, $value);
}
self::devLog('Invalid key "'.$key.'" for session data saving', DEVLOG_SEVERITY_WARNING);
return FALSE;
}
// Save value in session data.
@ -717,9 +721,7 @@ class Helper {
$GLOBALS['BE_USER']->setAndSaveSessionData($key, $value);
return TRUE;
} else {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\Helper->saveToSession([data], '.$_key.')] Unexpected TYPO3_MODE "'.TYPO3_MODE.'"', self::$extKey, SYSLOG_SEVERITY_ERROR, $value);
}
self::devLog('Unexpected TYPO3_MODE "'.TYPO3_MODE.'"', DEVLOG_SEVERITY_ERROR);
return FALSE;
}
}
@ -744,9 +746,7 @@ class Helper {
// Sanitize input.
$pid = max(intval($pid), 0);
if (!$pid) {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\Helper->translate('.$_index_name.', '.$table.', '.$_pid.')] Invalid PID "'.$pid.'" for translation', self::$extKey, SYSLOG_SEVERITY_WARNING);
}
self::devLog('Invalid PID '.$pid.' for translation', DEVLOG_SEVERITY_WARNING);
return $index_name;
}
// Check if "index_name" is an UID.
@ -817,14 +817,10 @@ class Helper {
}
}
} else {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\Helper->translate('.$_index_name.', '.$table.', '.$_pid.')] No translation with PID "'.$pid.'" available in table "'.$table.'" or translation not accessible', self::extKey, SYSLOG_SEVERITY_NOTICE);
}
self::devLog('No translation with PID '.$pid.' available in table "'.$table.'" or translation not accessible', DEVLOG_SEVERITY_NOTICE);
}
} else {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\Helper->translate('.$_index_name.', '.$table.', '.$_pid.')] No translations available for table "'.$table.'"', self::$extKey, SYSLOG_SEVERITY_WARNING);
}
self::devLog('No translations available for table "'.$table.'"', DEVLOG_SEVERITY_WARNING);
}
}
if (!empty($labels[$table][$pid][$GLOBALS['TSFE']->sys_language_content][$index_name])) {
@ -866,9 +862,7 @@ class Helper {
} elseif (TYPO3_MODE === 'BE') {
return \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($table);
} else {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\Helper->whereClause('.$table.', ['.($showHidden ? 'TRUE' : 'FALSE').'])] Unexpected TYPO3_MODE "'.TYPO3_MODE.'"', self::$extKey, SYSLOG_SEVERITY_ERROR);
}
self::devLog('Unexpected TYPO3_MODE "'.TYPO3_MODE.'"', DEVLOG_SEVERITY_ERROR);
return ' AND 1=-1';
}
}

View File

@ -91,9 +91,7 @@ class Indexer {
if ($parent->ready) {
$errors = self::add($parent, $core);
} else {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\Indexer->add(['.$doc->uid.'], '.$core.')] Could not load parent document with UID "'.$doc->parentId.'"', self::$extKey, SYSLOG_SEVERITY_ERROR);
}
Helper::devLog('Could not load parent document with UID '.$doc->parentId, DEVLOG_SEVERITY_ERROR);
return 1;
}
}
@ -169,9 +167,7 @@ class Indexer {
);
Helper::addMessage($message);
}
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\Indexer->add(['.$doc->uid.'], '.$core.')] Apache Solr threw exception: "'.$e->getMessage().'"', self::$extKey, SYSLOG_SEVERITY_ERROR);
}
Helper::devLog('Apache Solr threw exception: "'.$e->getMessage().'"', DEVLOG_SEVERITY_ERROR);
return 1;
}
} else {
@ -185,9 +181,7 @@ class Indexer {
);
Helper::addMessage($message);
}
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\Indexer->add(['.$doc->uid.'], '.$core.')] Could not connect to Apache Solr server', self::$extKey, SYSLOG_SEVERITY_ERROR);
}
Helper::devLog('Could not connect to Apache Solr server', DEVLOG_SEVERITY_ERROR);
return 1;
}
}
@ -238,9 +232,7 @@ class Indexer {
);
Helper::addMessage($message);
}
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\Indexer->delete('.$_uid.')] Apache Solr threw exception: "'.$e->getMessage().'"', self::$extKey, SYSLOG_SEVERITY_ERROR);
}
Helper::devLog('Apache Solr threw exception: "'.$e->getMessage().'"', DEVLOG_SEVERITY_ERROR);
return 1;
}
} else {
@ -254,9 +246,7 @@ class Indexer {
);
Helper::addMessage($message);
}
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\Indexer->delete('.$_uid.')] Could not connect to Apache Solr server', self::$extKey, SYSLOG_SEVERITY_ERROR);
}
Helper::devLog('Could not connect to Apache Solr server', DEVLOG_SEVERITY_ERROR);
return 1;
}
if ((TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_CLI) == FALSE) {
@ -271,9 +261,7 @@ class Indexer {
}
return 0;
} else {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\Indexer->delete('.$_uid.')] Invalid UID "'.$uid.'" for document deletion', self::$extKey, SYSLOG_SEVERITY_ERROR);
}
Helper::devLog('Invalid UID '.$uid.' for document deletion', DEVLOG_SEVERITY_ERROR);
return 1;
}
}
@ -294,9 +282,7 @@ class Indexer {
// Sanitize input.
$pid = max(intval($pid), 0);
if (!$pid) {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\Indexer->getIndexFieldName('.$index_name.', '.$_pid.')] Invalid PID "'.$pid.'" for metadata configuration', self::$extKey, SYSLOG_SEVERITY_ERROR);
}
Helper::devLog('Invalid PID '.$pid.' for metadata configuration', DEVLOG_SEVERITY_ERROR);
return '';
}
// Load metadata configuration.

View File

@ -176,9 +176,7 @@ class Solr {
}
// Check if core is set.
if (empty($core)) {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\Solr->getInstance('.$_core.')] Invalid core name "'.$core.'" for Apache Solr', self::$extKey, SYSLOG_SEVERITY_ERROR);
}
Helper::devLog('Invalid core name "'.$core.'" for Apache Solr', DEVLOG_SEVERITY_ERROR);
return;
}
// Check if there is an instance in the registry already.
@ -195,9 +193,7 @@ class Solr {
// Return new instance.
return $instance;
} else {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\Solr->getInstance('.$_core.')] Could not connect to Apache Solr server', self::$extKey, SYSLOG_SEVERITY_ERROR);
}
Helper::devLog('Could not connect to Apache Solr server', DEVLOG_SEVERITY_ERROR);
return;
}
}
@ -464,9 +460,7 @@ class Solr {
$method = '_get'.ucfirst($var);
if (!property_exists($this, $var)
|| !method_exists($this, $method)) {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\Solr->__get('.$var.')] There is no getter function for property "'.$var.'"', self::$extKey, SYSLOG_SEVERITY_WARNING);
}
Helper::devLog('There is no getter function for property "'.$var.'"', DEVLOG_SEVERITY_WARNING);
return;
} else {
return $this->$method();
@ -487,9 +481,7 @@ class Solr {
$method = '_set'.ucfirst($var);
if (!property_exists($this, $var)
|| !method_exists($this, $method)) {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\Solr->__set('.$var.', [data])] There is no setter function for property "'.$var.'"', self::$extKey, SYSLOG_SEVERITY_WARNING, $value);
}
Helper::devLog('There is no setter function for property "'.$var.'"', DEVLOG_SEVERITY_WARNING);
} else {
$this->$method($value);
}

View File

@ -119,9 +119,7 @@ class DataHandler {
return;
}
}
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Hooks\DataHandler->processDatamap_postProcessFieldArray('.$status.', '.$table.', '.$id.', [data], ['.get_class($pObj).'])] Could not create new Apache Solr core "dlfCore'.$coreNumber.'"', $this->extKey, SYSLOG_SEVERITY_ERROR, $fieldArray);
}
Helper::devLog('Could not create new Apache Solr core "dlfCore'.$coreNumber.'"', DEVLOG_SEVERITY_ERROR);
// Solr core could not be created, thus unset field array.
$fieldArray = [];
break;
@ -197,9 +195,7 @@ class DataHandler {
list ($fieldArray['index_name']) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result);
}
}
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Hooks\DataHandler->processDatamap_postProcessFieldArray('.$status.', '.$table.', '.$id.', [data], ['.get_class($pObj).'])] Prevented change of "index_name" for UID "'.$id.'" in table "'.$table.'"', $this->extKey, SYSLOG_SEVERITY_NOTICE, $fieldArray);
}
Helper::devLog('Prevented change of index_name for UID '.$id.' in table "'.$table.'"', DEVLOG_SEVERITY_NOTICE);
}
break;
}
@ -255,9 +251,7 @@ class DataHandler {
if ($doc->ready) {
$doc->save($doc->pid, $core);
} else {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Hooks\DataHandler->processDatamap_afterDatabaseOperations('.$status.', '.$table.', '.$id.', [data], ['.get_class($pObj).'])] Failed to re-index document with UID "'.$id.'"', $this->extKey, SYSLOG_SEVERITY_ERROR, $fieldArray);
}
Helper::devLog('Failed to re-index document with UID '.$id, DEVLOG_SEVERITY_ERROR);
}
}
}
@ -316,9 +310,7 @@ class DataHandler {
if ($doc->ready) {
$doc->save($doc->pid, $core);
} else {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Hooks\DataHandler->processCmdmap_postProcess('.$command.', '.$table.', '.$id.', '.$value.', ['.get_class($pObj).'])] Failed to re-index document with UID "'.$id.'"', $this->extKey, SYSLOG_SEVERITY_ERROR);
}
Helper::devLog('Failed to re-index document with UID '.$id, DEVLOG_SEVERITY_ERROR);
}
break;
}

View File

@ -50,9 +50,7 @@ class Collection extends \Kitodo\Dlf\Common\AbstractPlugin {
$this->setCache(TRUE);
// Quit without doing anything if required configuration variables are not set.
if (empty($this->conf['pages'])) {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Plugins\Collection->main('.$content.', [data])] Incomplete plugin configuration', $this->extKey, SYSLOG_SEVERITY_WARNING, $conf);
}
Helper::devLog('Incomplete plugin configuration', DEVLOG_SEVERITY_WARNING);
return $content;
}
// Load template file.
@ -252,9 +250,7 @@ class Collection extends \Kitodo\Dlf\Common\AbstractPlugin {
}
$solr = Solr::getInstance($this->conf['solrcore']);
if (!$solr->ready) {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Plugins\Collection->showSingleCollection('.intval($id).')] Apache Solr not available', $this->extKey, SYSLOG_SEVERITY_ERROR);
}
Helper::devLog('Apache Solr not available', DEVLOG_SEVERITY_ERROR);
return;
}
$params['fields'] = 'uid';
@ -342,7 +338,7 @@ class Collection extends \Kitodo\Dlf\Common\AbstractPlugin {
$list->metadata = $listMetadata;
$list->save();
// Clean output buffer.
\TYPO3\CMS\Core\Utility\GeneralUtility::cleanOutputBuffers();
Helper::cleanOutputBuffers();
// Send headers.
header('Location: '.\TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl($this->cObj->typoLink_URL(['parameter' => $this->conf['targetPid']])));
// Flush output buffer and end script processing.

View File

@ -149,7 +149,7 @@ class Feeds extends \Kitodo\Dlf\Common\AbstractPlugin {
$rss->appendChild($root);
$content = $rss->saveXML();
// Clean output buffer.
\TYPO3\CMS\Core\Utility\GeneralUtility::cleanOutputBuffers();
Helper::cleanOutputBuffers();
// Send headers.
header('HTTP/1.1 200 OK');
header('Cache-Control: no-cache');

View File

@ -461,9 +461,7 @@ class ListView extends \Kitodo\Dlf\Common\AbstractPlugin {
// Instantiate search object.
$solr = Solr::getInstance($this->list->metadata['options']['core']);
if (!$solr->ready) {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Plugins\ListView->main('.$content.', [data])] Apache Solr not available', $this->extKey, SYSLOG_SEVERITY_ERROR, $conf);
}
Helper::devLog('Apache Solr not available', DEVLOG_SEVERITY_ERROR);
return $content;
}
// Set search parameters.

View File

@ -102,9 +102,7 @@ class Metadata extends \Kitodo\Dlf\Common\AbstractPlugin {
array_unshift($metadata, $data);
}
if (empty($metadata)) {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Plugins\Metadata->main('.$content.', [data])] No metadata found for document with UID "'.$this->doc->uid.'"', $this->extKey, SYSLOG_SEVERITY_WARNING, $conf);
}
Helper::devLog('No metadata found for document with UID '.$this->doc->uid, DEVLOG_SEVERITY_WARNING);
return $content;
}
ksort($metadata);

View File

@ -81,7 +81,7 @@ class OaiPmh extends \Kitodo\Dlf\Common\AbstractPlugin {
);
if ($GLOBALS['TYPO3_DB']->sql_affected_rows() === -1) {
// Deletion failed.
$this->devLog('[\Kitodo\Dlf\Plugins\OaiPmh->deleteExpiredTokens()] Could not delete expired resumption tokens', SYSLOG_SEVERITY_WARNING);
Helper::devLog('Could not delete expired resumption tokens', DEVLOG_SEVERITY_WARNING);
}
}
@ -266,10 +266,10 @@ class OaiPmh extends \Kitodo\Dlf\Common\AbstractPlugin {
// Import node into \DOMDocument.
$mets = $this->oai->importNode($root->item(0), TRUE);
} else {
$this->devLog('[\Kitodo\Dlf\Plugins\OaiPmh->getMetsData([data])] No METS part found in document with location "'.$metadata['location'].'"', SYSLOG_SEVERITY_ERROR, $metadata);
Helper::devLog('No METS part found in document with location "'.$metadata['location'].'"', DEVLOG_SEVERITY_ERROR);
}
} else {
$this->devLog('[\Kitodo\Dlf\Plugins\OaiPmh->getMetsData([data])] Could not load XML file from "'.$metadata['location'].'"', SYSLOG_SEVERITY_ERROR, $metadata);
Helper::devLog('Could not load XML file from "'.$metadata['location'].'"', DEVLOG_SEVERITY_ERROR);
}
if ($mets === NULL) {
$mets = $this->oai->createElementNS('http://kitodo.org/', 'kitodo:error', htmlspecialchars($this->pi_getLL('error', 'Error!', FALSE), ENT_NOQUOTES, 'UTF-8'));
@ -358,7 +358,7 @@ class OaiPmh extends \Kitodo\Dlf\Common\AbstractPlugin {
$this->oai->appendChild($root);
$content = $this->oai->saveXML();
// Clean output buffer.
\TYPO3\CMS\Core\Utility\GeneralUtility::cleanOutputBuffers();
Helper::cleanOutputBuffers();
// Send headers.
header('HTTP/1.1 200 OK');
header('Cache-Control: no-cache');
@ -507,7 +507,7 @@ class OaiPmh extends \Kitodo\Dlf\Common\AbstractPlugin {
$adminEmail = htmlspecialchars(trim(str_replace('mailto:', '', $resArray['contact'])), ENT_NOQUOTES);
$repositoryName = htmlspecialchars($resArray['oai_label'], ENT_NOQUOTES);
} else {
$this->devLog('[\Kitodo\Dlf\Plugins\OaiPmh->verbIdentify()] Incomplete plugin configuration', SYSLOG_SEVERITY_NOTICE);
Helper::devLog('Incomplete plugin configuration', DEVLOG_SEVERITY_NOTICE);
}
// Get earliest datestamp. Use a default value if that fails.
$earliestDatestamp = '0000-00-00T00:00:00Z';
@ -523,7 +523,7 @@ class OaiPmh extends \Kitodo\Dlf\Common\AbstractPlugin {
list ($timestamp) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result);
$earliestDatestamp = gmdate('Y-m-d\TH:i:s\Z', $timestamp);
} else {
$this->devLog('[\Kitodo\Dlf\Plugins\OaiPmh->verbIdentify()] No records found with PID "'.$this->conf['pages'].'"', SYSLOG_SEVERITY_NOTICE);
Helper::devLog('No records found with PID '.$this->conf['pages'], DEVLOG_SEVERITY_NOTICE);
}
$linkConf = [
'parameter' => $GLOBALS['TSFE']->id,
@ -927,7 +927,7 @@ class OaiPmh extends \Kitodo\Dlf\Common\AbstractPlugin {
if ($GLOBALS['TYPO3_DB']->sql_affected_rows() == 1) {
$resumptionToken = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'resumptionToken', htmlspecialchars($token, ENT_NOQUOTES, 'UTF-8'));
} else {
$this->devLog('[\Kitodo\Dlf\Plugins\OaiPmh->verb'.$this->piVars['verb'].'()] Could not create resumption token', SYSLOG_SEVERITY_ERROR);
Helper::devLog('Could not create resumption token', DEVLOG_SEVERITY_ERROR);
}
} else {
// Result set complete. We don't need a token.
@ -938,21 +938,4 @@ class OaiPmh extends \Kitodo\Dlf\Common\AbstractPlugin {
$resumptionToken->setAttribute('expirationDate', gmdate('Y-m-d\TH:i:s\Z', $GLOBALS['EXEC_TIME'] + $this->conf['expired']));
return $resumptionToken;
}
/**
* Helper for TYPO3 developer log
*
* @access protected
*
* @param string $message: The message to log
* @param integer $severity: The severity of the error
* @param mixed $data: Additional data to add to the log
*
* @return void
*/
protected function devLog($message, $severity, $data = NULL) {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog($message, $this->extKey, $severity, $data);
}
}
}

View File

@ -142,9 +142,7 @@ class PageGrid extends \Kitodo\Dlf\Common\AbstractPlugin {
$this->getTemplate();
$entryTemplate = $this->cObj->getSubpart($this->template, '###ENTRY###');
if (empty($entryTemplate)) {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Plugins\PageGrid->main('.$content.', [data])] No template subpart for list entry found', $this->extKey, SYSLOG_SEVERITY_WARNING, $conf);
}
Helper::devLog('No template subpart for list entry found', DEVLOG_SEVERITY_WARNING);
// Quit without doing anything if required variables are not set.
return $content;
}

View File

@ -192,9 +192,7 @@ class PageView extends \Kitodo\Dlf\Common\AbstractPlugin {
$image['mimetype'] = $this->doc->getFileMimeType($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$fileGrp]);
break;
} else {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Plugins\PageView->getImage('.$page.')] File not found in fileGrp "'.$fileGrp.'"', $this->extKey, SYSLOG_SEVERITY_WARNING);
}
Helper::devLog('File not found in fileGrp "'.$fileGrp.'"', DEVLOG_SEVERITY_WARNING);
}
}
return $image;
@ -222,9 +220,7 @@ class PageView extends \Kitodo\Dlf\Common\AbstractPlugin {
$fulltext['url'] = $this->cObj->typoLink_URL($linkConf);
$fulltext['mimetype'] = $this->doc->getFileMimeType($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$this->conf['fileGrpFulltext']]);
} else {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Plugins\PageView->getFulltext('.$page.')] File not found in fileGrp "'.$this->conf['fileGrpFulltext'].'"', $this->extKey, SYSLOG_SEVERITY_WARNING);
}
Helper::devLog('File not found in fileGrp "'.$this->conf['fileGrpFulltext'].'"', DEVLOG_SEVERITY_WARNING);
}
return $fulltext;
}

View File

@ -52,9 +52,7 @@ class Search extends \Kitodo\Dlf\Common\AbstractPlugin {
if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
$GLOBALS['TSFE']->additionalHeaderData[$this->prefixId.'_search_suggest'] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'Resources/Public/Javascript/Search/Suggester.js"></script>';
} else {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Plugins\Search->addAutocompleteJS()] No metadata fields configured for search suggestions', $this->extKey, SYSLOG_SEVERITY_WARNING);
}
Helper::devLog('No metadata fields configured for search suggestions', DEVLOG_SEVERITY_WARNING);
}
}
@ -185,9 +183,7 @@ class Search extends \Kitodo\Dlf\Common\AbstractPlugin {
protected function addFacetsMenu() {
// Check for typoscript configuration to prevent fatal error.
if (empty($this->conf['facetsConf.'])) {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Plugins\Search->addFacetsMenu()] Incomplete plugin configuration', $this->extKey, SYSLOG_SEVERITY_WARNING);
}
Helper::devLog('Incomplete plugin configuration', DEVLOG_SEVERITY_WARNING);
return '';
}
// Quit without doing anything if no facets are selected.
@ -322,9 +318,7 @@ class Search extends \Kitodo\Dlf\Common\AbstractPlugin {
$this->setCache(FALSE);
// Quit without doing anything if required variables are not set.
if (empty($this->conf['solrcore'])) {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Plugins\Search->main('.$content.', [data])] Incomplete plugin configuration', $this->extKey, SYSLOG_SEVERITY_WARNING, $conf);
}
Helper::devLog('Incomplete plugin configuration', DEVLOG_SEVERITY_WARNING);
return $content;
}
if (!isset($this->piVars['query'])
@ -370,9 +364,7 @@ class Search extends \Kitodo\Dlf\Common\AbstractPlugin {
// Instantiate search object.
$solr = Solr::getInstance($this->conf['solrcore']);
if (!$solr->ready) {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Plugins\Search->main('.$content.', [data])] Apache Solr not available', $this->extKey, SYSLOG_SEVERITY_ERROR, $conf);
}
Helper::devLog('Apache Solr not available', DEVLOG_SEVERITY_ERROR);
return $content;
}
// Build label for result list.
@ -456,9 +448,7 @@ class Search extends \Kitodo\Dlf\Common\AbstractPlugin {
// Instantiate search object.
$solr = Solr::getInstance($this->conf['solrcore']);
if (!$solr->ready) {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Plugins\Search->main('.$content.', [data])] Apache Solr not available', $this->extKey, SYSLOG_SEVERITY_ERROR, $conf);
}
Helper::devLog('Apache Solr not available', DEVLOG_SEVERITY_ERROR);
return $content;
}
// Set search parameters.
@ -475,7 +465,7 @@ class Search extends \Kitodo\Dlf\Common\AbstractPlugin {
];
$list->save();
// Clean output buffer.
\TYPO3\CMS\Core\Utility\GeneralUtility::cleanOutputBuffers();
Helper::cleanOutputBuffers();
$additionalParams = [];
if (!empty($this->piVars['logicalPage'])) {
$additionalParams['logicalPage'] = $this->piVars['logicalPage'];
@ -538,9 +528,7 @@ class Search extends \Kitodo\Dlf\Common\AbstractPlugin {
// Get applicable facets.
$solr = Solr::getInstance($this->conf['solrcore']);
if (!$solr->ready) {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Plugins\Search->makeFacetsMenuArray('.$content.', [data])] Apache Solr not available', $this->extKey, SYSLOG_SEVERITY_ERROR, $conf);
}
Helper::devLog('Apache Solr not available', DEVLOG_SEVERITY_ERROR);
return [];
}
// Set needed parameters for facet search.

View File

@ -40,9 +40,7 @@ class Statistics extends \Kitodo\Dlf\Common\AbstractPlugin {
$this->setCache(TRUE);
// Quit without doing anything if required configuration variables are not set.
if (empty($this->conf['pages'])) {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Plugins\Statistics->main('.$content.', [data])] Incomplete plugin configuration', $this->extKey, SYSLOG_SEVERITY_WARNING, $conf);
}
Helper::devLog('Incomplete plugin configuration', DEVLOG_SEVERITY_WARNING);
return $content;
}
// Get description.

View File

@ -120,9 +120,7 @@ class TableOfContents extends \Kitodo\Dlf\Common\AbstractPlugin {
$this->init($conf);
// Check for typoscript configuration to prevent fatal error.
if (empty($this->conf['menuConf.'])) {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Plugins\TableOfContents->main('.$content.', [data])] Incomplete plugin configuration', $this->extKey, SYSLOG_SEVERITY_WARNING, $conf);
}
Helper::devLog('Incomplete plugin configuration', DEVLOG_SEVERITY_WARNING);
return $content;
}
// Load template file.

View File

@ -106,9 +106,7 @@ class ImageDownloadTool extends \Kitodo\Dlf\Common\AbstractPlugin {
$imageLink = $this->cObj->typoLink($label.' '.$mimetypeLabel, $linkConf);
break;
} else {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Plugins\Tools\ImageDownloadTool->getImage('.$page.')] File not found in fileGrp "'.$fileGrp.'"', $this->extKey, SYSLOG_SEVERITY_WARNING);
}
Helper::devLog('File not found in fileGrp "'.$fileGrp.'"', DEVLOG_SEVERITY_WARNING);
}
}
return $imageLink;

View File

@ -96,10 +96,9 @@ class PdfDownloadTool extends \Kitodo\Dlf\Common\AbstractPlugin {
$page2Link = $this->doc->getFileLocation($file);
}
}
if (TYPO3_DLOG
&& empty($page1Link)
if (empty($page1Link)
&& empty($page2Link)) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Plugins\Tools\PdfDownloadTool->getPageLink()] File not found in fileGrp "'.$this->conf['fileGrpDownload'].'"', $this->extKey, SYSLOG_SEVERITY_WARNING);
Helper::devLog('File not found in fileGrp "'.$this->conf['fileGrpDownload'].'"', DEVLOG_SEVERITY_WARNING);
}
// Wrap URLs with HTML.
if (!empty($page1Link)) {
@ -137,9 +136,7 @@ class PdfDownloadTool extends \Kitodo\Dlf\Common\AbstractPlugin {
if (!empty($workLink)) {
$workLink = $this->cObj->typoLink($this->pi_getLL('work', ''), ['parameter' => $workLink, 'title' => $this->pi_getLL('work', '')]);
} else {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Plugins\Tools\PdfDownloadTool->getWorkLink()] File not found in fileGrp "'.$this->conf['fileGrpDownload'].'"', $this->extKey, SYSLOG_SEVERITY_WARNING);
}
Helper::devLog('File not found in fileGrp "'.$this->conf['fileGrpDownload'].'"', DEVLOG_SEVERITY_WARNING);
}
return $workLink;
}

View File

@ -12,6 +12,22 @@
if (!defined('TYPO3_MODE')) {
die ('Access denied.');
}
// Define constants.
if (!defined('DEVLOG_SEVERITY_OK')) {
define ('DEVLOG_SEVERITY_OK', -1);
}
if (!defined('DEVLOG_SEVERITY_INFO')) {
define ('DEVLOG_SEVERITY_INFO', 0);
}
if (!defined('DEVLOG_SEVERITY_NOTICE')) {
define ('DEVLOG_SEVERITY_NOTICE', 1);
}
if (!defined('DEVLOG_SEVERITY_WARNING')) {
define ('DEVLOG_SEVERITY_WARNING', 2);
}
if (!defined('DEVLOG_SEVERITY_ERROR')) {
define ('DEVLOG_SEVERITY_ERROR', 3);
}
// Register plugins.
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPItoST43($_EXTKEY, 'Classes/Plugins/AudioPlayer.php', '_audioplayer', 'list_type', TRUE);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPItoST43($_EXTKEY, 'Classes/Plugins/Basket.php', '_basket', 'list_type', FALSE);