Browse Source

Unset default Solr core

tags/v1.2.0
Sebastian Meyer 10 years ago
parent
commit
48e1af02b7
  1. 11
      dlf/common/class.tx_dlf_document.php
  2. 4
      dlf/common/class.tx_dlf_helper.php
  3. 8
      dlf/common/class.tx_dlf_indexing.php
  4. 4
      dlf/common/class.tx_dlf_solr.php
  5. 3
      dlf/ext_tables.php
  6. 55
      dlf/hooks/class.tx_dlf_tceforms.php
  7. 16
      dlf/locallang.xml
  8. 4
      dlf/modules/indexing/index.php
  9. 2
      dlf/modules/indexing/locallang.xml
  10. 4
      dlf/plugins/collection/class.tx_dlf_collection.php
  11. 2
      dlf/plugins/oai/flexform.xml
  12. 16
      dlf/plugins/search/class.tx_dlf_search.php
  13. 9
      dlf/plugins/search/flexform.xml
  14. 4
      dlf/plugins/statistics/class.tx_dlf_statistics.php
  15. 2
      dlf/plugins/toc/class.tx_dlf_toc.php

11
dlf/common/class.tx_dlf_document.php

@ -1031,7 +1031,7 @@ class tx_dlf_document {
*
* @return boolean TRUE on success or FALSE on failure
*/
public function save($pid = 0, $core = 1) {
public function save($pid = 0, $core = 0) {
if (TYPO3_MODE !== 'BE') {
@ -1044,6 +1044,9 @@ class tx_dlf_document {
// Make sure $pid is a non-negative integer.
$pid = max(intval($pid), 0);
// Make sure $core is a non-negative integer.
$core = max(intval($core), 0);
// If $pid is not given, try to get it elsewhere.
if (!$pid && $this->pid) {
@ -1263,7 +1266,7 @@ class tx_dlf_document {
if ($superior->pid != $pid) {
$superior->save($pid);
$superior->save($pid, $core);
}
@ -1348,6 +1351,10 @@ class tx_dlf_document {
tx_dlf_indexing::add($this, $core);
} else {
trigger_error('Invalid UID for Solr core ('.$core.') given to index document', E_USER_NOTICE);
}
return TRUE;

4
dlf/common/class.tx_dlf_helper.php

@ -771,8 +771,8 @@ class tx_dlf_helper {
if (TYPO3_MODE === 'FE') {
// Tables "tx_dlf_solrcores" and "tx_dlf_formats" always have PID 0.
if (in_array($table, array ('tx_dlf_solrcores', 'tx_dlf_formats'))) {
// Table "tx_dlf_formats" always has PID 0.
if ($table == 'tx_dlf_formats') {
return t3lib_BEfunc::deleteClause($table);

8
dlf/common/class.tx_dlf_indexing.php

@ -134,7 +134,7 @@ class tx_dlf_indexing {
*
* @return integer 0 on success or 1 on failure
*/
public static function add(tx_dlf_document &$doc, $core = 1) {
public static function add(tx_dlf_document &$doc, $core = 0) {
if (in_array($doc->uid, self::$processedDocs)) {
@ -242,8 +242,8 @@ class tx_dlf_indexing {
$_message = t3lib_div::makeInstance(
't3lib_FlashMessage',
$GLOBALS['LANG']->getLL('flash.solrNoConnection', TRUE),
$GLOBALS['LANG']->getLL('flash.error', TRUE),
t3lib_FlashMessage::ERROR,
$GLOBALS['LANG']->getLL('flash.warning', TRUE),
t3lib_FlashMessage::WARNING,
TRUE
);
@ -251,7 +251,7 @@ class tx_dlf_indexing {
}
trigger_error('Could not connect to Apache Solr server', E_USER_ERROR);
trigger_error('Could not connect to Apache Solr server', E_USER_WARNING);
return 1;

4
dlf/common/class.tx_dlf_solr.php

@ -55,7 +55,7 @@ class tx_dlf_solr {
*
* @return mixed Instance of Apache_Solr_Service or NULL on failure
*/
public static function solrConnect($core = 1) {
public static function solrConnect($core = 0) {
// Load class.
if (!class_exists('Apache_Solr_Service')) {
@ -97,7 +97,7 @@ class tx_dlf_solr {
} else {
trigger_error('Could not find Solr core with UID '.$core, E_USER_ERROR);
trigger_error('Could not find Solr core with UID '.$core, E_USER_NOTICE);
return;

3
dlf/ext_tables.php

@ -129,7 +129,8 @@ $TCA['tx_dlf_solrcores'] = array (
'delete' => 'deleted',
'dynamicConfigFile' => t3lib_extMgm::extPath($_EXTKEY).'tca.php',
'iconfile' => t3lib_extMgm::extRelPath($_EXTKEY).'res/icon_txdlfsolrcores.png',
'rootLevel' => 1,
'rootLevel' => 0,
'adminOnly' => 1,
'dividers2tabs' => 2,
),
'feInterface' => array (

55
dlf/hooks/class.tx_dlf_tceforms.php

@ -148,6 +148,61 @@ class tx_dlf_tceforms {
}
/**
* Helper to get flexform's items array for plugin "tx_dlf_search"
*
* @access public
*
* @param array &$params: An array with parameters
* @param t3lib_TCEforms &$pObj: The parent object
*
* @return void
*/
public function itemsProcFunc_solrList(&$params, &$pObj) {
if ($params['row']['pi_flexform']) {
$pi_flexform = t3lib_div::xml2array($params['row']['pi_flexform']);
$pages = $pi_flexform['data']['sDEF']['lDEF']['pages']['vDEF'];
// There is a strange behavior where the uid from the flexform is prepended by the table's name and appended by its title.
// i.e. instead of "18" it reads "pages_18|Title"
if (!t3lib_div::testInt($pages)) {
$_parts = explode('|', $pages);
$pages = array_pop(explode('_', $_parts[0]));
}
if ($pages > 0) {
$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'label,uid',
'tx_dlf_solrcores',
'pid IN ('.intval($pages).',0)'.tx_dlf_helper::whereClause('tx_dlf_solrcores'),
'',
'label',
''
);
if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) {
while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_row($result)) {
$params['items'][] = $resArray;
}
}
}
}
}
/**
* Helper to get flexform's items array for plugin "tx_dlf_toolbox"
*
* @access public

16
dlf/locallang.xml

@ -138,7 +138,7 @@
<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="cliUserGroup.usrRealName">Goobi.Presentation command line indexer</label>
<label index="cliUserGroup.usrOkay">User "_cli_dlf" configured and enabled!</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>
<label index="cliUserGroup.usrConfigured">User "_cli_dlf" configured successfully!</label>
<label index="cliUserGroup.usrConfiguredMsg">The backend user for the command line indexer was configured properly.</label>
@ -146,10 +146,10 @@
<label index="cliUserGroup.usrNotConfiguredMsg">The backend user for the command line indexer exists, but is not configured properly.</label>
<label index="cliUserGroup.usrCreated">User "_cli_dlf" created successfully!</label>
<label index="cliUserGroup.usrCreatedMsg">The backend user for the command line indexer was created and configured properly.</label>
<label index="cliUserGroup.usrNotCreated">User "_cli_dlf" not created!</label>
<label index="cliUserGroup.usrNotCreated">User "_cli_dlf" not found!</label>
<label index="cliUserGroup.usrNotCreatedMsg">The backend user for the command line indexer does not exist.</label>
<label index="cliUserGroup.grpDescription">Usergroup for the Goobi.Presentation command line indexer.</label>
<label index="cliUserGroup.grpOkay">Usergroup "_cli_dlf" configured and enabled!</label>
<label index="cliUserGroup.grpOkay">Usergroup "_cli_dlf" found!</label>
<label index="cliUserGroup.grpOkayMsg">The backend usergroup for the command line indexer exists and is configured properly.</label>
<label index="cliUserGroup.grpConfigured">Usergroup "_cli_dlf" configured successfully!</label>
<label index="cliUserGroup.grpConfiguredMsg">The backend usergroup for the command line indexer was configured properly.</label>
@ -157,7 +157,7 @@
<label index="cliUserGroup.grpNotConfiguredMsg">The backend usergroup for the command line indexer exists, but is not configured properly.</label>
<label index="cliUserGroup.grpCreated">Usergroup "_cli_dlf" created successfully!</label>
<label index="cliUserGroup.grpCreatedMsg">The backend usergroup for the command line indexer was created and configured properly.</label>
<label index="cliUserGroup.grpNotCreated">Usergroup "_cli_dlf" not created!</label>
<label index="cliUserGroup.grpNotCreated">Usergroup "_cli_dlf" not found!</label>
<label index="cliUserGroup.grpNotCreatedMsg">The backend usergroup for the command line indexer does not exist.</label>
<label index="cliUserGroup.cliOkay">Command Line Interface available!</label>
<label index="cliUserGroup.cliOkayMsg">The TYPO3 command line interface is available for the indexer to use.</label>
@ -297,7 +297,7 @@
<label index="solr.notConnected">Verbindung fehlgeschlagen!</label>
<label index="solr.error">Apache Solr ist unter &lt;strong&gt;%s&lt;/strong&gt; nicht erreichbar.</label>
<label index="cliUserGroup.usrRealName">Goobi.Presentation Kommandozeilen-Indexierungsdienst</label>
<label index="cliUserGroup.usrOkay">Nutzer "_cli_dlf" eingerichtet!</label>
<label index="cliUserGroup.usrOkay">Nutzer "_cli_dlf" gefunden!</label>
<label index="cliUserGroup.usrOkayMsg">Der Nutzer für den Kommandozeilen-Indexierungsdienst ist korrekt konfiguriert und aktiviert.</label>
<label index="cliUserGroup.usrConfigured">Nutzer "_cli_dlf" erfolgreich konfiguriert!</label>
<label index="cliUserGroup.usrConfiguredMsg">Der Nutzer für den Kommandozeilen-Indexierungsdienst wurde erfolgreich konfiguriert.</label>
@ -305,10 +305,10 @@
<label index="cliUserGroup.usrNotConfiguredMsg">Der Nutzer für den Kommandozeilen-Indexierungsdienst existiert, ist aber nicht korrekt konfiguriert.</label>
<label index="cliUserGroup.usrCreated">Nutzer "_cli_dlf" erfolgreich angelegt!</label>
<label index="cliUserGroup.usrCreatedMsg">Der Nutzer für den Kommandozeilen-Indexierungsdienst wurde erfolgreich angelegt und konfiguriert.</label>
<label index="cliUserGroup.usrNotCreated">Nutzer "_cli_dlf" nicht angelegt!</label>
<label index="cliUserGroup.usrNotCreated">Nutzer "_cli_dlf" nicht gefunden!</label>
<label index="cliUserGroup.usrNotCreatedMsg">Der Nutzer für den Kommandozeilen-Indexierungsdienst existiert nicht.</label>
<label index="cliUserGroup.grpDescription">Nutzergruppe für den Goobi.Presentation Kommandozeilen-Indexierungsdienst.</label>
<label index="cliUserGroup.grpOkay">Nutzergruppe "_cli_dlf" eingerichtet!</label>
<label index="cliUserGroup.grpOkay">Nutzergruppe "_cli_dlf" gefunden!</label>
<label index="cliUserGroup.grpOkayMsg">Die Nutzergruppe für den Kommandozeilen-Indexierungsdienst ist korrekt konfiguriert und aktiviert.</label>
<label index="cliUserGroup.grpConfigured">Nutzergruppe "_cli_dlf" erfolgreich konfiguriert!</label>
<label index="cliUserGroup.grpConfiguredMsg">Die Nutzergruppe für den Kommandozeilen-Indexierungsdienst wurde erfolgreich konfiguriert.</label>
@ -316,7 +316,7 @@
<label index="cliUserGroup.grpNotConfiguredMsg">Die Nutzergruppe für den Kommandozeilen-Indexierungsdienst existiert, ist aber nicht korrekt konfiguriert.</label>
<label index="cliUserGroup.grpCreated">Nutzergruppe "_cli_dlf" erfolgreich angelegt!</label>
<label index="cliUserGroup.grpCreatedMsg">Die Nutzergruppe für den Kommandozeilen-Indexierungsdienst wurde erfolgreich angelegt und konfiguriert.</label>
<label index="cliUserGroup.grpNotCreated">Nutzergruppe "_cli_dlf" nicht angelegt!</label>
<label index="cliUserGroup.grpNotCreated">Nutzergruppe "_cli_dlf" nicht gefunden!</label>
<label index="cliUserGroup.grpNotCreatedMsg">Die Nutzergruppe für den Kommandozeilen-Indexierungsdienst existiert nicht.</label>
<label index="cliUserGroup.cliOkay">Kommandozeilen-Schnittstelle verfügbar!</label>
<label index="cliUserGroup.cliOkayMsg">Die TYPO3-Kommandozeilenschnittstelle steht für den Indexierungsdienst zur Verfügung.</label>

4
dlf/modules/indexing/index.php

@ -70,7 +70,7 @@ class tx_dlf_modIndexing extends tx_dlf_module {
$_cores = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'tx_dlf_solrcores.label AS label,tx_dlf_solrcores.uid AS uid',
'tx_dlf_solrcores',
'tx_dlf_solrcores.pid=0'.tx_dlf_helper::whereClause('tx_dlf_solrcores'),
'1=1'.tx_dlf_helper::whereClause('tx_dlf_solrcores'),
'',
'',
''
@ -134,7 +134,7 @@ class tx_dlf_modIndexing extends tx_dlf_module {
$_cores = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'tx_dlf_solrcores.label AS label,tx_dlf_solrcores.uid AS uid',
'tx_dlf_solrcores',
'tx_dlf_solrcores.pid=0'.tx_dlf_helper::whereClause('tx_dlf_solrcores'),
'1=1'.tx_dlf_helper::whereClause('tx_dlf_solrcores'),
'',
'',
''

2
dlf/modules/indexing/locallang.xml

@ -13,6 +13,7 @@
<label index="form.submit">Start indexing</label>
<label index="flash.attention">Attention!</label>
<label index="flash.done">Done!</label>
<label index="flash.warning">Warning!</label>
<label index="flash.error">Error!</label>
<label index="flash.running">Please wait...</label>
<label index="flash.newCollection">New collection "%s" [%u] added to database.</label>
@ -33,6 +34,7 @@
<label index="form.submit">Indexierung starten</label>
<label index="flash.attention">Achtung!</label>
<label index="flash.done">Fertig!</label>
<label index="flash.warning">Warnung!</label>
<label index="flash.error">Fehler!</label>
<label index="flash.running">Indexierung läuft...</label>
<label index="flash.newCollection">Neue Sammlung "%s" [%u] zur Datenbank hinzugefügt.</label>

4
dlf/plugins/collection/class.tx_dlf_collection.php

@ -54,7 +54,9 @@ class tx_dlf_collection extends tx_dlf_plugin {
$this->init($conf);
// Quit without doing anything if required configuration variables are not set.
if (!$this->conf['pages']) {
if (empty($this->conf['pages'])) {
trigger_error('Incomplete configuration for plugin '.get_class($this), E_USER_NOTICE);
return $content;

2
dlf/plugins/oai/flexform.xml

@ -13,9 +13,9 @@
<el>
<pages>
<TCEforms>
<onChange>reload</onChange>
<exclude>1</exclude>
<label>LLL:EXT:lang/locallang_general.xml:LGL.startingpoint</label>
<onChange>reload</onChange>
<config>
<type>group</type>
<internal_type>db</internal_type>

16
dlf/plugins/search/class.tx_dlf_search.php

@ -56,6 +56,15 @@ class tx_dlf_search extends tx_dlf_plugin {
// Disable caching for this plugin.
$this->setCache(FALSE);
// Quit without doing anything if required variables are not set.
if (empty($this->conf['solrcore'])) {
trigger_error('Incomplete configuration for plugin '.get_class($this), E_USER_NOTICE);
return $content;
}
if (empty($this->piVars['query'])) {
// Load template file.
@ -83,12 +92,9 @@ class tx_dlf_search extends tx_dlf_plugin {
return $this->pi_wrapInBaseClass($content);
} else {
// Get Solr instance...
$solr = tx_dlf_solr::solrConnect($this->conf['solrcore']);
} elseif (($solr = tx_dlf_solr::solrConnect($this->conf['solrcore'])) !== NULL) {
// ...and perform search.
// Perform search.
$query = $solr->search($this->piVars['query'], 0, $this->conf['limit'], array ());
$numHits = count($query->response->docs);

9
dlf/plugins/search/flexform.xml

@ -15,6 +15,7 @@
<TCEforms>
<exclude>1</exclude>
<label>LLL:EXT:lang/locallang_general.xml:LGL.startingpoint</label>
<onChange>reload</onChange>
<config>
<type>group</type>
<internal_type>db</internal_type>
@ -28,15 +29,15 @@
<solrcore>
<TCEforms>
<exclude>1</exclude>
<displayCond>FIELD:pages:REQ:true</displayCond>
<label>LLL:EXT:dlf/plugins/search/locallang.xml:tt_content.pi_flexform.solrcore</label>
<config>
<type>select</type>
<foreign_table>tx_dlf_solrcores</foreign_table>
<foreign_table_where>AND tx_dlf_solrcores.pid=0 ORDER BY tx_dlf_solrcores.label</foreign_table_where>
<default>1</default>
<items type="array"></items>
<itemsProcFunc>tx_dlf_tceforms->itemsProcFunc_solrList</itemsProcFunc>
<size>1</size>
<maxitems>1</maxitems>
<minitems>1</minitems>
<minitems>0</minitems>
</config>
</TCEforms>
</solrcore>

4
dlf/plugins/statistics/class.tx_dlf_statistics.php

@ -54,7 +54,9 @@ class tx_dlf_statistics extends tx_dlf_plugin {
$this->init($conf);
// Quit without doing anything if required configuration variables are not set.
if (!$this->conf['pages']) {
if (empty($this->conf['pages'])) {
trigger_error('Incomplete configuration for plugin '.get_class($this), E_USER_NOTICE);
return $content;

2
dlf/plugins/toc/class.tx_dlf_toc.php

@ -163,7 +163,7 @@ class tx_dlf_toc extends tx_dlf_plugin {
// Check for typoscript configuration to prevent fatal error.
if (empty($this->conf['menuConf.'])) {
trigger_error('No typoscript configuration for table of contents available', E_USER_ERROR);
trigger_error('No typoscript configuration for table of contents available', E_USER_NOTICE);
return $content;

Loading…
Cancel
Save