ActionScheduler_WPCLI_Scheduler_command::fix_schema()publicWC 1.0

Force tables schema creation for Action Scheduler

OPTIONS

Method of the class: ActionScheduler_WPCLI_Scheduler_command{}

No Hooks.

Return

null. Nothing (null).

Usage

$ActionScheduler_WPCLI_Scheduler_command = new ActionScheduler_WPCLI_Scheduler_command();
$ActionScheduler_WPCLI_Scheduler_command->fix_schema( $args, $assoc_args );
$args(array) (required)
Positional arguments.
$assoc_args(array) (required)
Keyed arguments.

ActionScheduler_WPCLI_Scheduler_command::fix_schema() code WC 8.7.0

public function fix_schema( $args, $assoc_args ) {
	$schema_classes = array( ActionScheduler_LoggerSchema::class, ActionScheduler_StoreSchema::class );

	foreach ( $schema_classes as $classname ) {
		if ( is_subclass_of( $classname, ActionScheduler_Abstract_Schema::class ) ) {
			$obj = new $classname();
			$obj->init();
			$obj->register_tables( true );

			WP_CLI::success(
				sprintf(
					/* translators: %s refers to the schema name*/
					__( 'Registered schema for %s', 'woocommerce' ),
					$classname
				)
			);
		}
	}
}