[TYPO3-Solr] Getting rid of the domain record dependency in EXT:solr / XCLASS problem

Peter Kraume usenet at kraume.de
Tue Jul 16 22:29:29 CEST 2013


Hi all,

I'd like to get rid of the domain record dependency in EXT:solr because 
it hinders us in our development process. Each developer has his own 
file system & git repo but we all share one database to have the same 
UIDs. All configuration is outsourced to files except the domain record 
which is a little pain in the ass for us.

There are three references to sys_domain in EXT:solr:
\tx_solr_Site::getDomain
\tx_solr_scheduler_IndexQueueWorkerTask::initializeHttpHost
both use t3lib_BEfunc::firstDomainRecord($rootLine)

\tx_solr_report_SolrConfigurationStatus::getDomainRecordAvailableStatus
$domainRecords = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
	'uid, pid',
	'sys_domain',
	'pid IN(' . implode(',', $rootPageIds) . ') AND redirectTo=\'\' AND 
hidden=0',
	'pid',
	'pid, sorting',
	'',
	'pid'
);

The last reference is negligible since it's just a test for the reports 
module.

So my first attempt was to XCLASS t3lib_BEfunc::firstDomainRecord but 
this won't work due to the static call of firstDomainRecord.

Second try was to XCLASS initializeHttpHost(tx_solr_indexqueue_Item 
$item) in class.tx_solr_scheduler_indexqueueworkertask.php

But this didn't work out either. In ext_localconf.php I've put this code:
$GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/solr/scheduler/class.tx_solr_scheduler_indexqueueworkertask.php'] 
= t3lib_extMgm::extPath('my_solr') . 
'XCLASS/class.ux_tx_solr_scheduler_indexqueueworkertask.php';

class.ux_tx_solr_scheduler_indexqueueworkertask.php has for the moment 
only a static host instead of a domain record:

class ux_tx_solr_scheduler_IndexQueueWorkerTask extends 
tx_solr_scheduler_IndexQueueWorkerTask {
	protected function initializeHttpHost(tx_solr_indexqueue_Item $item) {
		static $hosts = array();

		// relevant for realURL environments, only
		if (t3lib_extMgm::isLoaded('realurl')) {
			$rootpageId = $item->getRootPageUid();
			$hostFound  = !empty($hosts[$rootpageId]);

			if (!$hostFound) {
				$rootline = t3lib_BEfunc::BEgetRootLine($rootpageId);
				//$host     = t3lib_BEfunc::firstDomainRecord($rootline);
				$host = 'pk.dev.foo.bar.com';
				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('initializeHttpHost', 
'xclass', 0);
				$hosts[$rootpageId] = $host;
			}

			$_SERVER['HTTP_HOST'] = $hosts[$rootpageId];
		}
	}
}


Any idea why this doesn't work? Any other ideas how to circumvent 
sys_domain? I'd prefer not to alter EXT:solr to keep update efforts as 
low as possible.

By the way, we use TYPO3 6.1.1 and latest EXT:solr from the git 
repository at Forge.

Cheers
Peter


More information about the TYPO3-project-solr mailing list