Skip to content
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

One notice for all missing db tables #506

Merged
merged 3 commits into from May 7, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 15 additions & 1 deletion stream.php
Expand Up @@ -200,12 +200,26 @@ public function verify_database_present() {
$uninstall_message = '';

// Check if all needed DB is present
$missing_tables = array();
foreach ( $this->db->get_table_names() as $table_name ) {
if ( $wpdb->get_var( "SHOW TABLES LIKE '$table_name'" ) !== $table_name ) {
$database_message .= sprintf( '%s %s', __( 'The following table is not present in the WordPress database:', 'stream' ), $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 ( is_plugin_active_for_network( WP_STREAM_PLUGIN ) && current_user_can( 'manage_network_plugins' ) ) {
$uninstall_message = sprintf( __( 'Please <a href="%s">uninstall</a> the Stream plugin and activate it again.', 'stream' ), network_admin_url( 'plugins.php#stream' ) );
} elseif ( current_user_can( 'activate_plugins' ) ) {
Expand Down