\MatthiasWeb\RealMediaLibrary\attachmentCountCache

This class handles the count cache for the folder structure.

Summary

Methods
Properties
Constants
getPluginConstantPrefix()
updateCountCache()
getSingleCountSql()
resetCountCache()
resetCountCacheOnWpDie()
wp_die()
addNewAttachment()
getInstance()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
__construct()
$me
$newAttachments
$folderIdsOnWpDie
N/A

Properties

$me

$me :

Type

$newAttachments

$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.

Type

$folderIdsOnWpDie

$folderIdsOnWpDie :

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

Type

Methods

getPluginConstantPrefix()

getPluginConstantPrefix(): string

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

Returns

string

updateCountCache()

updateCountCache(array<mixed,integer>  $folders = null,array<mixed,integer>  $attachments = null,boolean  $onlyReturn = false): string|null

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

Parameters

array<mixed,integer> $folders

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

array<mixed,integer> $attachments

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

boolean $onlyReturn

Set to true if you only want the SQL query

Returns

string|null

getSingleCountSql()

getSingleCountSql(): string

Get the single SQL for the subquery of count getter.

Returns

string

resetCountCache()

resetCountCache(integer  $folderId = null): \MatthiasWeb\RealMediaLibrary\attachment\CountCache

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

Parameters

integer $folderId

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

Returns

\MatthiasWeb\RealMediaLibrary\attachment\CountCache

resetCountCacheOnWpDie()

resetCountCacheOnWpDie(integer  $folderId)

Is fired with wp_die event.

Parameters

integer $folderId

The folder id

wp_die()

wp_die()

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

addNewAttachment()

addNewAttachment(integer  $id)

Add an attachment to the update queue.

Parameters

integer $id

The attachment id

__construct()

__construct()

C'tor.