mirror of
https://github.com/nextcloud/server.git
synced 2026-06-08 16:26:59 -04:00
fix: Remove use of static vars in dav application
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
This commit is contained in:
parent
6b49aa792b
commit
b256928385
5 changed files with 25 additions and 25 deletions
|
|
@ -190,7 +190,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
];
|
||||
|
||||
/** @var array parameters to index */
|
||||
public static array $indexParameters = [
|
||||
private const INDEXED_PARAMETERS = [
|
||||
'ATTENDEE' => ['CN'],
|
||||
'ORGANIZER' => ['CN'],
|
||||
];
|
||||
|
|
@ -3386,9 +3386,9 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
$query->executeStatement();
|
||||
}
|
||||
|
||||
if (array_key_exists($property->name, self::$indexParameters)) {
|
||||
if (array_key_exists($property->name, self::INDEXED_PARAMETERS)) {
|
||||
$parameters = $property->parameters();
|
||||
$indexedParametersForProperty = self::$indexParameters[$property->name];
|
||||
$indexedParametersForProperty = self::INDEXED_PARAMETERS[$property->name];
|
||||
|
||||
foreach ($parameters as $key => $value) {
|
||||
if (in_array($key, $indexedParametersForProperty)) {
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ class CardDavBackend implements BackendInterface, SyncSupport {
|
|||
private string $dbCardsPropertiesTable = 'cards_properties';
|
||||
|
||||
/** @var array properties to index */
|
||||
public static array $indexProperties = [
|
||||
private const INDEXED_PROPERTIES = [
|
||||
'BDAY', 'UID', 'N', 'FN', 'TITLE', 'ROLE', 'NOTE', 'NICKNAME',
|
||||
'ORG', 'CATEGORIES', 'EMAIL', 'TEL', 'IMPP', 'ADR', 'URL', 'GEO',
|
||||
'CLOUD', 'X-SOCIALPROFILE'];
|
||||
|
|
@ -1384,7 +1384,7 @@ class CardDavBackend implements BackendInterface, SyncSupport {
|
|||
);
|
||||
|
||||
foreach ($vCard->children() as $property) {
|
||||
if (!in_array($property->name, self::$indexProperties)) {
|
||||
if (!in_array($property->name, self::INDEXED_PROPERTIES)) {
|
||||
continue;
|
||||
}
|
||||
$preferred = 0;
|
||||
|
|
|
|||
|
|
@ -23,14 +23,14 @@ use Sabre\VObject\Component\VCard;
|
|||
use Sabre\VObject\Reader;
|
||||
|
||||
class ContactsSearchProvider implements IFilteringProvider {
|
||||
private static array $searchPropertiesRestricted = [
|
||||
private const SEARCH_PROPERTIES_RESTRICTED = [
|
||||
'N',
|
||||
'FN',
|
||||
'NICKNAME',
|
||||
'EMAIL',
|
||||
];
|
||||
|
||||
private static array $searchProperties = [
|
||||
private const SEARCH_PROPERTIES = [
|
||||
'N',
|
||||
'FN',
|
||||
'NICKNAME',
|
||||
|
|
@ -87,7 +87,7 @@ class ContactsSearchProvider implements IFilteringProvider {
|
|||
$searchResults = $this->backend->searchPrincipalUri(
|
||||
$principalUri,
|
||||
$query->getFilter('term')?->get() ?? '',
|
||||
$query->getFilter('title-only')?->get() ? self::$searchPropertiesRestricted : self::$searchProperties,
|
||||
$query->getFilter('title-only')?->get() ? self::SEARCH_PROPERTIES_RESTRICTED : self::SEARCH_PROPERTIES,
|
||||
[
|
||||
'limit' => $query->getLimit(),
|
||||
'offset' => $query->getCursor(),
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ class EventsSearchProvider extends ACalendarSearchProvider implements IFiltering
|
|||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
private static $searchProperties = [
|
||||
private const SEARCH_PROPERTIES = [
|
||||
'SUMMARY',
|
||||
'LOCATION',
|
||||
'DESCRIPTION',
|
||||
|
|
@ -42,9 +42,9 @@ class EventsSearchProvider extends ACalendarSearchProvider implements IFiltering
|
|||
];
|
||||
|
||||
/**
|
||||
* @var string[]
|
||||
* @var array<string, string[]>
|
||||
*/
|
||||
private static $searchParameters = [
|
||||
private const SEARCH_PARAMETERS = [
|
||||
'ATTENDEE' => ['CN'],
|
||||
'ORGANIZER' => ['CN'],
|
||||
];
|
||||
|
|
@ -52,7 +52,7 @@ class EventsSearchProvider extends ACalendarSearchProvider implements IFiltering
|
|||
/**
|
||||
* @var string
|
||||
*/
|
||||
private static $componentType = 'VEVENT';
|
||||
private const COMPONENT_TYPE = 'VEVENT';
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
|
|
@ -102,9 +102,9 @@ class EventsSearchProvider extends ACalendarSearchProvider implements IFiltering
|
|||
$searchResults = $this->backend->searchPrincipalUri(
|
||||
$principalUri,
|
||||
$term,
|
||||
[self::$componentType],
|
||||
self::$searchProperties,
|
||||
self::$searchParameters,
|
||||
[self::COMPONENT_TYPE],
|
||||
self::SEARCH_PROPERTIES,
|
||||
self::SEARCH_PARAMETERS,
|
||||
[
|
||||
'limit' => $query->getLimit(),
|
||||
'offset' => $query->getCursor(),
|
||||
|
|
@ -122,9 +122,9 @@ class EventsSearchProvider extends ACalendarSearchProvider implements IFiltering
|
|||
$attendeeSearchResults = $this->backend->searchPrincipalUri(
|
||||
$principalUri,
|
||||
$personDisplayName,
|
||||
[self::$componentType],
|
||||
[self::COMPONENT_TYPE],
|
||||
['ATTENDEE'],
|
||||
self::$searchParameters,
|
||||
self::SEARCH_PARAMETERS,
|
||||
[
|
||||
'limit' => $query->getLimit(),
|
||||
'offset' => $query->getCursor(),
|
||||
|
|
@ -148,7 +148,7 @@ class EventsSearchProvider extends ACalendarSearchProvider implements IFiltering
|
|||
}
|
||||
}
|
||||
$formattedResults = \array_map(function (array $eventRow) use ($calendarsById, $subscriptionsById): SearchResultEntry {
|
||||
$component = $this->getPrimaryComponent($eventRow['calendardata'], self::$componentType);
|
||||
$component = $this->getPrimaryComponent($eventRow['calendardata'], self::COMPONENT_TYPE);
|
||||
$title = (string)($component->SUMMARY ?? $this->l10n->t('Untitled event'));
|
||||
|
||||
if ($eventRow['calendartype'] === CalDavBackend::CALENDAR_TYPE_CALENDAR) {
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ class TasksSearchProvider extends ACalendarSearchProvider {
|
|||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
private static $searchProperties = [
|
||||
private const SEARCH_PROPERTIES = [
|
||||
'SUMMARY',
|
||||
'DESCRIPTION',
|
||||
'CATEGORIES',
|
||||
|
|
@ -33,12 +33,12 @@ class TasksSearchProvider extends ACalendarSearchProvider {
|
|||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
private static $searchParameters = [];
|
||||
private const SEARCH_PARAMETERS = [];
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private static $componentType = 'VTODO';
|
||||
private const COMPONENT_TYPE = 'VTODO';
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
|
|
@ -83,9 +83,9 @@ class TasksSearchProvider extends ACalendarSearchProvider {
|
|||
$searchResults = $this->backend->searchPrincipalUri(
|
||||
$principalUri,
|
||||
$query->getFilter('term')?->get() ?? '',
|
||||
[self::$componentType],
|
||||
self::$searchProperties,
|
||||
self::$searchParameters,
|
||||
[self::COMPONENT_TYPE],
|
||||
self::SEARCH_PROPERTIES,
|
||||
self::SEARCH_PARAMETERS,
|
||||
[
|
||||
'limit' => $query->getLimit(),
|
||||
'offset' => $query->getCursor(),
|
||||
|
|
@ -94,7 +94,7 @@ class TasksSearchProvider extends ACalendarSearchProvider {
|
|||
]
|
||||
);
|
||||
$formattedResults = \array_map(function (array $taskRow) use ($calendarsById, $subscriptionsById):SearchResultEntry {
|
||||
$component = $this->getPrimaryComponent($taskRow['calendardata'], self::$componentType);
|
||||
$component = $this->getPrimaryComponent($taskRow['calendardata'], self::COMPONENT_TYPE);
|
||||
$title = (string)($component->SUMMARY ?? $this->l10n->t('Untitled task'));
|
||||
|
||||
if ($taskRow['calendartype'] === CalDavBackend::CALENDAR_TYPE_CALENDAR) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue