本文整理汇总了PHP中Tx_Solr_Util::getRootPageId方法的典型用法代码示例。如果您正苦于以下问题:PHP Tx_Solr_Util::getRootPageId方法的具体用法?PHP Tx_Solr_Util::getRootPageId怎么用?PHP Tx_Solr_Util::getRootPageId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tx_Solr_Util
的用法示例。
在下文中一共展示了Tx_Solr_Util::getRootPageId方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getSiteByPageId
/**
* Gets the Site for a specific page Id.
*
* @param integer $pageId The page Id to get a Site object for.
* @return Tx_Solr_Site Site for the given page Id.
*/
public static function getSiteByPageId($pageId)
{
$rootPageId = Tx_Solr_Util::getRootPageId($pageId);
if (!isset(self::$sitesCache[$rootPageId])) {
self::$sitesCache[$rootPageId] = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(__CLASS__, $rootPageId);
}
return self::$sitesCache[$rootPageId];
}
示例2: getSiteByPageId
/**
* Gets the Site for a specific page Id.
*
* @param integer $pageId The page Id to get a Site object for.
* @return Tx_Solr_Site Site for the given page Id.
*/
public static function getSiteByPageId($pageId)
{
$rootPageId = Tx_Solr_Util::getRootPageId($pageId);
if (!isset(self::$sitesCache[$rootPageId])) {
self::$sitesCache[$rootPageId] = t3lib_div::makeInstance(__CLASS__, $rootPageId);
}
return self::$sitesCache[$rootPageId];
}
示例3: addItem
/**
* Adds an item to the index queue.
*
* Not meant for public use.
*
* @param string $itemType The item's type, usually a table name.
* @param string $itemUid The item's uid, usually an integer uid, could be a
* different value for non-database-record types.
* @param string $indexingConfiguration The item's indexing configuration to use.
* Optional, overwrites existing / determined configuration.
* @return void
*/
private function addItem($itemType, $itemUid, $indexingConfiguration)
{
// FIXME must respect the indexer's additionalWhereClause option:
// must not add items to the index queue which are excluded through
// additionalWhereClause. Requires construction of additionalWhereClause
// through multiple options instead of just one
// FIXME temporary until we have a query builder to take care of this
$additionalRecordFields = '';
if ($itemType == 'pages') {
$additionalRecordFields = ', doktype, uid';
}
$record = t3lib_BEfunc::getRecord($itemType, $itemUid, 'pid' . $additionalRecordFields);
// FIXME temporary until we have a query builder to take care of this
if (empty($record) || $itemType == 'pages' && !Tx_Solr_Util::isAllowedPageType($record)) {
return;
}
if ($itemType == 'pages') {
$rootPageId = Tx_Solr_Util::getRootPageId($itemUid);
} else {
$rootPageId = Tx_Solr_Util::getRootPageId($record['pid']);
}
if (Tx_Solr_Util::isRootPage($rootPageId)) {
$item = array('root' => $rootPageId, 'item_type' => $itemType, 'item_uid' => $itemUid, 'changed' => $this->getItemChangedTime($itemType, $itemUid));
if (!empty($indexingConfiguration)) {
$indexingConfigurationList = array($indexingConfiguration);
} else {
$indexingConfigurationList = $this->getIndexingConfigurationsByItem($itemType, $itemUid, $rootPageId);
}
// make a backup of the current item
$baseItem = $item;
foreach ($indexingConfigurationList as $indexingConfigurationCurrent) {
$item = $baseItem;
$item['indexing_configuration'] = $indexingConfigurationCurrent;
$writeToIndex = TRUE;
// Ensure additionalWhereClause is applied.
$solrConfiguration = tx_solr_Util::getSolrConfigurationFromPageId($record['pid']);
if (!empty($solrConfiguration['index.']['queue.'][$item['indexing_configuration'] . '.']['additionalWhereClause'])) {
$record = t3lib_BEfunc::getRecord($itemType, $itemUid, 'pid' . $additionalRecordFields, ' AND ' . $solrConfiguration['index.']['queue.'][$item['indexing_configuration'] . '.']['additionalWhereClause']);
if (empty($record)) {
$writeToIndex = FALSE;
}
}
if ($writeToIndex) {
$GLOBALS['TYPO3_DB']->exec_INSERTquery('tx_solr_indexqueue_item', $item);
}
}
}
}
示例4: addItem
/**
* Adds an item to the index queue.
*
* Not meant for public use.
*
* @param string $itemType The item's type, usually a table name.
* @param string $itemUid The item's uid, usually an integer uid, could be a
* different value for non-database-record types.
* @param string $indexingConfiguration The item's indexing configuration to use.
* Optional, overwrites existing / determined configuration.
* @return void
*/
private function addItem($itemType, $itemUid, $indexingConfiguration)
{
$additionalRecordFields = '';
if ($itemType == 'pages') {
$additionalRecordFields = ', doktype, uid';
}
$record = BackendUtility::getRecord($itemType, $itemUid, 'pid' . $additionalRecordFields);
if (empty($record) || $itemType == 'pages' && !Tx_Solr_Util::isAllowedPageType($record)) {
return;
}
if ($itemType == 'pages') {
$rootPageId = Tx_Solr_Util::getRootPageId($itemUid);
} else {
$rootPageId = Tx_Solr_Util::getRootPageId($record['pid']);
}
if (Tx_Solr_Util::isRootPage($rootPageId)) {
$item = array('root' => $rootPageId, 'item_type' => $itemType, 'item_uid' => $itemUid, 'changed' => $this->getItemChangedTime($itemType, $itemUid));
if (!empty($indexingConfiguration)) {
$indexingConfigurationList = array($indexingConfiguration);
} else {
$indexingConfigurationList = $this->getIndexingConfigurationsByItem($itemType, $itemUid, $rootPageId);
}
$solrConfiguration = tx_solr_Util::getSolrConfigurationFromPageId($rootPageId);
// make a backup of the current item
$baseItem = $item;
foreach ($indexingConfigurationList as $indexingConfigurationCurrent) {
$item = $baseItem;
$item['indexing_configuration'] = $indexingConfigurationCurrent;
$addItemToQueue = TRUE;
// Ensure additionalWhereClause is applied.
if (!empty($solrConfiguration['index.']['queue.'][$item['indexing_configuration'] . '.']['additionalWhereClause'])) {
$indexingConfigurationCheckRecord = BackendUtility::getRecord($itemType, $itemUid, 'pid' . $additionalRecordFields, ' AND ' . $solrConfiguration['index.']['queue.'][$item['indexing_configuration'] . '.']['additionalWhereClause']);
if (empty($indexingConfigurationCheckRecord)) {
// item does not match the indexing configuration's additionalWhereClause
$addItemToQueue = FALSE;
}
}
if ($addItemToQueue) {
$GLOBALS['TYPO3_DB']->exec_INSERTquery('tx_solr_indexqueue_item', $item);
}
}
}
}