\DevOwl\RealCookieBannerActivator

The activator class handles the plugin relevant activation hooks: Uninstall, activation, deactivation and installation. The "installation" means installing needed database tables.

Summary

Methods
Properties
Constants
getPluginConstantPrefix()
dbDelta()
getMaxIndexLength()
install()
getDatabaseVersion()
getPreviousDatabaseVersions()
persistPreviousVersion()
removePreviousPersistedVersions()
anyPluginToggledState()
activate()
deactivate()
addInitialContent()
detectFirstInstallation()
uninstall()
No public properties found
OPTION_NAME_INSTALLATION_DATE
OPTION_NAME_NEEDS_DEFAULT_CONTENT
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Constants

OPTION_NAME_INSTALLATION_DATE

OPTION_NAME_INSTALLATION_DATE =RCB_OPT_PREFIX . '-installation-date'

OPTION_NAME_NEEDS_DEFAULT_CONTENT

OPTION_NAME_NEEDS_DEFAULT_CONTENT =RCB_OPT_PREFIX . '-needs-default-content'

Methods

getPluginConstantPrefix()

getPluginConstantPrefix(): string

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

Returns

string

dbDelta()

dbDelta(boolean  $errorlevel)

Install tables, stored procedures or whatever in the database.

This method is always called when the version bumps up or for the first initial activation.

Parameters

boolean $errorlevel

If true throw errors

getMaxIndexLength()

getMaxIndexLength()

Indexes have a maximum size of 767 bytes. Historically, we haven't need to be concerned about that.

As of 4.2, however, we moved to utf8mb4, which uses 4 bytes per character. This means that an index which used to have room for floor(767/3) = 255 characters, now only has room for floor(767/4) = 191 characters.

install()

install(boolean  $errorlevel = false,callable  $installThisCallable = null)

Run an installation or dbDelta within a callable.

Parameters

boolean $errorlevel

Set true to throw errors.

callable $installThisCallable

Set a callable to install this one instead of the default.

getDatabaseVersion()

getDatabaseVersion()

Get the current persisted database version.

getPreviousDatabaseVersions()

getPreviousDatabaseVersions(): array<mixed,string>

Get a list of previous installed database versions.

Returns

array<mixed,string>

persistPreviousVersion()

persistPreviousVersion()

Persist the previous installed versions of this plugin so we can e.g. start migrations.

removePreviousPersistedVersions()

removePreviousPersistedVersions(callback  $filter)

Remove the previous persisted versions from the saved option. This is useful if you have successfully finished your migration.

Parameters

callback $filter

anyPluginToggledState()

anyPluginToggledState()

Any plugin got deactivated / activated so let's recalculate the presets cache.

activate()

activate()

Method gets fired when the user activates the plugin.

deactivate()

deactivate()

Method gets fired when the user deactivates the plugin.

addInitialContent()

addInitialContent()

Add initial content after first installation. It also supports multiple languages (e.g. WPML and PolyLang).

detectFirstInstallation()

detectFirstInstallation()

Detect first installation and conditionally create initial content.

uninstall()

uninstall()

Uninstall our plugin (it does currently not remove any settings!).