Refactor Solr core handling
This commit is contained in:
parent
dd8588210d
commit
e447ddd5ef
|
@ -2,7 +2,7 @@
|
|||
/***************************************************************
|
||||
* Copyright notice
|
||||
*
|
||||
* (c) 2011 Sebastian Meyer <sebastian.meyer@slub-dresden.de>
|
||||
* (c) 2012 Sebastian Meyer <sebastian.meyer@slub-dresden.de>
|
||||
* All rights reserved
|
||||
*
|
||||
* This script is part of the TYPO3 project. The TYPO3 project is
|
||||
|
@ -36,23 +36,13 @@ if (!defined('TYPO3_cliMode')) {
|
|||
* CLI script for the 'dlf' extension.
|
||||
*
|
||||
* @author Sebastian Meyer <sebastian.meyer@slub-dresden.de>
|
||||
* @copyright Copyright (c) 2011, Sebastian Meyer, SLUB Dresden
|
||||
* @copyright Copyright (c) 2012, Sebastian Meyer, SLUB Dresden
|
||||
* @package TYPO3
|
||||
* @subpackage tx_dlf
|
||||
* @access public
|
||||
*/
|
||||
class tx_dlf_cli extends t3lib_cli {
|
||||
|
||||
public $cli_help = array (
|
||||
'name' => 'Command Line Interface for the Digital Library Framework',
|
||||
'synopsis' => '###OPTIONS###',
|
||||
'description' => '',
|
||||
'examples' => '/PATH/TO/TYPO3/cli_dispatch.phpsh dlf TASK -ARG1=VALUE1 -ARG2=VALUE2',
|
||||
'options' => '',
|
||||
'license' => 'GNU GPL - free software!',
|
||||
'author' => 'Sebastian Meyer <sebastian.meyer@slub-dresden.de>',
|
||||
);
|
||||
|
||||
/**
|
||||
* Main function of the script.
|
||||
*
|
||||
|
@ -79,10 +69,20 @@ class tx_dlf_cli extends t3lib_cli {
|
|||
// Get the document...
|
||||
$doc = tx_dlf_document::getInstance($this->cli_args['-doc'][0], 0, TRUE);
|
||||
|
||||
// ...save it to the database...
|
||||
if (!$doc->ready || !$doc->save(intval($this->cli_args['-pid'][0]), $this->cli_args['-core'][0])) {
|
||||
if ($doc->ready) {
|
||||
|
||||
$this->cli_echo('ERROR: Document '.$this->cli_args['-doc'][0].' not saved and indexed'.LF, TRUE);
|
||||
// ...and save it to the database...
|
||||
if (!$doc->save(intval($this->cli_args['-pid'][0]), intval($this->cli_args['-core'][0]))) {
|
||||
|
||||
$this->cli_echo('ERROR: Document '.$this->cli_args['-doc'][0].' not saved and indexed'.LF, TRUE);
|
||||
|
||||
exit (1);
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
$this->cli_echo('ERROR: Document '.$this->cli_args['-doc'][0].' could not be loaded.'.LF, TRUE);
|
||||
|
||||
exit (1);
|
||||
|
||||
|
@ -104,6 +104,17 @@ class tx_dlf_cli extends t3lib_cli {
|
|||
|
||||
public function __construct() {
|
||||
|
||||
// Set basic information about the script.
|
||||
$this->cli_help = array (
|
||||
'name' => 'Command Line Interface for Goobi.Presentation',
|
||||
'synopsis' => '###OPTIONS###',
|
||||
'description' => 'Currently the only task available is "index".'.LF.'Try "/PATH/TO/TYPO3/cli_dispatch.phpsh dlf index" to view more options.',
|
||||
'examples' => '/PATH/TO/TYPO3/cli_dispatch.phpsh dlf TASK -ARG1=VALUE1 -ARG2=VALUE2',
|
||||
'options' => '',
|
||||
'license' => 'GNU GPL - free software!',
|
||||
'author' => 'Sebastian Meyer <sebastian.meyer@slub-dresden.de>',
|
||||
);
|
||||
|
||||
// Run parent constructor.
|
||||
parent::t3lib_cli();
|
||||
|
||||
|
|
|
@ -884,9 +884,11 @@ class tx_dlf_document {
|
|||
protected function load($location) {
|
||||
|
||||
// Load XML file.
|
||||
// There is a bug in filter_var($var, FILTER_VALIDATE_URL) in PHP < 5.3.3.
|
||||
// (see https://bugs.php.net/bug.php?id=51192)
|
||||
if (version_compare(phpversion(), '5.3.3', '<') || t3lib_div::isValidUrl($location)) {
|
||||
if (t3lib_div::isValidUrl($location)
|
||||
// There is a bug in filter_var($var, FILTER_VALIDATE_URL) in PHP < 5.3.3 which causes
|
||||
// the function to validate URLs containing whitespaces and invalidate URLs containing
|
||||
// hyphens. (see https://bugs.php.net/bug.php?id=51192)
|
||||
|| version_compare(phpversion(), '5.3.3', '<')) {
|
||||
|
||||
// Load extension configuration
|
||||
$_extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['dlf']);
|
||||
|
|
|
@ -64,6 +64,6 @@ $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['proc
|
|||
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/common/class.tx_dlf_document.php']['hookClass'][] = 'EXT:'.$_EXTKEY.'/hooks/class.tx_dlf_hacks.php:tx_dlf_hacks';
|
||||
|
||||
// Register command line scripts.
|
||||
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['cliKeys'][$_EXTKEY] = array ('EXT:'.$_EXTKEY.'/cli/class.tx_dlf_cli.php', '_CLI_dlf');
|
||||
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['cliKeys'][$_EXTKEY] = array ('EXT:'.$_EXTKEY.'/cli/class.tx_dlf_cli.php', '_cli_dlf');
|
||||
|
||||
?>
|
|
@ -107,13 +107,17 @@ class tx_dlf_metadata extends tx_dlf_plugin {
|
|||
|
||||
$_id = array_pop($_ids);
|
||||
|
||||
foreach ($_id as $id) {
|
||||
if (is_array($_id)) {
|
||||
|
||||
$_data = $this->doc->getMetadata($id, $this->conf['pages']);
|
||||
foreach ($_id as $id) {
|
||||
|
||||
$_data['_id'] = $id;
|
||||
$_data = $this->doc->getMetadata($id, $this->conf['pages']);
|
||||
|
||||
$metadata[] = $_data;
|
||||
$_data['_id'] = $id;
|
||||
|
||||
$metadata[] = $_data;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
28
dlf/tca.php
28
dlf/tca.php
|
@ -227,20 +227,24 @@ $TCA['tx_dlf_documents'] = array (
|
|||
),
|
||||
),
|
||||
'partof' => array (
|
||||
'exclude' => 1,
|
||||
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.partof',
|
||||
'config' => array (
|
||||
'type' => 'select',
|
||||
'items' => array (
|
||||
array ('LLL:EXT:dlf/locallang.xml:tx_dlf_documents.partof.none', 0),
|
||||
),
|
||||
'foreign_table' => 'tx_dlf_documents',
|
||||
'foreign_table_where' => 'AND tx_dlf_documents.pid=###CURRENT_PID### ORDER BY tx_dlf_documents.title_sorting',
|
||||
'size' => 1,
|
||||
'minitems' => 1,
|
||||
'maxitems' => 1,
|
||||
'default' => 0,
|
||||
'type' => 'passthrough',
|
||||
),
|
||||
// This results in really long loading times because a list of all available documents is rendered.
|
||||
// 'exclude' => 1,
|
||||
// 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.partof',
|
||||
// 'config' => array (
|
||||
// 'type' => 'select',
|
||||
// 'items' => array (
|
||||
// array ('LLL:EXT:dlf/locallang.xml:tx_dlf_documents.partof.none', 0),
|
||||
// ),
|
||||
// 'foreign_table' => 'tx_dlf_documents',
|
||||
// 'foreign_table_where' => 'AND tx_dlf_documents.pid=###CURRENT_PID### ORDER BY tx_dlf_documents.title_sorting',
|
||||
// 'size' => 1,
|
||||
// 'minitems' => 1,
|
||||
// 'maxitems' => 1,
|
||||
// 'default' => 0,
|
||||
// ),
|
||||
),
|
||||
'volume' => array (
|
||||
'exclude' => 1,
|
||||
|
|
Loading…
Reference in New Issue