Created
January 28, 2021 16:21
-
-
Save froemken/c9f24243d406b1f873ba321b72addedf to your computer and use it in GitHub Desktop.
A really nasty solution to prevent call of TYPO3 Solr getAvailableSites performance issue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* While copying pagetree we have to prevent calling getAvailableSites of solr, as it | |
* initializes ALL 300 pagetrees and load its full TS. | |
*/ | |
protected function modifyRequestForSolrAndSolrfal() | |
{ | |
// While copying pagetree solr will monitor various records. But without known | |
// rootPageUid it will call getAllSites() which will build the TS for all sites. | |
// We set monitored tables to invalidTable, so NO table will be monitored. | |
$solrExtConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['solr']); | |
$solrExtConf['useConfigurationMonitorTables'] = 'invalidTable'; | |
$GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['solr'] = serialize($solrExtConf); | |
// While copying pagetree solrfal will check, if a record is used on another pagetree. | |
// To prevent that, we have to add all known tables temporary to siteExclusiveRecordTables | |
$connectionPool = GeneralUtility::makeInstance(ConnectionPool::class); | |
$connection = $connectionPool->getConnectionByName(ConnectionPool::DEFAULT_CONNECTION_NAME); | |
$tables = $connection->getSchemaManager()->listTableNames(); | |
$solrfalExtConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['solrfal']); | |
$solrfalExtConf['siteExclusiveRecordTables'] = implode(',', $tables); | |
$GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['solrfal'] = serialize($solrfalExtConf); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment