Browse Source

Add namespaces to all common classes

pull/329/head
Sebastian Meyer 4 years ago
parent
commit
bb7ac1ba6e
  1. 2
      Classes/Common/AbstractPlugin.php
  2. 42
      Classes/Common/Document.php
  3. 28
      Classes/Common/DocumentList.php
  4. 15
      Classes/Common/DocumentTypeCheck.php
  5. 4
      Classes/Common/FulltextInterface.php
  6. 10
      Classes/Common/Helper.php
  7. 26
      Classes/Common/Indexer.php
  8. 8
      Classes/Common/MetadataInterface.php
  9. 6
      Classes/Common/Solr.php
  10. 12
      Classes/Formats/Alto.php
  11. 12
      Classes/Formats/Mods.php
  12. 12
      Classes/Formats/TeiHeader.php
  13. 56
      Classes/Hooks/ConfigurationForm.php
  14. 16
      Classes/Hooks/DataHandler.php
  15. 8
      Classes/Hooks/FormEngine.php
  16. 12
      Classes/Hooks/KitodoProductionHacks.php
  17. 2
      Configuration/TCA/tx_dlf_documents.php
  18. 88
      class.ext_update.php
  19. 6
      ext_conf_template.txt
  20. 8
      ext_localconf.php
  21. 16
      locallang.xml
  22. 2
      plugins/basket/class.tx_dlf_basket.php
  23. 4
      plugins/collection/flexform.xml
  24. 2
      plugins/feeds/class.tx_dlf_feeds.php
  25. 4
      plugins/feeds/flexform.xml
  26. 40
      plugins/oai/class.tx_dlf_oai.php
  27. 4
      plugins/oai/flexform.xml
  28. 2
      plugins/pageview/class.tx_dlf_geturl_eid.php
  29. 8
      plugins/search/flexform.xml
  30. 2
      plugins/statistics/flexform.xml
  31. 2
      plugins/toolbox/class.tx_dlf_toolbox.php
  32. 2
      plugins/toolbox/flexform.xml

2
Classes/Common/AbstractPlugin.php

@ -291,7 +291,7 @@ abstract class AbstractPlugin extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin
*/
protected function parseTS($string = '') {
$parser = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\TypoScript\\Parser\\TypoScriptParser');
$parser = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser::class);
$parser->parse($string);

42
Classes/Common/Document.php

@ -163,7 +163,7 @@ final class Document {
protected $metadataArrayLoaded = FALSE;
/**
* This holds the XML file's METS part as SimpleXMLElement object
* This holds the XML file's METS part as \SimpleXMLElement object
*
* @var \SimpleXMLElement
* @access protected
@ -336,9 +336,9 @@ final class Document {
protected $uid = 0;
/**
* This holds the whole XML file as SimpleXMLElement object
* This holds the whole XML file as \SimpleXMLElement object
*
* @var SimpleXMLElement
* @var \SimpleXMLElement
* @access protected
*/
protected $xml;
@ -784,7 +784,7 @@ final class Document {
$class = $this->formats[$this->dmdSec[$dmdId]['type']]['class'];
// Get the metadata from class.
if (class_exists($class) && ($obj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance($class)) instanceof FormatInterface) {
if (class_exists($class) && ($obj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance($class)) instanceof MetadataInterface) {
$obj->extractMetadata($this->dmdSec[$dmdId]['xml'], $metadata);
@ -835,10 +835,10 @@ final class Document {
''
);
// We need a DOMDocument here, because SimpleXML doesn't support XPath functions properly.
// We need a \DOMDocument here, because SimpleXML doesn't support XPath functions properly.
$domNode = dom_import_simplexml($this->dmdSec[$dmdId]['xml']);
$domXPath = new DOMXPath($domNode->ownerDocument);
$domXPath = new \DOMXPath($domNode->ownerDocument);
$this->registerNamespaces($domXPath);
@ -848,7 +848,7 @@ final class Document {
// Set metadata field's value(s).
if ($resArray['format'] > 0 && !empty($resArray['xpath']) && ($values = $domXPath->evaluate($resArray['xpath'], $domNode))) {
if ($values instanceof DOMNodeList && $values->length > 0) {
if ($values instanceof \DOMNodeList && $values->length > 0) {
$metadata[$resArray['index_name']] = array ();
@ -858,7 +858,7 @@ final class Document {
}
} elseif (!($values instanceof DOMNodeList)) {
} elseif (!($values instanceof \DOMNodeList)) {
$metadata[$resArray['index_name']] = array (trim((string) $values));
@ -881,11 +881,11 @@ final class Document {
if ($resArray['format'] > 0 && !empty($resArray['xpath_sorting']) && ($values = $domXPath->evaluate($resArray['xpath_sorting'], $domNode))) {
if ($values instanceof DOMNodeList && $values->length > 0) {
if ($values instanceof \DOMNodeList && $values->length > 0) {
$metadata[$resArray['index_name'].'_sorting'][0] = trim((string) $values->item(0)->nodeValue);
} elseif (!($values instanceof DOMNodeList)) {
} elseif (!($values instanceof \DOMNodeList)) {
$metadata[$resArray['index_name'].'_sorting'][0] = trim((string) $values);
@ -1337,11 +1337,11 @@ final class Document {
}
/**
* Register all available namespaces for a SimpleXMLElement object
* Register all available namespaces for a \SimpleXMLElement object
*
* @access public
*
* @param SimpleXMLElement|DOMXPath &$obj: SimpleXMLElement or DOMXPath object
* @param \SimpleXMLElement|\DOMXPath &$obj: \SimpleXMLElement or \DOMXPath object
*
* @return void
*/
@ -1349,12 +1349,12 @@ final class Document {
$this->loadFormats();
// Do we have a SimpleXMLElement or DOMXPath object?
if ($obj instanceof SimpleXMLElement) {
// Do we have a \SimpleXMLElement or \DOMXPath object?
if ($obj instanceof \SimpleXMLElement) {
$method = 'registerXPathNamespace';
} elseif ($obj instanceof DOMXPath) {
} elseif ($obj instanceof \DOMXPath) {
$method = 'registerNamespace';
@ -1563,7 +1563,7 @@ final class Document {
if (!defined('TYPO3_cliMode')) {
$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
\TYPO3\CMS\Core\Messaging\FlashMessage::class,
htmlspecialchars(sprintf(Helper::getLL('flash.newCollection'), $collection, $substUid[$collNewUid])),
Helper::getLL('flash.attention', TRUE),
\TYPO3\CMS\Core\Messaging\FlashMessage::INFO,
@ -1624,7 +1624,7 @@ final class Document {
if (!defined('TYPO3_cliMode')) {
$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
\TYPO3\CMS\Core\Messaging\FlashMessage::class,
htmlspecialchars(sprintf(Helper::getLL('flash.newLibrary'), $owner, $ownerUid)),
Helper::getLL('flash.attention', TRUE),
\TYPO3\CMS\Core\Messaging\FlashMessage::INFO,
@ -1792,7 +1792,7 @@ final class Document {
if (!defined('TYPO3_cliMode')) {
$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
\TYPO3\CMS\Core\Messaging\FlashMessage::class,
htmlspecialchars(sprintf(Helper::getLL('flash.documentSaved'), $metadata['title'][0], $this->uid)),
Helper::getLL('flash.done', TRUE),
\TYPO3\CMS\Core\Messaging\FlashMessage::OK,
@ -2055,7 +2055,7 @@ final class Document {
*
* @access protected
*
* @return SimpleXMLElement The XML's METS part as SimpleXMLElement object
* @return \SimpleXMLElement The XML's METS part as \SimpleXMLElement object
*/
protected function _getMets() {
@ -2743,7 +2743,7 @@ final class Document {
*/
public function __sleep() {
// SimpleXMLElement objects can't be serialized, thus save the XML as string for serialization
// \SimpleXMLElement objects can't be serialized, thus save the XML as string for serialization
$this->asXML = $this->xml->asXML();
return array ('uid', 'pid', 'recordId', 'parentId', 'asXML');
@ -2759,7 +2759,7 @@ final class Document {
*/
public function __toString() {
$xml = new DOMDocument('1.0', 'utf-8');
$xml = new \DOMDocument('1.0', 'utf-8');
$xml->appendChild($xml->importNode(dom_import_simplexml($this->mets), TRUE));

28
Classes/Common/DocumentList.php

@ -20,11 +20,11 @@ namespace Kitodo\Dlf\Common;
* @subpackage dlf
* @access public
*/
class DocumentList implements ArrayAccess, Countable, Iterator, \TYPO3\CMS\Core\SingletonInterface {
class DocumentList implements \ArrayAccess, \Countable, \Iterator, \TYPO3\CMS\Core\SingletonInterface {
/**
* This holds the number of documents in the list
* @see Countable
* @see \Countable
*
* @var integer
* @access protected
@ -33,7 +33,7 @@ class DocumentList implements ArrayAccess, Countable, Iterator, \TYPO3\CMS\Core\
/**
* This holds the list entries in sorted order
* @see ArrayAccess
* @see \ArrayAccess
*
* @var array
* @access protected
@ -50,7 +50,7 @@ class DocumentList implements ArrayAccess, Countable, Iterator, \TYPO3\CMS\Core\
/**
* This holds the current list position
* @see Iterator
* @see \Iterator
*
* @var integer
* @access protected
@ -107,7 +107,7 @@ class DocumentList implements ArrayAccess, Countable, Iterator, \TYPO3\CMS\Core\
/**
* This counts the elements
* @see Countable::count()
* @see \Countable::count()
*
* @access public
*
@ -121,7 +121,7 @@ class DocumentList implements ArrayAccess, Countable, Iterator, \TYPO3\CMS\Core\
/**
* This returns the current element
* @see Iterator::current()
* @see \Iterator::current()
*
* @access public
*
@ -374,7 +374,7 @@ class DocumentList implements ArrayAccess, Countable, Iterator, \TYPO3\CMS\Core\
/**
* This returns the current position
* @see Iterator::key()
* @see \Iterator::key()
*
* @access public
*
@ -473,7 +473,7 @@ class DocumentList implements ArrayAccess, Countable, Iterator, \TYPO3\CMS\Core\
/**
* This increments the current list position
* @see Iterator::next()
* @see \Iterator::next()
*
* @access public
*
@ -487,7 +487,7 @@ class DocumentList implements ArrayAccess, Countable, Iterator, \TYPO3\CMS\Core\
/**
* This checks if an offset exists
* @see ArrayAccess::offsetExists()
* @see \ArrayAccess::offsetExists()
*
* @access public
*
@ -503,7 +503,7 @@ class DocumentList implements ArrayAccess, Countable, Iterator, \TYPO3\CMS\Core\
/**
* This returns the element at the given offset
* @see ArrayAccess::offsetGet()
* @see \ArrayAccess::offsetGet()
*
* @access public
*
@ -533,7 +533,7 @@ class DocumentList implements ArrayAccess, Countable, Iterator, \TYPO3\CMS\Core\
/**
* This sets the element at the given offset
* @see ArrayAccess::offsetSet()
* @see \ArrayAccess::offsetSet()
*
* @access public
*
@ -655,7 +655,7 @@ class DocumentList implements ArrayAccess, Countable, Iterator, \TYPO3\CMS\Core\
/**
* This resets the list position
* @see Iterator::rewind()
* @see \Iterator::rewind()
*
* @access public
*
@ -803,7 +803,7 @@ class DocumentList implements ArrayAccess, Countable, Iterator, \TYPO3\CMS\Core\
/**
* This unsets the element at the given offset
* @see ArrayAccess::offsetUnset()
* @see \ArrayAccess::offsetUnset()
*
* @access public
*
@ -824,7 +824,7 @@ class DocumentList implements ArrayAccess, Countable, Iterator, \TYPO3\CMS\Core\
/**
* This checks if the current list position is valid
* @see Iterator::valid()
* @see \Iterator::valid()
*
* @access public
*

15
Classes/Hooks/class.tx_dlf_doctype.php → Classes/Common/DocumentTypeCheck.php

@ -1,4 +1,6 @@
<?php
namespace Kitodo\Dlf\Common;
/**
* (c) Kitodo. Key to digital objects e.V. <contact@kitodo.org>
*
@ -9,19 +11,16 @@
* LICENSE.txt file that was distributed with this source code.
*/
use Kitodo\Dlf\Common\Document;
use Kitodo\Dlf\Common\Helper;
/**
* Document Type Check for usage as Typoscript Condition.
* Document Type Checker for usage as Typoscript Condition.
* @see dlf/ext_localconf.php->user_dlf_docTypeCheck()
*
* @author Alexander Bigga <alexander.bigga@slub-dresden.de>
* @package TYPO3
* @subpackage tx_dlf
* @subpackage dlf
* @access public
*/
class tx_dlf_doctype {
class DocumentTypeCheck {
/**
* This holds the current document
@ -173,7 +172,7 @@ class tx_dlf_doctype {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_doctype->loadDocument()] Failed to load document with UID "'.$this->piVars['id'].'"', $this->extKey, SYSLOG_SEVERITY_WARNING);
\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);
}
@ -208,7 +207,7 @@ class tx_dlf_doctype {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_doctype->loadDocument()] Failed to load document with record ID "'.$this->piVars['recordId'].'"', $this->extKey, SYSLOG_SEVERITY_WARNING);
\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);
}

4
Classes/Common/FulltextInterface.php

@ -27,10 +27,10 @@ interface FulltextInterface {
*
* @access public
*
* @param SimpleXMLElement $xml: The XML to extract the metadata from
* @param \SimpleXMLElement $xml: The XML to extract the metadata from
*
* @return string The raw unformatted fulltext
*/
public function getRawText(SimpleXMLElement $xml);
public function getRawText(\SimpleXMLElement $xml);
}

10
Classes/Common/Helper.php

@ -49,7 +49,7 @@ class Helper {
*/
public static function addMessage($message) {
$flashMessageService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessageService');
$flashMessageService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessageService::class);
$flashMessageService->getMessageQueueByIdentifier()->enqueue($message);
@ -337,7 +337,7 @@ class Helper {
if (TYPO3_MODE === 'FE' || TYPO3_MODE === 'BE') {
// Initialize backend session with CLI user's rights.
$userObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Authentication\\BackendUserAuthentication');
$userObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Authentication\BackendUserAuthentication::class);
$userObj->dontSetCookie = TRUE;
@ -915,7 +915,7 @@ class Helper {
public static function processDB(array $data = array (), array $cmd = array (), $reverseOrder = FALSE, $be_user = FALSE) {
// Instantiate TYPO3 core engine.
$tce = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\DataHandling\\DataHandler');
$tce = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\DataHandling\DataHandler::class);
// Set some configuration variables.
$tce->stripslashes_values = FALSE;
@ -997,7 +997,7 @@ class Helper {
*/
public static function renderFlashMessages() {
$flashMessageService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessageService');
$flashMessageService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessageService::class);
$content = '';
@ -1300,7 +1300,7 @@ class Helper {
} else {
$pageRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Page\\PageRepository');
$pageRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Frontend\Page\PageRepository::class);
$GLOBALS['TSFE']->includeTCA();

26
Classes/Common/Indexer.php

@ -180,7 +180,7 @@ class Indexer {
if (!$errors) {
$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
\TYPO3\CMS\Core\Messaging\FlashMessage::class,
htmlspecialchars(sprintf(Helper::getLL('flash.documentIndexed'), $resArray['title'], $doc->uid)),
Helper::getLL('flash.done', TRUE),
\TYPO3\CMS\Core\Messaging\FlashMessage::OK,
@ -190,7 +190,7 @@ class Indexer {
} else {
$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
\TYPO3\CMS\Core\Messaging\FlashMessage::class,
htmlspecialchars(sprintf(Helper::getLL('flash.documentNotIndexed'), $resArray['title'], $doc->uid)),
Helper::getLL('flash.error', TRUE),
\TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
@ -205,12 +205,12 @@ class Indexer {
return $errors;
} catch (Exception $e) {
} catch (\Exception $e) {
if (!defined('TYPO3_cliMode')) {
$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
\TYPO3\CMS\Core\Messaging\FlashMessage::class,
Helper::getLL('flash.solrException', TRUE).'<br />'.htmlspecialchars($e->getMessage()),
Helper::getLL('flash.error', TRUE),
\TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
@ -236,7 +236,7 @@ class Indexer {
if (!defined('TYPO3_cliMode')) {
$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
\TYPO3\CMS\Core\Messaging\FlashMessage::class,
Helper::getLL('flash.solrNoConnection', TRUE),
Helper::getLL('flash.warning', TRUE),
\TYPO3\CMS\Core\Messaging\FlashMessage::WARNING,
@ -301,12 +301,12 @@ class Indexer {
$updateQuery->addCommit();
self::$solr->service->update($updateQuery);
} catch (Exception $e) {
} catch (\Exception $e) {
if (!defined('TYPO3_cliMode')) {
$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
\TYPO3\CMS\Core\Messaging\FlashMessage::class,
Helper::getLL('flash.solrException', TRUE).'<br />'.htmlspecialchars($e->getMessage()),
Helper::getLL('flash.error', TRUE),
\TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
@ -332,7 +332,7 @@ class Indexer {
if (!defined('TYPO3_cliMode')) {
$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
\TYPO3\CMS\Core\Messaging\FlashMessage::class,
Helper::getLL('flash.solrNoConnection', TRUE),
Helper::getLL('flash.error', TRUE),
\TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
@ -356,7 +356,7 @@ class Indexer {
if (!defined('TYPO3_cliMode')) {
$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
\TYPO3\CMS\Core\Messaging\FlashMessage::class,
htmlspecialchars(sprintf(Helper::getLL('flash.documentDeleted'), $title, $uid)),
Helper::getLL('flash.done', TRUE),
\TYPO3\CMS\Core\Messaging\FlashMessage::OK,
@ -632,12 +632,12 @@ class Indexer {
$updateQuery->addDocument($solrDoc);
self::$solr->service->update($updateQuery);
} catch (Exception $e) {
} catch (\Exception $e) {
if (!defined('TYPO3_cliMode')) {
$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
\TYPO3\CMS\Core\Messaging\FlashMessage::class,
Helper::getLL('flash.solrException', TRUE).'<br />'.htmlspecialchars($e->getMessage()),
Helper::getLL('flash.error', TRUE),
\TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
@ -799,12 +799,12 @@ class Indexer {
$updateQuery->addDocument($solrDoc);
self::$solr->service->update($updateQuery);
} catch (Exception $e) {
} catch (\Exception $e) {
if (!defined('TYPO3_cliMode')) {
$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
\TYPO3\CMS\Core\Messaging\FlashMessage::class,
Helper::getLL('flash.solrException', TRUE).'<br />'.htmlspecialchars($e->getMessage()),
Helper::getLL('flash.error', TRUE),
\TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,

8
Classes/Common/FormatInterface.php → Classes/Common/MetadataInterface.php

@ -12,7 +12,7 @@ namespace Kitodo\Dlf\Common;
*/
/**
* Format interface for the 'dlf' extension.
* Metadata interface for the 'dlf' extension.
*
* @author Sebastian Meyer <sebastian.meyer@slub-dresden.de>
* @package TYPO3
@ -20,18 +20,18 @@ namespace Kitodo\Dlf\Common;
* @access public
* @abstract
*/
interface FormatInterface {
interface MetadataInterface {
/**
* This extracts metadata from XML
*
* @access public
*
* @param SimpleXMLElement $xml: The XML to extract the metadata from
* @param \SimpleXMLElement $xml: The XML to extract the metadata from
* @param array &$metadata: The metadata array to fill
*
* @return void
*/
public function extractMetadata(SimpleXMLElement $xml, array &$metadata);
public function extractMetadata(\SimpleXMLElement $xml, array &$metadata);
}

6
Classes/Common/Solr.php

@ -105,7 +105,7 @@ class Solr {
*/
public static function escapeQuery($query) {
$helper = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Solarium\Core\Query\Helper');
$helper = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\Solarium\Core\Query\Helper::class);
// Escape query phrase or term.
if (preg_match('/^".*"$/', $query)) {
@ -661,7 +661,7 @@ class Solr {
);
// Instantiate Solarium\Client class.
$this->service = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Solarium\Client', $config);
$this->service = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\Solarium\Client::class, $config);
// Check if connection is established.
$ping = $this->service->createPing();
@ -676,7 +676,7 @@ class Solr {
// Instantiation successful!
$this->ready = TRUE;
} catch (Exception $e) {
} catch (\Exception $e) {
// Nothing to do here.

12
Classes/Formats/class.tx_dlf_alto.php → Classes/Formats/Alto.php

@ -1,4 +1,6 @@
<?php
namespace Kitodo\Dlf\Formats;
/**
* (c) Kitodo. Key to digital objects e.V. <contact@kitodo.org>
*
@ -10,25 +12,25 @@
*/
/**
* Fulltext format class 'tx_dlf_alto' for the 'dlf' extension.
* Fulltext ALTO format class for the 'dlf' extension.
*
* @author Sebastian Meyer <sebastian.meyer@slub-dresden.de>
* @package TYPO3
* @subpackage tx_dlf
* @subpackage dlf
* @access public
*/
class tx_dlf_alto implements \Kitodo\Dlf\Common\FulltextInterface {
class Alto implements \Kitodo\Dlf\Common\FulltextInterface {
/**
* This extracts the fulltext data from ALTO XML
*
* @access public
*
* @param SimpleXMLElement $xml: The XML to extract the raw text from
* @param \SimpleXMLElement $xml: The XML to extract the raw text from
*
* @return string The raw unformatted fulltext
*/
public function getRawText(SimpleXMLElement $xml) {
public function getRawText(\SimpleXMLElement $xml) {
$xml->registerXPathNamespace('alto', 'http://www.loc.gov/standards/alto/ns-v2#');

12
Classes/Formats/class.tx_dlf_mods.php → Classes/Formats/Mods.php

@ -1,4 +1,6 @@
<?php
namespace Kitodo\Dlf\Formats;
/**
* (c) Kitodo. Key to digital objects e.V. <contact@kitodo.org>
*
@ -10,26 +12,26 @@
*/
/**
* Metadata format class 'tx_dlf_mods' for the 'dlf' extension.
* Metadata MODS format class for the 'dlf' extension.
*
* @author Sebastian Meyer <sebastian.meyer@slub-dresden.de>
* @package TYPO3
* @subpackage tx_dlf
* @subpackage dlf
* @access public
*/
class tx_dlf_mods implements \Kitodo\Dlf\Common\FormatInterface {
class Mods implements \Kitodo\Dlf\Common\MetadataInterface {
/**
* This extracts the essential MODS metadata from XML
*
* @access public
*
* @param SimpleXMLElement $xml: The XML to extract the metadata from
* @param \SimpleXMLElement $xml: The XML to extract the metadata from
* @param array &$metadata: The metadata array to fill
*
* @return void
*/
public function extractMetadata(SimpleXMLElement $xml, array &$metadata) {
public function extractMetadata(\SimpleXMLElement $xml, array &$metadata) {
$xml->registerXPathNamespace('mods', 'http://www.loc.gov/mods/v3');

12
Classes/Formats/class.tx_dlf_teihdr.php → Classes/Formats/TeiHeader.php

@ -1,4 +1,6 @@
<?php
namespace Kitodo\Dlf\Formats;
/**
* (c) Kitodo. Key to digital objects e.V. <contact@kitodo.org>
*
@ -10,26 +12,26 @@
*/
/**
* Metadata format class 'tx_dlf_teihdr' for the 'dlf' extension.
* Metadata TEI-Header format class for the 'dlf' extension.
*
* @author Sebastian Meyer <sebastian.meyer@slub-dresden.de>
* @package TYPO3
* @subpackage tx_dlf
* @subpackage dlf
* @access public
*/
class tx_dlf_teihdr implements \Kitodo\Dlf\Common\FormatInterface {
class TeiHeader implements \Kitodo\Dlf\Common\MetadataInterface {
/**
* This extracts the essential TEIHDR metadata from XML
*
* @access public
*
* @param SimpleXMLElement $xml: The XML to extract the metadata from
* @param \SimpleXMLElement $xml: The XML to extract the metadata from
* @param array &$metadata: The metadata array to fill
*
* @return void
*/
public function extractMetadata(SimpleXMLElement $xml, array &$metadata) {
public function extractMetadata(\SimpleXMLElement $xml, array &$metadata) {
$xml->registerXPathNamespace('teihdr', 'http://www.tei-c.org/ns/1.0');

56
Classes/Hooks/class.tx_dlf_em.php → Classes/Hooks/ConfigurationForm.php

@ -1,4 +1,6 @@
<?php
namespace Kitodo\Dlf\Hooks;
/**
* (c) Kitodo. Key to digital objects e.V. <contact@kitodo.org>
*
@ -13,14 +15,14 @@ use Kitodo\Dlf\Common\Helper;
use Kitodo\Dlf\Common\Solr;
/**
* Hooks and helper for the extension manager.
* Hooks and helper for \TYPO3\CMS\Core\TypoScript\ConfigurationForm
*
* @author Sebastian Meyer <sebastian.meyer@slub-dresden.de>
* @package TYPO3
* @subpackage tx_dlf
* @subpackage dlf
* @access public
*/
class tx_dlf_em {
class ConfigurationForm {
/**
* This holds the current configuration
@ -84,7 +86,7 @@ class tx_dlf_em {
if (is_array($status)) {
$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
\TYPO3\CMS\Core\Messaging\FlashMessage::class,
sprintf($GLOBALS['LANG']->getLL('solr.status'), (string) $status[0]),
$GLOBALS['LANG']->getLL('solr.connected'),
($status[0] == 0 ? \TYPO3\CMS\Core\Messaging\FlashMessage::OK : \TYPO3\CMS\Core\Messaging\FlashMessage::WARNING),
@ -100,7 +102,7 @@ class tx_dlf_em {
}
$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
\TYPO3\CMS\Core\Messaging\FlashMessage::class,
sprintf($GLOBALS['LANG']->getLL('solr.error'), $url),
$GLOBALS['LANG']->getLL('solr.notConnected'),
\TYPO3\CMS\Core\Messaging\FlashMessage::WARNING,
@ -157,7 +159,7 @@ class tx_dlf_em {
$usrUid = $resArray['uid'];
$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
\TYPO3\CMS\Core\Messaging\FlashMessage::class,
$GLOBALS['LANG']->getLL('cliUserGroup.usrOkayMsg'),
$GLOBALS['LANG']->getLL('cliUserGroup.usrOkay'),
\TYPO3\CMS\Core\Messaging\FlashMessage::OK,
@ -189,7 +191,7 @@ class tx_dlf_em {
$usrUid = $resArray['uid'];
$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
\TYPO3\CMS\Core\Messaging\FlashMessage::class,
$GLOBALS['LANG']->getLL('cliUserGroup.usrConfiguredMsg'),
$GLOBALS['LANG']->getLL('cliUserGroup.usrConfigured'),
\TYPO3\CMS\Core\Messaging\FlashMessage::INFO,
@ -199,7 +201,7 @@ class tx_dlf_em {
} else {
$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
\TYPO3\CMS\Core\Messaging\FlashMessage::class,
$GLOBALS['LANG']->getLL('cliUserGroup.usrNotConfiguredMsg'),
$GLOBALS['LANG']->getLL('cliUserGroup.usrNotConfigured'),
\TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
@ -211,7 +213,7 @@ class tx_dlf_em {
} else {
$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
\TYPO3\CMS\Core\Messaging\FlashMessage::class,
$GLOBALS['LANG']->getLL('cliUserGroup.usrNotConfiguredMsg'),
$GLOBALS['LANG']->getLL('cliUserGroup.usrNotConfigured'),
\TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
@ -246,7 +248,7 @@ class tx_dlf_em {
$usrUid = $substUid[$tempUid];
$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
\TYPO3\CMS\Core\Messaging\FlashMessage::class,
$GLOBALS['LANG']->getLL('cliUserGroup.usrCreatedMsg'),
$GLOBALS['LANG']->getLL('cliUserGroup.usrCreated'),
\TYPO3\CMS\Core\Messaging\FlashMessage::INFO,
@ -256,7 +258,7 @@ class tx_dlf_em {
} else {
$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
\TYPO3\CMS\Core\Messaging\FlashMessage::class,
$GLOBALS['LANG']->getLL('cliUserGroup.usrNotCreatedMsg'),
$GLOBALS['LANG']->getLL('cliUserGroup.usrNotCreated'),
\TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
@ -268,7 +270,7 @@ class tx_dlf_em {
} else {
$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
\TYPO3\CMS\Core\Messaging\FlashMessage::class,
$GLOBALS['LANG']->getLL('cliUserGroup.usrNotCreatedMsg'),
$GLOBALS['LANG']->getLL('cliUserGroup.usrNotCreated'),
\TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
@ -368,7 +370,7 @@ class tx_dlf_em {
$grpUid = $resArray['uid'];
$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
\TYPO3\CMS\Core\Messaging\FlashMessage::class,
$GLOBALS['LANG']->getLL('cliUserGroup.grpOkayMsg'),
$GLOBALS['LANG']->getLL('cliUserGroup.grpOkay'),
\TYPO3\CMS\Core\Messaging\FlashMessage::OK,
@ -403,7 +405,7 @@ class tx_dlf_em {
$grpUid = $resArray['uid'];
$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
\TYPO3\CMS\Core\Messaging\FlashMessage::class,
$GLOBALS['LANG']->getLL('cliUserGroup.grpConfiguredMsg'),
$GLOBALS['LANG']->getLL('cliUserGroup.grpConfigured'),
\TYPO3\CMS\Core\Messaging\FlashMessage::INFO,
@ -413,7 +415,7 @@ class tx_dlf_em {
} else {
$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
\TYPO3\CMS\Core\Messaging\FlashMessage::class,
$GLOBALS['LANG']->getLL('cliUserGroup.grpNotConfiguredMsg'),
$GLOBALS['LANG']->getLL('cliUserGroup.grpNotConfigured'),
\TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
@ -425,7 +427,7 @@ class tx_dlf_em {
} else {
$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
\TYPO3\CMS\Core\Messaging\FlashMessage::class,
$GLOBALS['LANG']->getLL('cliUserGroup.grpNotConfiguredMsg'),
$GLOBALS['LANG']->getLL('cliUserGroup.grpNotConfigured'),
\TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
@ -461,7 +463,7 @@ class tx_dlf_em {
$grpUid = $substUid[$tempUid];
$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
\TYPO3\CMS\Core\Messaging\FlashMessage::class,
$GLOBALS['LANG']->getLL('cliUserGroup.grpCreatedMsg'),
$GLOBALS['LANG']->getLL('cliUserGroup.grpCreated'),
\TYPO3\CMS\Core\Messaging\FlashMessage::INFO,
@ -471,7 +473,7 @@ class tx_dlf_em {
} else {
$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
\TYPO3\CMS\Core\Messaging\FlashMessage::class,
$GLOBALS['LANG']->getLL('cliUserGroup.grpNotCreatedMsg'),
$GLOBALS['LANG']->getLL('cliUserGroup.grpNotCreated'),
\TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
@ -483,7 +485,7 @@ class tx_dlf_em {
} else {
$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
\TYPO3\CMS\Core\Messaging\FlashMessage::class,
$GLOBALS['LANG']->getLL('cliUserGroup.grpNotCreatedMsg'),
$GLOBALS['LANG']->getLL('cliUserGroup.grpNotCreated'),
\TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
@ -528,7 +530,7 @@ class tx_dlf_em {
if (is_executable(PATH_typo3.'cli_dispatch.phpsh')) {
$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
\TYPO3\CMS\Core\Messaging\FlashMessage::class,
$GLOBALS['LANG']->getLL('cliUserGroup.cliOkayMsg'),
$GLOBALS['LANG']->getLL('cliUserGroup.cliOkay'),
\TYPO3\CMS\Core\Messaging\FlashMessage::OK,
@ -538,7 +540,7 @@ class tx_dlf_em {
} else {
$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
\TYPO3\CMS\Core\Messaging\FlashMessage::class,
$GLOBALS['LANG']->getLL('cliUserGroup.cliNotOkayMsg'),
$GLOBALS['LANG']->getLL('cliUserGroup.cliNotOkay'),
\TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
@ -595,7 +597,7 @@ class tx_dlf_em {
'type' => 'MODS',
'root' => 'mods',
'namespace' => 'http://www.loc.gov/mods/v3',
'class' => 'tx_dlf_mods'
'class' => 'Kitodo\\Dlf\\Formats\\Mods'
);
}
@ -608,7 +610,7 @@ class tx_dlf_em {
'type' => 'TEIHDR',
'root' => 'teiHeader',
'namespace' => 'http://www.tei-c.org/ns/1.0',
'class' => 'tx_dlf_teihdr'
'class' => 'Kitodo\\Dlf\\Formats\\TeiHeader'
);
}
@ -621,7 +623,7 @@ class tx_dlf_em {
'type' => 'ALTO',
'root' => 'alto',
'namespace' => 'http://www.loc.gov/standards/alto/ns-v2#',
'class' => 'tx_dlf_alto'
'class' => 'Kitodo\\Dlf\\Formats\\Alto'
);
}
@ -634,7 +636,7 @@ class tx_dlf_em {
if (!empty($substUid)) {
$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
\TYPO3\CMS\Core\Messaging\FlashMessage::class,
$GLOBALS['LANG']->getLL('metadataFormats.nsCreatedMsg'),
$GLOBALS['LANG']->getLL('metadataFormats.nsCreated'),
\TYPO3\CMS\Core\Messaging\FlashMessage::INFO,
@ -644,7 +646,7 @@ class tx_dlf_em {
} else {
$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
\TYPO3\CMS\Core\Messaging\FlashMessage::class,
$GLOBALS['LANG']->getLL('metadataFormats.nsNotCreatedMsg'),
$GLOBALS['LANG']->getLL('metadataFormats.nsNotCreated'),
\TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
@ -656,7 +658,7 @@ class tx_dlf_em {
} else {
$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
\TYPO3\CMS\Core\Messaging\FlashMessage::class,
$GLOBALS['LANG']->getLL('metadataFormats.nsOkayMsg'),
$GLOBALS['LANG']->getLL('metadataFormats.nsOkay'),
\TYPO3\CMS\Core\Messaging\FlashMessage::OK,

16
Classes/Hooks/class.tx_dlf_tcemain.php → Classes/Hooks/DataHandler.php

@ -1,4 +1,6 @@
<?php
namespace Kitodo\Dlf\Hooks;
/**
* (c) Kitodo. Key to digital objects e.V. <contact@kitodo.org>
*
@ -14,14 +16,14 @@ use Kitodo\Dlf\Common\Helper;
use Kitodo\Dlf\Common\Solr;
/**
* Hooks and helper for the '\TYPO3\CMS\Core\DataHandling\DataHandler' library.
* Hooks and helper for \TYPO3\CMS\Core\DataHandling\DataHandler
*
* @author Sebastian Meyer <sebastian.meyer@slub-dresden.de>
* @package TYPO3
* @subpackage tx_dlf
* @subpackage dlf
* @access public
*/
class tx_dlf_tcemain {
class DataHandler {
/**
* Field post-processing hook for the process_datamap() method.
@ -161,7 +163,7 @@ class tx_dlf_tcemain {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_tcemain->processDatamap_postProcessFieldArray('.$status.', '.$table.', '.$id.', [data], ['.get_class($pObj).'])] Could not create new Apache Solr core "dlfCore'.$coreNumber.'"', $this->extKey, SYSLOG_SEVERITY_ERROR, $fieldArray);
\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);
}
@ -269,7 +271,7 @@ class tx_dlf_tcemain {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_tcemain->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);
\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);
}
@ -348,7 +350,7 @@ class tx_dlf_tcemain {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_tcemain->processDatamap_afterDatabaseOperations('.$status.', '.$table.', '.$id.', [data], ['.get_class($pObj).'])] Failed to re-index document with UID "'.$id.'"', $this->extKey, SYSLOG_SEVERITY_ERROR, $fieldArray);
\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);
}
@ -434,7 +436,7 @@ class tx_dlf_tcemain {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_tcemain->processCmdmap_postProcess('.$command.', '.$table.', '.$id.', '.$value.', ['.get_class($pObj).'])] Failed to re-index document with UID "'.$id.'"', $this->extKey, SYSLOG_SEVERITY_ERROR);
\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);
}

8
Classes/Hooks/class.tx_dlf_tceforms.php → Classes/Hooks/FormEngine.php

@ -1,4 +1,6 @@
<?php
namespace Kitodo\Dlf\Hooks;
/**
* (c) Kitodo. Key to digital objects e.V. <contact@kitodo.org>
*
@ -12,14 +14,14 @@
use Kitodo\Dlf\Common\Helper;
/**
* Hooks and helper for the '\TYPO3\CMS\Backend\Form\FormEngine' library.
* Hooks and helper for \TYPO3\CMS\Backend\Form\FormEngine
*
* @author Sebastian Meyer <sebastian.meyer@slub-dresden.de>
* @package TYPO3
* @subpackage tx_dlf
* @subpackage dlf
* @access public
*/
class tx_dlf_tceforms {
class FormEngine {
/**
* Helper to display document's thumbnail for table "tx_dlf_documents"

12
Classes/Hooks/class.tx_dlf_hacks.php → Classes/Hooks/KitodoProductionHacks.php

@ -1,4 +1,6 @@
<?php
namespace Kitodo\Dlf\Hooks;
/**
* (c) Kitodo. Key to digital objects e.V. <contact@kitodo.org>
*
@ -10,14 +12,14 @@
*/
/**
* Hooks and hacks for Kitodo.Production.
* Hooks and hacks for Kitodo.Production
*
* @author Sebastian Meyer <sebastian.meyer@slub-dresden.de>
* @package TYPO3
* @subpackage tx_dlf
* @subpackage dlf
* @access public
*/
class tx_dlf_hacks {
class KitodoProductionHacks {
/**
* Hook for \Kitodo\Dlf\Common\Document::__construct()
@ -26,12 +28,12 @@ class tx_dlf_hacks {
*
* @access public
*
* @param SimpleXMLElement &$xml: The XML object
* @param \SimpleXMLElement &$xml: The XML object
* @param mixed $record_id: The record identifier
*
* @return void
*/
public function construct_postProcessRecordId(SimpleXMLElement &$xml, &$record_id) {
public function construct_postProcessRecordId(\SimpleXMLElement &$xml, &$record_id) {
if (!$record_id) {

2
Configuration/TCA/tx_dlf_documents.php

@ -212,7 +212,7 @@ return array (
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.thumbnail',
'config' => array (
'type' => 'user',
'userFunc' => 'EXT:dlf/Classes/Hooks/class.tx_dlf_tceforms.php:tx_dlf_tceforms->displayThumbnail',
'userFunc' => 'EXT:dlf/Classes/Hooks/FormEngine.php:FormEngine->displayThumbnail',
),
),
'metadata' => array (

88
class.ext_update.php

@ -81,7 +81,7 @@ class ext_update {
$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'tx_dlf_metadata.uid AS uid',
'tx_dlf_metadata',
'tx_dlf_metadata.format=0 AND NOT tx_dlf_metadata.xpath=\'\''.Helper::whereClause('tx_dlf_metadata'),
'tx_dlf_metadata.format=0 AND NOT tx_dlf_metadata.xpath=""'.Helper::whereClause('tx_dlf_metadata'),
'',
'',
''
@ -119,21 +119,52 @@ class ext_update {
}
if ($this->oldIndexRelatedTableNames()) {
$this->renameIndexRelatedColumns();
}
if ($this->solariumSolrUpdateRequired()) {
$this->doSolariumSolrUpdate();
}
if (count($this->oldFormatClasses())) {
$this->updateFormatClasses();
}
return $this->content;
}
/**
* Check for old format classes
*
* @access protected
*
* @return boolean true if old format classes exist
*/
protected function oldFormatClasses() {
$oldRecords = array ();
// Get all records with outdated configuration.
$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'tx_dlf_formats.uid AS uid,tx_dlf_formats.type AS type',
'tx_dlf_formats',
'tx_dlf_formats.class NOT LIKE "%\\%"'.Helper::whereClause('tx_dlf_formats'),
'',
'',
''
);
while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
$oldRecords[$resArray['uid']] = $resArray['type'];
}
return $oldRecords;
}
/**
* Check for old index related colums
*
@ -189,7 +220,7 @@ class ext_update {
if ($result) {
$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
\TYPO3\CMS\Core\Messaging\FlashMessage::class,
$GLOBALS['LANG']->getLL('update.copyIndexRelatedColumnsOkay', TRUE),
$GLOBALS['LANG']->getLL('update.copyIndexRelatedColumns', TRUE),
\TYPO3\CMS\Core\Messaging\FlashMessage::OK,
@ -199,7 +230,7 @@ class ext_update {
} else {
$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
\TYPO3\CMS\Core\Messaging\FlashMessage::class,
$GLOBALS['LANG']->getLL('update.copyIndexRelatedColumnsNotOkay', TRUE),
$GLOBALS['LANG']->getLL('update.copyIndexRelatedColumns', TRUE),
\TYPO3\CMS\Core\Messaging\FlashMessage::WARNING,
@ -212,6 +243,43 @@ class ext_update {
}
/**
* Update all outdated format records
*
* @access protected
*
* @return void
*/
protected function updateFormatClasses() {
$oldRecords = $this->oldFormatClasses();
$newValues = array (
'ALTO' => 'Kitodo\\Dlf\\Formats\\Alto',
'MODS' => 'Kitodo\\Dlf\\Formats\\Mods',
'TEIHDR' => 'Kitodo\\Dlf\\Formats\\TeiHeader'
);
foreach ($oldRecords as $uid => $type) {
$sqlQuery = 'UPDATE tx_dlf_formats SET class="'.$newValues[$type].'" WHERE uid='.$uid;
$GLOBALS['TYPO3_DB']->sql_query($sqlQuery);
}
$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
\TYPO3\CMS\Core\Messaging\FlashMessage::class,
$GLOBALS['LANG']->getLL('update.FormatClassesOkay', TRUE),
$GLOBALS['LANG']->getLL('update.FormatClasses', TRUE),
\TYPO3\CMS\Core\Messaging\FlashMessage::OK,
FALSE
);
$this->content .= $message->render();
}
/**
* Update all outdated metadata configuration records
*
@ -266,7 +334,7 @@ class ext_update {
if (!empty($substUids)) {
$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
\TYPO3\CMS\Core\Messaging\FlashMessage::class,
$GLOBALS['LANG']->getLL('update.metadataConfigOkay', TRUE),
$GLOBALS['LANG']->getLL('update.metadataConfig', TRUE),
\TYPO3\CMS\Core\Messaging\FlashMessage::OK,
@ -276,7 +344,7 @@ class ext_update {
} else {
$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
\TYPO3\CMS\Core\Messaging\FlashMessage::class,
$GLOBALS['LANG']->getLL('update.metadataConfigNotOkay', TRUE),
$GLOBALS['LANG']->getLL('update.metadataConfig', TRUE),
\TYPO3\CMS\Core\Messaging\FlashMessage::WARNING,
@ -397,7 +465,7 @@ class ext_update {
}
$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
\TYPO3\CMS\Core\Messaging\FlashMessage::class,
$GLOBALS['LANG']->getLL('update.solariumSolrUpdateNotOkay', TRUE),
sprintf($GLOBALS['LANG']->getLL('update.solariumSolrUpdate', TRUE), $resArray['index_name']),
\TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
@ -413,7 +481,7 @@ class ext_update {
}
$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
\TYPO3\CMS\Core\Messaging\FlashMessage::class,
$GLOBALS['LANG']->getLL('update.solariumSolrUpdateOkay', TRUE),
$GLOBALS['LANG']->getLL('update.solariumSolrUpdate', TRUE),
\TYPO3\CMS\Core\Messaging\FlashMessage::OK,

6
ext_conf_template.txt

@ -1,7 +1,7 @@
# cat=Basic; type=user[EXT:dlf/Classes/Hooks/class.tx_dlf_em.php:tx_dlf_em->checkMetadataFormats]; label=LLL:EXT:dlf/locallang.xml:config.metadataFormats
# cat=Basic; type=user[EXT:dlf/Classes/Hooks/ConfigurationForm.php:ConfigurationForm->checkMetadataFormats]; label=LLL:EXT:dlf/locallang.xml:config.metadataFormats
metadataFormats = 0
# cat=Basic; type=user[EXT:dlf/Classes/Hooks/class.tx_dlf_em.php:tx_dlf_em->checkCliUserGroup]; label=LLL:EXT:dlf/locallang.xml:config.cliUserGroup
# cat=Basic; type=user[EXT:dlf/Classes/Hooks/ConfigurationForm.php:ConfigurationForm->checkCliUserGroup]; label=LLL:EXT:dlf/locallang.xml:config.cliUserGroup
cliUserGroup = 0
# cat=Basic; type=boolean; label=LLL:EXT:dlf/locallang.xml:config.makeCliUserGroup
@ -34,7 +34,7 @@ fileGrpFulltext = FULLTEXT
# cat=Files; type=string; label=LLL:EXT:dlf/locallang.xml:config.fileGrpAudio
fileGrpAudio = AUDIO
# cat=Solr; type=user[EXT:dlf/Classes/Hooks/class.tx_dlf_em.php:tx_dlf_em->checkSolrConnection]; label=LLL:EXT:dlf/locallang.xml:config.solrConnect
# cat=Solr; type=user[EXT:dlf/Classes/Hooks/ConfigurationForm.php:ConfigurationForm->checkSolrConnection]; label=LLL:EXT:dlf/locallang.xml:config.solrConnect
solrConnect = 0
# cat=Solr; type=boolean; label=LLL:EXT:dlf/locallang.xml:config.solrHttps

8
ext_localconf.php

@ -60,11 +60,11 @@ $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/plugins/toolbox/tools'][\TYPO3\CM
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/plugins/toolbox/tools'][\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getCN($_EXTKEY).'_toolsImagedownload'] = 'LLL:EXT:dlf/locallang.xml:tx_dlf_toolbox.toolsImagedownload';
// Register hooks.
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass'][] = 'EXT:'.$_EXTKEY.'/Classes/Hooks/class.tx_dlf_tcemain.php:tx_dlf_tcemain';
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass'][] = 'EXT:'.$_EXTKEY.'/Classes/Hooks/DataHandler.php:DataHandler';
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processCmdmapClass'][] = 'EXT:'.$_EXTKEY.'/Classes/Hooks/class.tx_dlf_tcemain.php:tx_dlf_tcemain';
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processCmdmapClass'][] = 'EXT:'.$_EXTKEY.'/Classes/Hooks/DataHandler.php:DataHandler';
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Common/Document.php']['hookClass'][] = 'EXT:'.$_EXTKEY.'/Classes/Hooks/class.tx_dlf_hacks.php:tx_dlf_hacks';
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Common/Document.php']['hookClass'][] = 'EXT:'.$_EXTKEY.'/Classes/Hooks/KitodoProductionHacks.php:KitodoProductionHacks';
// Register command line scripts.
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['cliKeys'][$_EXTKEY] = array (
@ -94,7 +94,7 @@ if (TYPO3_MODE === 'FE') {
*/
function user_dlf_docTypeCheck($type) {
$hook = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_doctype');
$hook = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\Kitodo\Dlf\Common\DocumentTypeCheck::class);
return ($hook->getDocType() === $type);

16
locallang.xml

@ -186,11 +186,11 @@
<label index="solr.notConnected">Connection failed!</label>
<label index="solr.error">Apache Solr was not reachable under &lt;strong&gt;%s&lt;/strong&gt;.</label>
<label index="metadataFormats.nsOkay">Default namespaces found!</label>
<label index="metadataFormats.nsOkayMsg">The namespace definitions for MODS and TEIHDR do exist.</label>
<label index="metadataFormats.nsOkayMsg">The namespace definitions for MODS, TEIHDR and ALTO do exist.</label>
<label index="metadataFormats.nsCreated">Default namespaces created successfully!</label>
<label index="metadataFormats.nsCreatedMsg">The namespace definitions for MODS and/or TEIHDR were created properly.</label>
<label index="metadataFormats.nsCreatedMsg">The namespace definitions for MODS, TEIHDR and/or ALTO were created properly.</label>
<label index="metadataFormats.nsNotCreated">Default namespaces not found!</label>
<label index="metadataFormats.nsNotCreatedMsg">The namespace definitions for MODS and/or TEIHDR do not exist and could not be created.</label>
<label index="metadataFormats.nsNotCreatedMsg">The namespace definitions for MODS, TEIHDR and/or ALTO do not exist and could not be created.</label>
<label index="cliUserGroup.usrRealName">Kitodo.Presentation command line indexer</label>
<label index="cliUserGroup.usrOkay">User "_cli_dlf" found!</label>
<label index="cliUserGroup.usrOkayMsg">The backend user for the command line indexer exists and is configured properly.</label>
@ -226,6 +226,8 @@
<label index="update.solariumSolrUpdate">Re-adding cores to Solr...</label>
<label index="update.solariumSolrUpdateOkay">...successfully completed! Please re-index your documents now.</label>
<label index="update.solariumSolrUpdateNotOkay">...failed for core %s! Please check your Solr configuration.</label>
<label index="update.FormatClasses">Switching format classes to namespaces...</label>
<label index="update.FormatClassesOkay">...successfully completed! Please check all format records in the page tree's root.</label>