WscCli
in package
Table of Contents
Properties
- $hooksRegistered : bool
- $lastMessage : string|null
- $lastProgress : int|null
Methods
- flixmediaFeed() : void
- Generate Flixmedia feed.
- flushAllSites() : void
- Flush and repopulate collections for all sites or a subset.
- flushSite() : void
- Flush and repopulate collections for a single site.
- flushUnlock() : void
- Remove the flush lock file if a previous run was interrupted.
- handleProgressMessageUpdate() : void
- handleProgressUpdate() : void
- populate() : void
- Populate a single collection.
- populateDocument() : void
- Populate a single document in a collection.
- register() : void
- Register WP-CLI commands.
- removeOld() : void
- Remove old TypeSense collections with backup policy.
- wayviaShops() : void
- Generate Wayvia online shops collection.
- buildSkipOptions() : array<string|int, mixed>
- finalizeProgressState() : void
- initializeProgressState() : void
- isFlushLocked() : bool
- normalizeCollectionClassName() : string
- parseOptionalSiteId() : int|null
- parseSiteIds() : array<string|int, mixed>
- registerProgressHooks() : void
- resolveCollectionInstance() : array<string|int, mixed>
- runInSiteContext() : mixed
Properties
$hooksRegistered
private
static bool
$hooksRegistered
= false
$lastMessage
private
static string|null
$lastMessage
= null
$lastProgress
private
static int|null
$lastProgress
= null
Methods
flixmediaFeed()
Generate Flixmedia feed.
public
static flixmediaFeed(array<string|int, mixed> $args, array<string|int, mixed> $assoc_args) : void
Examples:
- wp wsc flixmedia-feed
- wp wsc flixmedia-feed --site-id=3
Parameters
- $args : array<string|int, mixed>
- $assoc_args : array<string|int, mixed>
flushAllSites()
Flush and repopulate collections for all sites or a subset.
public
static flushAllSites(array<string|int, mixed> $args, array<string|int, mixed> $assoc_args) : void
Examples:
- wp wsc flush-all-sites
- wp wsc flush-all-sites --site-ids=2,5,7
- wp wsc flush-all-sites --skip-attributes --skip-external-products
Parameters
- $args : array<string|int, mixed>
- $assoc_args : array<string|int, mixed>
flushSite()
Flush and repopulate collections for a single site.
public
static flushSite(array<string|int, mixed> $args, array<string|int, mixed> $assoc_args) : void
Examples:
- wp wsc flush-site --site-id=3
- wp wsc flush-site --site-id=3 --skip-attributes --skip-products
Parameters
- $args : array<string|int, mixed>
- $assoc_args : array<string|int, mixed>
flushUnlock()
Remove the flush lock file if a previous run was interrupted.
public
static flushUnlock(array<string|int, mixed> $args, array<string|int, mixed> $assoc_args) : void
Example:
- wp wsc flush-unlock
Parameters
- $args : array<string|int, mixed>
- $assoc_args : array<string|int, mixed>
handleProgressMessageUpdate()
public
static handleProgressMessageUpdate(mixed $old, mixed $new) : void
Parameters
- $old : mixed
- $new : mixed
handleProgressUpdate()
public
static handleProgressUpdate(mixed $old, mixed $new) : void
Parameters
- $old : mixed
- $new : mixed
populate()
Populate a single collection.
public
static populate(array<string|int, mixed> $args, array<string|int, mixed> $assoc_args) : void
Examples:
- wp wsc populate --collection=ProductsCollection --site-id=3
- wp wsc populate --collection=WayviaOnlineShopsCollection
Parameters
- $args : array<string|int, mixed>
- $assoc_args : array<string|int, mixed>
populateDocument()
Populate a single document in a collection.
public
static populateDocument(array<string|int, mixed> $args, array<string|int, mixed> $assoc_args) : void
Examples:
- wp wsc populate-document --collection=ProductsCollection --document-id=ABC123 --site-id=3
Parameters
- $args : array<string|int, mixed>
- $assoc_args : array<string|int, mixed>
register()
Register WP-CLI commands.
public
static register() : void
Examples:
- wp wsc populate --collection=ProductsCollection --site-id=3
- wp wsc populate-document --collection=ProductsCollection --document-id=ABC123 --site-id=3
- wp wsc flush-site --site-id=3
- wp wsc flush-site --site-id=3 --skip-attributes --skip-products
- wp wsc flush-all-sites
- wp wsc flush-all-sites --site-ids=2,5,7 --skip-external-products
- wp wsc remove-old
- wp wsc flixmedia-feed --site-id=3
- wp wsc wayvia-shops --site-id=3
removeOld()
Remove old TypeSense collections with backup policy.
public
static removeOld(array<string|int, mixed> $args, array<string|int, mixed> $assoc_args) : void
Example:
- wp wsc remove-old
Parameters
- $args : array<string|int, mixed>
- $assoc_args : array<string|int, mixed>
wayviaShops()
Generate Wayvia online shops collection.
public
static wayviaShops(array<string|int, mixed> $args, array<string|int, mixed> $assoc_args) : void
Examples:
- wp wsc wayvia-shops
- wp wsc wayvia-shops --site-id=3
Parameters
- $args : array<string|int, mixed>
- $assoc_args : array<string|int, mixed>
buildSkipOptions()
private
static buildSkipOptions(array<string|int, mixed> $assoc_args) : array<string|int, mixed>
Parameters
- $assoc_args : array<string|int, mixed>
Return values
array<string|int, mixed>finalizeProgressState()
private
static finalizeProgressState(bool $success, string $message) : void
Parameters
- $success : bool
- $message : string
initializeProgressState()
private
static initializeProgressState() : void
isFlushLocked()
private
static isFlushLocked() : bool
Return values
boolnormalizeCollectionClassName()
private
static normalizeCollectionClassName(string $collection) : string
Parameters
- $collection : string
Return values
stringparseOptionalSiteId()
private
static parseOptionalSiteId(array<string|int, mixed> $assoc_args) : int|null
Parameters
- $assoc_args : array<string|int, mixed>
Return values
int|nullparseSiteIds()
private
static parseSiteIds(array<string|int, mixed> $assoc_args) : array<string|int, mixed>
Parameters
- $assoc_args : array<string|int, mixed>
Return values
array<string|int, mixed>registerProgressHooks()
private
static registerProgressHooks() : void
resolveCollectionInstance()
private
static resolveCollectionInstance(array<string|int, mixed> $assoc_args) : array<string|int, mixed>
Parameters
- $assoc_args : array<string|int, mixed>
Return values
array<string|int, mixed>runInSiteContext()
private
static runInSiteContext(int|null $siteId, callable $callback) : mixed
Parameters
- $siteId : int|null
- $callback : callable