BC Migration Documentation

MigrateSubscribeData

MigrateSubscribeData class.

Table of Contents

Properties

$instance  : MigrateSubscribeData|null
The single instance of the class.
$db_table  : string
The name of the email database table.
$stp_db  : object
The database object for the `subscribe_to_page` table.

Methods

init()  : MigrateSubscribeData
Gets the single instance of the class.
migrate_subscribe_data()  : array{migrated_row_ids: int[], db_removed: int}|void
Migrates subscribe data for a given post ID, and removes the legacy email DB table.
db_table_exists()  : bool
Check if the email table exists in the database.
migrate_email_db()  : array<string|int, int>
Migrates the `bcm_subprocessors_email` table to the `subscribe_to_page` table.
remove_email_db()  : int
Removes the email database.
remove_email_options()  : void
Deletes the options set by the subscribe form.

Properties

Methods

migrate_subscribe_data()

Migrates subscribe data for a given post ID, and removes the legacy email DB table.

public migrate_subscribe_data([int $post_id = 0 ]) : array{migrated_row_ids: int[], db_removed: int}|void
Parameters
$post_id : int = 0

The ID of the post whose subscribe data should be migrated.

Return values
array{migrated_row_ids: int[], db_removed: int}|void

An associative array containing two values:

  • 'migrated_row_ids' - an array of IDs of migrated rows (may be empty)
  • 'db_removed' - int indicating whether the email DB table was removed

db_table_exists()

Check if the email table exists in the database.

private db_table_exists() : bool
Return values
bool

Whether the table exists.

migrate_email_db()

Migrates the `bcm_subprocessors_email` table to the `subscribe_to_page` table.

private migrate_email_db(array<string|int, int> $posts) : array<string|int, int>
Parameters
$posts : array<string|int, int>

Array of post IDs to migrate.

Return values
array<string|int, int>

Array of migrated row IDs.

remove_email_db()

Removes the email database.

private remove_email_db() : int

Drops the table if it exists, then deletes the database version option.

Return values
int

The number of rows deleted.

remove_email_options()

Deletes the options set by the subscribe form.

private remove_email_options() : void

This deletes the options for the subscribe emails and settings.


        
On this page

Search results