Automattic\WooCommerce\Internal\Utilities
DatabaseUtil::parse_dbdelta_output
Parses the output given by dbdelta and returns information about it.
Method of the class: DatabaseUtil{}
No Hooks.
Returns
Array[]. An array containing a 'created_tables' key whose value is an array with the names of the tables that have been (or would have been) created.
Usage
$DatabaseUtil = new DatabaseUtil(); $DatabaseUtil->parse_dbdelta_output( $dbdelta_output ): array;
- $dbdelta_output(array) (required)
- The output from the execution of dbdelta.
DatabaseUtil::parse_dbdelta_output() DatabaseUtil::parse dbdelta output code WC 10.6.2
public function parse_dbdelta_output( array $dbdelta_output ): array {
$created_tables = array();
foreach ( $dbdelta_output as $table_name => $result ) {
if ( "Created table $table_name" === $result ) {
$created_tables[] = str_replace( '(', '', $table_name );
}
}
return array( 'created_tables' => $created_tables );
}