本文整理汇总了PHP中ApacheSolrForTypo3\Solr\Site::getRootPageId方法的典型用法代码示例。如果您正苦于以下问题:PHP Site::getRootPageId方法的具体用法?PHP Site::getRootPageId怎么用?PHP Site::getRootPageId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ApacheSolrForTypo3\Solr\Site
的用法示例。
在下文中一共展示了Site::getRootPageId方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAdditionalInformation
/**
* Returns some additional information about indexing progress, shown in
* the scheduler's task overview list.
*
* @return string Information to display
*/
public function getAdditionalInformation()
{
$message = 'Site: ' . $this->site->getLabel();
$failedItemsCount = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('uid', 'tx_solr_indexqueue_item', 'root = ' . $this->site->getRootPageId() . ' AND errors != \'\'');
if ($failedItemsCount) {
$message .= ' Failures: ' . $failedItemsCount;
}
return $message;
}
示例2: buildSelectStatement
/**
* Builds the SELECT part of the Index Queue initialization query.
*
*/
protected function buildSelectStatement()
{
$changedField = $GLOBALS['TCA'][$this->type]['ctrl']['tstamp'];
if (!empty($GLOBALS['TCA'][$this->type]['ctrl']['enablecolumns']['starttime'])) {
$changedField = 'GREATEST(' . $GLOBALS['TCA'][$this->type]['ctrl']['enablecolumns']['starttime'] . ',' . $GLOBALS['TCA'][$this->type]['ctrl']['tstamp'] . ')';
}
$select = 'SELECT ' . '\'' . $this->site->getRootPageId() . '\' as root, ' . '\'' . $this->type . '\' AS item_type, ' . 'uid AS item_uid, ' . '\'' . $this->indexingConfigurationName . '\' as indexing_configuration, ' . $this->getIndexingPriority() . ' AS indexing_priority, ' . $changedField . ' AS changed';
return $select;
}
示例3: resolveSite
/**
* @return void
*/
protected function resolveSite()
{
$this->site = $this->moduleData->getSite();
if (!$this->site instanceof Site) {
$this->initializeSiteFromFirstAvailableAndStoreInModuleData();
}
$rootPageId = $this->site instanceof Site ? $this->site->getRootPageId() : 0;
if ($rootPageId > 0 && !Util::pageExists($rootPageId)) {
$this->initializeSiteFromFirstAvailableAndStoreInModuleData();
}
}
示例4: getProgress
/**
* Gets the indexing progress.
*
* @return float Indexing progress as a two decimal precision float. f.e. 44.87
*/
public function getProgress()
{
$itemsIndexedPercentage = 0.0;
$totalItemsCount = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('uid', 'tx_solr_indexqueue_item', 'root = ' . $this->site->getRootPageId());
$remainingItemsCount = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('uid', 'tx_solr_indexqueue_item', 'changed > indexed AND root = ' . $this->site->getRootPageId());
$itemsIndexedCount = $totalItemsCount - $remainingItemsCount;
if ($totalItemsCount > 0) {
$itemsIndexedPercentage = $itemsIndexedCount * 100 / $totalItemsCount;
$itemsIndexedPercentage = round($itemsIndexedPercentage, 2);
}
return $itemsIndexedPercentage;
}
示例5: getIndexQueueConfigurationTableMap
/**
* Builds a map of indexing configuration names to tables to to index.
*
* @return array Indexing configuration to database table map
*/
protected function getIndexQueueConfigurationTableMap()
{
$indexingTableMap = array();
$solrConfiguration = Util::getSolrConfigurationFromPageId($this->site->getRootPageId());
foreach ($solrConfiguration['index.']['queue.'] as $name => $configuration) {
if (is_array($configuration)) {
$name = substr($name, 0, -1);
if ($solrConfiguration['index.']['queue.'][$name]) {
$table = $name;
if ($solrConfiguration['index.']['queue.'][$name . '.']['table']) {
$table = $solrConfiguration['index.']['queue.'][$name . '.']['table'];
}
$indexingTableMap[$name] = $table;
}
}
}
return $indexingTableMap;
}
示例6: initializeAction
/**
* Initializes the controller before invoking an action method.
*
* @return void
*/
protected function initializeAction()
{
$this->site = $this->moduleData->getSite();
if (!$this->site instanceof Site) {
$this->initializeSiteFromFirstAvailableAndStoreInModuleData();
}
$rootPageId = $this->site->getRootPageId();
if ($rootPageId > 0 && !Util::pageExists($rootPageId)) {
$this->initializeSiteFromFirstAvailableAndStoreInModuleData();
}
try {
$moduleName = $this->request->getArgument('module');
if ($this->moduleManager->isRegisteredModule($moduleName)) {
$this->activeModuleName = $moduleName;
$this->activeModule = $this->moduleManager->getModule($moduleName);
}
} catch (NoSuchArgumentException $e) {
$this->activeModule = $this->moduleManager->getModule($this->activeModuleName);
}
$this->moduleManager->sortModules();
$this->modules = $this->moduleManager->getModules();
}
示例7: getConfigurationsBySite
/**
* Gets all connection configurations for a given site.
*
* @param Site $site A TYPO3 site
* @return array An array of Solr connection configurations for a site
*/
public function getConfigurationsBySite(Site $site)
{
$solrConfigurations = array();
$allConfigurations = $this->getAllConfigurations();
foreach ($allConfigurations as $configuration) {
if ($configuration['rootPageUid'] == $site->getRootPageId()) {
$solrConfigurations[] = $configuration;
}
}
return $solrConfigurations;
}
示例8: getItemsToIndex
/**
* Gets $limit number of items to index for a particular $site.
*
* @param Site $site TYPO3 site
* @param integer $limit Number of items to get from the queue
* @return Item[] Items to index to the given solr server
*/
public function getItemsToIndex(Site $site, $limit = 50)
{
$itemsToIndex = array();
// determine which items to index with this run
$indexQueueItemRecords = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*', 'tx_solr_indexqueue_item', 'root = ' . $site->getRootPageId() . ' AND changed > indexed' . ' AND changed <= ' . time() . ' AND errors = \'\'', '', 'indexing_priority DESC, changed DESC, uid DESC', intval($limit));
if (!empty($indexQueueItemRecords)) {
// convert queued records to index queue item objects
$itemsToIndex = $this->getIndexQueueItemObjectsFromRecords($indexQueueItemRecords);
}
return $itemsToIndex;
}
示例9: getAvailableSitesSelector
/**
* Creates a dropdown selector of available TYPO3 sites with Solr
* configured.
*
* @param string $selectorName Name to be used in the select's name attribute
* @param Site $selectedSite Optional, currently selected site
* @return string Site selector HTML code
* @todo Extract into own class like indexing configuration selector
*/
public static function getAvailableSitesSelector($selectorName, Site $selectedSite = null)
{
$sites = self::getAvailableSites();
$selector = '<select name="' . $selectorName . '">';
foreach ($sites as $site) {
$selectedAttribute = '';
if ($selectedSite !== null && $site->getRootPageId() == $selectedSite->getRootPageId()) {
$selectedAttribute = ' selected="selected"';
}
$selector .= '<option value="' . $site->getRootPageId() . '"' . $selectedAttribute . '>' . $site->getLabel() . '</option>';
}
$selector .= '</select>';
return $selector;
}