-
Notifications
You must be signed in to change notification settings - Fork 117
"Install::verify_db()" removed. #1201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -71,12 +71,6 @@ public function __construct( $plugin ) { | |
| $this->db_version = $this->get_db_version(); | ||
| $this->stream_url = self_admin_url( $this->plugin->admin->admin_parent_page . '&page=' . $this->plugin->admin->settings_page_slug ); | ||
|
|
||
| // Check DB and display an admin notice if there are tables missing. | ||
| add_action( 'init', array( $this, 'verify_db' ) ); | ||
|
|
||
| // Install the plugin. | ||
| add_action( 'wp_stream_before_db_notices', array( $this, 'check' ) ); | ||
|
|
||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| register_activation_hook( $this->plugin->locations['plugin'], array( $this, 'check' ) ); | ||
| } | ||
|
|
||
|
|
@@ -137,87 +131,6 @@ public function check() { | |
| $this->update_db_option(); | ||
| } | ||
|
|
||
| /** | ||
| * Verify that the required DB tables exists | ||
| * | ||
| * @return void | ||
| */ | ||
| public function verify_db() { | ||
| /** | ||
| * Filter will halt install() if set to true | ||
| * | ||
| * @param bool | ||
| * | ||
| * @return bool | ||
| */ | ||
| if ( apply_filters( 'wp_stream_no_tables', false ) ) { | ||
| return; | ||
| } | ||
|
|
||
| if ( ! function_exists( 'is_plugin_active_for_network' ) ) { | ||
| require_once ABSPATH . '/wp-admin/includes/plugin.php'; | ||
| } | ||
|
|
||
| /** | ||
| * Fires before admin notices are triggered for missing database tables. | ||
| */ | ||
| do_action( 'wp_stream_before_db_notices' ); | ||
|
|
||
| global $wpdb; | ||
|
|
||
| $database_message = ''; | ||
| $uninstall_message = ''; | ||
|
|
||
| // Check if all needed DB is present. | ||
| $missing_tables = array(); | ||
|
|
||
| foreach ( $this->plugin->db->get_table_names() as $table_name ) { | ||
| $table_search = $wpdb->get_var( | ||
| $wpdb->prepare( 'SHOW TABLES LIKE %s', $table_name ) | ||
| ); | ||
| if ( $table_search !== $table_name ) { | ||
| $missing_tables[] = $table_name; | ||
| } | ||
| } | ||
|
|
||
| if ( $missing_tables ) { | ||
| $database_message .= sprintf( | ||
| '%s <strong>%s</strong>', | ||
| _n( | ||
| 'The following table is not present in the WordPress database:', | ||
| 'The following tables are not present in the WordPress database:', | ||
| count( $missing_tables ), | ||
| 'stream' | ||
| ), | ||
| esc_html( implode( ', ', $missing_tables ) ) | ||
| ); | ||
| } | ||
|
|
||
| if ( $this->plugin->is_network_activated() && current_user_can( 'manage_network_plugins' ) ) { | ||
| $uninstall_message = sprintf( | ||
| /* translators: %#$s: HTML Link tags (e.g. "<a href="https://foo.com/wp-admin/">") */ | ||
| __( 'Please %1$suninstall%2$s the Stream plugin and activate it again.', 'stream' ), | ||
| '<a href="' . network_admin_url( 'plugins.php#stream' ) . '">', | ||
| '</a>' | ||
| ); | ||
| } elseif ( current_user_can( 'activate_plugins' ) ) { | ||
| $uninstall_message = sprintf( | ||
| /* translators: %#$s: HTML Link tags (e.g. "<a href="https://foo.com/wp-admin/">") */ | ||
| __( 'Please %1$suninstall%2$s the Stream plugin and activate it again.', 'stream' ), | ||
| '<a href="' . admin_url( 'plugins.php#stream' ) . '">', | ||
| '</a>' | ||
| ); | ||
| } | ||
|
|
||
| if ( ! empty( $database_message ) ) { | ||
| $this->plugin->admin->notice( $database_message ); | ||
|
|
||
| if ( ! empty( $uninstall_message ) ) { | ||
| $this->plugin->admin->notice( $uninstall_message ); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * Register a routine to be called when stream or a stream connector has been updated | ||
| * It works by comparing the current version with the version previously stored in the database. | ||
|
|
||
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kidunot89 I think removing this now makes the Travis checks fail because the table for the plugin is not created on the first run https://travis-ci.com/github/xwp/stream/jobs/468947527#L511