AttributePoller
in package
Nightly stand-in for the attribute webhooks PIM does not send.
Without it a renamed attribute (and with it its pretty_id, which products are keyed by) stays
stale until someone repopulates by hand. Changes are fed into the webhook buffer as
entry_type: attribute records, so BufferChecker does the actual work.
Table of Contents
Constants
- ACTION : mixed = 'wsc_poll_attribute_changes'
- CURSOR_OPTION : mixed = 'wsc_attribute_poll_since'
- LOG_CHANNEL : mixed = 'wsc-attribute-poller'
- MAX_PAGES : mixed = 50
- OVERLAP : mixed = HOUR_IN_SECONDS
- PAGE_SIZE : mixed = 100
Methods
- attributesInRenamedGroups() : array<int, string>
- IDs of the catalogue attributes whose embedded group name no longer matches PIM.
- register() : void
- run() : void
- fetchAll() : array<int, object>
- fetchChangedAttributeIds() : array<int, string>
- Strict paging: PimService::fetchAllPages() returns what it has on a failed page, and a partial delta would advance the cursor past changes we never saw.
- fetchGroupNames() : array<int, array<string|int, mixed>|string>
- normalizeName() : string
- TypeSense drops null locales and reorders keys, so compare canonical forms only.
Constants
ACTION
public
mixed
ACTION
= 'wsc_poll_attribute_changes'
CURSOR_OPTION
public
mixed
CURSOR_OPTION
= 'wsc_attribute_poll_since'
LOG_CHANNEL
private
mixed
LOG_CHANNEL
= 'wsc-attribute-poller'
MAX_PAGES
private
mixed
MAX_PAGES
= 50
OVERLAP
private
mixed
OVERLAP
= HOUR_IN_SECONDS
PAGE_SIZE
private
mixed
PAGE_SIZE
= 100
Methods
attributesInRenamedGroups()
IDs of the catalogue attributes whose embedded group name no longer matches PIM.
public
static attributesInRenamedGroups(array<int|string, array<string|int, mixed>|string> $pimGroupNames, array<string, array<string|int, mixed>> $catalogue) : array<int, string>
PIM's last_ts on groups is unproven and group edits don't show up in the attribute delta,
yet every attribute doc embeds its group name (section headings, the filters-group match).
Comparing against the catalogue needs no stored state and stops matching once fixed.
Parameters
- $pimGroupNames : array<int|string, array<string|int, mixed>|string>
-
Group id => locale map (or legacy string).
- $catalogue : array<string, array<string|int, mixed>>
-
AttributesCollection::getIndexedAttributes().
Return values
array<int, string>register()
public
static register() : void
run()
public
static run() : void
fetchAll()
private
static fetchAll(string $url[, string|null $lang = null ]) : array<int, object>
Parameters
- $url : string
- $lang : string|null = null
Return values
array<int, object>fetchChangedAttributeIds()
Strict paging: PimService::fetchAllPages() returns what it has on a failed page, and a partial delta would advance the cursor past changes we never saw.
private
static fetchChangedAttributeIds(int $since) : array<int, string>
Parameters
- $since : int
Return values
array<int, string>fetchGroupNames()
private
static fetchGroupNames() : array<int, array<string|int, mixed>|string>
Return values
array<int, array<string|int, mixed>|string>normalizeName()
TypeSense drops null locales and reorders keys, so compare canonical forms only.
private
static normalizeName(mixed $name) : string
Parameters
- $name : mixed