first commit
This commit is contained in:
@@ -40,8 +40,8 @@ class SiteHashService
|
||||
/**
|
||||
* Resolves magic keywords in allowed sites configuration.
|
||||
* Supported keywords:
|
||||
* __solr_current_site - The domain of the site the query has been started from
|
||||
* __current_site - Same as __solr_current_site
|
||||
* __meilisearch_current_site - The domain of the site the query has been started from
|
||||
* __current_site - Same as __meilisearch_current_site
|
||||
* __all - Adds all domains as allowed sites
|
||||
* * - Means all sites are allowed, same as no siteHash
|
||||
*
|
||||
@@ -56,8 +56,8 @@ class SiteHashService
|
||||
} elseif ($allowedSitesConfiguration === '*') {
|
||||
return '*';
|
||||
} else {
|
||||
// we thread empty allowed site configurations as __solr_current_site since this is the default behaviour
|
||||
$allowedSitesConfiguration = empty($allowedSitesConfiguration) ? '__solr_current_site' : $allowedSitesConfiguration;
|
||||
// we thread empty allowed site configurations as __meilisearch_current_site since this is the default behaviour
|
||||
$allowedSitesConfiguration = empty($allowedSitesConfiguration) ? '__meilisearch_current_site' : $allowedSitesConfiguration;
|
||||
return $this->getDomainByPageIdAndReplaceMarkers($pageId, $allowedSitesConfiguration);
|
||||
}
|
||||
}
|
||||
@@ -98,7 +98,7 @@ class SiteHashService
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the domain of the site that belongs to the passed pageId and replaces their markers __solr_current_site
|
||||
* Retrieves the domain of the site that belongs to the passed pageId and replaces their markers __meilisearch_current_site
|
||||
* and __current_site.
|
||||
*
|
||||
* @param integer $pageId
|
||||
@@ -108,7 +108,7 @@ class SiteHashService
|
||||
protected function getDomainByPageIdAndReplaceMarkers($pageId, $allowedSitesConfiguration)
|
||||
{
|
||||
$domainOfPage = $this->getSiteByPageId($pageId)->getDomain();
|
||||
$allowedSites = str_replace(['__solr_current_site', '__current_site'], $domainOfPage, $allowedSitesConfiguration);
|
||||
$allowedSites = str_replace(['__meilisearch_current_site', '__current_site'], $domainOfPage, $allowedSitesConfiguration);
|
||||
return (string)$allowedSites;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user