-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure wp core functions exist before using them (#135)
In this PR I propose that we always check if a wp core function is defined before attempting to use it, [as we do in the constructor of the Translator class](https://github.com/WordPress/sqlite-database-integration/blob/main/wp-includes/sqlite/class-wp-sqlite-translator.php#L564). Several hooks (do_action, apply_filters) are used in the `WP_SQLite_Translator` class. The class may be used in a context where WordPress is not loaded. We are currently working on adding support for SQLite to the WP Cli import and export commands and intend to use the translator to execute various SQL statements. Those commands run in a context where WordPress has not been loaded so `do_action` and `apply_filters` are unavailable.
- Loading branch information
Showing
1 changed file
with
45 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters