\MatthiasWeb\UtilsActivator

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
dbDelta()
getMaxIndexLength()
install()
isMigrationLocked()
getDatabaseVersion()
getPreviousDatabaseVersions()
persistPreviousVersion()
removePreviousPersistedVersions()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

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.

isMigrationLocked()

isMigrationLocked()

Check if the migration is locked. It uses a time span of 10 minutes (like Yoast SEO plugin).

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