Documentation

CountCache
in package
Uses UtilsProvider

This class handles the count cache for the folder structure.

Table of Contents

Properties

$folderIdsOnWpDie  : mixed
A collection of folder ids which gets reset on wp_die event.
$me  : mixed
$newAttachments  : mixed
An array of new attachment ID's which should be updated with the this::updateCountCache method. This includes also deleted attachments. The "new" means the attachments which are changed, but new for the update.

Methods

addNewAttachment()  : mixed
Add an attachment to the update queue.
getInstance()  : CountCache
Get instance.
getPluginConstantPrefix()  : string
Get the prefix of this plugin so composer packages can dynamically build other constant values on it.
getSingleCountSql()  : string
Get the single SQL for the subquery of count getter.
resetCountCache()  : CountCache
Reset the count cache for the current blog id. The content of the array is not prepared for the statement
resetCountCacheOnWpDie()  : mixed
Is fired with wp_die event.
updateCountCache()  : string|null
Handle the count cache for the folders. This should avoid a lack SQL subquery which loads data from the posts table.
wp_die()  : mixed
Update at the end of the script execution the count of the given added / deleted attachments.
__construct()  : mixed
C'tor.

Properties

$folderIdsOnWpDie

A collection of folder ids which gets reset on wp_die event.

private mixed $folderIdsOnWpDie = []

$newAttachments

An array of new attachment ID's which should be updated with the this::updateCountCache method. This includes also deleted attachments. The "new" means the attachments which are changed, but new for the update.

private mixed $newAttachments = []

Methods

addNewAttachment()

Add an attachment to the update queue.

public addNewAttachment(int $id) : mixed
Parameters
$id : int

The attachment id

getPluginConstantPrefix()

Get the prefix of this plugin so composer packages can dynamically build other constant values on it.

public getPluginConstantPrefix() : string
Tags
codeCoverageIgnore

It only returns a string with the constant prefix

Return values
string

getSingleCountSql()

Get the single SQL for the subquery of count getter.

public getSingleCountSql() : string
Return values
string

resetCountCache()

Reset the count cache for the current blog id. The content of the array is not prepared for the statement

public resetCountCache([int $folderId = null ]) : CountCache
Parameters
$folderId : int = null

Array If you pass folder id/ids array, only this one will be reset.

Return values
CountCache

resetCountCacheOnWpDie()

Is fired with wp_die event.

public resetCountCacheOnWpDie(int $folderId) : mixed
Parameters
$folderId : int

The folder id

updateCountCache()

Handle the count cache for the folders. This should avoid a lack SQL subquery which loads data from the posts table.

public updateCountCache([array<string|int, int> $folders = null ][, array<string|int, int> $attachments = null ][, bool $onlyReturn = false ]) : string|null
Parameters
$folders : array<string|int, int> = null

Array of folders ID, if null then all folders with cnt = NULL are updated

$attachments : array<string|int, int> = null

Array of attachments ID, is merged with $folders if given

$onlyReturn : bool = false

Set to true if you only want the SQL query

Return values
string|null

wp_die()

Update at the end of the script execution the count of the given added / deleted attachments.

public wp_die() : mixed

__construct()

C'tor.

private __construct() : mixed

        
On this page

Search results