本文整理汇总了PHP中ApacheSolrForTypo3\Solr\Site::getFirstAvailableSite方法的典型用法代码示例。如果您正苦于以下问题:PHP Site::getFirstAvailableSite方法的具体用法?PHP Site::getFirstAvailableSite怎么用?PHP Site::getFirstAvailableSite使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ApacheSolrForTypo3\Solr\Site
的用法示例。
在下文中一共展示了Site::getFirstAvailableSite方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initializePageIndexQueue
/**
* Initialize page index queue
*
* @return void
*/
protected function initializePageIndexQueue()
{
$this->pageInitializer->setIndexingConfigurationName('pages');
$this->pageInitializer->setSite(Site::getFirstAvailableSite());
$this->pageInitializer->setType('pages');
$this->pageInitializer->initialize();
}
示例2: preFilledQueueContainsRootPageAfterInitialize
/**
* @test
*/
public function preFilledQueueContainsRootPageAfterInitialize()
{
$this->importDataSetFromFixture('can_clear_queue_after_initialize.xml');
$itemCount = $this->indexQueue->getAllItemsCount();
$this->assertItemsInQueue(1);
$this->assertFalse($this->indexQueue->containsItem('pages', 1));
$this->assertTrue($this->indexQueue->containsItem('pages', 4711));
// after initialize the prefilled queue item should be lost and the root page should be added again
$site = Site::getFirstAvailableSite();
$this->indexQueue->initialize($site, 'pages');
$this->assertItemsInQueue(1);
$this->assertTrue($this->indexQueue->containsItem('pages', 1));
$this->assertFalse($this->indexQueue->containsItem('pages', 4711));
}
示例3: initializeSiteFromFirstAvailableAndStoreInModuleData
/**
* Resets the stored site to the first available site.
*
* @return void‚
*/
protected function initializeSiteFromFirstAvailableAndStoreInModuleData()
{
$site = Site::getFirstAvailableSite();
$this->setSiteAndResetCore($site);
$this->site = $site;
}
示例4: solrIsEmptyAfterCleanup
/**
* @test
*/
public function solrIsEmptyAfterCleanup()
{
$this->importDataSetFromFixture('can_reindex_task_fill_queue.xml');
// fill the solr
$site = Site::getFirstAvailableSite();
$this->indexQueue->updateItem('pages', 1);
$items = $this->indexQueue->getItems('pages', 1);
/** @var $indexer \ApacheSolrForTypo3\Solr\IndexQueue\Indexer */
$indexer = GeneralUtility::makeInstance('ApacheSolrForTypo3\\Solr\\IndexQueue\\Indexer');
$indexer->index($items[0]);
sleep(2);
$this->assertSolrContainsDocumentCount(1);
$this->task->setSite($site);
$this->task->setIndexingConfigurationsToReIndex(array('pages'));
$this->task->execute();
sleep(2);
// after the task was running the solr server should be empty
$this->assertSolrIsEmpty();
// if not we cleanup now
$this->cleanUpSolrServerAndAssertEmpty();
}
示例5: canGetAdditionalInformationFromTask
/**
* @test
*/
public function canGetAdditionalInformationFromTask()
{
$this->importDataSetFromFixture('can_trigger_frontend_calls_for_page_index.xml');
$site = Site::getFirstAvailableSite();
/** @var $indexQueueQueueWorkerTask \ApacheSolrForTypo3\Solr\Task\IndexQueueWorkerTask */
$indexQueueQueueWorkerTask = GeneralUtility::makeInstance('ApacheSolrForTypo3\\Solr\\Task\\IndexQueueWorkerTask');
$indexQueueQueueWorkerTask->setDocumentsToIndexLimit(1);
$indexQueueQueueWorkerTask->setSite($site);
$additionalInformation = $indexQueueQueueWorkerTask->getAdditionalInformation();
$this->assertContains('Root Page ID: 1', $additionalInformation);
$this->assertContains('Site: page for testing', $additionalInformation);
}
示例6: canResolveAbsRefPrefix
/**
*
* @dataProvider canResolveAbsRefPrefixDataProvider
* @param string $absRefPrefix
* @param string $expectedUrl
* @test
*/
public function canResolveAbsRefPrefix($absRefPrefix, $expectedUrl)
{
$this->cleanUpSolrServerAndAssertEmpty();
// create fake extension database table and TCA
$this->importDumpFromFixture('fake_extension2_table.sql');
$GLOBALS['TCA']['tx_fakeextension_domain_model_bar'] = (include $this->getFixturePath('fake_extension2_bar_tca.php'));
$GLOBALS['TCA']['tx_fakeextension_domain_model_directrelated'] = (include $this->getFixturePath('fake_extension2_directrelated_tca.php'));
$this->importDataSetFromFixture('can_index_custom_record_absRefPrefix_' . $absRefPrefix . '.xml');
$this->addToIndexQueue('tx_fakeextension_domain_model_bar', 111);
/** @var $cliEnvironment CliEnvironment */
$cliEnvironment = GeneralUtility::makeInstance(CliEnvironment::class);
$cliEnvironment->backup();
$cliEnvironment->initialize(PATH_site);
/** @var $indexService IndexService */
$site = Site::getFirstAvailableSite();
$indexService = GeneralUtility::makeInstance(IndexService::class, $site);
// run the indexer
$indexService->indexItems(1);
$cliEnvironment->restore();
// do we have the record in the index with the value from the mm relation?
sleep(2);
$solrContent = file_get_contents('http://localhost:8080/solr/core_en/select?q=*:*');
$this->assertContains('"numFound":1', $solrContent, 'Could not index document into solr');
$this->assertContains('"url":"' . $expectedUrl . '"', $solrContent, 'Generated unexpected url with absRefPrefix = auto');
$this->assertNotContains('auto', $solrContent, 'absRefPrefix=auto was not resolved');
$this->cleanUpSolrServerAndAssertEmpty();
}
示例7: canGetDefaultLanguage
/**
* @test
*/
public function canGetDefaultLanguage()
{
$this->importDataSetFromFixture('can_get_default_language.xml');
$site = Site::getFirstAvailableSite();
$this->assertEquals(888, $site->getDefaultLanguage(), 'Could not get default language from site');
}
示例8: canTriggerFrontendIndexingAndMarkQueueEntryAsProcessed
/**
* @test
*/
public function canTriggerFrontendIndexingAndMarkQueueEntryAsProcessed()
{
$this->importDataSetFromFixture('can_trigger_frontend_calls_for_page_index.xml');
// we expect that the index queue is empty before we start
$this->assertFalse($this->indexQueue->containsIndexedItem('pages', 1));
/** @var $beUser \TYPO3\CMS\Core\Authentication\BackendUserAuthentication */
$beUser = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Authentication\\BackendUserAuthentication');
$GLOBALS['BE_USER'] = $beUser;
/** @var $languageService \TYPO3\CMS\Lang\LanguageService */
$languageService = GeneralUtility::makeInstance('TYPO3\\CMS\\Lang\\LanguageService');
$GLOBALS['LANG'] = $languageService;
$charsetConverter = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Charset\\CharsetConverter');
$GLOBALS['LANG']->csConvObj = $charsetConverter;
$site = Site::getFirstAvailableSite();
/** @var $indexQueueQueueWorkerTask \ApacheSolrForTypo3\Solr\Task\IndexQueueWorkerTask */
$indexQueueQueueWorkerTask = GeneralUtility::makeInstance('ApacheSolrForTypo3\\Solr\\Task\\IndexQueueWorkerTask');
$indexQueueQueueWorkerTask->setDocumentsToIndexLimit(1);
$indexQueueQueueWorkerTask->setSite($site);
$indexQueueQueueWorkerTask->execute();
// we expect that the index queue is empty before we start
$this->assertTrue($this->indexQueue->containsIndexedItem('pages', 1));
}