DbConsentV2
in package
Uses
UtilsProvider
Migrate consent data to new database table `wp_rcb_consent_v2`.
Table of Contents
Constants
- CONSENT_MIGRATION_CHUNK_SIZE = 70000
- DECISION_MIGRATION_CHUNK_SIZE = 1000000
- IP_MIGRATION_CHUNK_SIZE = 50000
- MIGRATION_TYPES = ['urls' => ['fields' => ['url_imprint', 'url_privacy_policy', 'referer', 'pure_referer'], 'chunkSize' => self::URL_MIGRATION_CHUNK_SIZE, 'method' => 'migrateUrls'], 'decisions' => ['fields' => ['previous_decision', 'decision', 'previous_gcm_consent', 'gcm_consent'], 'chunkSize' => self::DECISION_MIGRATION_CHUNK_SIZE, 'method' => 'migrateDecisions'], 'tcf_string' => ['fields' => ['previous_tcf_string', 'tcf_string'], 'chunkSize' => self::TCF_STRING_MIGRATION_CHUNK_SIZE, 'method' => 'migrateTcfString'], 'ip' => ['fields' => ['ip'], 'chunkSize' => self::IP_MIGRATION_CHUNK_SIZE, 'method' => 'migrateIps'], 'consent' => ['fields' => ['consent'], 'chunkSize' => self::CONSENT_MIGRATION_CHUNK_SIZE, 'method' => 'migrateConsent']]
- REAL_QUEUE_TYPE = 'rcb-db-consent-v2'
- TCF_STRING_MIGRATION_CHUNK_SIZE = 500000
- URL_MIGRATION_CHUNK_SIZE = 500000
Methods
- getPluginConstantPrefix() : string
- Get the prefix of this plugin so composer packages can dynamically build other constant values on it.
- isMigrationNeeded() : mixed
- Checks if the old consent table exists.
- migrate() : mixed
- Migrate consent data to new database table `wp_rcb_consent_v2`.
- probablyCreateJob() : mixed
- Check if the table of old consent data exists and create a migration job for it.
- real_queue_additional_data_migration_progress() : mixed
- Checks if there is a migration needed so we can trigger to continue the migration process.
- real_queue_error_description() : mixed
- Get human-readable description for a RCB queue jobs.
- real_queue_job_actions() : mixed
- Get actions for RCB queue jobs.
- real_queue_job_label() : mixed
- Get human-readable label for RCB queue jobs.
- getConsentTableStats() : mixed
- Get the count, minimum and maximum ID of the old consent table. This allows us to improve the `INSERT INTO` performance by avoiding the `LIMIT` clause.
- getMigrationError() : mixed
- Get a migration error as `WP_Error` instance.
- migrateConsent() : mixed
- Migrate consent.
- migrateDecisions() : mixed
- Migrate decisions.
- migrateIps() : mixed
- Migrate IPs.
- migrateTcfString() : mixed
- Migrate TCF strings.
- migrateUrls() : mixed
- Migrate URLs.
- processMigrationType() : bool|WP_Error
- Process a single migration type.
- removeOldTable() : mixed
- Remove the old consent table.
Constants
CONSENT_MIGRATION_CHUNK_SIZE
public
mixed
CONSENT_MIGRATION_CHUNK_SIZE
= 70000
DECISION_MIGRATION_CHUNK_SIZE
public
mixed
DECISION_MIGRATION_CHUNK_SIZE
= 1000000
IP_MIGRATION_CHUNK_SIZE
public
mixed
IP_MIGRATION_CHUNK_SIZE
= 50000
MIGRATION_TYPES
public
mixed
MIGRATION_TYPES
= ['urls' => ['fields' => ['url_imprint', 'url_privacy_policy', 'referer', 'pure_referer'], 'chunkSize' => self::URL_MIGRATION_CHUNK_SIZE, 'method' => 'migrateUrls'], 'decisions' => ['fields' => ['previous_decision', 'decision', 'previous_gcm_consent', 'gcm_consent'], 'chunkSize' => self::DECISION_MIGRATION_CHUNK_SIZE, 'method' => 'migrateDecisions'], 'tcf_string' => ['fields' => ['previous_tcf_string', 'tcf_string'], 'chunkSize' => self::TCF_STRING_MIGRATION_CHUNK_SIZE, 'method' => 'migrateTcfString'], 'ip' => ['fields' => ['ip'], 'chunkSize' => self::IP_MIGRATION_CHUNK_SIZE, 'method' => 'migrateIps'], 'consent' => ['fields' => ['consent'], 'chunkSize' => self::CONSENT_MIGRATION_CHUNK_SIZE, 'method' => 'migrateConsent']]
REAL_QUEUE_TYPE
public
mixed
REAL_QUEUE_TYPE
= 'rcb-db-consent-v2'
TCF_STRING_MIGRATION_CHUNK_SIZE
public
mixed
TCF_STRING_MIGRATION_CHUNK_SIZE
= 500000
URL_MIGRATION_CHUNK_SIZE
public
mixed
URL_MIGRATION_CHUNK_SIZE
= 500000
Methods
getPluginConstantPrefix()
Get the prefix of this plugin so composer packages can dynamically build other constant values on it.
public
getPluginConstantPrefix() : string
Tags
Return values
stringisMigrationNeeded()
Checks if the old consent table exists.
public
isMigrationNeeded() : mixed
migrate()
Migrate consent data to new database table `wp_rcb_consent_v2`.
public
static migrate(Job $job) : mixed
Parameters
- $job : Job
probablyCreateJob()
Check if the table of old consent data exists and create a migration job for it.
public
probablyCreateJob() : mixed
real_queue_additional_data_migration_progress()
Checks if there is a migration needed so we can trigger to continue the migration process.
public
static real_queue_additional_data_migration_progress(array<string|int, mixed> $data) : mixed
Parameters
- $data : array<string|int, mixed>
real_queue_error_description()
Get human-readable description for a RCB queue jobs.
public
static real_queue_error_description(string $description, string $type, array<string|int, int> $remaining) : mixed
Parameters
- $description : string
- $type : string
- $remaining : array<string|int, int>
real_queue_job_actions()
Get actions for RCB queue jobs.
public
static real_queue_job_actions(array<string|int, array<string|int, mixed>> $actions, string $type) : mixed
Parameters
- $actions : array<string|int, array<string|int, mixed>>
- $type : string
real_queue_job_label()
Get human-readable label for RCB queue jobs.
public
static real_queue_job_label(string $label, string $originalType) : mixed
Parameters
- $label : string
- $originalType : string
getConsentTableStats()
Get the count, minimum and maximum ID of the old consent table. This allows us to improve the `INSERT INTO` performance by avoiding the `LIMIT` clause.
protected
getConsentTableStats() : mixed
Tags
getMigrationError()
Get a migration error as `WP_Error` instance.
protected
getMigrationError() : mixed
migrateConsent()
Migrate consent.
protected
migrateConsent(string $field, int $minId, bool $isFirstRun) : mixed
Parameters
- $field : string
- $minId : int
- $isFirstRun : bool
migrateDecisions()
Migrate decisions.
protected
migrateDecisions(string $field, int $minId, bool $isFirstRun) : mixed
Parameters
- $field : string
- $minId : int
- $isFirstRun : bool
migrateIps()
Migrate IPs.
protected
migrateIps(string $field, int $minId, bool $isFirstRun) : mixed
Parameters
- $field : string
- $minId : int
- $isFirstRun : bool
migrateTcfString()
Migrate TCF strings.
protected
migrateTcfString(string $field, int $minId, bool $isFirstRun) : mixed
Parameters
- $field : string
- $minId : int
- $isFirstRun : bool
migrateUrls()
Migrate URLs.
protected
migrateUrls(string $field, int $minId, bool $isFirstRun) : mixed
Parameters
- $field : string
- $minId : int
- $isFirstRun : bool
processMigrationType()
Process a single migration type.
protected
processMigrationType(Job $job, string $type, string $field, array<string|int, mixed> $config, int $originalMinId, int $originalMaxId) : bool|WP_Error
Parameters
- $job : Job
- $type : string
- $field : string
- $config : array<string|int, mixed>
- $originalMinId : int
- $originalMaxId : int
Return values
bool|WP_Error —True if the migration can continue, otherwise false or a WP_Error
instance
removeOldTable()
Remove the old consent table.
protected
removeOldTable() : mixed